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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 F# r: s/ y7 a* ~7 W
  1. [code]EDMA sample test application4 Y5 l/ e8 p) {
  2. /*5 k2 E: R$ u1 e* N) N7 q6 n
  3. * edma_test.c3 R: f5 j" \; ]+ ?! s% G  a
  4. *1 o4 ~/ I6 A2 b  e4 N+ e
  5. * brief  EDMA3 Test Application, K) A0 u" t% e
  6. *
    , O+ C. T8 Z$ R3 M' I. ~
  7. *   This file contains EDMA3 Test code.8 M$ L( r- R& Q" m
  8. *
    + I! ~  B% `4 M1 {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) m; v) V" w5 C5 b. b0 K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # j8 i" Z# L3 u  p4 N
  11. *         TO CHANGE.
    : a8 S7 V! F  ~* F5 Y9 }
  12. *
    $ g3 N, W8 i  U& |, k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 D8 p3 w+ s8 p' w
  14. *
    3 ^$ t" g; ~% f; [
  15. * This program is free software; you can redistribute it and/or
    - n3 {$ x1 q" |  @& |4 U2 t
  16. * modify it under the terms of the GNU General Public License as. L2 @5 Z6 f* n# C$ b
  17. * published by the Free Software Foundation version 2.# j: o/ A3 D) ]9 j& K; F
  18. *6 B$ Q2 V7 _3 P" u  o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) F7 e; q8 s# T% e9 m
  20. * kind, whether express or implied; without even the implied warranty' Q5 {& I0 _0 u1 l3 h" v* N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 @4 p6 v) Z* h3 [; {2 l& I
  22. * GNU General Public License for more details.! f* \1 G  p; A9 D, Y- o6 C
  23. */4 E9 i9 C) i* S# l' \+ a

  24. ! w4 y" j- f/ N7 W% K
  25. #include <linux/module.h>
    5 O0 w; V& C5 `4 c: n8 ^/ l
  26. #include <linux/init.h>
    9 s% T' p- a) M
  27. #include <linux/errno.h>  e: j* r/ f0 ?" q5 Q) s% Q" a
  28. #include <linux/types.h>
    ( k$ g7 o/ i2 V: h
  29. #include <linux/interrupt.h>
    7 C+ A# w, p6 w, _$ G0 N
  30. #include <asm/io.h>
    2 ^4 P; ^- ^% \; G8 ~  p# l
  31. #include <linux/moduleparam.h>* s0 ^, B+ s5 }- F/ X
  32. #include <linux/sysctl.h>
    & W' U$ d8 E% g' s2 |+ Z" m$ q% J
  33. #include <linux/mm.h>5 v7 R: m8 [, u5 |* k% ~
  34. #include <linux/dma-mapping.h>
    , x+ X, I  ]# {: N( Z2 L6 Z
  35. + O, E  m- R, D
  36. #include <mach/memory.h>
    ! S4 T: m  E( X' q
  37. #include <mach/hardware.h>( d, K( _! a1 c" S. A( ^" k, g
  38. #include <mach/irqs.h>
    ! R& L, p7 r! P! d4 @0 z- U' T
  39. #include <asm/hardware/edma.h>
    2 T1 e) @9 h8 E7 F0 u
  40. ' _* d9 v* X: f6 R. }1 e2 r% W
  41. #undef EDMA3_DEBUG1 G7 Z  n0 [6 r0 m$ k0 `
  42. /*#define EDMA3_DEBUG*/% ^8 U9 F! W% n* q
  43. 2 J* X# W( ]% g5 y2 m
  44. #ifdef EDMA3_DEBUG& N# Y- }) V3 K! x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! _6 f+ g( z& m- o8 {& E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ b& u) P7 r: \2 ~, Q% h; q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' ^" r* E. e# s" j- k' Z9 i- f3 ]  E
  48. #else) l+ @# r1 V+ J; B3 w
  49. #define DMA_PRINTK( x... )
    6 a6 S( W7 [( z' \# z3 O
  50. #define DMA_FN_IN
    # `+ j3 H1 O, A' M! V8 z0 F# W
  51. #define DMA_FN_OUT1 q2 z7 }' U0 U& m, G. M
  52. #endif
    5 c, E, _) g$ S
  53. - f2 s" g; F% E! z, l! u2 ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) {8 ~% ]7 t5 ^8 I9 ~8 \
  55. #define STATIC_SHIFT                35 w6 S7 n0 L3 A. x+ }
  56. #define TCINTEN_SHIFT               20
    5 c1 v- G3 T) S( y; N8 I' H+ Y+ Y
  57. #define ITCINTEN_SHIFT              217 a3 c# O+ k, s* T* O! r4 d
  58. #define TCCHEN_SHIFT                22
    % c. j+ I, Y# m. i3 j; R
  59. #define ITCCHEN_SHIFT               23
      K# Z8 G5 @0 F% k1 s5 c
  60. 9 ]1 R: F7 g' F) ^7 Q  ?
  61. static volatile int irqraised1 = 0;2 x( z, P& H/ `, r) d% {4 y: M+ @
  62. static volatile int irqraised2 = 0;
    3 p  v; w0 Z1 F

  63. 8 ]; e/ E9 O, s* _, M, }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. v9 c" Z7 \6 ~* E  A2 b3 @3 B: s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 O: a: D9 \2 d0 h# W0 R0 Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * m3 {5 u; i" i/ E0 o

  67. 8 h, O/ |' O& r. ^: J6 y6 G/ S! ~$ @
  68. dma_addr_t dmaphyssrc1 = 0;
    + {( }3 N0 S, [( _! d$ `0 f
  69. dma_addr_t dmaphyssrc2 = 0;
    6 o; g3 N; [! t, i3 h7 Z
  70. dma_addr_t dmaphysdest1 = 0;) H5 Z" I$ c/ Z5 ?' ^
  71. dma_addr_t dmaphysdest2 = 0;: z* Z1 Z. n9 f
  72. , z3 ~& ^" m9 Z$ d) P
  73. char *dmabufsrc1 = NULL;
    3 F$ u' \/ l8 n; y* h9 z: F6 f* f
  74. char *dmabufsrc2 = NULL;* _6 ]8 U9 ~: V* X/ D* [. q/ t
  75. char *dmabufdest1 = NULL;! }, f$ S( @% K, a7 v
  76. char *dmabufdest2 = NULL;9 ^+ C2 u- _4 C- a. s4 l* `# s% l
  77. 5 P0 C1 V8 x$ m5 O
  78. static int acnt = 512;
    . Q2 ?! y- g/ t& u! x# G
  79. static int bcnt = 8;7 w6 i0 q# ?9 o
  80. static int ccnt = 8;
    ' ~) m0 F* C* R( n

  81.   n  ]6 I# x0 k4 n
  82. module_param(acnt, int, S_IRUGO);
    8 {1 b6 L: y) N# j& G. G
  83. module_param(bcnt, int, S_IRUGO);! T! K, R" D% [
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# M" R  }' Z$ o( B" X& r

. T+ \1 D3 A; [4 `0 r      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' u7 n8 e. ^  ]! M' @+ o( ^2 d: J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ n! n7 L1 a/ @% a
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) {' M" }" s+ i' i

) `: Q4 n6 F/ Q% I- Z" P/ p5 L4 L2 z9 c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-14 00:22 , Processed in 0.036259 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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