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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 B% s( Q6 X6 j
  1. [code]EDMA sample test application
    ; C9 v- }0 N3 G! L$ g
  2. /*' `" J  Q% P8 }9 C6 b
  3. * edma_test.c' g6 \. ]/ E' `& g
  4. *
    . p) ?9 }" y) s( Y
  5. * brief  EDMA3 Test Application
    5 P* o+ n- K% n# F
  6. */ P* X0 J2 e) H. d" q+ }
  7. *   This file contains EDMA3 Test code.3 j" k  w2 r8 ]: q. g; G  c
  8. *3 S9 f! g" t& _% G: C1 X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * x3 d' j1 Z( @- q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 u0 Y  _" u8 C: Y9 Z& f" y
  11. *         TO CHANGE.0 t2 r; r5 J  D/ e
  12. *
    % p1 a7 E0 l9 s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 f9 r) Y" d0 [" ?7 q7 x: ~
  14. *
    0 |( A: O6 y" F0 w9 p! n
  15. * This program is free software; you can redistribute it and/or
    , Q  s3 h: {6 _- t* C, \" A
  16. * modify it under the terms of the GNU General Public License as. z1 \# q! U+ b) I0 X1 a
  17. * published by the Free Software Foundation version 2.
      \- J' I. h' t/ |
  18. *1 R4 t/ p4 g$ H8 q% B6 ?% G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( R* J" E; a2 D  O1 ~8 ~" m# g/ M" y
  20. * kind, whether express or implied; without even the implied warranty- d# z* y% r. E; ]) A6 x, D7 ^' {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% x- B- d8 p  H6 J1 f
  22. * GNU General Public License for more details.' X/ m. e# J" N; [: T4 O5 M' w
  23. */
    & k+ O  m. ^, J+ c- w( q

  24. ! b+ T7 J/ @9 C" G; S3 q5 x9 p
  25. #include <linux/module.h>, i6 i$ [9 Y; h% q) F
  26. #include <linux/init.h>
    5 ]8 s$ P3 @3 _' s, q2 I# {, f0 C
  27. #include <linux/errno.h>
    : s3 H+ e. \. g8 p2 F& j, Q1 p
  28. #include <linux/types.h>
    4 d3 I" G; T0 h0 r. S
  29. #include <linux/interrupt.h>5 [* b+ z' i0 T% c
  30. #include <asm/io.h>5 z% Z! C  P* ~2 `* T( B: U- l
  31. #include <linux/moduleparam.h>6 S+ O* f1 M- B" R4 K. q
  32. #include <linux/sysctl.h>
    " F4 d  b( F; \# T' B
  33. #include <linux/mm.h>7 @+ T6 l% P3 Q* y! \% ^* t# y
  34. #include <linux/dma-mapping.h>
    * g4 N6 n% f7 D/ X& g

  35. " k& D! a" g. D) I0 [% S6 `
  36. #include <mach/memory.h>
    " Q6 q+ M2 T3 y+ J( B
  37. #include <mach/hardware.h>
    ' I* x# p3 [4 U# ~# u/ v$ V
  38. #include <mach/irqs.h>6 r& w' f# S& _3 `
  39. #include <asm/hardware/edma.h>
    ( z$ H# O. |8 `) ]: A6 k+ o
  40. 7 a! t2 M, H/ R2 h* P
  41. #undef EDMA3_DEBUG$ {$ t1 k; V& d2 |2 N$ |3 I8 ?
  42. /*#define EDMA3_DEBUG*/
    # Y( w8 U% f# R$ ]8 e
  43.   I: i2 C- Y6 J$ t1 m/ j
  44. #ifdef EDMA3_DEBUG  L8 }4 _: A4 ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % V+ B6 J4 z) S# V/ h7 F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " M6 p. N  p6 q3 l! ^5 ~2 C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! g8 m, M$ A" f' A$ a! r/ s
  48. #else( F. U8 c( P7 f7 J( P
  49. #define DMA_PRINTK( x... )
    " d- S  c) ]! @6 h& H% Y! F4 V- @
  50. #define DMA_FN_IN
    9 `0 y5 m6 c8 J2 R6 x/ Y
  51. #define DMA_FN_OUT
    ; S* ?$ \" E# K
  52. #endif
    9 F- Y( E; U, c& \9 y
  53. , D. `' ]0 t$ o! b; i9 E) [3 a/ _( b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 f( ~, }( @& P2 u9 T# f7 E
  55. #define STATIC_SHIFT                3& G( ?7 b" L* r. A5 k3 `
  56. #define TCINTEN_SHIFT               20  n3 d, j5 x2 l8 k: [% e9 A
  57. #define ITCINTEN_SHIFT              21" A# {2 Q0 X) L7 ], Z
  58. #define TCCHEN_SHIFT                225 \, C. ^2 _" M/ R( j' N! L4 M
  59. #define ITCCHEN_SHIFT               23
    % K- `; O; O( h/ Y# a, Z% o/ d
  60. ( \* Z, @4 `( C9 |  A
  61. static volatile int irqraised1 = 0;, {9 p& t- k3 m5 x9 X" q
  62. static volatile int irqraised2 = 0;! I8 R+ C+ U/ L/ R1 A" ]

  63.   d, E+ a+ n5 m7 ]% y0 l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- o6 p. R7 r) V9 A9 D, C9 U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " ~/ t" ^) x0 M- L2 ~, Z+ i: w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 E% J5 E2 j/ F5 V3 d9 u7 u

  67. 3 x, A/ {: j) y7 q1 r1 @4 Y
  68. dma_addr_t dmaphyssrc1 = 0;
    ! Z1 J* b# m6 n/ I
  69. dma_addr_t dmaphyssrc2 = 0;7 O$ R: q# B+ w6 s
  70. dma_addr_t dmaphysdest1 = 0;* |0 Z7 d/ _/ r/ `1 I5 k
  71. dma_addr_t dmaphysdest2 = 0;; F* ?, y& k5 K3 D1 P
  72. / N1 P$ o5 [, U7 m& x: ~6 J
  73. char *dmabufsrc1 = NULL;* f4 r; O" W( s3 E* T5 z, [
  74. char *dmabufsrc2 = NULL;
    : \2 D. D& h. Q5 p' y9 N
  75. char *dmabufdest1 = NULL;
    ) F, X) P* l: r% d
  76. char *dmabufdest2 = NULL;
    1 J3 E, l1 l5 [% ]2 f3 ]
  77. 2 _  J: \! N" [2 _+ \' a
  78. static int acnt = 512;
    - S8 i8 k2 P" M( \
  79. static int bcnt = 8;
    , f; C* q4 ?# [3 K
  80. static int ccnt = 8;6 M3 I) B- [" w

  81. % N. W6 e& }. l% H& w& s& R1 ]
  82. module_param(acnt, int, S_IRUGO);
    . J- p9 ?+ i: _. B& n
  83. module_param(bcnt, int, S_IRUGO);
    ! K! {; ?/ a" H/ ^; R+ o- p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* Y2 D* s5 v& p
; K( K7 c9 M9 V# W0 l. d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 S; ^2 X) o$ ]  J: A* H8 Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  @# J/ V+ v7 O; Q& ?8 m4 e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 y! `3 E6 D1 b6 V7 v! X, X, S. A9 {3 l& a
+ j7 W1 \  q4 s* \/ `5 ~" g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 19:15 , Processed in 0.039037 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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