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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" w# E+ `$ T& [/ X
  1. [code]EDMA sample test application
      X& K! q9 S" P& @
  2. /*
    4 z8 F1 T4 d6 [
  3. * edma_test.c( j" r* N5 L9 q: I6 w
  4. *$ d0 u( u0 [; h/ L8 h5 p6 h; _
  5. * brief  EDMA3 Test Application+ U( V" j3 k2 r. C; \; |, X
  6. *
    ' v3 H- \) N- G0 I/ W8 t( s; C8 W
  7. *   This file contains EDMA3 Test code.
    9 |- m6 z+ p/ @& C: j0 N
  8. *3 P: L# u4 @9 N$ y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 M& J. |* M, h3 D- J' O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 ]4 J# D. |  B8 E8 S+ J/ b
  11. *         TO CHANGE.
    : Z& [$ U2 ^! A4 g. V$ i) q( `
  12. *
    ' `6 M! p0 M/ h) W6 J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. |( r5 m) [- T; o8 W2 E- ]3 Y, u0 j
  14. *
    3 h3 E7 M+ w" I  v4 W
  15. * This program is free software; you can redistribute it and/or
    " I, j; M9 }6 P1 r; `
  16. * modify it under the terms of the GNU General Public License as
    ( }2 T: V. @& m% t
  17. * published by the Free Software Foundation version 2.9 I  E3 Q6 u; Q% p) `1 G
  18. *
    & z6 J: A, C1 n! Q- k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; a5 O$ t# E, C5 q/ c
  20. * kind, whether express or implied; without even the implied warranty
    * I$ C) S9 a2 @/ V6 `* z& |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . {4 R1 o7 E& i; I' Q
  22. * GNU General Public License for more details.
    - O0 H1 n% W& q. @
  23. */
    ! ~# n! D4 K$ [! S; V/ n7 S

  24. 2 O, G: }" n) _3 e" s
  25. #include <linux/module.h>
    8 I% {3 m9 x" x" F" j& z5 K4 b4 m
  26. #include <linux/init.h>
      j9 E- H. Y9 K  f7 g- f9 r6 j
  27. #include <linux/errno.h>
    " e/ j3 o  `+ F/ w
  28. #include <linux/types.h>
    - q/ O& ^  x4 R4 a! _
  29. #include <linux/interrupt.h>  p9 p+ w5 N; {) W' |% _
  30. #include <asm/io.h>
    $ C% s6 Z! H; v7 Y) \8 E* M
  31. #include <linux/moduleparam.h>8 v& d- f4 |0 s
  32. #include <linux/sysctl.h>3 n; l$ ^7 r: c* J9 }& T7 f  O# Z
  33. #include <linux/mm.h>
    / w, p% y6 t/ G7 \2 C% H! I
  34. #include <linux/dma-mapping.h>
    ) r+ G0 |( k& q9 `) O: c% ?- G
  35. $ D0 ^* \$ ?$ i, L! O) Z+ i
  36. #include <mach/memory.h>
    * G( B' t0 _# H0 Y& u
  37. #include <mach/hardware.h>0 \: x& T; T  a7 X  R8 T) v5 d
  38. #include <mach/irqs.h>7 z6 g  ^! [+ R+ k* }% V
  39. #include <asm/hardware/edma.h>' Z. K" B6 y- |% \: }2 u7 P+ z
  40. * E! s8 e( v. u4 b: o: e4 ^$ P
  41. #undef EDMA3_DEBUG3 F6 T1 V5 d( ^4 s$ x
  42. /*#define EDMA3_DEBUG*/: G; K, V9 }' u% p7 h

  43. 5 W' N2 I+ b) _" F2 G: R3 J5 x$ {+ R
  44. #ifdef EDMA3_DEBUG
    ) e- l4 ]' V9 C5 Z, g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 K: }' h; M. L- \- n, I( p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; P5 |' Y. p& s$ ^/ X9 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ z9 \# _* n7 s; |' n
  48. #else
    * ^: k! ~! l4 N+ Z5 l3 _
  49. #define DMA_PRINTK( x... )& R2 }) J/ }. Q0 N# G
  50. #define DMA_FN_IN' Z) B+ Z4 n$ g
  51. #define DMA_FN_OUT
    5 N" F  X" A, L2 m( Q
  52. #endif1 ~' W7 X0 ]+ y  s
  53. , i( M7 P; J& _% \2 o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 M2 ]2 L% j4 {+ b' G
  55. #define STATIC_SHIFT                3' t) z0 p9 q* @% ]% H$ B2 \
  56. #define TCINTEN_SHIFT               202 s! W* a8 k7 N) Y3 p9 b7 `
  57. #define ITCINTEN_SHIFT              21
    + ?( j  s9 u; s& }( r! D
  58. #define TCCHEN_SHIFT                22! p) n% s+ i8 K) Z
  59. #define ITCCHEN_SHIFT               23) w( ^% H8 Q# A7 V. f, t
  60. ( W$ p/ c0 }6 f5 l$ w
  61. static volatile int irqraised1 = 0;; B  N. Y0 m3 e: n
  62. static volatile int irqraised2 = 0;+ o6 G& c$ v: V8 l5 L
  63. - Q# n7 F$ X0 A& N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 t: z* L. R# G. a  {- d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 @, `- d8 x: v3 Q' a- J/ \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - Z- F6 P7 H( j( V# a
  67. 9 ^8 w- g- @, p7 P
  68. dma_addr_t dmaphyssrc1 = 0;
      |, C# P8 Z, k2 d% q
  69. dma_addr_t dmaphyssrc2 = 0;+ r$ b: s, y1 @8 D! w# |9 a" j
  70. dma_addr_t dmaphysdest1 = 0;
    : {" y" z5 Y6 G
  71. dma_addr_t dmaphysdest2 = 0;
    : }. \6 M5 N, J1 O+ u! U1 i/ t

  72. & ^) x7 Z3 T) }8 F3 P$ Y+ a
  73. char *dmabufsrc1 = NULL;6 V) o2 D1 D# }) ^: f* k3 l& w
  74. char *dmabufsrc2 = NULL;: F+ U4 z+ u: N& G
  75. char *dmabufdest1 = NULL;- A. H! L9 u8 b4 @  S
  76. char *dmabufdest2 = NULL;
    ' `. f7 w8 ~0 T

  77. 0 @$ Y* u, Y  o9 L9 {
  78. static int acnt = 512;  ?5 a' P) G2 [3 U! s0 }1 n
  79. static int bcnt = 8;2 ~1 L$ v9 @4 |$ D  L5 X/ ^
  80. static int ccnt = 8;
    6 n- C( D0 }: O6 L% D. l" }
  81. 9 s# Q, @% G6 c2 i3 _3 Q
  82. module_param(acnt, int, S_IRUGO);
    3 S" \( z( _; Q, e2 C" y; r& [% a
  83. module_param(bcnt, int, S_IRUGO);+ {; s* x4 i7 @1 ?) G. W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, c/ h/ U* R- u# F) o0 w- G& L5 K( a& r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) |4 o- d7 ^$ N/ M; v7 X" Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' V8 T) L9 L( L2 F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' i2 F$ w: `- v* [7 _4 e& e8 c. e. o/ T

+ z6 G9 S* }0 P* c) k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-11 17:56 , Processed in 0.036319 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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