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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 V9 I3 a$ e1 w$ {8 I) O3 ~; j
  1. [code]EDMA sample test application
    ' r% A# m& I7 N" v
  2. /*
    / D  w& Z3 N( [2 j
  3. * edma_test.c
    2 W& C" m# w1 ^  a
  4. *$ A9 f" A  L, V( S7 [' D5 f
  5. * brief  EDMA3 Test Application' ^/ }9 A0 z! \* o! W
  6. *
    ( s' ]0 y  i8 W. E5 r, h
  7. *   This file contains EDMA3 Test code.! u: `5 Z8 w$ M2 ~( P
  8. *
    0 _5 q5 l: B$ v, _5 |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 U1 ~! h' z" ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " N+ H* ^" ~& @# v
  11. *         TO CHANGE.
    + _& C' z3 y/ u1 r- o
  12. *
    ! l7 G5 T& O- e* z1 w; W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 V  d- a# V- ~
  14. *6 E. f5 u6 P) P4 V% l# z- ]. o% X' B  S
  15. * This program is free software; you can redistribute it and/or. F; P/ W6 @0 M
  16. * modify it under the terms of the GNU General Public License as
    & T1 B: `7 r6 G$ k
  17. * published by the Free Software Foundation version 2.
    / Y+ M9 A  N, Q% M6 b4 I# `
  18. *
    $ R% n) \2 g; U9 s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ M9 i! O; u% r2 g& g* f
  20. * kind, whether express or implied; without even the implied warranty- V% {. \! q# c3 X* m* E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" k& s5 X2 J8 c1 U$ E
  22. * GNU General Public License for more details.
    . R; B% K8 e7 e1 `( C+ U
  23. */
    3 X& V& V! }7 F: U# p
  24. ' H* w( C$ }" {0 `2 s/ U
  25. #include <linux/module.h>3 t: r2 Z7 T8 D$ I; s0 C0 J
  26. #include <linux/init.h>. S. p, s# T( x
  27. #include <linux/errno.h>* z, V2 C9 e( l( @+ D  n
  28. #include <linux/types.h>
    8 C. S: G: g5 D5 _5 B8 }6 u* M
  29. #include <linux/interrupt.h>! K" a2 X. W0 n7 M+ q8 I# o0 J/ j
  30. #include <asm/io.h>1 s( j. n- g$ b  `& D: l& g) Z
  31. #include <linux/moduleparam.h>- @  a. J+ @! V* ^$ C2 U
  32. #include <linux/sysctl.h>$ O" c/ q: V/ L2 j2 I) r
  33. #include <linux/mm.h>& u; y1 @# A2 e; t% N& I
  34. #include <linux/dma-mapping.h>) U# `, Y3 j" x
  35. 4 M5 X1 V5 X6 F& G8 f+ }
  36. #include <mach/memory.h>
    ) b  A& Z3 F; o6 @  W
  37. #include <mach/hardware.h>
    . {' a) J0 h) ]1 a6 j7 P! L
  38. #include <mach/irqs.h>
    5 Z& C2 Y7 c& x# R9 p
  39. #include <asm/hardware/edma.h>
    0 h- {; M' G+ w1 c9 [

  40. # D2 N5 c6 K+ j. x
  41. #undef EDMA3_DEBUG- E$ X* F) |# x2 B: S# S
  42. /*#define EDMA3_DEBUG*/
    9 L0 M+ y# ~& o. g! t0 |

  43. 6 O. W8 O9 y* P: q
  44. #ifdef EDMA3_DEBUG6 r/ {4 A- e. l3 ^. z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 }8 w4 ~% F. P$ U2 S5 G0 A4 F8 T" _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( `+ u' M8 r' F6 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' D% y: p- u. g  s7 ^
  48. #else
    : S; K( P$ p. O$ l9 O1 z8 o  D, S
  49. #define DMA_PRINTK( x... ); t% a! I2 i  L5 G; N  g' V& {6 T
  50. #define DMA_FN_IN
    + [: v. q% ~" ^* Y/ S5 _# s
  51. #define DMA_FN_OUT
    # \/ x5 z# @: i
  52. #endif
    7 O8 d# A0 M& p/ V- {, O

  53. - W$ k( O: U* z$ `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 d$ y2 A4 t2 P* ?8 Q8 x
  55. #define STATIC_SHIFT                3% T( g5 i% w$ E+ b. y% c% o
  56. #define TCINTEN_SHIFT               20; y$ ?/ W$ R' x* ]6 F
  57. #define ITCINTEN_SHIFT              21
    ; m) L& a' D5 b2 \( O, p. N
  58. #define TCCHEN_SHIFT                22- D. f9 f. B6 Z, v. C9 Q( I
  59. #define ITCCHEN_SHIFT               23
    7 ], O8 l2 J7 K% C" M- g  ^8 y4 u

  60. " Z) ^, a( [* I3 S1 Y
  61. static volatile int irqraised1 = 0;
    ( q+ L) e, f& o/ l
  62. static volatile int irqraised2 = 0;3 s+ i! E! M' A
  63. 0 v% Z0 j4 C( L/ Q% a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # R' k- N9 p7 K8 f" }5 W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ w$ F* `2 n- [3 b# J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 N7 i9 d; \/ @6 B4 Q
  67. / g- Z; [( I3 C/ a9 `! C8 R
  68. dma_addr_t dmaphyssrc1 = 0;
    # O6 E. U% i2 c: e& ~
  69. dma_addr_t dmaphyssrc2 = 0;% B" m; d  c( J) n6 \
  70. dma_addr_t dmaphysdest1 = 0;! s( r0 m+ l, h8 ?
  71. dma_addr_t dmaphysdest2 = 0;8 g/ Z+ M6 A2 F- z

  72. : A/ b  n& N) S! ^
  73. char *dmabufsrc1 = NULL;
    $ y5 |1 Q0 O# ~* h
  74. char *dmabufsrc2 = NULL;, V) [6 Y+ t& `' d5 j6 P. f8 [
  75. char *dmabufdest1 = NULL;
    2 D1 s9 u" j0 S) Z8 w
  76. char *dmabufdest2 = NULL;
    % `: N* |; n: u% l

  77. ! b, h! u$ U& P2 c, X$ G- t( A* s
  78. static int acnt = 512;+ H2 g. R, P! \/ H! o
  79. static int bcnt = 8;
    " y! y1 u8 r( }# B. N
  80. static int ccnt = 8;+ L7 s# X0 B: Q0 f
  81. 0 u6 ~+ j: ^% a/ h
  82. module_param(acnt, int, S_IRUGO);+ Q. t0 D0 l( S0 E
  83. module_param(bcnt, int, S_IRUGO);
    ; J( ?9 Z" \- j/ a  V& C! Z* A
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, E9 t6 V# a$ I$ V
& O2 j$ Y$ X) v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% q- Y" _1 K6 garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 t* M' G' B* f! I/ r; B2 A% Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. l. l9 H' }" }3 U* y
/ a2 u2 o! W3 c! o( L. n  L  {: \; ^- j9 O, d$ M9 x" ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-14 22:13 , Processed in 0.044024 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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