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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : |' ]9 f) ^, h5 ?! Z6 f" h
  1. [code]EDMA sample test application* I4 d5 b4 n- Z  b
  2. /*8 f& i1 U) [( T- Q( P
  3. * edma_test.c
    ( p9 W* }; _# H3 v( _' y
  4. *$ \# J* U# u8 r
  5. * brief  EDMA3 Test Application3 j/ z+ d; m' B0 D
  6. *
    9 w6 l9 E  e' q4 Y( t' a
  7. *   This file contains EDMA3 Test code.4 k( r" @) _) Z! Y5 S- j# J
  8. *. L  h# V* u; |6 a# D1 D) y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; H+ H+ v9 {) ^. |! v' o5 W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 Y; u* }0 v4 V6 \2 O  A9 p
  11. *         TO CHANGE.( T$ c  _8 Z6 m  S; f, k/ Z6 z
  12. ** K- w6 n: |$ ]4 t5 A! X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' Z2 m, v  M4 o4 c5 s
  14. ** ~" |) K7 n  @6 L' u+ _5 M* M
  15. * This program is free software; you can redistribute it and/or5 G7 a1 K. T3 ^) R' N$ J
  16. * modify it under the terms of the GNU General Public License as
    # E- h- n2 D  v
  17. * published by the Free Software Foundation version 2.
    ' I, ~8 E9 O9 i7 k: z) Y  U: p5 I
  18. *$ u0 g  d  a+ x; U, A( f+ _# l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 P  A/ U  k- v  C: P4 Z
  20. * kind, whether express or implied; without even the implied warranty  O- l' m! o3 Z* Y& C, Y% T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * o) t& Y7 k0 f& M+ l
  22. * GNU General Public License for more details.3 q5 j# X- U8 ~  s
  23. */
    ' S# E. T' ?% _0 I0 \

  24. 8 @, o1 U( s0 |0 B* Z
  25. #include <linux/module.h>, W1 k+ }3 M/ y: |( T
  26. #include <linux/init.h>0 ?; \% }0 x0 z. U& O( [" L$ J
  27. #include <linux/errno.h>
    " }/ A' z( k+ R" ~* E% F
  28. #include <linux/types.h>
    + {( ?% K+ G  [& v
  29. #include <linux/interrupt.h>
    ( C. N, _! {# w7 a1 i. @/ W
  30. #include <asm/io.h>- W8 Y/ f8 y2 p. ^
  31. #include <linux/moduleparam.h>
    7 g# D9 ]- [3 k) q4 c6 d1 F  O
  32. #include <linux/sysctl.h>8 F3 M: w+ G9 G5 D& ^: w4 w" j. t; I
  33. #include <linux/mm.h>
    % o0 D# Z# T3 ~% ]" Y. ~" r
  34. #include <linux/dma-mapping.h>5 p/ E5 J5 S+ v" o. z

  35. 2 u# z( h( Y% ?6 A
  36. #include <mach/memory.h>8 k1 ^+ ?# y# ?3 B
  37. #include <mach/hardware.h>7 P, y. V( h/ n! ~
  38. #include <mach/irqs.h>4 N2 Z. M. r8 @- {2 R0 Z. B
  39. #include <asm/hardware/edma.h>
    ( L  m6 t3 K: `* Y
  40. / g5 O7 K1 d% v
  41. #undef EDMA3_DEBUG* a$ D' `! Q! q, _; K
  42. /*#define EDMA3_DEBUG*/
    * t; T2 z3 _: O0 u* f+ z! k$ h
  43. 1 G( ]' a* a( g% Q
  44. #ifdef EDMA3_DEBUG
    8 O* ]3 g. v) N3 Q. L. d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % z5 d- T5 Y. W: N& p3 y8 O2 x6 e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , `: M8 f7 x, z4 N9 }' R- _0 A* G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , N4 P3 V1 [) A( D5 d% ]+ d7 b/ a9 M
  48. #else' ~1 D& a% H0 U- J. m, o* L
  49. #define DMA_PRINTK( x... )9 X0 [+ |" j% X0 b7 g+ k" S8 |
  50. #define DMA_FN_IN4 }& G& g: R) y0 T
  51. #define DMA_FN_OUT
    % q' R" k! \/ b" C6 h) }
  52. #endif. A9 B3 E. L. J* i
  53. 7 _4 j& j6 D8 c# z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# @! l1 C8 R* d- d
  55. #define STATIC_SHIFT                3
    % E% U8 x$ u9 e1 T2 s
  56. #define TCINTEN_SHIFT               20
    4 q- R6 b' W, w& v( V
  57. #define ITCINTEN_SHIFT              21
    6 S' [7 H2 N! d0 K5 \) M& ^  F& G4 ~
  58. #define TCCHEN_SHIFT                22& J3 D1 ^7 g" [- v2 l" w+ b
  59. #define ITCCHEN_SHIFT               23
    % S  j( Y5 h; w' N& C( x
  60. + V# H0 j) {, X. J6 i
  61. static volatile int irqraised1 = 0;
    . f) K; H# V7 [2 \1 r
  62. static volatile int irqraised2 = 0;1 e; h7 b9 ]. m! O
  63. 1 u1 l1 f# B3 E! _' T4 t# u+ H: n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 I" x0 O3 \( Q" b9 Q) x- q5 e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* w" T4 ]8 ?0 f  R" B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 A" _5 j+ o9 g6 [; B
  67. % _* d" w3 _. `# m; g
  68. dma_addr_t dmaphyssrc1 = 0;& d# s4 b+ T7 I+ {0 D% x- g9 ?5 ]
  69. dma_addr_t dmaphyssrc2 = 0;
    2 Z! D( d' _, O( Y4 K: D
  70. dma_addr_t dmaphysdest1 = 0;
    9 y" y  b! k# c7 ?' w  q: n6 F% X/ D
  71. dma_addr_t dmaphysdest2 = 0;
    # E) q" c) a% L* p: ~, ]; h
  72. 0 s" E: i6 E6 }$ ?
  73. char *dmabufsrc1 = NULL;* N1 y* A' n1 A
  74. char *dmabufsrc2 = NULL;
    5 n8 ~# g$ S# _& `# G( o" X6 @7 y
  75. char *dmabufdest1 = NULL;
    ' ]5 m( f% O4 N  V3 p0 `3 n: S
  76. char *dmabufdest2 = NULL;6 I/ r. z9 N2 Q* H  X4 O

  77. 8 H( Q& f% \- u$ g9 x, j) B
  78. static int acnt = 512;
    + L# ]" d( M  g- D
  79. static int bcnt = 8;& E$ V  e2 I0 O* r! ?4 |5 e
  80. static int ccnt = 8;# c0 T3 t6 ?( c1 n7 G' m
  81. ' O6 x0 x, e* h) H0 X5 V
  82. module_param(acnt, int, S_IRUGO);" H# {( Q0 `8 ?3 m$ m+ k0 l# P
  83. module_param(bcnt, int, S_IRUGO);
    $ Z' b; X1 f0 ~% U- ^6 i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 b$ K$ r$ F2 M1 S

0 Z, O6 C  L' x, ~6 S5 s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& r1 Y" ?9 r" e- @3 `3 {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 B; q7 M" ^& N* X8 Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, S, R+ m" C3 V. A+ ~) v
! Q2 K  m0 j  e' w* ^- X3 a3 q- Y& S4 [: z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-23 15:05 , Processed in 0.037647 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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