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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# }/ w7 {$ K. ?5 D
  1. [code]EDMA sample test application
    0 q; l! g* J' g: X5 T; m3 b
  2. /*
    ( Q4 R& i5 }8 u+ b) `
  3. * edma_test.c: L' P, H) h4 C7 t& l
  4. *  {3 |' N+ w6 L* {9 e, f' q. m+ q
  5. * brief  EDMA3 Test Application& G) S4 C, W2 e( E/ U7 e  g
  6. *
    , [  G' R2 S7 C/ e$ T' g
  7. *   This file contains EDMA3 Test code.! ^: w6 l% |8 J  H8 `
  8. *
    ! ~9 j8 ]9 B: P* k) D" S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 i) h- W7 q$ M# e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 C4 p: j. p4 z
  11. *         TO CHANGE.
    1 T, s0 W6 E2 }. M0 y
  12. *
    ! _% q& z1 c' p, _( T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 S. P8 ~" V: t& |) s+ ?
  14. *
    % v9 e7 [  Y5 J0 P
  15. * This program is free software; you can redistribute it and/or- ]8 O% R% g( D
  16. * modify it under the terms of the GNU General Public License as
    6 T" x8 p) P) X5 f& x
  17. * published by the Free Software Foundation version 2.# X  }4 o; S1 r8 W6 ^
  18. *; e# W4 F- }5 N# }* n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 ?5 y. P8 y  }& r2 N
  20. * kind, whether express or implied; without even the implied warranty) m: N! s; o4 Z& x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 @  V. p" t- K+ N5 k$ K
  22. * GNU General Public License for more details.5 [* U" c4 e6 R
  23. */
    , V* b8 J5 m( O: G

  24. + ~/ B4 E$ r, P; S4 t5 n
  25. #include <linux/module.h>
    4 K  O) T! [' G0 B( }' S! k$ U
  26. #include <linux/init.h>
    ) q( L, ^; k# w4 U. S  h
  27. #include <linux/errno.h>
      i( `5 c( F( `7 C
  28. #include <linux/types.h>
    - c' b$ b2 u* ~' _
  29. #include <linux/interrupt.h>$ |/ R, r1 Z/ x, C! K4 A
  30. #include <asm/io.h>
    4 P; K+ a1 W) E2 m8 t
  31. #include <linux/moduleparam.h>
    ' h8 y3 \3 S5 [& F5 K* s1 m, t
  32. #include <linux/sysctl.h>
    1 O; I6 `  _4 m
  33. #include <linux/mm.h>
    ' b, ]& {2 x3 \* ~8 {# G
  34. #include <linux/dma-mapping.h>
    . A9 ]9 n4 P6 n& T! x2 X

  35. / C1 h& C  t2 B! H
  36. #include <mach/memory.h>: S8 M' T& k4 B1 t  Z/ D
  37. #include <mach/hardware.h>
    $ W* |) w" b- w! W& V- S! S0 F
  38. #include <mach/irqs.h>$ h# [5 y* ?8 D9 g$ o& d  U
  39. #include <asm/hardware/edma.h>
    # u! I, T, _% _3 W# j

  40. 1 I" |+ A( E' L; L6 }  T& D
  41. #undef EDMA3_DEBUG- |$ \' g1 v+ o( P
  42. /*#define EDMA3_DEBUG*/
    3 a$ L/ d8 ]0 F' D. W

  43. 5 \6 `; a0 b3 F4 @
  44. #ifdef EDMA3_DEBUG
    9 P* i" D+ y4 d4 A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      o$ q" \) Y9 d) c* _" I) C# x& A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 P2 k9 e" J, x  ~! \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): V% V" ~+ K% D$ }0 t% f
  48. #else! z" H8 Z' E8 m9 R( G! P* w
  49. #define DMA_PRINTK( x... )! s+ q5 l( C' E! N' q
  50. #define DMA_FN_IN
    , ]  {: I3 l8 n) Z0 w4 O" T2 c1 l  e7 o
  51. #define DMA_FN_OUT0 B) G! x) O: |5 s6 t' h
  52. #endif
    & N& L1 m3 Z( h, C# i( n! i1 @
  53. % j( M" B! K7 T: E4 R+ N  C+ J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 i) I7 n* Z+ m" i: A3 L3 ?/ M
  55. #define STATIC_SHIFT                36 d, `, ~: q4 @
  56. #define TCINTEN_SHIFT               20, Q8 R; ]2 H7 H" w! F
  57. #define ITCINTEN_SHIFT              21- M9 w2 Z; C. Y* t  j) x
  58. #define TCCHEN_SHIFT                22( L- r$ ~5 O. d7 m  f; z
  59. #define ITCCHEN_SHIFT               231 k. S  B0 o  \( g) K+ S8 y

  60. . m5 p6 q5 B3 R, p
  61. static volatile int irqraised1 = 0;" c0 B& S2 `6 h; U! B- [
  62. static volatile int irqraised2 = 0;. @; g; @. i. d- R) Y

  63. 6 \( h$ [7 n. o" A1 D3 Q9 P) j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 x- r1 |, y$ M* D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 M9 x& U- p+ [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! b# U. K9 D2 n) G  {

  67. ; J2 _2 ?4 X8 G2 ~
  68. dma_addr_t dmaphyssrc1 = 0;
    7 H! @" X5 k- u) H
  69. dma_addr_t dmaphyssrc2 = 0;
    6 i2 r8 D6 m& Y' d  J; P$ \  G9 P( t, [
  70. dma_addr_t dmaphysdest1 = 0;4 p9 J7 ^: H. p& ?; g; D" D
  71. dma_addr_t dmaphysdest2 = 0;
    ! w* Q% x9 ?! U+ _& c) z, Z- i* w

  72. , X  F* J+ T9 E5 r. x4 Q4 F
  73. char *dmabufsrc1 = NULL;  N# Y+ h3 b) Q
  74. char *dmabufsrc2 = NULL;, k0 P% u8 P6 C& m, A& A
  75. char *dmabufdest1 = NULL;% l8 E, n( Y) l
  76. char *dmabufdest2 = NULL;. m8 C5 R+ H" j* \+ T' \
  77. ; _( w" @/ E3 o
  78. static int acnt = 512;+ ^2 l# X% x5 V* M1 ~3 i- k
  79. static int bcnt = 8;8 W( Y: S  w  u( h
  80. static int ccnt = 8;2 B* n% J6 E/ Y* _; F

  81. & _  p: i$ C' a# L' u( H3 Y/ L
  82. module_param(acnt, int, S_IRUGO);5 h: W* N0 F2 h9 M9 N
  83. module_param(bcnt, int, S_IRUGO);
    . C' y& h. j' R# Y; c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 n+ o( ~! Y1 [0 B' Z" Q7 r
% t" s( F" z9 N/ f
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 H. Z4 C9 g* v, {+ y: D7 Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 d0 a; }" A7 H$ M. Q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% F# u! f" W+ W; [9 h1 W/ H9 I: G+ N1 m; d* {3 z. X4 {4 e1 d
" D7 A0 ^7 @' h% g7 D9 `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 06:12 , Processed in 0.046235 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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