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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : T3 N3 J' W- K! u
  1. [code]EDMA sample test application- P0 [; U% I0 h0 x
  2. /** C' e2 Z. Z& s' z$ d0 T) y
  3. * edma_test.c
    0 [( ]$ L# V$ s4 o. A9 ~& J) D& D7 r
  4. *
    ( I4 t6 }+ i. L% I/ e1 |
  5. * brief  EDMA3 Test Application5 m6 F1 f- K8 T4 s& u$ `* O' R5 Q
  6. *& |( I+ O7 S! p" V
  7. *   This file contains EDMA3 Test code.
    % Y! M0 z8 f; S6 y% ]  |. F
  8. *
    + c: v( h9 w1 e% L& z& A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" ~! h- L: m6 r: y" P2 Q, T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / S: I4 {$ \% E8 q1 ]2 \# E1 h
  11. *         TO CHANGE.. y. B! S- L7 N2 u
  12. *" `' ]; F6 x( |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 G$ H" J. n) c) v* v
  14. *
    6 N8 {: f% F; V1 F+ R1 |
  15. * This program is free software; you can redistribute it and/or: E& B7 E4 `4 l" Z! N' k
  16. * modify it under the terms of the GNU General Public License as8 i& l: w* H) C9 K' ^' R: v% \
  17. * published by the Free Software Foundation version 2.
    ( R5 D/ G8 [$ ?
  18. *
    7 z( O, M* r5 v/ G' V# V& B1 E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : d5 `4 f- W& a# a& _0 f% D/ z! G
  20. * kind, whether express or implied; without even the implied warranty
    / w! E8 N: q) y' g- i+ Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! F3 L# m7 c0 D4 ]5 n. {0 Y2 Y& b' J, T
  22. * GNU General Public License for more details.
    8 v  X4 F$ [9 ?1 d/ @2 U- C
  23. */
    6 n/ L) N: p9 b* K1 c
  24. # S2 {+ E+ l& D' G+ E. V
  25. #include <linux/module.h>' R3 i0 ?# ^1 V# H8 c
  26. #include <linux/init.h>& \/ |3 O$ D9 G7 Y7 h" d6 A3 d
  27. #include <linux/errno.h>
    6 R- V- \* Q* p- J( _2 g
  28. #include <linux/types.h>6 X: ~& d2 B7 p4 ]# E5 k
  29. #include <linux/interrupt.h>
    + u1 t/ O- _2 D  E8 ^: o% b" ^
  30. #include <asm/io.h>
    & I: S4 X; {# ?9 L! o
  31. #include <linux/moduleparam.h>
    7 f3 P: k! F8 z
  32. #include <linux/sysctl.h>
    2 m, d# _- l, X6 {+ L. g' v
  33. #include <linux/mm.h>
    / F* k& c4 S4 N' m
  34. #include <linux/dma-mapping.h>
    ! N. m, c/ p3 ?
  35. . Z! j, t* U4 T/ }3 k
  36. #include <mach/memory.h>
    0 M$ i1 q% _) t5 }! Z, f# q- ]
  37. #include <mach/hardware.h>/ }5 o1 F  y* Q. k7 ?% u' I" D9 l
  38. #include <mach/irqs.h>
    ) z6 b7 k$ ^/ E; [6 ~
  39. #include <asm/hardware/edma.h>0 C' B8 A' O" n3 w" x- y

  40. 9 C& K5 G6 g& B0 r% W' h
  41. #undef EDMA3_DEBUG+ c4 f' H* g( V$ r2 r! |7 |
  42. /*#define EDMA3_DEBUG*/3 O- c' Y/ L2 t4 B

  43. ) n2 i# ?1 S, G7 b; t
  44. #ifdef EDMA3_DEBUG  v  M# {2 {( {- m2 q$ Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ j) l" ?, J0 U- e% H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' y& S' T7 j3 y5 H  D. X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & p6 m( l- u9 ?. l9 ^! n9 P# a
  48. #else/ ]+ n8 U" s' C# I. U' s& s
  49. #define DMA_PRINTK( x... )
    0 h  Y9 R" h# |4 Y) x9 z* Q
  50. #define DMA_FN_IN
    % q. I4 w  @1 ?. F
  51. #define DMA_FN_OUT
    9 q6 ^" g; Z! F6 L/ n% n
  52. #endif
    % ~& ^6 G" X2 r! w' _. T9 K
  53. ! ]/ H) g6 S5 {; N% D  _& R4 ~8 X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 a6 Z; Y  S6 \5 T
  55. #define STATIC_SHIFT                3
    5 M) X+ q8 r% Q8 d4 C! [2 v
  56. #define TCINTEN_SHIFT               20
    & W$ O0 k% f# `! F
  57. #define ITCINTEN_SHIFT              21; c+ Y. l' u; G2 Z7 |2 o  W
  58. #define TCCHEN_SHIFT                22
    9 l6 w, h4 Q9 h# Q
  59. #define ITCCHEN_SHIFT               23
    ) i! y: ?1 R/ R* b4 ~& j

  60. ' s) i( f4 r8 u+ o* z
  61. static volatile int irqraised1 = 0;. {8 V$ E7 R8 s# Z1 J9 F
  62. static volatile int irqraised2 = 0;
    1 C# z9 ]' b5 X4 o( \
  63. 2 v$ N# L7 Y3 i/ J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# G9 M* E& N% j& g9 D+ l- N( j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # q* l3 D5 h& J4 i/ ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 P" i1 h) {3 _+ f! m/ m4 `5 v
  67. ! R/ J7 }( i1 o0 }
  68. dma_addr_t dmaphyssrc1 = 0;: M2 J: k" z4 _+ w: h
  69. dma_addr_t dmaphyssrc2 = 0;
    / j: I2 s+ n* g! O7 h7 @; W# p
  70. dma_addr_t dmaphysdest1 = 0;- b! j; K/ z; R" ~: [. Z8 g0 t4 _; H
  71. dma_addr_t dmaphysdest2 = 0;0 h- g" ?0 l+ A
  72. 1 ~5 h: g; p" ^4 s9 i
  73. char *dmabufsrc1 = NULL;3 a' P2 f' N) b& k# W+ ?
  74. char *dmabufsrc2 = NULL;
    $ S9 s8 o+ t$ y$ O/ d
  75. char *dmabufdest1 = NULL;
    0 r3 M& H1 F& v2 T8 o
  76. char *dmabufdest2 = NULL;
    + l& N' j  O0 d/ R  b: E* |3 U6 ^

  77. 7 |/ C' v: h2 ^  f8 M; p
  78. static int acnt = 512;
    : p; c6 i3 {1 w4 S
  79. static int bcnt = 8;' |& Y# x3 d/ I) J" p! O
  80. static int ccnt = 8;
      Q. l; A& l* _6 p+ M
  81. 6 Z7 c6 d% D; _" x
  82. module_param(acnt, int, S_IRUGO);
    % S1 J* f) B# E) M+ r
  83. module_param(bcnt, int, S_IRUGO);+ J$ y+ }2 T! s$ L/ C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 }; b! i; [' A' }2 ~6 q

3 u4 Q) b  H' u, ]  M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: K7 K9 I8 ~. p; q( 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ W' x" C/ y( ^) p0 M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 {& E" r% D& E
. C! @: ~9 S. |. E% q
% w( n. V6 m$ e( B; j* a+ B" z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-8 22:42 , Processed in 0.038189 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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