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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, o! U4 ~* c4 X
  1. [code]EDMA sample test application
    0 J" k0 m* }, ?* Y
  2. /*% Q0 T% |% L8 j5 @2 E
  3. * edma_test.c
    9 I0 G" m; e2 h( Y( o& S
  4. *
    0 _# u" I6 H+ }1 f0 g: K- H
  5. * brief  EDMA3 Test Application: C" H' x  c) ?( [
  6. *
    5 _, B+ o/ K9 d0 h: r
  7. *   This file contains EDMA3 Test code.# X/ d7 f* g/ {$ g- d5 z7 U2 a
  8. *
    ; X) b- h" q2 i5 y& }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# V9 ?/ I9 k( ?$ H, w6 O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      D- y# k5 O; D  N5 e, S1 y# _6 x) U* @
  11. *         TO CHANGE." R4 }! \* L* x- l7 F6 q! f# c
  12. *
    ) a8 _  y1 h0 h) v' l' G2 R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 E1 D8 o/ h7 y* K8 W; k5 _  b
  14. *
    ! {$ p/ P/ X1 z) D% K, E
  15. * This program is free software; you can redistribute it and/or/ n4 G, }( [8 ?8 `
  16. * modify it under the terms of the GNU General Public License as; k# k+ ?5 z$ r# \& U, A' r
  17. * published by the Free Software Foundation version 2.
    4 J* y- G8 `, h
  18. *
    + Y1 S) M6 K/ R5 L/ X, F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" O1 r6 C0 T' u
  20. * kind, whether express or implied; without even the implied warranty: I/ R* ~8 i  A  d. R& M! F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 }4 G- j, R9 V) H6 k1 Q" A- \& G
  22. * GNU General Public License for more details.) Q( B0 g/ O0 ]1 s6 T1 n
  23. *// u5 V, [* \6 {+ x* T( T
  24. 2 w8 {/ e) [) C6 k
  25. #include <linux/module.h>1 {3 }- X5 B) z5 J  l% l$ t: J
  26. #include <linux/init.h>) \* J0 D" I! c! X5 ]& w2 x# \
  27. #include <linux/errno.h>* `3 ~1 l# Y6 m$ ~& Q5 f$ n6 _1 ^
  28. #include <linux/types.h>) o1 M+ {. u3 P, T# F
  29. #include <linux/interrupt.h>
    ) X% b9 l7 V: g' V/ D5 Z' y; v1 L
  30. #include <asm/io.h>
    - s# G; a$ H' o" `% s1 S
  31. #include <linux/moduleparam.h>
    ; G: r2 s/ e, {# K, q2 V. r
  32. #include <linux/sysctl.h>! b! s- X/ b9 j. D- q
  33. #include <linux/mm.h>
    % b) z( p# G; @, {# }* M+ R9 m& n$ L; O
  34. #include <linux/dma-mapping.h>! m7 J2 m% x6 [6 q8 q

  35. 8 v3 Q3 ?. i9 e2 \- {% I* ?
  36. #include <mach/memory.h>& ~6 ?+ W4 g; d
  37. #include <mach/hardware.h>5 q. G/ I0 [0 E8 D" w1 M/ x
  38. #include <mach/irqs.h>) I+ x' o1 F  d& {5 p) z/ E
  39. #include <asm/hardware/edma.h>
    % @9 `' b! ?* R( [8 Z  J4 e
  40. ; Y: n+ ^' [9 A% R- K; f
  41. #undef EDMA3_DEBUG
    $ L+ H* z( V  \0 B. {5 ?; Z
  42. /*#define EDMA3_DEBUG*/
    % R6 p& s3 Y) `

  43. * a: W) z) L. n1 w4 w4 n: D1 S5 o
  44. #ifdef EDMA3_DEBUG9 @. J7 q4 {* W6 x, Y/ ]9 Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % p5 _" y% K. d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ V0 b' d" G! r+ P3 e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( O) t2 x) l7 s4 U
  48. #else% O0 Z  r* B: W8 i7 Y- ~5 L0 F$ n3 C
  49. #define DMA_PRINTK( x... )
    & _( T* e7 H) t3 K" ]* L; R
  50. #define DMA_FN_IN5 O- T6 N! I( u, W$ _* X8 }. A
  51. #define DMA_FN_OUT
    0 R: N- f! x+ k' H5 ]* r
  52. #endif0 W8 e  K, R# Z5 ?
  53. 9 _- q; E7 f* _4 F9 F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 C. g6 A8 C% `# b6 x
  55. #define STATIC_SHIFT                3
    , t! w$ o$ n  b, P% r& D: w& F
  56. #define TCINTEN_SHIFT               20
    . ]! k* ^9 l  T! C
  57. #define ITCINTEN_SHIFT              21
    / T# }" C7 K1 q0 v2 {" X4 |  E
  58. #define TCCHEN_SHIFT                225 F2 }- l7 g3 ~- c
  59. #define ITCCHEN_SHIFT               23
    , L" w& ?0 a/ x+ E" v
  60. 8 j* J9 g) S' L5 i9 F% l. m
  61. static volatile int irqraised1 = 0;0 g. h4 A2 Z0 C# n* ~! G; E) u) }
  62. static volatile int irqraised2 = 0;" J8 x4 l! D2 i

  63. ! m) D, I2 Y1 u# r: M2 ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; x' |) `$ W' C' J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / s' V$ h  n( s) F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . ]- B* r- M6 w' A2 c& O/ P

  67. 1 C! k, L2 R& Q, X8 A: p6 e! K, f: l3 y
  68. dma_addr_t dmaphyssrc1 = 0;
    3 [$ z6 ?! y4 e/ `. k
  69. dma_addr_t dmaphyssrc2 = 0;6 G2 B% u1 F. S, H5 {
  70. dma_addr_t dmaphysdest1 = 0;( a2 w* n. V3 t3 v8 n+ _' I
  71. dma_addr_t dmaphysdest2 = 0;
    + b* @+ r% l9 l/ L% c! S
  72. ; Y# u' |* z) N2 [* _* t! Z8 O
  73. char *dmabufsrc1 = NULL;& H7 n: y8 h0 ~$ \+ s* t
  74. char *dmabufsrc2 = NULL;
    2 @$ a, s/ q* |: x5 l
  75. char *dmabufdest1 = NULL;8 D( E" F. n1 H
  76. char *dmabufdest2 = NULL;9 _% L: y9 d7 h/ x/ t6 Y# n
  77. - D5 b8 Q: ?& F; q$ P, R
  78. static int acnt = 512;0 s" d" O( y9 N
  79. static int bcnt = 8;, j1 l/ ^- ^( w% V' W* a
  80. static int ccnt = 8;
    " A6 J, Q8 t7 [. X' c; O* {) x

  81. 0 O; F/ N; B- x
  82. module_param(acnt, int, S_IRUGO);
    7 B, N; j0 U8 U: G. c: u" \9 U
  83. module_param(bcnt, int, S_IRUGO);- H0 |" ?# t, Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ p( k% E8 W( x

1 g' q! `) i9 ?% m% C1 O6 y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 `$ ^4 D; `  V$ q5 J( @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, j' Y9 w# W! N5 @; I4 [     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 Z4 z$ D+ ?1 G  W
  L6 W5 a9 e9 L5 o$ {2 H/ f8 W+ y2 G1 A$ h" B- E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 06:16 , Processed in 0.046251 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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