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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 ~( T1 n$ ?7 E3 j* K
  1. [code]EDMA sample test application
    3 a0 D; p- D& ^: f  Q% a- N/ I
  2. /*# ~/ y! C7 {4 O6 _" t
  3. * edma_test.c; v' X  n0 n, P! a: ~# {
  4. *
    : A5 f8 k7 f# _8 H$ o" I+ f
  5. * brief  EDMA3 Test Application
    2 `  C" }, F; {! B3 u9 G( Z
  6. *
    2 p9 K7 l$ H+ n/ k$ F/ U! o" ?
  7. *   This file contains EDMA3 Test code., u+ J3 }( N. I1 z0 a1 @, B
  8. *6 T' d/ U+ L) g) x  ~# ?2 ^8 X7 S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 K8 F" W4 E) h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! j0 d1 A8 {9 X$ Q
  11. *         TO CHANGE.
    " f, e* v2 z& B. o
  12. *
    & n' p+ c! v+ a8 m5 e1 b; P! m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 A- {% O4 A& O/ r( I. s6 |  _
  14. *7 D/ ]/ C& I+ o" W$ T  C; w4 o
  15. * This program is free software; you can redistribute it and/or
    - j" k3 q( j6 ~9 ]& g& o$ V) |
  16. * modify it under the terms of the GNU General Public License as! l- v% X( Z* ^# p0 a1 P8 @
  17. * published by the Free Software Foundation version 2.7 Z5 y* w- e2 R% W( \% b1 z' m
  18. *" E( u* \7 v0 Z8 h! E% Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 S/ P- Z( L1 X& k2 U
  20. * kind, whether express or implied; without even the implied warranty  D6 f" J. l3 e9 ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ l: E) ]: z/ y5 q/ d
  22. * GNU General Public License for more details.2 K$ z- K- M7 Z2 {: x3 @
  23. */' w) U2 ?% j$ v7 x

  24. , Y. G4 H# ^+ ^0 W
  25. #include <linux/module.h>* ?- B) I) e, m/ s1 G
  26. #include <linux/init.h>
    7 P- y! Y& L4 A$ L8 l; f) }+ E' A
  27. #include <linux/errno.h>3 j3 \4 R2 f& P/ E
  28. #include <linux/types.h>
    2 {! I( Q# Q; G0 \
  29. #include <linux/interrupt.h>
    $ I7 x0 D( \3 N* ~# A
  30. #include <asm/io.h>
    " M" t5 l+ e6 o; K0 S
  31. #include <linux/moduleparam.h>* ]" _$ `  x1 k$ C
  32. #include <linux/sysctl.h>
    & v& N8 K" F5 H, k/ R4 r
  33. #include <linux/mm.h>
    & C7 [, y6 r5 a: h' U6 u
  34. #include <linux/dma-mapping.h>
    % T$ w* ~4 E9 l
  35. 0 h1 e7 v8 p% s$ r) z) i3 s1 X
  36. #include <mach/memory.h>
    # O6 W* i% ^/ x( J1 j
  37. #include <mach/hardware.h>
    7 o& e6 @; g- j0 h
  38. #include <mach/irqs.h>
    % s8 O6 w1 Z( U$ \) `# i3 ^
  39. #include <asm/hardware/edma.h>$ G# q$ T% L; k* H
  40. % U- t- p7 @0 M
  41. #undef EDMA3_DEBUG
    0 I7 m9 Q/ L4 N; U: d# i
  42. /*#define EDMA3_DEBUG*/
    + x4 [; O; |) P& K! u2 }
  43. 6 w! t8 h( Z6 E" \
  44. #ifdef EDMA3_DEBUG, j" t/ H5 n# Z5 X: q9 q, z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! H/ Y, P7 |6 g) B3 C1 B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 v7 ~* t! Y7 [  _$ S- ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , V8 O7 }5 _: x% W9 h& D0 C4 G
  48. #else6 Q. J8 j" ~1 o& B+ R6 T+ t
  49. #define DMA_PRINTK( x... )
    % N* ]& x- L; B/ W- D
  50. #define DMA_FN_IN
    : H( t& K1 u+ p3 @! d" T9 K
  51. #define DMA_FN_OUT
    - f/ `9 c+ Z+ F  E' c9 \- Y7 I
  52. #endif
    - O9 s' s; s) ^: W9 C
  53. 3 k; k1 m" I& a5 n% Z/ E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 A1 k2 Y7 J  J+ [1 V3 C) }
  55. #define STATIC_SHIFT                3
    " g) Y1 X: e8 s3 P$ x$ C
  56. #define TCINTEN_SHIFT               203 E" \6 E; h4 m* x- p$ s% g
  57. #define ITCINTEN_SHIFT              21- r. a2 B0 d3 ^3 |- u5 {
  58. #define TCCHEN_SHIFT                222 W( L6 O0 n4 y; a4 i5 E
  59. #define ITCCHEN_SHIFT               23
    / b1 o8 _# B. @
  60. / l6 p1 R# t2 R& r0 A
  61. static volatile int irqraised1 = 0;
    ! D. X, G) x& W( w
  62. static volatile int irqraised2 = 0;) y- i  k% T: S4 Z! _4 P- X- M, c* n

  63. . W7 X6 E! F: I8 i* E  d: l1 @% ], L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! _: w1 S/ B6 X  K, Y0 u$ a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 |- x- d) Q9 u( D; `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 V: H$ w. x8 ?( S4 e

  67. ! O& X1 x0 Z0 o+ Q5 D
  68. dma_addr_t dmaphyssrc1 = 0;  n/ Y+ k1 E' [% f: H6 U% r
  69. dma_addr_t dmaphyssrc2 = 0;$ A+ ~5 S# u: K" G; O
  70. dma_addr_t dmaphysdest1 = 0;
    5 l% @0 b  _9 p0 O3 _- A
  71. dma_addr_t dmaphysdest2 = 0;5 }, `- |0 ]; Y- b) t" Q9 J

  72. 6 X1 P; D1 @6 d* k
  73. char *dmabufsrc1 = NULL;% L( B7 n- x6 p+ ]3 _
  74. char *dmabufsrc2 = NULL;0 }3 O4 M8 s  Z, ~4 j5 w) k. A! F
  75. char *dmabufdest1 = NULL;- f& X( ~' d! k# t- W
  76. char *dmabufdest2 = NULL;
    $ B  t5 w. x' b

  77. 9 g3 K/ }1 k' k+ y% G" ?- T. t/ Q
  78. static int acnt = 512;
      m! B! s* Z0 e9 E2 @4 i
  79. static int bcnt = 8;& L# I+ A* Q, q& z! |
  80. static int ccnt = 8;: I  L" t6 d. v
  81. . F9 t4 Z5 y+ l* _
  82. module_param(acnt, int, S_IRUGO);
    . r  a' ?& }7 a
  83. module_param(bcnt, int, S_IRUGO);
    " e( ^+ x! L; \) f+ P8 @: X
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 O1 L) c) U: t
6 @  D8 O2 @8 W* L! Y& [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. |0 S! O+ _& t4 Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 i& V$ O1 q+ l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( @' x! P& ]  S8 Y# A2 W

5 d+ y& e3 g5 v( V0 m9 l3 E# ^0 d' e. a/ L" G' e8 [# t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 17:36 , Processed in 0.039134 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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