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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 p* m) S1 H, R, Q8 g
  1. [code]EDMA sample test application  _0 y; p* ]( D: i2 w% r
  2. /*
    8 N. s* |8 c1 Y, i
  3. * edma_test.c
    # s' F( P3 K( |! s. [6 B
  4. *3 A7 f! T8 Y' [" @& M
  5. * brief  EDMA3 Test Application$ }2 d- {4 d$ {6 o
  6. *& X* [2 i$ G2 P" e
  7. *   This file contains EDMA3 Test code.5 O) u- H. m, v; `
  8. *
    $ c) l/ X$ u2 ^/ s1 A9 w$ R2 r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- n6 ]  s* n8 q" v3 m/ W) _6 D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" W* [& r& `; t6 N2 L6 r4 O7 s
  11. *         TO CHANGE.
    , A* F! j" J$ `; T/ s4 t
  12. *
    * S$ @& K, l) C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 }0 g$ e/ B, ]0 }
  14. *, K! ~  L* _2 _. c6 _. e
  15. * This program is free software; you can redistribute it and/or
    / A2 `7 _$ E9 ]8 Z$ i+ p, N
  16. * modify it under the terms of the GNU General Public License as
    + `% k' s) }( o4 }
  17. * published by the Free Software Foundation version 2.; H; P) X+ @5 M
  18. *6 A9 G" T" G6 e' a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: c/ ]4 r2 O! w( c  S8 R7 W
  20. * kind, whether express or implied; without even the implied warranty
    ( a; m+ y9 K; P+ |  I$ N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) I9 x& L. m. R% h& }
  22. * GNU General Public License for more details.
    & D3 S( G0 v; z- B7 C
  23. */
    ' \8 f" e( z4 v5 X2 R7 W
  24. $ H+ y/ Z. D4 J0 c/ ~$ ~
  25. #include <linux/module.h>4 Q7 D. G3 P3 i7 l
  26. #include <linux/init.h>
    - o; D) u- n! M( L9 s! v$ w* n; K# w
  27. #include <linux/errno.h>
    ' a  |& p( x4 _% \
  28. #include <linux/types.h>
    - v6 H0 s! Z! g8 ~7 P8 P+ }
  29. #include <linux/interrupt.h>* J7 C+ ~) J8 t/ \  D$ `4 `
  30. #include <asm/io.h>
    7 M& i8 C- k4 u. b8 ^* Q
  31. #include <linux/moduleparam.h>) _: Z# C' D& {6 x0 \. g
  32. #include <linux/sysctl.h>3 P1 T, j) G! c+ ~
  33. #include <linux/mm.h>, A. ~. }+ G" N: w: y; ]8 G+ Q
  34. #include <linux/dma-mapping.h>
    ' g/ a+ F. V9 T) `( v8 v

  35. $ l! W" Q6 T6 P5 C: J8 i" P) E
  36. #include <mach/memory.h>
    $ A! c; u1 m9 e5 M0 ]+ b8 v
  37. #include <mach/hardware.h>
    : o, q2 Z& \8 b+ ^/ d
  38. #include <mach/irqs.h>$ Y  o% F) O# }( d
  39. #include <asm/hardware/edma.h>
    9 N- g  h& [' R! [0 Y+ Z

  40. 7 z7 _0 c' W4 R* ?  W
  41. #undef EDMA3_DEBUG: U* ~! ~' t8 z
  42. /*#define EDMA3_DEBUG*/& P# k: s; E6 K  E1 v" R2 B7 a
  43. : {- A: D: _, o% k9 a) T
  44. #ifdef EDMA3_DEBUG
    " ~1 P# l; J$ j4 r" S9 d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 K, h. s. ~9 l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 t* R( a: D" |# m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# ^) f2 S' J% Z& \
  48. #else( d3 H' A0 [" `: A* e  q6 J
  49. #define DMA_PRINTK( x... )" m( S0 b! i2 K3 C
  50. #define DMA_FN_IN; z) `" c. e0 \! L8 \5 T) H
  51. #define DMA_FN_OUT& x/ {4 f: m5 X; r2 @1 L
  52. #endif
    9 n% q! b  x. K( D
  53. - U1 S$ b" s) Q5 C" h+ g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); E  j; Z' ]" |7 s
  55. #define STATIC_SHIFT                3
    , J  Z2 A1 F8 u
  56. #define TCINTEN_SHIFT               204 e' V! i. v. q1 S- j; x
  57. #define ITCINTEN_SHIFT              219 {$ p7 J# X9 e" R
  58. #define TCCHEN_SHIFT                22
    8 x$ v4 f  J- N5 T: F" d" g
  59. #define ITCCHEN_SHIFT               23. @& f4 G- K0 K5 w- e

  60. / R& u' ?4 X# c& F; K
  61. static volatile int irqraised1 = 0;- N+ D' |5 K! q5 q; B5 q8 P
  62. static volatile int irqraised2 = 0;  M$ R0 Y+ R4 F9 p8 e
  63. ) I" A4 E) Y6 A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 A# h* z3 l- [9 g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( l: W8 k# e' L& n( R  T$ e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! s; a% K$ @2 g. d, q
  67. 7 u: Y9 ^$ W7 X
  68. dma_addr_t dmaphyssrc1 = 0;* L6 ~+ j5 ]; \8 T6 f7 M! \$ Y
  69. dma_addr_t dmaphyssrc2 = 0;0 j4 v* x2 B; d2 G6 N
  70. dma_addr_t dmaphysdest1 = 0;6 X5 h+ ?" N. C6 ^1 H
  71. dma_addr_t dmaphysdest2 = 0;, `' Z3 v$ G( c* T

  72. 1 m2 P3 W# e, [- S& ~! ~% C
  73. char *dmabufsrc1 = NULL;
    " I8 R5 v7 b" V% @* Z5 `4 Z
  74. char *dmabufsrc2 = NULL;* g1 V7 h$ o; K4 V
  75. char *dmabufdest1 = NULL;
    # m' t% G# d" J4 W
  76. char *dmabufdest2 = NULL;+ x' y" E: n% y( K/ y% e$ o
  77. ( u& y+ Z: e" j4 _) O
  78. static int acnt = 512;
    ( C! D7 r: S1 d. j" f
  79. static int bcnt = 8;8 F9 q' A! m5 n0 P+ a
  80. static int ccnt = 8;9 T* i( n& @/ s; d
  81. $ S! E  J7 j  o+ F3 H% T8 z
  82. module_param(acnt, int, S_IRUGO);% i! W: H& x) s, N7 y8 ]0 L! E  x8 }
  83. module_param(bcnt, int, S_IRUGO);/ h; F) S# @( L: Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. b* O* p; Q0 S8 y8 w4 q4 p
% p( l% M+ A5 \* l' C      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, P% p# F7 B& ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- a0 E4 R: f  D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, F  Q8 u% m$ J2 f& {: U( b9 Q' w/ S6 r& j! J/ q( V  ?1 J* ]
* |: P3 }) i- K2 k, X+ y) g4 ]+ {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-28 15:41 , Processed in 0.046944 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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