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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! A  P) Z; R+ Z# J7 O/ n
  1. [code]EDMA sample test application* Y: x" s5 L" \+ `
  2. /*
    % a, {% A& u/ W! `; S
  3. * edma_test.c$ J: Q( q1 f+ X4 i) }
  4. *' ?6 v1 S; l! p7 c' {
  5. * brief  EDMA3 Test Application
    & m) M7 k# \" ^3 R4 F
  6. *4 ~3 ?7 n7 T- G/ H# b" i
  7. *   This file contains EDMA3 Test code.  ?: u& b  E7 {+ l: d- Y
  8. *0 [9 \/ |6 n- g; E* n5 E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, o: \& q6 N' Q& `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ k8 c$ P- _- [) t$ G3 W
  11. *         TO CHANGE.+ v6 l" v: ~, E2 ]  E) Q' P
  12. *! B: ^5 G1 S7 ^4 {/ v) W( p$ G% t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  G/ {) o* c( @5 M- ?. T1 u/ c7 `
  14. ** Q' e0 t% }3 f' w# y
  15. * This program is free software; you can redistribute it and/or
    ) n$ H  }( l8 C  R4 u8 [0 D8 U
  16. * modify it under the terms of the GNU General Public License as7 s% D2 `5 j" m( \) a
  17. * published by the Free Software Foundation version 2.
    7 ~; \1 o, n9 C8 H# \6 e
  18. *0 L* M( ?5 u2 a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 w0 j$ R8 _, x8 o
  20. * kind, whether express or implied; without even the implied warranty0 x; x2 e( w/ h" F1 ^2 r% t5 o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 E" D6 T- N. f
  22. * GNU General Public License for more details.5 @: W4 ^3 _/ \3 n' X2 H; v
  23. */
    " N2 C) O: P2 N

  24. / F, E5 g  |2 ?$ D9 E' C
  25. #include <linux/module.h>! e& S- N2 ?" B. ]. {: S
  26. #include <linux/init.h>
    1 B0 M- P8 h. R2 L
  27. #include <linux/errno.h>
    ; z/ j8 a* B; X4 a# r/ i2 ]
  28. #include <linux/types.h>4 p+ H- \' }" d. o/ x; Y5 j8 p
  29. #include <linux/interrupt.h>  r4 A$ [; p" E- u. a$ I
  30. #include <asm/io.h>1 T- l; X3 V: d) _7 s* y$ T
  31. #include <linux/moduleparam.h>( Z: _2 F2 S) K. F/ {2 K
  32. #include <linux/sysctl.h>$ F; r; J7 N  {# W- {4 ?: V
  33. #include <linux/mm.h>' Z% R$ d8 m" _; {
  34. #include <linux/dma-mapping.h>
    8 p& X2 a5 l+ o8 C

  35. . z& c1 P: Y! \! v9 m) a0 N  f! \
  36. #include <mach/memory.h>
    " E, s$ q7 {4 b
  37. #include <mach/hardware.h>
    ! b6 _! n; T- W
  38. #include <mach/irqs.h>
    5 @2 ?7 G$ f6 N* r& _
  39. #include <asm/hardware/edma.h>+ O- g: b# F; Y3 a* n

  40. + d' Z8 a- x* A2 v6 {
  41. #undef EDMA3_DEBUG
    8 V  R/ W& l( K. e2 A
  42. /*#define EDMA3_DEBUG*/
    - H' c+ S5 t7 q3 h/ O- i# U, V% m

  43. % o0 j0 {0 J# t1 Q
  44. #ifdef EDMA3_DEBUG
    " p/ k. z, B3 S' s8 P' `: \* K# Z$ v. N1 r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . s5 C0 g6 ^0 D! r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- n2 m+ ~' ?* B: Z/ w9 u3 x' c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 ~4 u/ i8 O& F$ X0 u3 Y9 H
  48. #else2 w$ A: x7 W( Y( c4 `- F
  49. #define DMA_PRINTK( x... )
    9 \$ I0 y" u6 E7 J* Q
  50. #define DMA_FN_IN$ o/ R, t: d. |* E0 E/ p  I
  51. #define DMA_FN_OUT
    ! y" h# b$ @" F$ H1 Q
  52. #endif
    5 |; R* Q, O2 S$ H% O

  53. + b# v: m, A" w0 Z/ J+ c* D8 ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- B: v" F" A' _* S3 m* F; F6 S; v; a
  55. #define STATIC_SHIFT                34 I' o" r5 K: n
  56. #define TCINTEN_SHIFT               20
    8 {2 G* k2 G% i0 W; @
  57. #define ITCINTEN_SHIFT              21# ?# L/ j* g) ?
  58. #define TCCHEN_SHIFT                22) o4 ]) {7 `8 G' `2 m( W
  59. #define ITCCHEN_SHIFT               23
    : k; j5 z1 D8 @6 c

  60. & c. Z- U5 j5 |) H
  61. static volatile int irqraised1 = 0;$ o% h# j" E2 e7 W$ J( {
  62. static volatile int irqraised2 = 0;4 ^; a5 M) T# \  H- G/ f# e

  63. ( P6 [* Q& w' M( Z9 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" k& E- f6 Y0 p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 s3 E1 U9 Y# [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , z- z7 O+ x7 f' Z, |, J
  67. 2 K" O. t1 o6 A3 F4 \* S  J
  68. dma_addr_t dmaphyssrc1 = 0;# R* ~! u& R9 w8 `2 v: P
  69. dma_addr_t dmaphyssrc2 = 0;7 L3 f  ^( T1 c
  70. dma_addr_t dmaphysdest1 = 0;
    ( D* w; k3 Q' O# Y* M
  71. dma_addr_t dmaphysdest2 = 0;  L1 N  H9 q1 N6 B* P

  72. $ A/ I* H& A$ C% _$ V
  73. char *dmabufsrc1 = NULL;
    7 u! _1 [8 p# |2 [
  74. char *dmabufsrc2 = NULL;8 r" g$ Y9 P5 Y* S' o
  75. char *dmabufdest1 = NULL;) p4 d$ a' M: x1 p1 o
  76. char *dmabufdest2 = NULL;& l0 M4 [4 K' t% k

  77. & L) n5 {0 ?6 @4 B
  78. static int acnt = 512;% Y( z) W9 v& F# Y" d8 |
  79. static int bcnt = 8;* ?7 O& v( _. \2 W# ~* Q1 g# L
  80. static int ccnt = 8;( [/ b, C0 Z6 `! L# ]
  81. : j% `" a. S( v6 V# G' e
  82. module_param(acnt, int, S_IRUGO);
    7 N- y3 k( j4 d4 J" |& ]
  83. module_param(bcnt, int, S_IRUGO);
    + W) @2 {+ T4 w& I4 Z9 d9 q# P( q# n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 f0 H; ^1 ]; q3 r4 I6 x8 x
" R7 y5 f, B9 c' s( t" r# T
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 q8 Y. T  E, G' a* \* t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 B0 I) f: }+ f% r     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) D: L8 B" R8 Y
9 u" R8 }1 x4 A  ?- j/ ?: g4 d  \2 C3 u9 o% e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-21 10:03 , Processed in 0.039995 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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