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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ m# D" D  w/ i
  1. [code]EDMA sample test application
    $ C# B" O" r# T" V; E% L
  2. /*; F0 I) c- R7 f. I, K
  3. * edma_test.c
      M* p& |! t; i5 ~) Z- J
  4. *
    $ p  }5 B# J! A7 C. m, J+ U2 F: I
  5. * brief  EDMA3 Test Application
    8 V8 D  c5 A2 i, J4 [& D
  6. *
    ' T1 N/ l' j% I$ @, P
  7. *   This file contains EDMA3 Test code.
    5 s( J# w1 F; i# C$ b
  8. *
    0 W9 F) a+ t, ~0 m7 J8 C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . `5 ^+ K! i1 N+ q+ |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* y$ |2 P  O1 A' x5 }! m
  11. *         TO CHANGE.
    . Z# [1 B* \# A0 {9 }3 z$ D
  12. *' v. }% l4 k" w1 z7 x. t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) c' g+ Q, y0 c7 H  c
  14. *
    5 F4 l+ B- o4 L* C( M. p' p
  15. * This program is free software; you can redistribute it and/or. ]% T! ~6 u$ X
  16. * modify it under the terms of the GNU General Public License as1 @  M2 Y/ b* b3 q- G3 i6 `7 w
  17. * published by the Free Software Foundation version 2.
    ( ?  S7 g8 o8 ~! k
  18. *6 t/ R/ S- C2 E. e( q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 z6 u8 c) Q9 V, g! i$ s# Z8 v% q. N
  20. * kind, whether express or implied; without even the implied warranty) T) a% }  r( a1 V- P7 k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 z7 U  x+ S( ~4 W
  22. * GNU General Public License for more details.* e) T9 W# f& K, C0 q9 ~$ r+ U1 {& M
  23. */
    + Z) B: o( E/ N
  24. * u% d' ^: H! G6 q
  25. #include <linux/module.h>! o& X& w# F8 \* r$ z- M+ N
  26. #include <linux/init.h>
    6 |4 M7 R: K& a1 y/ R
  27. #include <linux/errno.h>* i+ ^/ T. \" _* ]& ]* y( N; ]  d4 G8 U
  28. #include <linux/types.h>
      _! r. t6 e. X* B
  29. #include <linux/interrupt.h>
    5 s) ?6 G, h2 A2 h: t
  30. #include <asm/io.h>
      {. |! R* @. a* t6 [  P' n
  31. #include <linux/moduleparam.h>
    3 B6 d- c: K% Z1 t) s
  32. #include <linux/sysctl.h>
    - {4 d* @; ]# a6 p# G, e
  33. #include <linux/mm.h>
    3 [2 N; c( G+ z% g" ~0 q
  34. #include <linux/dma-mapping.h>5 r) F; I6 k  t& S: h/ X+ [5 _

  35. & ^$ J8 ], p! l) H
  36. #include <mach/memory.h>
    : [  u: j3 ]' s2 V9 K! k  Y
  37. #include <mach/hardware.h>5 N& k: \/ B% @3 |& Y3 @
  38. #include <mach/irqs.h>+ Y5 V# C5 J. p; o7 H
  39. #include <asm/hardware/edma.h>
    / y' N0 g$ T) ]% d! A! U
  40. 2 A# v# p; L# t* W! M' D. f
  41. #undef EDMA3_DEBUG& O6 l) g9 e  t0 y# b/ z
  42. /*#define EDMA3_DEBUG*/
    4 u# f4 c& l& m' D1 T
  43. ' `8 ^6 J' P4 d( }! Q5 b9 d$ O
  44. #ifdef EDMA3_DEBUG
    1 K2 W2 a( u2 `) x# m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( ?+ u7 a  G; y; [3 Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 U5 s- k% g, W2 W7 S0 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( ]* N" J: x' _* s. C: W2 Z& b
  48. #else- \3 w5 ^# `" n) z" a) z
  49. #define DMA_PRINTK( x... )  C1 s0 l: g: {& r& q; h9 s
  50. #define DMA_FN_IN6 `  Y4 c0 F* D2 U
  51. #define DMA_FN_OUT+ m" o' p$ F# ^' i9 z% ?! e! M' t1 ^
  52. #endif
    ( V) H: d5 `: E: n
  53. ' A& ~# e+ |8 U5 ^- F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & h; e  D( `. J: k+ D; @
  55. #define STATIC_SHIFT                3
    ( X. O- ?. J# `
  56. #define TCINTEN_SHIFT               20/ ]0 c: g& `: ^$ p/ [* l1 L/ C
  57. #define ITCINTEN_SHIFT              21" i' x; h2 ~" A# f" ?# }' a' b3 U0 M
  58. #define TCCHEN_SHIFT                22* x& N7 ]" ^- [8 Y) E; X8 v
  59. #define ITCCHEN_SHIFT               23
    1 j7 u, s+ |0 N
  60. # o; K! R' \; D/ s
  61. static volatile int irqraised1 = 0;
    $ |, r9 M9 m7 {+ A
  62. static volatile int irqraised2 = 0;9 l9 |' p1 Y; @9 S# H; Q! N- u

  63. . k6 x% Z; B( X% a2 P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 D. z7 ]& M6 N3 [( r0 t8 D. v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 v4 f& ^- `8 \* ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 H8 F1 [2 a+ G+ j
  67. * \4 h! X$ l- z: v
  68. dma_addr_t dmaphyssrc1 = 0;7 f& @3 {6 H, o. L
  69. dma_addr_t dmaphyssrc2 = 0;
    0 c+ k* i; a( }# X' G9 F- q
  70. dma_addr_t dmaphysdest1 = 0;
    & \3 [$ u% k" t) g1 h5 B
  71. dma_addr_t dmaphysdest2 = 0;
    9 ?" V; a1 ?' V7 Z5 L* o: g
  72. ; s! f5 }* q  L. s8 t8 {
  73. char *dmabufsrc1 = NULL;
    4 d: k  U1 U3 C; V( a
  74. char *dmabufsrc2 = NULL;
    9 J9 N' q& \! b
  75. char *dmabufdest1 = NULL;6 x( D# P- `2 A* I0 e) K
  76. char *dmabufdest2 = NULL;
    # V7 @8 ]: @7 ~+ A6 P/ u
  77. , y* p: j, n. K& i& S
  78. static int acnt = 512;
    - M: E* h; w) P! m3 e7 v
  79. static int bcnt = 8;
    # v& A3 \% v4 `9 c3 m
  80. static int ccnt = 8;
    1 A) F! o5 B, t& j
  81. . y4 F% m$ d  ^6 j& @+ |
  82. module_param(acnt, int, S_IRUGO);
    7 Y# T, W7 k5 l# M0 L% g8 f
  83. module_param(bcnt, int, S_IRUGO);  J0 ?. R: S" s: `( J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! H5 [- _5 K3 y0 {+ a: G1 _2 P% V  M$ z0 l: q! a; w8 M3 e- E8 J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: ~+ Z4 _# w# [& i5 E6 `7 v+ z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 }0 F# v& s* X3 F+ B  x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 v( u+ r( l1 ]/ Q5 J% _1 f
7 `! R- Q! \% N# d1 W+ J+ B. J' d9 K+ E6 j) U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 10:29 , Processed in 0.040161 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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