OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 7457|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ ^3 w8 W4 Y# f) S" `4 p1 A$ [
  1. [code]EDMA sample test application6 g" P/ i" {! ?% t# V) w" R
  2. /*: L. f: k$ I: q1 b: N
  3. * edma_test.c
    ! y8 C0 Y8 W4 y; |( V! A. D
  4. *2 t% \' i$ H& ]  o! L" ^% |
  5. * brief  EDMA3 Test Application# [2 c0 }5 D$ h* `* J6 r
  6. *9 J5 ?, ~8 j1 s' z% n. j9 z
  7. *   This file contains EDMA3 Test code.
    # f% G& w" V2 h* L
  8. *
    , }+ t' c, B' v9 r5 l, H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 P* N+ a# K* V3 A( G0 D2 ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 u5 A+ s* u" D) l
  11. *         TO CHANGE.
    , f3 _% j9 ]6 W: S4 H+ z% D1 Z  x( `6 Y
  12. *! y" I* t' ^, `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' N$ x6 N! l7 e" T# L6 q. _
  14. *- G& q9 d* @: y" |9 u4 X
  15. * This program is free software; you can redistribute it and/or4 v# n1 @! f% \8 l9 Y
  16. * modify it under the terms of the GNU General Public License as
    - h9 ^3 g, [$ t$ ^6 _& h4 O
  17. * published by the Free Software Foundation version 2.' C3 Y  P- a. G7 T
  18. *
    5 c8 b+ x+ v4 f! i! K% G) u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . \$ V: f1 J" C4 z  [7 Q& C
  20. * kind, whether express or implied; without even the implied warranty
    6 A  T5 N( o/ F$ |" @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& p% U+ E/ U" @* R, d8 w6 q
  22. * GNU General Public License for more details.
    0 t( p- E: X) J1 P$ l: \/ S' f0 i# V
  23. */7 f) \8 O  j; r7 Z: _. Y1 i5 a

  24. # x0 C8 g! Y/ |; {! X/ k2 Q
  25. #include <linux/module.h>
      y: z7 O: a# d/ o
  26. #include <linux/init.h>" t4 s* k6 V  Q; @; y1 ~0 b* N& H
  27. #include <linux/errno.h>
    % f& U& f) f& |2 j! a; ]- T
  28. #include <linux/types.h>; U2 M6 q9 F! t# f8 T" V' g0 c
  29. #include <linux/interrupt.h>6 g5 y: _4 [0 U7 g* T
  30. #include <asm/io.h>: \2 V! h! u) d, L$ f
  31. #include <linux/moduleparam.h>
      O7 q: z9 q  j6 Y+ u, B3 }
  32. #include <linux/sysctl.h>
    , I- ]' ?& a2 K$ [$ t
  33. #include <linux/mm.h>
    " U, V+ u) Y: d0 S, u
  34. #include <linux/dma-mapping.h>
    ; a2 ]# A: U# u

  35. / N5 m$ U- x* P, k) J
  36. #include <mach/memory.h>
    * u) q/ z) R8 J0 }  g
  37. #include <mach/hardware.h>2 G" b8 y( P: c% {
  38. #include <mach/irqs.h>% D0 N* T8 \! V8 M4 D3 f
  39. #include <asm/hardware/edma.h>5 E2 i% c' c9 \2 d5 }, v

  40. & e. c: `$ w# u# Z+ l1 X/ T' z
  41. #undef EDMA3_DEBUG+ F! R: l; I; B2 ?
  42. /*#define EDMA3_DEBUG*/) R' s( z8 i' D6 ^
  43. 1 C! ?% }. G# Y: Q, Q7 T. G
  44. #ifdef EDMA3_DEBUG3 d/ v+ ^2 o% {& ~  \. B. }( M% v$ K' |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ W( V( E2 f2 C* w8 I" R) u% [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + o: N( S! E. ]7 Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- V$ }7 L& z: {, K
  48. #else( a& c3 [- t) k( a4 h+ v' K. e
  49. #define DMA_PRINTK( x... )8 f- i% j, g' W9 p: c: J1 G- g% p- ]
  50. #define DMA_FN_IN5 \0 E' n. h, {' O% [# I; r
  51. #define DMA_FN_OUT
    ' W# v" _( L) E6 p
  52. #endif
    ) G8 i2 x6 ?" ~# ?
  53. 2 ]7 w% U; }3 S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* K8 Q" p, x" ~. z! i# G6 [
  55. #define STATIC_SHIFT                3
    1 F: z& D$ l  h- M1 V+ d
  56. #define TCINTEN_SHIFT               20
    ( `8 @  \3 u  t& p
  57. #define ITCINTEN_SHIFT              21$ _. E2 J6 s1 [9 I0 N$ p
  58. #define TCCHEN_SHIFT                221 C$ ^9 _+ n, R
  59. #define ITCCHEN_SHIFT               23
    ) F3 n/ C) f) e, G7 K9 B" a/ ^; e2 L
  60. . \7 }2 M! s7 \1 H# @3 \& z4 ~
  61. static volatile int irqraised1 = 0;
    ' C9 {# {* c/ d! C6 a
  62. static volatile int irqraised2 = 0;5 o- L5 J$ ]$ w% e9 z9 n$ l
  63. ( {6 [, }: \, }6 J; z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% T2 q1 E+ z4 d" z) P( C& p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + _" I; a, C3 c) j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( j- ]1 H' Z6 O* d6 F+ C: R

  67. 8 }& l! W5 [8 n6 z2 `# d( s
  68. dma_addr_t dmaphyssrc1 = 0;
    3 a5 ^6 G/ g5 N0 w/ w
  69. dma_addr_t dmaphyssrc2 = 0;
    3 l4 U$ h0 q6 q- E2 G/ x( z
  70. dma_addr_t dmaphysdest1 = 0;
      ~. N- q" O( K# D6 l' O8 e
  71. dma_addr_t dmaphysdest2 = 0;  v4 a( f/ c0 k  O7 t" V2 S. f
  72. 0 i- Y: h7 [+ G* Q& J0 b
  73. char *dmabufsrc1 = NULL;
    , I) `  [; D& i9 A3 K
  74. char *dmabufsrc2 = NULL;
    / |. }% _, S, R
  75. char *dmabufdest1 = NULL;
    1 E1 F5 ^3 X) V  D. `4 ]
  76. char *dmabufdest2 = NULL;
    - @' t) p+ B, Y' ?7 |* Y- F& \

  77. / b+ j, K8 U$ ?2 R+ e8 o$ }* U
  78. static int acnt = 512;( D3 d; l$ ^' J* @! }, m$ j& \3 L1 G
  79. static int bcnt = 8;
    ; h9 X9 ]9 e) c& ^- M
  80. static int ccnt = 8;
    4 T$ E# V$ Z6 u# j! _( D" i/ h

  81. ' w: @% x& `* k0 |$ t7 |/ b8 H$ x
  82. module_param(acnt, int, S_IRUGO);
    / q$ M0 w- p1 W" P& C( A
  83. module_param(bcnt, int, S_IRUGO);
    6 _8 y9 B' R6 p* l% ]9 {  L
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 Y* \, G% H% S: J+ G& W+ `

% \' D; o9 Y: _      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 U( X; c$ y! \+ F/ L: ~) Earm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! o4 k9 ]7 `3 ]5 j2 L     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" ^) M; `9 z, u4 v9 ~8 l" w% [2 }3 g) ]2 [+ K

. f2 W/ U' Q" o7 t  o' G2 }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2025-7-7 07:39 , Processed in 0.038294 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表