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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 v7 x7 I4 u( a, e2 G7 t6 U' u
  1. [code]EDMA sample test application& y& q( ^1 N+ t4 n( y# b% w1 z
  2. /*! }! a! b% b3 e' E1 w: j) R+ Y
  3. * edma_test.c
    5 I1 y' }  k: J/ |7 q
  4. *, ^, ^  Q! y' ^, A. ^( X1 {( J1 c
  5. * brief  EDMA3 Test Application9 U  B  E4 C$ v( S3 q
  6. *
    5 B5 A! ]' b4 w5 E4 d7 C0 V* F" n' i
  7. *   This file contains EDMA3 Test code.
    % F, J" `& V5 ]) t
  8. *
    ! ]. S0 P$ ^' f$ U7 c3 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ Y1 Y+ s  q& U' A+ _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 d7 ?7 C: v: Q( W4 U4 O' T
  11. *         TO CHANGE.7 J6 b( n* q; C/ e) s& T5 q" p
  12. *
    * @" O; O! ^  I5 V' {% g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* X+ }9 Y; h+ l/ O  M; h' }1 h0 D
  14. *
    ( C- E" ]2 V/ _% P
  15. * This program is free software; you can redistribute it and/or
    & \0 g5 {3 ~  r( j( D% W
  16. * modify it under the terms of the GNU General Public License as
    & C+ w6 f( a' T. z' m. P
  17. * published by the Free Software Foundation version 2.( v: H1 p& T- c8 J; e
  18. *: q4 _; n' e- Q9 l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: B0 S9 b+ l0 }
  20. * kind, whether express or implied; without even the implied warranty6 o: ~. u3 U, C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 A2 X, J5 P) t% i: ?
  22. * GNU General Public License for more details.
    + g- J6 G4 r/ `2 `3 C
  23. */' }" b7 e8 L- |2 K( q

  24. / |1 H: ~5 f5 d5 ^, S$ Q0 w- F
  25. #include <linux/module.h>
    # S% S, V6 t! ?" V! k
  26. #include <linux/init.h>
    / B* i( O/ @+ ]# n
  27. #include <linux/errno.h>6 x7 z' N+ e- n+ k5 D  H
  28. #include <linux/types.h>
    % k) M5 w. Y' M1 v$ Y6 @# D
  29. #include <linux/interrupt.h>6 W4 D# O5 }. q' C
  30. #include <asm/io.h>
    3 Q8 s; t3 z# }
  31. #include <linux/moduleparam.h># G& z) f" r' Y" G9 V& m% ]: H8 p
  32. #include <linux/sysctl.h>
    + y+ E1 y) M6 G! ~. M4 r
  33. #include <linux/mm.h>6 |; E8 b& \; D& N9 `9 v
  34. #include <linux/dma-mapping.h>
    ) A# Y5 T( k+ t" v, _3 Y
  35. ! {5 L& L1 ?7 h* Z& R
  36. #include <mach/memory.h>
    * |' H7 H. y  K; Q4 x6 `1 G; j
  37. #include <mach/hardware.h>
    % s1 r4 ?5 j0 {5 l
  38. #include <mach/irqs.h>/ t" Q! R& b! Z5 i8 L: E
  39. #include <asm/hardware/edma.h>
    8 }8 b. I# o# G9 [

  40. $ C+ v! l, @& E! r" o6 s
  41. #undef EDMA3_DEBUG
    ' p' I5 j0 v. O9 B4 V
  42. /*#define EDMA3_DEBUG*/
    $ A/ l+ T2 L2 ^# K
  43. ' W) N6 m3 M2 H1 d9 F7 [
  44. #ifdef EDMA3_DEBUG
    ( p3 l# m- D5 F# i' ?8 R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% w/ @) \# z& X- u1 ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 ]0 E* L6 B& y& d& x* ^# s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - L: h6 l5 x; g
  48. #else3 c& p  w) W" y- C5 q
  49. #define DMA_PRINTK( x... )
    4 n- W/ _; G" M& R( F
  50. #define DMA_FN_IN
    0 S$ r- g: _7 q
  51. #define DMA_FN_OUT* L3 W: p5 s4 i5 V0 ~- \- ]  b: j. d# ]
  52. #endif
    / @5 P. g7 s$ q( r
  53. & d4 B) k' @( q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ Q8 S. i* I5 E. v$ _# ]4 m
  55. #define STATIC_SHIFT                39 n! I% J% L; ]" W
  56. #define TCINTEN_SHIFT               20
    ( c0 i1 _! o/ P0 M6 ^5 T+ l) X) [% ~
  57. #define ITCINTEN_SHIFT              21
    / s4 ?- F( |% _& P
  58. #define TCCHEN_SHIFT                22
    ' ^1 |+ n: P  i9 d" i
  59. #define ITCCHEN_SHIFT               23) e% x* d* |0 y# X

  60. ; |6 D, R# U  i- B0 \& }+ P  E2 o
  61. static volatile int irqraised1 = 0;
    ; c! Y) @) A4 l
  62. static volatile int irqraised2 = 0;# x: R0 M- w. F2 j/ \9 j# n

  63. $ e# u3 c) X8 M* P" H7 v/ c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; z: ^' X& {9 Z5 s! {! `( N2 g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ Z0 u/ I6 ]0 _$ e+ `6 h+ [2 U7 u# F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 ?5 d5 e8 V9 P
  67. 3 R6 R* d" ?3 z* `+ o
  68. dma_addr_t dmaphyssrc1 = 0;# @1 Y) H  T" ~
  69. dma_addr_t dmaphyssrc2 = 0;
    ; [8 Y" y; a4 ^/ v6 O' L# I: c
  70. dma_addr_t dmaphysdest1 = 0;
    8 @  [& K% ]# P+ c2 Y
  71. dma_addr_t dmaphysdest2 = 0;7 x& [( Z" {3 c1 s) E4 W

  72. ; T! _& M% A5 @2 S
  73. char *dmabufsrc1 = NULL;
    ; B$ w8 i' t% ?% l
  74. char *dmabufsrc2 = NULL;
    2 u8 {% i1 i+ |* C# |
  75. char *dmabufdest1 = NULL;1 x; S" k0 |7 h7 Z
  76. char *dmabufdest2 = NULL;' Y% r, b0 r+ f5 L
  77. 0 H+ ^: r$ S! \/ a- a
  78. static int acnt = 512;
    ; {" v0 h4 V9 y% _
  79. static int bcnt = 8;( i( |( i9 V% k6 K: P& l
  80. static int ccnt = 8;
    ( t2 F7 ^# F& q. |! K
  81. - Y, X8 p7 U& T
  82. module_param(acnt, int, S_IRUGO);
    2 k3 C! A) N# y/ \2 D# o
  83. module_param(bcnt, int, S_IRUGO);
    2 T4 _8 y- U- t& W  x9 k& q: v, s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" Z3 Y; j7 F$ H8 u2 Y, `6 s
' x4 r9 j* ?% n. K7 S5 S
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( o- w: q6 d3 u8 S' v1 ?+ e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* P/ A/ |! ^5 {     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# Y! `& X8 l5 ]) }, n

" p& t! m5 \& q; E" {" |1 F( Q, T! z$ t/ }. x/ ]8 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-3 16:35 , Processed in 0.038407 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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