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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( c. n6 b: G/ a5 f
  1. [code]EDMA sample test application' I! }6 W. {2 D) h# A( D6 z; f6 h$ ?
  2. /*
    , _* L2 ~, W4 f7 F- Y
  3. * edma_test.c) E  g: h' C9 I% X
  4. *! N- P' p. i+ p( q2 {' C
  5. * brief  EDMA3 Test Application4 `' r6 ]. H: Y' O4 o
  6. *; e2 q" |5 W( A9 u; w2 V" s
  7. *   This file contains EDMA3 Test code.( A, {( i+ S+ s# p0 }+ {
  8. *  l6 N) u* S* I& F- I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : M% k5 r9 i+ _8 n3 V" R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 Q4 C& P" k" i2 l( t% i" @
  11. *         TO CHANGE.# e2 Z% U1 W' k* e5 M' t" u
  12. *7 {* j+ |$ G/ E) T! k8 X" r  M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 [) m0 l' M9 E# R) b4 Q' z
  14. *  c8 O9 R+ _) f& K
  15. * This program is free software; you can redistribute it and/or
    6 C/ W* o: N6 E( ?! ]  S2 X- B- h
  16. * modify it under the terms of the GNU General Public License as! D! B! |/ t) O# I1 Y' U6 H
  17. * published by the Free Software Foundation version 2.
      G  Q" l0 k" I
  18. *( L: j8 M' O- U3 H' B, u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % @1 F1 t1 a' E2 l0 Y$ w3 m" T
  20. * kind, whether express or implied; without even the implied warranty) Y; [" S* h# H, T# x% t9 l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      l& l6 J  v/ ?! c. N7 j
  22. * GNU General Public License for more details.% Y$ ~1 H; Q' M+ F
  23. */
    / Y" b& U' t) A0 ~% O! v/ H3 o

  24. 3 Y& p$ y$ W0 K7 L! S5 F7 h
  25. #include <linux/module.h>
    6 C4 g3 [( O% g( W
  26. #include <linux/init.h>
    + |  L  }% f. |3 i+ t3 d8 ?
  27. #include <linux/errno.h>
    ( O: ^2 V; \3 {& N- h- w) J2 m
  28. #include <linux/types.h>0 ?* O! R  c# M% W2 g/ T
  29. #include <linux/interrupt.h>
    ( y' b5 x; Y' y3 D
  30. #include <asm/io.h>
    3 e: l3 I- ?9 ?7 O2 z
  31. #include <linux/moduleparam.h>+ x. }# A. `% C7 r
  32. #include <linux/sysctl.h>
    4 U) L& d8 i# v3 \4 M, u& N
  33. #include <linux/mm.h>+ A" q! T9 E& F# `; H4 A. B
  34. #include <linux/dma-mapping.h>
    1 Q+ j8 e; N# r) ?! H4 G8 D: |

  35. " R8 t$ s7 G0 C
  36. #include <mach/memory.h>5 d4 x7 K0 u! }4 Z: Q+ x
  37. #include <mach/hardware.h>; `0 J9 V: j( M* X: V
  38. #include <mach/irqs.h>
    ( M0 h* i6 K( a
  39. #include <asm/hardware/edma.h>
    ( W$ I& I4 U4 r5 }; g# F$ b

  40. + m8 E7 A( B5 _; F
  41. #undef EDMA3_DEBUG3 ~* e! h5 }% o' n9 O3 x9 i% {- Z
  42. /*#define EDMA3_DEBUG*/
    ; |7 z8 J9 L* a) y+ t" W# \

  43. 6 q6 f2 x3 M+ T$ `( ~, Y, R
  44. #ifdef EDMA3_DEBUG
    $ R7 W  n! {; u6 r9 w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) ^! J2 a, |: ~9 r3 y+ e  h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 l4 ?8 e$ c! Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! \0 Q; X1 t2 F
  48. #else
    % v$ K% r% ?% Z8 W
  49. #define DMA_PRINTK( x... )
    ! N4 g1 ]2 H% K% \) _/ g' |
  50. #define DMA_FN_IN
    - a9 V' R6 ]! _" g5 I3 {! S0 f4 `
  51. #define DMA_FN_OUT/ G+ |* ]7 U% R% M1 L* C
  52. #endif- a; [. c) s. g7 \: d, ~# L; x
  53. : P' }: \' M# n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 Y. ^5 Y" T4 y0 E5 ?4 b
  55. #define STATIC_SHIFT                32 v3 \! {& a% h7 B2 n6 y
  56. #define TCINTEN_SHIFT               20# [* B, V, M4 F" M, s+ a1 s7 \
  57. #define ITCINTEN_SHIFT              21/ _8 Z9 X) q' n' m
  58. #define TCCHEN_SHIFT                22
    % t7 A3 o- Q9 a. G! \+ B) w
  59. #define ITCCHEN_SHIFT               239 ?" Q1 o5 V7 O$ r
  60. 0 G4 _( I) l4 N) d7 m3 p
  61. static volatile int irqraised1 = 0;! n7 W' K- ^; h( S% [8 y
  62. static volatile int irqraised2 = 0;
    ' V. s+ j+ i- Y* V+ G
  63. 6 }  }/ L3 ]. Y6 ^* b" j5 x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 N( a$ h& L( Y% p- G& x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& y% h1 x( R3 A2 i+ m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      q& v9 D+ |! m  P% m2 \% I
  67. 5 H1 O* F4 x% f. ]( Z+ O. _9 ]
  68. dma_addr_t dmaphyssrc1 = 0;2 T6 e0 I2 v$ q+ }' h0 K# l
  69. dma_addr_t dmaphyssrc2 = 0;
    6 q. D, G" r* {) N
  70. dma_addr_t dmaphysdest1 = 0;
    . d5 r1 g1 J( t& X9 U+ F1 [
  71. dma_addr_t dmaphysdest2 = 0;
    5 j8 n3 f9 P; E" _
  72. - P% ^) i$ P' E
  73. char *dmabufsrc1 = NULL;, `7 f0 I+ P/ z. k* a
  74. char *dmabufsrc2 = NULL;2 o! b: v& i# F1 S8 c6 J6 F& X9 v! F: e
  75. char *dmabufdest1 = NULL;& t% _: _4 u- k$ v* V1 l9 d
  76. char *dmabufdest2 = NULL;
    / |( t( J( @7 U
  77. 3 V& `) ^5 |' E
  78. static int acnt = 512;* ~* d8 a: m$ [+ _
  79. static int bcnt = 8;) T  S, S! C! n: C4 K( F' u8 ^
  80. static int ccnt = 8;
    ! \' j& y/ y3 @% b9 ~( w7 O/ L
  81. , a7 `/ v7 l# |$ `5 W0 D
  82. module_param(acnt, int, S_IRUGO);4 c6 N1 J: R; W5 D
  83. module_param(bcnt, int, S_IRUGO);4 s0 O0 \! y- h6 R* Z5 w( \) k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ Y& h4 W: g$ N% l) X  w3 G$ U% ?( \/ I: h- G2 b) J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ s9 x# `6 N8 Y  o4 y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( }6 o. N) ^# a( q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' K4 J( J4 @3 ~* r; I6 d2 p
0 x& k0 G! I6 y# N' a8 r
# `3 t# W  {2 l" P8 B) H* t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-30 05:25 , Processed in 0.043831 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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