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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! g8 ]* S+ R: q/ R1 |3 o: d
  1. [code]EDMA sample test application
    8 N: Q" a0 I$ ^  ]
  2. /*
    6 q* W3 u% r; D# T  b" h, C
  3. * edma_test.c# G0 V  [* d& E6 W+ @) i. C
  4. *9 K! o, Q" R3 I* @" K8 A
  5. * brief  EDMA3 Test Application
    8 F8 b1 X/ G2 R5 A: k+ Q; E
  6. *
    4 c8 _& D6 }' V- ]" b( x% K
  7. *   This file contains EDMA3 Test code.3 V# x* N* i6 F/ }
  8. *
    ! k+ t# G5 Z3 }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 t7 _( O- Y1 T8 o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) I" u6 s6 J- K: K1 k) A! r
  11. *         TO CHANGE.5 q; ]; @3 @4 J5 t9 }& Z" B
  12. *3 @6 ^. Y$ H0 E( A9 e' {! J4 m% Z# L- c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 H1 d. v8 g9 k1 t9 ]$ v' B
  14. *
    ) g$ g0 a' w0 ]8 {4 m' F
  15. * This program is free software; you can redistribute it and/or& K& z2 Q5 y9 H8 @6 F- r5 ?2 z
  16. * modify it under the terms of the GNU General Public License as: P8 X. N+ L1 Z3 e: I7 j1 h8 N% U# Y
  17. * published by the Free Software Foundation version 2.
      D) M. y0 G( K) S8 o% W# m
  18. *: n; [( v* N$ E) m! z- A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      a" a% Y7 ?' D' o4 ]; U
  20. * kind, whether express or implied; without even the implied warranty, R! g4 N9 F" B+ m' j  e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : \" z; j" d# f  T& R
  22. * GNU General Public License for more details.. x4 u. ~4 h3 G) [% }2 I
  23. */; |' |0 t' Y, C  p0 @8 o0 b

  24.   V: g; S; [' q% g
  25. #include <linux/module.h>
    ( E9 _3 D! `+ A( y5 n  D- u1 J
  26. #include <linux/init.h>/ u4 i8 U5 P- Z1 G  w* `! o& Z
  27. #include <linux/errno.h>
    # d; {! m- `1 U7 v- ?3 r( u4 F* V
  28. #include <linux/types.h>
    - L- B( {8 T/ J: ?
  29. #include <linux/interrupt.h>* s. [8 m* t5 z' e, R/ U0 v+ A
  30. #include <asm/io.h>
    / e" T+ r9 p2 V- w# W+ |7 C* P
  31. #include <linux/moduleparam.h>
    1 f: z8 d9 L8 Q: G+ a2 G/ c7 T
  32. #include <linux/sysctl.h>
    # k1 S, F" ^4 k2 d
  33. #include <linux/mm.h>: h) V& e: Z8 l$ W  I$ I% [! R
  34. #include <linux/dma-mapping.h>- G. O  V: y" i' [- D: ^

  35. & U3 D& p0 c  M, c
  36. #include <mach/memory.h>* o' s) R3 U: m# x; g
  37. #include <mach/hardware.h>
    6 Y- O2 _3 X/ R$ ^
  38. #include <mach/irqs.h>
    . J' T3 ^+ Q* q. q5 V/ |9 E
  39. #include <asm/hardware/edma.h>2 x5 x/ l! N( Y9 e* z+ H8 L
  40. 7 ~! z! Q8 X+ e  h( O3 S; e
  41. #undef EDMA3_DEBUG: \8 ^+ d6 M1 v) M; Y4 G, R
  42. /*#define EDMA3_DEBUG*/
    ) y# ]$ A! U6 {2 `# r

  43. 0 p. B8 q3 D) i) w8 F" m
  44. #ifdef EDMA3_DEBUG4 }- T/ N, k" ]1 L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 v2 w6 |) w& x4 F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 n0 i% O: E3 ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , }: a2 p" E% P6 w
  48. #else5 u6 ^& U- M+ @' f) L. w
  49. #define DMA_PRINTK( x... )
    9 `4 f' V1 O) |, ~
  50. #define DMA_FN_IN2 P- B$ c( P7 P" H% y
  51. #define DMA_FN_OUT
    3 O: H$ ?. r7 Q! ?2 L, v, e
  52. #endif, z( f/ j4 K  o0 g
  53. - ?3 _$ t. l0 o6 j2 w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  B4 z% T' R% b8 n2 a
  55. #define STATIC_SHIFT                31 g3 L: L6 a% V* A& g- ]
  56. #define TCINTEN_SHIFT               20
    5 ^- Q7 M( H5 _6 w! t1 z. G* i8 T
  57. #define ITCINTEN_SHIFT              213 V" T  Y% J. B
  58. #define TCCHEN_SHIFT                22, @7 M' G: {" q$ M! A. V) g
  59. #define ITCCHEN_SHIFT               23
    ) Q- R5 n, G+ ~( \9 s

  60. 3 i- Y8 L9 T; f6 A/ N# A, S, Z; p1 I
  61. static volatile int irqraised1 = 0;
    7 V  N& B3 P- g! Z
  62. static volatile int irqraised2 = 0;$ ~# O& X0 U0 X5 R1 c

  63. ) k6 d$ R0 N" C$ F) H9 a# T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' w, m; y7 N- T& l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % [4 c3 p0 m& i5 v' f9 a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ I* Z' C( D9 R0 Z( j3 A4 d
  67. # U- s; i0 O3 W# k+ ?7 I0 p, {
  68. dma_addr_t dmaphyssrc1 = 0;% g" _. z" q% t  h$ T" [
  69. dma_addr_t dmaphyssrc2 = 0;* \5 n6 B) D0 j5 w- i: c7 ]
  70. dma_addr_t dmaphysdest1 = 0;
    ) Q& i' N% h& L6 |: `
  71. dma_addr_t dmaphysdest2 = 0;& m/ o& f( _7 B* I; u/ u
  72. + N* ]6 `5 \2 S( v% ^% z& y7 l
  73. char *dmabufsrc1 = NULL;3 H6 q; ]. J8 [# B7 O
  74. char *dmabufsrc2 = NULL;- X% G" l$ V2 V: s
  75. char *dmabufdest1 = NULL;
    ) m9 H/ z* s) _/ |4 B" v
  76. char *dmabufdest2 = NULL;
    2 n1 _; f+ {$ q5 H3 k2 H+ v0 t
  77. & z" Q8 y* _4 R$ {/ F9 d
  78. static int acnt = 512;/ j) R$ R7 R- L: |' |# b
  79. static int bcnt = 8;; M; z6 u8 Q* @5 y. L  }: K5 n
  80. static int ccnt = 8;) q# a8 h. K: n' W
  81. . ~& }. _1 F5 S6 q
  82. module_param(acnt, int, S_IRUGO);
    4 n0 a+ f4 X* f1 x$ G
  83. module_param(bcnt, int, S_IRUGO);
    % I* Y& E- N4 o: I# |& P' Q, K& v' ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 a$ p9 t  t7 {
- J- q3 a0 r$ W" h) b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, ~  {8 X5 a( O8 m: L! u) d8 Q9 Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( X, l# X# r! q4 w- V+ [     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# b) X: A6 ?! K9 i2 _
3 `& Q) C0 v( J+ M7 D" q  y" }5 V, i9 [

& Y$ ~: I( N1 i8 Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-10 10:28 , Processed in 0.044995 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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