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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 ]1 g. V' Z1 m  s
  1. [code]EDMA sample test application. S' c, M, t7 C$ t# e
  2. /*$ H2 S4 I6 O/ o0 W& s. S
  3. * edma_test.c, }# A* X, U# J& F+ i& h
  4. *
    1 @  Q% q2 j$ b- t) n! N& l! T) O
  5. * brief  EDMA3 Test Application
      x( w& k& g9 O9 `. ]# K
  6. *' O6 O% O% T4 S2 E. y
  7. *   This file contains EDMA3 Test code.
    + q, x8 Y# ?- M' }
  8. *
    : }, ^6 F, Q; `. D# Y+ C1 n. a; b& [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  d/ P5 V# p5 K5 w& y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * t+ c9 K; ^9 [) g1 u7 S
  11. *         TO CHANGE.* G* n4 g! g# b. [8 d( L: e
  12. *: |: F# E- p5 \/ H$ o3 B1 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, o2 B- R0 _# Y) K/ M& u  E
  14. */ e' z! J- O( a6 _3 C4 u9 p7 J
  15. * This program is free software; you can redistribute it and/or% r! X& Z9 Q: F0 J" Q: J$ J
  16. * modify it under the terms of the GNU General Public License as
    : K# `5 _, o; X" @/ P
  17. * published by the Free Software Foundation version 2.9 X4 _; [5 x% w- k& [. O. ]
  18. *
    ; S* R7 `2 o" b/ t& F8 O3 M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ P9 f2 Z/ A) @
  20. * kind, whether express or implied; without even the implied warranty
    1 d# b- t. p3 R2 E' p5 H* d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 E" }8 K2 p# p& a$ j: ?
  22. * GNU General Public License for more details.6 I2 B# j" c  D; s* x* }, Y6 T" W5 c
  23. */
    - F4 |5 D) R( ^8 X7 [

  24. : a' P5 N. f) q2 R
  25. #include <linux/module.h>
    4 K5 Y( m% m/ x; L  h2 i4 n: ^
  26. #include <linux/init.h>$ \8 a% i8 \3 V& }/ C0 c
  27. #include <linux/errno.h>
    9 U1 C' v0 A" e: w% z$ N1 ]6 P( F
  28. #include <linux/types.h>
    $ W3 U8 v* a4 O7 N$ z. S$ C5 A
  29. #include <linux/interrupt.h>
    # s7 I4 c+ K0 P# i) d+ t
  30. #include <asm/io.h>
    - O! U- h0 S/ w( t9 c, @
  31. #include <linux/moduleparam.h>
    8 h* s! w5 v" g5 m! P  I
  32. #include <linux/sysctl.h>
    : }$ t* ^) d2 O/ ~1 p
  33. #include <linux/mm.h>9 ]/ F; c- x( e" v
  34. #include <linux/dma-mapping.h>
    / T' {) |- c" z

  35. ! j% K+ V' n6 Q' B' C
  36. #include <mach/memory.h>8 Y& g+ k: f; |
  37. #include <mach/hardware.h>$ }3 T5 g# x  \- q. K9 W" e- g: e
  38. #include <mach/irqs.h>
    + B. R; E# J, I; q2 @
  39. #include <asm/hardware/edma.h>
    # g9 [/ y* n3 }+ _( x2 |! q& j% W0 E
  40. $ H1 F! Q3 Y/ R5 Z
  41. #undef EDMA3_DEBUG3 R# b$ d( v2 E0 Z
  42. /*#define EDMA3_DEBUG*/* R1 ~) M' e4 |+ {- u; P
  43. 2 G' N+ e2 O5 i: ^
  44. #ifdef EDMA3_DEBUG2 s5 G( G' ?* Q5 B/ U1 O7 T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . t  E  J; T& d2 h5 O/ x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & d8 F' W, v* ?% |" ~% Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 r# \6 w2 F8 S/ q+ e6 a* P. X
  48. #else
    + x# P/ j$ C: T4 o! [
  49. #define DMA_PRINTK( x... )
    ) W* h& ^, c; x! l$ P; q$ [8 {
  50. #define DMA_FN_IN& }$ ?6 i7 T& l! o  I, ~& l$ T
  51. #define DMA_FN_OUT
    1 c5 S) k3 N' o2 S8 {1 G. i/ l
  52. #endif
    8 ?; d" Y3 A) A0 x; ~  s
  53. ) |6 v# T( s" O$ {0 \6 j+ T  l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' K* [' \7 }, n- M1 {4 p  Y
  55. #define STATIC_SHIFT                3& S) p" H" H5 G) |9 K) J3 u
  56. #define TCINTEN_SHIFT               20
    4 B: }6 M8 k& V( s
  57. #define ITCINTEN_SHIFT              21+ C5 S5 G/ ]3 P) R; X
  58. #define TCCHEN_SHIFT                220 }# s6 @( ~2 D# e( y
  59. #define ITCCHEN_SHIFT               23
    2 \0 l; X" Y  l6 w0 y. I
  60. ' W0 T1 `6 m4 [; e8 B, C. N  f
  61. static volatile int irqraised1 = 0;
    ; w6 M# z$ \* s5 V: D- O. U; V( S
  62. static volatile int irqraised2 = 0;
    8 A9 Q/ N) _+ n3 {7 }
  63. 1 J; j$ x( @$ X* g! K4 g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % Z- o, d# r+ x! G. G; j# \( g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ k8 h7 x9 M2 p4 A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % s0 e8 T2 V+ O2 Z0 E

  67. 7 E7 P5 \$ ?: p2 q2 E5 x
  68. dma_addr_t dmaphyssrc1 = 0;* v# |" D1 _5 L! v* _, M4 a
  69. dma_addr_t dmaphyssrc2 = 0;
    + a! j7 {# U0 l9 U8 [! b% a
  70. dma_addr_t dmaphysdest1 = 0;: ~$ x/ P, P& O! a
  71. dma_addr_t dmaphysdest2 = 0;1 L" [+ u  |; }+ B" _1 T# Z. u
  72. 1 N8 Y  _& H  c) ~- a8 ?! c
  73. char *dmabufsrc1 = NULL;
    7 s) T6 s( |' L
  74. char *dmabufsrc2 = NULL;# I; ^5 R- M9 d" Z  Z$ v5 E
  75. char *dmabufdest1 = NULL;
      h, V% R5 w, k; U6 F2 F0 r
  76. char *dmabufdest2 = NULL;
    8 h# P, z! @+ [; J  y3 L
  77. . z# ^% N% {2 e/ z& k; m5 s( }
  78. static int acnt = 512;  u5 x' P2 C8 ^/ Q" W5 M
  79. static int bcnt = 8;6 k, V3 }$ \, C' f
  80. static int ccnt = 8;
    1 {. o& G5 F- k7 Q9 q
  81. 1 w9 a$ m) b- P$ w$ u! o
  82. module_param(acnt, int, S_IRUGO);
    & c+ V. e) d8 z5 i5 T+ h
  83. module_param(bcnt, int, S_IRUGO);
    " n$ }9 S+ K8 o: Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ p7 ?1 J( @  L1 W! M# j; [. F' a4 f5 P! p1 \8 ?- |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 L( q3 v; X, U& S" k: S" E  h) d" Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: \% g0 w( P7 D% E$ Y$ E, l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, U; D8 q) u: h" p% \

$ A  f: W6 F5 z% C( B) I
* Q, x2 {% G4 L% a+ O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-29 17:42 , Processed in 0.036852 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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