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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 \4 C/ r$ ?) M$ P4 e8 Q" H5 F; i
  1. [code]EDMA sample test application
    2 V; p- U; A  y
  2. /*& r' Q3 D+ j) k* k  K
  3. * edma_test.c
    9 P1 S$ c) a+ d7 T# a4 ]) q, [
  4. *2 E8 P1 h3 p6 u: Z0 K% t/ x
  5. * brief  EDMA3 Test Application9 W2 p1 ?1 |$ {( O; n" f6 T  R& S% U
  6. *
    * O- a. u3 ]1 d, O0 l- R
  7. *   This file contains EDMA3 Test code.5 w4 d4 [5 d3 V) z. M0 p' k  g
  8. *
    * b4 J) T: O4 X7 r" q( ?6 X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. z0 U" Q/ }% b. a; P+ p) @2 {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 s8 K1 ~1 O+ J2 O0 W! q
  11. *         TO CHANGE.
    $ j. f$ G0 c3 E7 K# @% T& M
  12. *1 l; l2 V& P7 W/ N2 @% O1 P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: F: J; x' `, O
  14. *
    ! i7 p- M" y5 \! L' U
  15. * This program is free software; you can redistribute it and/or& l0 {+ T! H$ u
  16. * modify it under the terms of the GNU General Public License as4 K5 Q0 k* g) q6 w# N
  17. * published by the Free Software Foundation version 2.
    # K0 ]& P7 l- }
  18. *! J- D9 j' R# z! |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- }, o: e* z. \4 q7 k& \4 k
  20. * kind, whether express or implied; without even the implied warranty
    , s) w  q/ Q. {. G7 }* ]# T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 Y3 p) Y5 r; R# x
  22. * GNU General Public License for more details.- Q0 j0 ~' X8 }$ p6 C) G+ ]8 ~
  23. */: x* k  V: }9 m- A( p
  24. . b1 M# B- N7 S5 W- g, |
  25. #include <linux/module.h>
    . m" C  k% ~2 K  L" I7 ]3 ]1 r
  26. #include <linux/init.h>
    1 |8 }% J0 K4 ~$ z" L
  27. #include <linux/errno.h>4 a7 t8 M# l0 k+ X( L
  28. #include <linux/types.h>0 a/ _8 Q" H9 S( _$ S
  29. #include <linux/interrupt.h>, n7 C( t9 B  o& C) W/ Z9 Q
  30. #include <asm/io.h>
    & a1 j) W, E) _" O+ W9 u) Q
  31. #include <linux/moduleparam.h>+ V- g! R( [, ]. j& q
  32. #include <linux/sysctl.h>
    & l! a- X/ \* K, G! w
  33. #include <linux/mm.h>
    5 y/ f' c) c; b; U* O- t6 K( C
  34. #include <linux/dma-mapping.h>1 s3 U2 I# e( R0 Y. v
  35. 3 [& O, ?$ g  o
  36. #include <mach/memory.h>0 l' n& t2 c+ U7 f# p" L
  37. #include <mach/hardware.h>
    , V$ \+ t$ I7 u1 V6 V
  38. #include <mach/irqs.h>
    6 I: s1 P- N8 U( v9 S! G
  39. #include <asm/hardware/edma.h>% i) H* L" x6 U0 X' h

  40. 1 W% i1 g" i. s; v
  41. #undef EDMA3_DEBUG) Q8 `; ]& `! X7 l) t2 [  ?
  42. /*#define EDMA3_DEBUG*/
    9 _2 B, N: y/ Q( B0 b

  43. ; M, x) p8 h, M4 [0 g: Y4 K
  44. #ifdef EDMA3_DEBUG9 h) G8 F1 N8 F7 J) [2 x+ P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 k8 G! R/ U, y8 R( X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : B: z' c4 r- L: E2 p$ B$ h& T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 v6 n( M6 a; S
  48. #else
    $ |1 X* p. a" H9 k; l, L  c
  49. #define DMA_PRINTK( x... )
    & }# {, t0 F' |% F# J
  50. #define DMA_FN_IN5 r+ m# j, V5 }* N7 G+ ]
  51. #define DMA_FN_OUT: K3 p& y) S& p& I
  52. #endif& z: O: M1 f7 O: }2 Z

  53. , J) y5 b& X' h5 D/ m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : j6 t: r8 J, y% H2 c6 ~
  55. #define STATIC_SHIFT                3
    # `( R9 C+ [7 Q# J" b- K/ v$ Y
  56. #define TCINTEN_SHIFT               20
    9 j" j% {1 y5 p& q
  57. #define ITCINTEN_SHIFT              21
    9 x( V7 H. N" C! L0 d! A6 i
  58. #define TCCHEN_SHIFT                220 @' F) F* F7 N- X
  59. #define ITCCHEN_SHIFT               23
    # q* U9 F7 F. K+ x8 F2 v' M
  60. 1 h) W" t+ k- Z& J) p7 e/ y; s/ r' p% v
  61. static volatile int irqraised1 = 0;
    ' i! g5 m# B4 B' a; ?
  62. static volatile int irqraised2 = 0;* h6 w7 r) L: z+ g
  63. 6 I4 Y8 M4 ?7 ]+ T+ r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) A7 w; P/ V. S2 k1 b5 ]7 T9 s7 F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 ^2 J7 d$ I* \3 [. q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! y1 d: t) t, M9 t5 D$ ^
  67. : Y1 p6 N. j7 F3 G# z( B
  68. dma_addr_t dmaphyssrc1 = 0;+ x; a6 Q% I  P1 S: q2 X3 J! L7 a
  69. dma_addr_t dmaphyssrc2 = 0;
    ; L$ f6 i' M3 i& {6 O0 I) k* J* m
  70. dma_addr_t dmaphysdest1 = 0;
    5 h6 T8 e5 |" M0 ]
  71. dma_addr_t dmaphysdest2 = 0;* w: M1 a; v& f  G' L

  72. + A( T" n# V8 k0 [. m$ `% x* }
  73. char *dmabufsrc1 = NULL;) s! G8 D# B% c. w9 U4 o, V  |
  74. char *dmabufsrc2 = NULL;3 g0 `4 l- R/ P$ j
  75. char *dmabufdest1 = NULL;9 W/ Z9 u9 r% H  ~: p: g  ]
  76. char *dmabufdest2 = NULL;
    ! W$ v% a+ I! a1 y3 J/ M9 h1 A

  77. 2 D7 n1 n% e2 V1 K  {
  78. static int acnt = 512;
    % B# s; @! E: f5 @1 c" r
  79. static int bcnt = 8;, ^/ x8 }4 q( \" O7 y8 V
  80. static int ccnt = 8;
    ( U. r, g: W8 v2 P& m! J" Z* e  l
  81. . s" m" r+ _/ C/ s/ }+ F8 n0 e
  82. module_param(acnt, int, S_IRUGO);5 o2 e) x3 a7 q' P$ K
  83. module_param(bcnt, int, S_IRUGO);( J) s4 b8 u2 Y1 ]* \( C: {2 ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 ?0 [: h. i* C+ x
) o9 `) g3 O3 Z6 w$ p" X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 O+ x5 h/ P/ l! S' w* @5 n; s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 N! ?$ c# q7 m' J" F  ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 y/ P3 V" f; X* O' X; Z! w7 Z5 v1 g* s
$ H" @  y7 H, Y1 _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-21 08:39 , Processed in 0.038257 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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