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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# S5 ]! i  z+ n- Z0 ]5 e: ]
  1. [code]EDMA sample test application
    + ?" }8 G+ m0 s  J9 ?
  2. /*
    , A# ]6 Q+ r+ d
  3. * edma_test.c
    7 ]' A4 o# W0 v, Y9 e$ h
  4. *
    4 U% u& E' R, S! ~
  5. * brief  EDMA3 Test Application
    + `8 h. p, I; \' B! h8 k" Q& I6 {5 x
  6. *1 y% X# o  O7 ^2 X$ X$ A
  7. *   This file contains EDMA3 Test code.7 d7 D2 o# K: J2 w8 V
  8. *
    + Y8 K# R) L& y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' i5 z0 w3 y/ d3 \, a/ ], F7 q3 A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * n3 I. Q* D' p8 }
  11. *         TO CHANGE.
    4 C! S* Y; U2 x1 G
  12. *
    0 Z$ P9 Q/ V1 u- D6 r" y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, Y$ N) |! O9 g# T
  14. *, j0 G3 T' m# o6 T0 \
  15. * This program is free software; you can redistribute it and/or$ }- a. W$ O% n$ l5 H' I9 F$ a
  16. * modify it under the terms of the GNU General Public License as% h( i5 O" q1 T$ Z% Y' Q$ L
  17. * published by the Free Software Foundation version 2.: y4 j' r- |/ b  q: P
  18. *
    : V0 o2 T: k3 G; K! C+ B& p7 x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 x/ f% W3 T7 s' u8 D& ^
  20. * kind, whether express or implied; without even the implied warranty
    1 P  M' l# s( C& f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 l: l, m3 F6 j$ g
  22. * GNU General Public License for more details.
    + ]4 q4 R. a) x, d6 q( m. K
  23. */& O7 S) X1 k" ?8 c* ~# \0 T
  24. ! S7 c1 v+ P4 e( o, B3 D( F/ d
  25. #include <linux/module.h>; n: K7 _3 V3 p0 g- i9 F
  26. #include <linux/init.h>2 N1 ^9 f6 @+ P$ I' X
  27. #include <linux/errno.h>$ R: H5 ?8 ^( S* B% D) s
  28. #include <linux/types.h>
    , a6 L- f3 `" N! Y4 _
  29. #include <linux/interrupt.h>( \) s8 r$ [8 K/ Y
  30. #include <asm/io.h>3 i. g- H6 f! X
  31. #include <linux/moduleparam.h># X& h* Z2 H( [8 F8 K% q) K, D
  32. #include <linux/sysctl.h>; k" [6 z8 W0 g
  33. #include <linux/mm.h>
      J9 j; e$ X5 q' P% n# h
  34. #include <linux/dma-mapping.h>* M0 N; A! G2 x1 A
  35. 4 C9 R: O1 Y7 @  [. Z
  36. #include <mach/memory.h>
    1 s' D, M7 {7 V3 v4 V
  37. #include <mach/hardware.h>
    * Z6 @, E8 {5 x' K; ^) K: A
  38. #include <mach/irqs.h># n& o, o6 P+ ^# U
  39. #include <asm/hardware/edma.h>- Y3 Q' ~8 ]* Y& x' Q0 u8 `3 u

  40. 2 a. f) H' l; o7 g( Q
  41. #undef EDMA3_DEBUG3 P: ^/ ?" F5 N+ J
  42. /*#define EDMA3_DEBUG*/0 @- {, a+ f5 P

  43. 7 s1 D% V1 C- q  B: c; [& I0 _
  44. #ifdef EDMA3_DEBUG
    4 N; Q6 y  A/ p2 e/ B7 `' p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - a$ n0 {( r- ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ i$ y; H" f% @7 d8 w1 I6 q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( O+ r% l# g  U4 e- V9 u
  48. #else3 h& A  b" r; \" C* Q
  49. #define DMA_PRINTK( x... )
    % |$ D: h7 Q$ E( t2 H4 c. b6 K6 L' ~
  50. #define DMA_FN_IN0 [2 K. M: d8 M$ F3 c
  51. #define DMA_FN_OUT
    1 G' P4 a5 Y, E
  52. #endif
    0 s4 w1 R/ }& K' p& o

  53. 1 Q" N' h" d( C, X' H  Y; ?# m, o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ R- D7 \. Z0 f' `& o: x
  55. #define STATIC_SHIFT                39 z% y% Q" z) }4 y
  56. #define TCINTEN_SHIFT               20
    0 s' r4 @% K* J% h- ~6 N/ {! n8 s
  57. #define ITCINTEN_SHIFT              21
    2 l' c2 w2 p: S* L0 D
  58. #define TCCHEN_SHIFT                22# Z& D2 t/ Z& m$ n4 K- ]
  59. #define ITCCHEN_SHIFT               23. \  @4 \& M0 m% e3 ~& R; L

  60. $ a$ G1 t! l0 g+ R
  61. static volatile int irqraised1 = 0;
    * x4 H4 }1 g- v' g0 n( j
  62. static volatile int irqraised2 = 0;
    , a' M, Q3 P0 P9 [$ O* B0 q  k, {

  63. / K1 L6 S) h9 O1 u4 ]8 X# l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. V$ c0 A, o! g! z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, V# X6 w) E2 R& `) I1 {- I! O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 K2 K! F2 I, H1 a' B* a" N) C1 j* y
  67. 4 [8 G2 l0 W6 _& O* @" O2 F! r
  68. dma_addr_t dmaphyssrc1 = 0;3 z5 ?8 i0 Q! T2 }4 l- @
  69. dma_addr_t dmaphyssrc2 = 0;
      X1 \2 v* e# w
  70. dma_addr_t dmaphysdest1 = 0;. C# ^2 ^0 W  {& u4 k
  71. dma_addr_t dmaphysdest2 = 0;
    , H, Y7 `/ g) b) i1 K7 Y
  72. 7 q' C7 d: E$ X
  73. char *dmabufsrc1 = NULL;7 d: H1 Y; P0 R3 K0 @& P6 r1 H
  74. char *dmabufsrc2 = NULL;
    2 G( S7 f$ E) P: R
  75. char *dmabufdest1 = NULL;
    # D. U: ^" Y8 [- y% Q/ `3 d
  76. char *dmabufdest2 = NULL;7 C! h- X0 t9 L% o$ P
  77. $ j( l# x# Q1 l2 N. K1 \
  78. static int acnt = 512;: t2 w& J$ s. a; b; x1 J
  79. static int bcnt = 8;
    % K6 ^( r! ]4 p# f2 M; [0 r; P
  80. static int ccnt = 8;5 u# n$ z2 z7 m0 }( f- z4 Q( M. `

  81. 5 d. k8 ~6 Q$ l# E6 [- e) n! L
  82. module_param(acnt, int, S_IRUGO);
    2 L$ ~2 h7 K$ |7 z4 @3 k" Z
  83. module_param(bcnt, int, S_IRUGO);
    3 r! w2 _. }, b* t2 @4 ~% Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# q' F$ F7 t$ G- J) e3 Z3 C0 s2 u% X& P1 A6 _" L
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 b, p. L) y9 A, {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 C& U" s) V1 v( r     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 I4 p: G5 o8 {1 n  S' l
& B4 b8 y' z; R, Y
% h+ D$ y! j* U0 v* X; Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 21:24 , Processed in 0.040071 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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