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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : ^- |; r5 l, k! I* ~( I
  1. [code]EDMA sample test application, f% U" J. h2 U8 E8 c/ {
  2. /*9 T3 R% L- I1 x0 h; c
  3. * edma_test.c
    , c. Y& e+ L- _2 r3 S$ f
  4. *' G; C/ B3 r; G& C
  5. * brief  EDMA3 Test Application
    ( j8 C& B; \5 C& [9 i
  6. *
    ( `& `' [, N; W5 _
  7. *   This file contains EDMA3 Test code.
    8 J# A3 {, W0 [9 q1 \: g
  8. *: U8 b  ^0 X9 {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * Y8 T. a  b7 [0 X( ^/ d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; `3 O3 W9 ?& Y. a
  11. *         TO CHANGE.
    3 U/ ?! W' n& A1 M( n
  12. *3 K$ Q' ~0 @+ J# V* P9 a( z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! x& f7 N7 F% S) v- s& Z  u
  14. *- Z2 Q. h0 f1 W/ \. z9 F) O  h
  15. * This program is free software; you can redistribute it and/or
    3 I: j+ X. Q" u" P
  16. * modify it under the terms of the GNU General Public License as
    5 ?3 a  `* y" \/ A( C; y
  17. * published by the Free Software Foundation version 2.
    4 r5 f! L2 {( w7 d4 @! v% B; G
  18. *7 _( A. C) N! N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* L. P+ B/ G8 D+ T
  20. * kind, whether express or implied; without even the implied warranty
    8 d) C8 j4 \, ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 z7 K' b, v7 S2 s( _+ t% g; E! ~
  22. * GNU General Public License for more details.
    & A: P& u9 f( f7 y5 W5 n  c% J
  23. */. x" c! V& [- r5 \

  24. 0 h% w) Y. Y+ U' s: u1 s# {! E, h; z
  25. #include <linux/module.h>' g* C- A* s$ D& ]9 ]/ r6 u
  26. #include <linux/init.h>: ~7 C4 d$ |/ p( n! }
  27. #include <linux/errno.h>
    * Q. F# \+ S: y! d5 Q- S
  28. #include <linux/types.h>0 @3 q! F4 r% \$ V  _% k
  29. #include <linux/interrupt.h>
    ) V% x  C/ J  |( \. X+ k; k# ?
  30. #include <asm/io.h>
    5 P$ Q; u# J/ Z# u$ x0 u. E9 \
  31. #include <linux/moduleparam.h>  I0 n% d2 h( w
  32. #include <linux/sysctl.h>& S. s5 A6 l3 M8 ?/ w2 S8 J
  33. #include <linux/mm.h>
    " L  }; q% Y& b# K0 A' P" ~
  34. #include <linux/dma-mapping.h>
    8 k) g8 ^2 i! g' m" ~

  35. ( E1 _, C* k3 k7 ~& u$ \, C& t
  36. #include <mach/memory.h>
    & Y: t' D: I' A3 O# A' ]
  37. #include <mach/hardware.h>
    ' ~* O1 t* c4 T8 B* P
  38. #include <mach/irqs.h>; i: r. U: r. L
  39. #include <asm/hardware/edma.h>
    ) \6 e$ L$ s+ Y/ Z- S: m
  40. : x# }8 B+ y* T; g1 R! b8 e
  41. #undef EDMA3_DEBUG
    1 K+ `% m* L; o1 T, `* w9 k
  42. /*#define EDMA3_DEBUG*/( ^% k* y3 P6 B2 N4 R( J

  43. , z$ H4 X  L/ t4 t; R  T
  44. #ifdef EDMA3_DEBUG
    / {; ~. a  ~- w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ S2 j+ i! @; o$ G, h% o9 u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; V8 d7 z5 R6 |5 r# }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 Y; q  C6 Z% N( r5 y# v5 `
  48. #else
    " A6 ]7 B8 a) o4 P
  49. #define DMA_PRINTK( x... )9 i8 g1 R$ r$ g# Q' p
  50. #define DMA_FN_IN
    4 p7 e9 Z/ f' J, Z
  51. #define DMA_FN_OUT6 _! r: b. p) t
  52. #endif
    # q# c. t; U# ^2 I

  53. 7 X. f+ y  a4 e7 i6 L$ ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) S) `7 g1 X. D, I4 m
  55. #define STATIC_SHIFT                3
    9 K5 j) B$ ]- }9 b
  56. #define TCINTEN_SHIFT               20
    " `6 l6 f) Z- W. x+ L
  57. #define ITCINTEN_SHIFT              21( D! R) ]5 |6 ?& m. E& Y
  58. #define TCCHEN_SHIFT                22
    9 p. G, p/ U1 q% l6 Y( k4 z- X0 ^3 s, P: B
  59. #define ITCCHEN_SHIFT               23
    ; K, U, M4 @- t$ V4 W0 D# R6 G5 F
  60. & ~8 M& h6 p! H5 J
  61. static volatile int irqraised1 = 0;# t" ]. b! [0 o0 ]
  62. static volatile int irqraised2 = 0;7 V3 }3 x* ?  T1 f! N3 }

  63. ' V- z( o1 z$ K* R, }* }- J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " f0 B, k2 R4 Q0 P, {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 T, o6 Z& U* m6 d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 I$ P9 A2 g! [' }! R4 C

  67. / F) Y$ b. B3 m1 T7 `. P
  68. dma_addr_t dmaphyssrc1 = 0;/ I) B2 K: X, S& B# i
  69. dma_addr_t dmaphyssrc2 = 0;
    6 ^/ T5 G, }+ e; \* h) e
  70. dma_addr_t dmaphysdest1 = 0;
    4 g# D7 t; o. f" ^& z& s, L7 n
  71. dma_addr_t dmaphysdest2 = 0;
    2 ]" ^, L$ v) Z% r: T# b6 S

  72. 6 S2 o3 q4 ]% C6 o
  73. char *dmabufsrc1 = NULL;
    0 \7 ~; l1 i' _# H& |* o" g
  74. char *dmabufsrc2 = NULL;9 ~' L: {# f! y/ f) I- L
  75. char *dmabufdest1 = NULL;0 j- e% F, B  u( q/ R$ _) T8 r7 V% _
  76. char *dmabufdest2 = NULL;- j( I# p2 d' `

  77. 1 c. f/ `& \# p. G0 V1 [) g* R
  78. static int acnt = 512;
    ) O* q8 J! d! O" Z9 ?
  79. static int bcnt = 8;7 Z% m/ a3 o: x$ |( F" y- \+ B
  80. static int ccnt = 8;& V( q% |  S7 o
  81. + N, p( f5 d" Y  i! d5 z6 Z# h
  82. module_param(acnt, int, S_IRUGO);
    " {5 F, z( U: E3 |  z! M2 m0 ]
  83. module_param(bcnt, int, S_IRUGO);, x8 q  L- o, _$ g
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ T/ x/ ?7 b' G1 G9 U
" D9 M; B! t2 C1 W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& R0 ^' Q7 S/ k3 u8 D: [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 X3 W. T# {" T8 d) l, G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. `/ H6 }* t9 x$ R0 @$ p6 z" Z

& w2 M2 {2 q: a+ B) n, Y5 D5 @% Q( T, J4 \- A( W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-2 02:37 , Processed in 0.051988 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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