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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% O+ l5 J0 Y' T1 @7 E0 o# f$ N
  1. [code]EDMA sample test application- Q/ f: N3 ^( Y: f7 {8 Y
  2. /*( {, F# B0 n  o! F5 b# Q3 m
  3. * edma_test.c
    9 w% D. A% W7 r5 O, X
  4. *. Y( z; p9 p: E4 y! Q; i: k2 u
  5. * brief  EDMA3 Test Application
    , ]( L+ a2 R* ]9 O3 B, @
  6. *; ?; k6 @8 I) t3 T
  7. *   This file contains EDMA3 Test code.! l' g( s7 |  t0 }( d% Z% W
  8. *
    $ ?" U' \9 E- E9 R; M4 k! S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% P* d9 J+ H% K# k4 U2 [2 V& c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( l! H$ T3 O% E% ]3 n2 N2 ~- c" k
  11. *         TO CHANGE.( F6 ^: ~6 `+ Q
  12. *2 d1 O9 }/ @  i9 k6 m- F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) R6 a- f8 l. y  x$ f4 q- g
  14. *5 s2 H' M& S4 B+ s, D
  15. * This program is free software; you can redistribute it and/or) h6 Y  K2 Y/ |. r, u
  16. * modify it under the terms of the GNU General Public License as
    ) W& W" {) d% `* W
  17. * published by the Free Software Foundation version 2.! e& Y+ L% {  @8 ~6 L
  18. *
    7 l. F& e$ S- B+ F8 o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- I  h+ ]2 K* z! {5 A
  20. * kind, whether express or implied; without even the implied warranty
    ) \# {+ Q3 ~, G7 I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 H4 j/ P  S$ v5 p; Y
  22. * GNU General Public License for more details.
    * _5 c# e9 L" O- F  j
  23. */
    2 ~+ Q/ c6 O3 F$ s! G* U0 j+ j

  24. 7 W* t; i, z. c* N
  25. #include <linux/module.h>/ D' i  ?7 L: L3 {6 K: ^4 Z
  26. #include <linux/init.h>/ \4 T9 b: I, W& I
  27. #include <linux/errno.h>
    / N& ~$ [. O* h( n. q4 s% Q7 v
  28. #include <linux/types.h>
    8 p! {3 T! T$ Y5 U
  29. #include <linux/interrupt.h>7 `' k# O( E$ [0 k- Z
  30. #include <asm/io.h>4 [& y8 f$ G# h; k( t
  31. #include <linux/moduleparam.h>+ y; ]9 c/ o( j0 n
  32. #include <linux/sysctl.h>8 b- ?$ H/ {$ N6 F( G7 W/ a
  33. #include <linux/mm.h>0 p! v9 ]2 h' h. a# z2 B- H# ]2 y
  34. #include <linux/dma-mapping.h>
    ' W$ b) @- e/ X
  35. 3 }* N# q' w, _& Z) Z/ G
  36. #include <mach/memory.h>
    # P3 v" b- @# b
  37. #include <mach/hardware.h>
    - f3 l& q1 J3 a. R" b5 Q
  38. #include <mach/irqs.h>1 Q. `. M, @) [2 B9 _
  39. #include <asm/hardware/edma.h>0 l9 K3 _. \7 J
  40. . S; g8 p" @+ N; d9 l+ z
  41. #undef EDMA3_DEBUG
    , _+ L. `; @) t7 E
  42. /*#define EDMA3_DEBUG*/
    # t" C* a9 ]9 N) {

  43. 4 I7 T" R' X5 _" d, J
  44. #ifdef EDMA3_DEBUG2 @/ E+ S) a+ F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & x0 L$ {7 P2 M# U5 p: w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 G5 n* F1 g0 s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 n* R/ s( r8 ]0 d- c, k$ `, }
  48. #else
    1 k* m  E- _8 j: v# u) I0 G2 W
  49. #define DMA_PRINTK( x... )
    - w& s' ]/ ?8 d& Q  M$ A+ b2 F* I
  50. #define DMA_FN_IN
    6 s9 c, T% E+ u$ f0 c( k0 [
  51. #define DMA_FN_OUT
    # F( b2 Y4 i6 ]
  52. #endif. l- ^0 m$ k+ C2 {

  53. ) R# w" W% V- j* l" g6 e( [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 R' m; A6 \. M' V; e! ]4 |
  55. #define STATIC_SHIFT                3
    ' k" X8 u/ q, @4 e" y8 P& ]
  56. #define TCINTEN_SHIFT               20- \3 t8 Y- y$ E# T: y) T
  57. #define ITCINTEN_SHIFT              21. ^# _; C! N- c7 h
  58. #define TCCHEN_SHIFT                22% N9 c; R. D3 \" t3 h8 q
  59. #define ITCCHEN_SHIFT               23: K; I1 C+ @' L. ^) }" S# E
  60. * x3 P4 E' g0 j
  61. static volatile int irqraised1 = 0;2 D1 V* U  q! v6 R* O
  62. static volatile int irqraised2 = 0;
    . h. T/ N: h# H( \9 q2 S) ], a; @, Q
  63. 3 u/ ^. _$ J* e/ [5 G2 }' h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  i: ^; M8 \# f  d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & @, C9 d: n6 A' ]2 B% v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 u0 P! x! l6 C
  67. 0 y+ x; h6 o/ f( z
  68. dma_addr_t dmaphyssrc1 = 0;! n" o2 g/ n$ F1 M$ N( |
  69. dma_addr_t dmaphyssrc2 = 0;
    $ _' M$ K2 f, y& B
  70. dma_addr_t dmaphysdest1 = 0;
    1 F2 y4 ]( c2 H. v' K! ~8 l* Z& M5 n
  71. dma_addr_t dmaphysdest2 = 0;
    1 Q) v8 W$ F, m6 Y" f

  72. ( Y% O5 k# s5 A1 g. w5 u# |
  73. char *dmabufsrc1 = NULL;
    # V! }& t2 P2 O7 ~1 P. v: i1 y# F
  74. char *dmabufsrc2 = NULL;
    5 i, c( q/ p8 O$ ^1 K+ N
  75. char *dmabufdest1 = NULL;
    9 I# }& `, i' T; c9 T
  76. char *dmabufdest2 = NULL;
    & r9 Y  F+ c2 A- D" D
  77.   ?9 V. T+ `, Z4 J- H
  78. static int acnt = 512;! r! Z4 z* X1 s$ ]  w% n
  79. static int bcnt = 8;
    . E0 i' c; V; o* T) L( s- d
  80. static int ccnt = 8;" f5 X+ A& z+ E
  81. 5 K9 d8 j: l) J+ r
  82. module_param(acnt, int, S_IRUGO);
    " w& C# k; h7 g! q& U
  83. module_param(bcnt, int, S_IRUGO);5 H6 S& {; d' @  n7 H' F; Y% q8 p! K
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 j- s9 z$ p: y! w' G* U# K1 p
  G. O3 N! S9 v& ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& w  P+ y1 E! T& u* g0 C+ ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ @- @, Z0 [7 z6 k
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ h9 T! }& E' ~* R$ H1 T3 {. \  ^  ]( c! ~+ n2 n
2 S! ^  D: s1 ]% C5 h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-22 12:21 , Processed in 0.038384 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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