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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 S: W# v9 B) ]+ q0 F+ {: L, F5 F  @
  1. [code]EDMA sample test application" ?! M/ E/ _* s8 t8 i/ s& T
  2. /*
    9 Z0 U: X$ J1 w
  3. * edma_test.c
    , t5 d0 t$ W8 q3 l
  4. *3 K% k8 B1 K$ k
  5. * brief  EDMA3 Test Application2 v: [: L% K5 ^
  6. ** v! a- d. q4 N, @5 L
  7. *   This file contains EDMA3 Test code.( \" E, i$ d6 a
  8. *3 ^7 f0 a8 E8 f9 L9 p" ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 O9 k$ _) t& G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & L- @* ]& D2 X' U, o) o. O
  11. *         TO CHANGE.
    # ?6 B& }2 Y1 C3 c/ a+ {' i
  12. *1 L- H4 U4 y9 j/ W, y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      W  H0 @( ~$ w' `2 [
  14. *
    1 V- a9 i! P# p/ `5 g& t
  15. * This program is free software; you can redistribute it and/or
    2 u$ O+ I4 @4 S) G. B2 K
  16. * modify it under the terms of the GNU General Public License as
    $ F" L9 O- T) B
  17. * published by the Free Software Foundation version 2.: M  x' p3 s! g/ F7 X6 H
  18. *
    7 ?3 A. b( }0 H* s4 p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 B; @% y, H7 X4 b
  20. * kind, whether express or implied; without even the implied warranty% l( r* `& d. k0 X* @  k1 a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + P( P8 K+ v8 F8 A! @
  22. * GNU General Public License for more details.
    ) n0 p! u; y) i) a( D
  23. */
    / {* G. n+ j4 I3 s7 q6 z5 a9 g

  24. 7 w0 {4 [( o* A5 ~* N# j: _
  25. #include <linux/module.h>
    0 K/ y1 {7 [: }  I5 G, e, h
  26. #include <linux/init.h>
      s. j" o$ x3 C: Y6 A
  27. #include <linux/errno.h>
    % P* |8 g' w7 G2 s3 p3 S% W
  28. #include <linux/types.h>
    . K% e# T' ]: l5 g+ U+ F
  29. #include <linux/interrupt.h>
    * a/ f1 i! V! v  o
  30. #include <asm/io.h>* _5 F1 h. l0 s+ u* p
  31. #include <linux/moduleparam.h>3 `2 m/ H; m" Z7 D) U' D
  32. #include <linux/sysctl.h>7 _# x' }, w# \! m6 `& ]+ S4 e
  33. #include <linux/mm.h>
    : u1 y6 z; g, S8 f* J! P* }' w. m
  34. #include <linux/dma-mapping.h>: b4 R& P3 ?( U( v! N4 o) g

  35. % y+ V5 W1 L0 S' o9 {5 K. ?
  36. #include <mach/memory.h>; e: Z+ ?( S, L7 {* C1 h0 V% f4 H
  37. #include <mach/hardware.h>
    7 l3 a7 M( ]- I9 V$ I- I
  38. #include <mach/irqs.h>
    . Y) B" }" _/ n  o$ G9 ~
  39. #include <asm/hardware/edma.h>
    . x0 N- Z3 [4 \% \. g

  40. 0 T8 v  N# r( w3 c( H2 ]- r
  41. #undef EDMA3_DEBUG( G; _8 Y6 P0 h) J
  42. /*#define EDMA3_DEBUG*/! X( v; H4 z. {$ d, p) D

  43. $ s5 V/ w9 I$ N* ~* b3 h7 y
  44. #ifdef EDMA3_DEBUG- y: K6 {( U( f2 L) x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), |' U( j! Y. W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , `3 h/ `# a) l7 E3 X( H) g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 [/ x% x- m# S! K0 r
  48. #else" o- ?' o, i8 }- ?- M; t4 C
  49. #define DMA_PRINTK( x... )
    % `! P. j: g6 l4 {+ u# T7 a
  50. #define DMA_FN_IN
    ( x, t8 p  e) X! x; v$ J
  51. #define DMA_FN_OUT
    # s: N/ a' A" G5 ^
  52. #endif" q! d1 F% W: ^" d" B
  53. 8 N0 t2 a$ A7 j3 S, G2 G: k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ O, b; _* k$ I- m/ j* G
  55. #define STATIC_SHIFT                3) K9 g" l- U# `% R
  56. #define TCINTEN_SHIFT               20
    - K- N$ q: M/ P1 {% g4 N( u! A( _
  57. #define ITCINTEN_SHIFT              21
    : c- ~, R( K# Y6 [1 M3 O- y! ^# a! u
  58. #define TCCHEN_SHIFT                22
    4 ^! }: |) X+ B9 w0 e2 ?7 \5 S
  59. #define ITCCHEN_SHIFT               23- J6 K; O; G, \. ?/ T( B& x# v

  60. & q, |8 ?& k$ [9 k, t, D
  61. static volatile int irqraised1 = 0;* X3 o$ `$ m# B) w0 {1 f
  62. static volatile int irqraised2 = 0;# ^5 y* j/ E7 u% p; G# Q$ \5 Y

  63. ' `+ x$ A& G6 A+ n5 E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 {6 Z# v3 L7 D1 t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / c: G( C; S7 r% z7 Q0 U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" a) b9 Y- M5 z

  67. 1 Q6 ]0 k4 R3 k, J: Z/ \
  68. dma_addr_t dmaphyssrc1 = 0;
    0 o9 y) a6 T7 V) }! \+ _% [
  69. dma_addr_t dmaphyssrc2 = 0;$ h1 }  m5 d$ o% D6 l, V- C3 r
  70. dma_addr_t dmaphysdest1 = 0;
    1 K% g. F% y- ?% D  L6 T( X
  71. dma_addr_t dmaphysdest2 = 0;
    ' G8 t% O/ v, Q, W( n+ S+ B

  72. ( s+ J- z( M* r/ x! w. ?" R. m. x
  73. char *dmabufsrc1 = NULL;
    ' g6 z( ?: n% h: q5 Y" `% ~* Q
  74. char *dmabufsrc2 = NULL;
    ) E3 H6 h* T% w) s
  75. char *dmabufdest1 = NULL;
    8 g! I* m" `, N/ O8 e
  76. char *dmabufdest2 = NULL;* B7 h3 C; i$ c3 V
  77. ! T/ W7 e3 r7 N2 ~# n5 R
  78. static int acnt = 512;- E- n$ c. {3 T2 I
  79. static int bcnt = 8;% F5 G( a) M$ @8 s5 g
  80. static int ccnt = 8;6 R* [/ W( x$ u% L8 ^
  81. & i9 ~8 `6 Y% m- S7 p
  82. module_param(acnt, int, S_IRUGO);5 f" g# T! O& n
  83. module_param(bcnt, int, S_IRUGO);
    1 _  P7 X! R3 n! D
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 `) T. K: i$ S  M7 g$ Z8 N6 E0 E+ I% }/ H$ Z* O6 ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" y; m# w! A8 y  \/ y9 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: I* b' j1 K0 ]% w( ]  ?. W& Y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ x3 Y4 L9 N! J% o3 v5 v" l6 t

) c8 [  I. ]: G; Z6 N8 b3 j, ?# _
$ |: n' e: K4 u3 t. g: ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-22 12:01 , Processed in 0.042629 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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