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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 o  {1 t% E, y& H9 r
  1. [code]EDMA sample test application: T0 M- M2 e6 x$ |/ G& n
  2. /*9 ~6 \1 B( S4 ~' a- Y
  3. * edma_test.c1 ?5 \2 t/ B* b8 ^2 o
  4. *( O1 R. D- x7 C0 e- c
  5. * brief  EDMA3 Test Application
    * A, H5 @- d" n* a& d5 {8 p
  6. *+ a+ U" r- w( w1 A$ J- T6 _
  7. *   This file contains EDMA3 Test code.+ q2 @2 T1 b6 g/ V3 [% Y+ C3 v3 A
  8. *: ^$ {9 Q. L) r2 F% s' x5 k0 d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! ]& o& m$ G( Y) f4 U. O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- W6 O& e& {1 n
  11. *         TO CHANGE.' V7 \* q+ Z- @; T) G; x( \6 z
  12. *: [4 q# e2 c9 O5 A8 a- H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' ?1 F8 ^! T5 a' |/ H- M, V
  14. *' P2 {2 i5 y; A( a% @
  15. * This program is free software; you can redistribute it and/or
    ; x% t: C& h" y9 j4 ]
  16. * modify it under the terms of the GNU General Public License as
    # N: R" o0 ~& M& O% `" J/ L4 {5 o
  17. * published by the Free Software Foundation version 2.6 G$ B; a! M  e) g( D/ Y2 ?
  18. *4 u7 v# C: l, R1 c7 c6 s% h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : G: M& j# l; L1 x6 H
  20. * kind, whether express or implied; without even the implied warranty& l9 D( ^9 N, H* {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 N4 y6 {3 e) s, P
  22. * GNU General Public License for more details.. T! u2 ~' h5 ~1 D9 @
  23. */
    , b0 K. ~2 X8 T
  24. * T0 ?2 V0 F( f9 x/ G
  25. #include <linux/module.h>3 k# v  v/ q7 Z  n; R' B/ s
  26. #include <linux/init.h>; @% ^) ~2 }% F" w
  27. #include <linux/errno.h>$ P0 d3 E0 i" Z; a4 @* b- E4 E
  28. #include <linux/types.h>( a( r, T  n/ g" |0 o( X" A: V! c
  29. #include <linux/interrupt.h>
    ' i8 O4 B: X9 f5 Q2 c2 O
  30. #include <asm/io.h>
    + j. I, U( v: t7 x" F
  31. #include <linux/moduleparam.h>7 ]( x8 _4 S6 o, ~5 r6 @1 L
  32. #include <linux/sysctl.h>  |2 S8 y7 ^2 Y# Z3 U8 w
  33. #include <linux/mm.h>
    $ G" p* r/ x9 a2 S( ^% m. c5 U
  34. #include <linux/dma-mapping.h>; X& y8 Z. r/ Q/ k) a
  35. ; K; w/ ]( W7 V. u( R0 [
  36. #include <mach/memory.h>
    9 F; a, C0 p3 [
  37. #include <mach/hardware.h>
    4 J: K0 j# F5 O3 T3 y8 Y! Y' a
  38. #include <mach/irqs.h>/ N$ ~; I% M9 L$ T$ v
  39. #include <asm/hardware/edma.h>
    , G1 N7 U* `+ y3 Q4 T' i* p9 ^
  40. % o3 J  j0 ^) ~! l" S
  41. #undef EDMA3_DEBUG
    ( w3 a4 i6 r+ k  P
  42. /*#define EDMA3_DEBUG*/. j# K2 M( p( @' m+ S( W; {. ^/ l& h

  43. 3 k, p% [7 ~- Y  {* q8 u
  44. #ifdef EDMA3_DEBUG* A! p1 ]3 k: q7 ^4 `' V6 T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% Y6 M1 N! z/ b# z+ [& d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : Z- E2 s! R+ Z& C7 x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( ^5 _3 O) ]6 V0 [6 o; w& g
  48. #else! C( i6 _; a: R$ G9 K8 ?/ z
  49. #define DMA_PRINTK( x... )
    9 w: A0 I8 F3 n( u8 G1 r  l
  50. #define DMA_FN_IN
    : x  z/ o5 b7 ?5 D
  51. #define DMA_FN_OUT
    + ?) v7 K3 g' H9 ?( s8 N/ }- W' C
  52. #endif. M$ n( t5 w" U2 V, ^5 p$ H
  53. # [9 |, s  j0 Y, O5 f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): J$ \8 C* `! t' d' R/ a
  55. #define STATIC_SHIFT                38 S( _# Q9 m& P- \
  56. #define TCINTEN_SHIFT               20
    1 f& `2 ?2 D% S7 e: k' Y7 q
  57. #define ITCINTEN_SHIFT              212 u& }6 F, o( V5 H# Z1 y3 l
  58. #define TCCHEN_SHIFT                22% T) y) p+ `0 B6 a
  59. #define ITCCHEN_SHIFT               23
    % j( l. i: n# y) E3 `6 p* G! ^
  60. ( N' G/ G/ [0 V1 o- q$ C: a
  61. static volatile int irqraised1 = 0;
    0 E! a  a5 M2 Y! l
  62. static volatile int irqraised2 = 0;
    & k# `$ r( A2 i

  63. 7 n! k7 n1 M% G6 d& a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , a+ j( k6 H4 Y& O" e- I6 y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 a( k, }- w$ r0 P8 @% M7 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 P! H2 X  F9 I7 V2 k' f% ~

  67. # |: `# H; j  c8 L/ H
  68. dma_addr_t dmaphyssrc1 = 0;0 J# I1 k2 b& `3 Z! Z
  69. dma_addr_t dmaphyssrc2 = 0;" P  l/ e8 N; U" V% l# J
  70. dma_addr_t dmaphysdest1 = 0;/ B) S+ U5 I6 t6 z
  71. dma_addr_t dmaphysdest2 = 0;6 o7 Y8 B( \+ O0 w4 ?

  72. ; p7 g$ }0 J0 I; F- h1 b! W/ j
  73. char *dmabufsrc1 = NULL;
    % m/ F0 j3 _0 W) J8 @
  74. char *dmabufsrc2 = NULL;) R% u+ r" ~8 o3 ~* C8 ]0 D% C
  75. char *dmabufdest1 = NULL;
    5 }7 N3 Y) E  T4 u7 @. f
  76. char *dmabufdest2 = NULL;" a6 X9 x& M0 ^- b- L" h

  77. , x9 Z$ j; C4 s1 e) b# P% a  G# @
  78. static int acnt = 512;
    0 c. S( y- R! A$ j
  79. static int bcnt = 8;+ }2 ?" [4 P3 Q$ A3 H( l! }$ }" t
  80. static int ccnt = 8;
    7 p5 A) Z' F- j, Y7 y
  81. 2 {" o1 n5 m, U
  82. module_param(acnt, int, S_IRUGO);% _& B) V. M5 G* P4 o; D
  83. module_param(bcnt, int, S_IRUGO);/ H$ p% J- P" x. F* R; ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 c; c2 x- a9 a; e6 l0 \7 {3 B# u% D; s: d7 }. p  {+ w; n9 x; v' v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ L6 {+ ~  _7 x4 ~, N4 b4 o. o0 o, yarm-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 H; j2 b% A2 g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 c; Q- f  B* S: y8 Q  S5 j  {  n4 ~! s0 C& x

0 c: `; U+ Y* x1 X7 o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-24 07:43 , Processed in 0.046988 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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