OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 U: a; N* _5 e5 u, z+ w
  1. [code]EDMA sample test application
    ( X0 R/ z* y. l% M: Z
  2. /*
    5 T- M4 n: N. b/ y( g
  3. * edma_test.c
    8 A* i* q. {" @' Z: i; v  |
  4. *2 G, K- B" E) _" v9 K7 l( E
  5. * brief  EDMA3 Test Application3 J0 v. a7 e  S; c+ j4 b
  6. *
    & \- E. e3 t; s( _
  7. *   This file contains EDMA3 Test code.
    7 ~4 m  A3 ]* S. K# f8 m
  8. *5 \/ b6 t0 {- e# g9 i0 m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 ^6 R, D$ Y4 b% A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 s0 B# t  M2 @0 ~# g$ d4 S
  11. *         TO CHANGE.
    $ n$ L+ {3 m5 w. k9 U/ C
  12. *; ]8 d6 X/ ^0 h9 A% f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , K5 h9 z" a' v  b$ [: h+ }, b$ b* B
  14. *6 S& b# P' g) V0 Z) m. ]
  15. * This program is free software; you can redistribute it and/or6 }0 T' o/ x# J9 @2 z% k
  16. * modify it under the terms of the GNU General Public License as( \$ X* q. I9 \8 m
  17. * published by the Free Software Foundation version 2.
    4 L( N' U& ]8 x/ t  [
  18. *1 Z& v( _0 B( X7 a; B8 q3 }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 P8 @) n0 N- {( ^0 c+ I7 Z* t
  20. * kind, whether express or implied; without even the implied warranty$ y6 @: [% U( w+ l2 l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) ?8 @$ A& I8 W0 ^4 p' E) b
  22. * GNU General Public License for more details.
    % H& E* x8 F3 U, B3 P
  23. */
    9 K4 ~% x9 d: U+ f: v; C

  24. ! G" A# ?- o. x8 g, p$ A( n
  25. #include <linux/module.h>
    8 @9 U1 \3 ~1 _! v
  26. #include <linux/init.h>: a  Q4 |4 R& w6 X! R# Z
  27. #include <linux/errno.h>( Y3 O9 I6 s' E9 T5 t+ Z; h/ P! \$ L* \
  28. #include <linux/types.h>! }1 c( `6 L; Q% n" y
  29. #include <linux/interrupt.h># ?6 s: Z3 F2 Z& [) h" b
  30. #include <asm/io.h>
    + F! o9 d7 g, d7 O% {; s! e
  31. #include <linux/moduleparam.h>
    " s7 O+ D2 O  S2 A4 X
  32. #include <linux/sysctl.h>
    ; Z8 P* j- O6 p
  33. #include <linux/mm.h>9 N) G& I3 o$ D6 I* a5 O( |$ r- @
  34. #include <linux/dma-mapping.h>* l, f* m8 p; D# `8 ~
  35. ; T/ P( v9 [; @, G1 t8 t
  36. #include <mach/memory.h>
    6 Q- x" |5 ^4 z7 i
  37. #include <mach/hardware.h>0 p1 P# \+ o) Z7 G5 H% f! V" v) h* o
  38. #include <mach/irqs.h>
    2 p3 I& \8 B7 L; V% U+ H( L
  39. #include <asm/hardware/edma.h>
    ; E& c& P5 e+ y5 [0 R

  40. 3 r7 T0 v* u  B! t4 S* e
  41. #undef EDMA3_DEBUG
    ; M! P+ ]7 o9 U' [- w
  42. /*#define EDMA3_DEBUG*/
    / j4 I* |: @* r4 L) x
  43. " I8 H+ G2 d1 c. Q; i
  44. #ifdef EDMA3_DEBUG
    $ Q: C+ ~# L+ e0 @6 g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % _3 w5 [( V+ O" Q+ I1 o2 ]. _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 Z" o8 A. w1 O! v& s- s) f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' O  E1 g* O) V5 k
  48. #else
    1 b( j. L  M' J
  49. #define DMA_PRINTK( x... )" o5 X7 d# j' m) Q. W* N
  50. #define DMA_FN_IN
    : Y2 h- _+ l8 O
  51. #define DMA_FN_OUT
    - `* }7 k8 l- }6 \7 V" w
  52. #endif
    / j- }+ h8 _( l7 |

  53. ( V8 x$ n) `0 k) j4 o+ S2 j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ Y1 x6 ?' h2 V1 k
  55. #define STATIC_SHIFT                3- k* B$ y$ v5 b5 o6 M( M8 X
  56. #define TCINTEN_SHIFT               20, v) v- R3 i: k
  57. #define ITCINTEN_SHIFT              21
    . T. L- `7 q$ T! i3 U0 f% r
  58. #define TCCHEN_SHIFT                22
    5 A) x3 \. S& E2 L0 |
  59. #define ITCCHEN_SHIFT               23
    6 A* @7 r$ h, L# ^( ^/ k0 T
  60. $ g, Z+ R+ E' l- B% o- {& U
  61. static volatile int irqraised1 = 0;3 B, x5 x/ ~. D" F0 p8 s
  62. static volatile int irqraised2 = 0;; D( I' s! D, D. C. G% d4 W

  63. + Q% Q% p) a. o' }4 l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  ]+ E1 A& E: l! ~# R2 i1 d: q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 ~% S5 j% ]5 |; L/ ?: F1 _& r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- E/ r' Z. u  C# n* K
  67. ) }* ]/ b7 m  U' w" G' q5 m
  68. dma_addr_t dmaphyssrc1 = 0;
    4 [# T8 P, Y. v* `) ~; e# x
  69. dma_addr_t dmaphyssrc2 = 0;
    * |4 S8 L, M; v7 ?$ s. i3 g
  70. dma_addr_t dmaphysdest1 = 0;
    8 ^( P1 @4 A# u% `: z  }5 k
  71. dma_addr_t dmaphysdest2 = 0;7 D: g0 C. t! z6 L; @! S

  72. 1 j. }! V# q0 N# ~% P4 _& `
  73. char *dmabufsrc1 = NULL;/ o6 D1 B9 ~* h
  74. char *dmabufsrc2 = NULL;2 `& d9 @. E# ?" L8 N
  75. char *dmabufdest1 = NULL;; a+ l3 z  x; K: Q7 \' p
  76. char *dmabufdest2 = NULL;+ e% m" k# V: Z- b
  77. / _7 k3 L0 M/ ^; x3 F  r
  78. static int acnt = 512;
    ! t$ [" O8 q: X: D& D+ @
  79. static int bcnt = 8;
    / t2 t4 N) ?1 C
  80. static int ccnt = 8;4 Q" N/ {( G# J$ ]  u$ M
  81. 2 j( h$ [7 j* O/ C, Q( T# N' M4 p6 O
  82. module_param(acnt, int, S_IRUGO);
    ) g  I5 q2 H  `$ i9 }  ?' [9 f
  83. module_param(bcnt, int, S_IRUGO);
    * h. h* ]" g" K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 i3 P" t/ m& M$ @+ ]' p0 l+ y0 k& i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 v0 F7 C9 E: f" n2 ]arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ t; b( S( u+ }& b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 _* p4 d+ a" `5 V9 e* f
& }' {, {4 }: r8 U8 T. E
( ^; u* j3 N+ k5 @9 D9 K: t* K$ o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-3-12 07:38 , Processed in 0.045859 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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