OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 ~( n2 ~  x+ @0 h2 N, z2 _
  1. [code]EDMA sample test application
    * o+ X8 Q, }6 @* ~" }/ h
  2. /*2 T5 ~: i- |$ o5 F
  3. * edma_test.c9 o& u4 w( ?4 Z9 w" _8 Y- c) y
  4. *
    , J, `* ]* m2 [: J* H
  5. * brief  EDMA3 Test Application
    0 D6 O& |% d. t6 r4 B0 A
  6. *& }% _. n$ r9 f5 ^- V$ _) p
  7. *   This file contains EDMA3 Test code.
    8 g8 O2 ~) S3 K4 W
  8. *
    ; ^9 B; s' o' Y+ Y, k5 o: F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) w5 z6 {& G. G$ o  ]: ^; {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 j8 x3 S; C' h
  11. *         TO CHANGE.
    8 k  f: x. h, v: N: _. Y# w$ E
  12. *
    + @3 N6 W% r7 b7 k8 U$ p, F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! u% y7 @1 ?4 p2 s6 T9 \
  14. *  m9 t: Q  d) `9 u
  15. * This program is free software; you can redistribute it and/or
    2 t( ^1 P! ?" H% e" n$ }% C1 W
  16. * modify it under the terms of the GNU General Public License as
    8 ?, j8 T+ F: U7 j
  17. * published by the Free Software Foundation version 2.9 v" n& `: r% s6 r
  18. *9 b$ I! D( C) G$ `" [0 q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : m" L3 K' |8 o. s, K1 g
  20. * kind, whether express or implied; without even the implied warranty
    4 t& V" R9 n# q! i( d* Z: b. V% ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 ^# I7 d9 h0 j/ x1 D
  22. * GNU General Public License for more details.& O' l+ y: ]* K  m% Z) w# D- s% w
  23. */
    , T5 x( {# R0 e; @0 j) i& K
  24. & ~; ~0 u( U1 ~+ j* s
  25. #include <linux/module.h>
    8 u8 T/ ^5 U$ J. l- c
  26. #include <linux/init.h># W) e1 }( h$ W; r" B
  27. #include <linux/errno.h>5 \9 a+ \# f* [  B0 r) \
  28. #include <linux/types.h>* m3 w7 a1 ?6 y
  29. #include <linux/interrupt.h>
    4 |5 ]+ y8 D( g
  30. #include <asm/io.h>) A6 M* u% O4 j) e/ j
  31. #include <linux/moduleparam.h>
    4 \3 F. g7 E1 d; x9 ^
  32. #include <linux/sysctl.h>
    & X: t/ V+ w( b8 u$ {0 p
  33. #include <linux/mm.h>' \8 W+ @/ a% U( ]% W. a, E; r
  34. #include <linux/dma-mapping.h>8 N6 w5 X  S- @- h1 @$ ?2 {
  35. : @1 A8 ^: S8 C  d. E
  36. #include <mach/memory.h>
    & J5 s! v3 F' v* i* J3 _, q
  37. #include <mach/hardware.h>
    " Q- D# d- m3 Z2 A& Y- s8 {
  38. #include <mach/irqs.h>1 z0 r4 c5 J% s, u4 @
  39. #include <asm/hardware/edma.h>  m( B7 ?7 g' ]3 c3 L% M& [  M

  40. ; `+ V, b' O- {3 m. O, q% X
  41. #undef EDMA3_DEBUG1 e/ b9 e) D" r; q% G% ^6 L. P
  42. /*#define EDMA3_DEBUG*/
    # }0 n; ]8 p8 i# D, i2 d; Q3 M& M

  43. * N, Y: L$ V$ m: e! s
  44. #ifdef EDMA3_DEBUG5 V) p- _. s& W, Y2 P8 W& K- l9 ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), w1 P! O+ Q; q8 M$ Y7 L, j6 @, c% d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& J% p" \5 e! ~  y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 d' ~0 n' B1 s& p5 f1 K
  48. #else
    ) e; R2 i4 A9 C* K& p6 t5 ~
  49. #define DMA_PRINTK( x... )
    * b9 U: `8 Y/ `4 {& c9 K; L
  50. #define DMA_FN_IN
    % b, d2 p3 v- e# x/ J
  51. #define DMA_FN_OUT! M( v; A, W2 i
  52. #endif5 c" t7 R" X6 U3 L0 X8 f
  53. - K2 X, F  U  C7 Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " @% d! Y6 y  P" c
  55. #define STATIC_SHIFT                3
    5 |, d$ X) w! j  i( c' B5 Y
  56. #define TCINTEN_SHIFT               20
    9 a1 `9 G' _5 ^0 _; G; e
  57. #define ITCINTEN_SHIFT              21
    + ~9 V: D2 m" m+ h9 }3 F' I
  58. #define TCCHEN_SHIFT                22( W- ?# {- Z+ ^8 i
  59. #define ITCCHEN_SHIFT               239 M# ?1 ~- X3 p2 T) H" A
  60. + t/ }* ]: @' i' l: Q4 r
  61. static volatile int irqraised1 = 0;
    # I4 S" ^" c$ ?9 x0 S
  62. static volatile int irqraised2 = 0;
    0 l% ^+ j+ O. l' C6 H: i6 l, x

  63. & l4 Y% C/ N- d9 ~2 S1 q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& p4 v, V1 q: S& O4 ~$ N( }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 Q" w  Q; e4 W& H* I; S5 Q' }! U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 B3 I. w6 {' V3 S5 Q+ F
  67. ; b: @, w4 u6 _+ r% b
  68. dma_addr_t dmaphyssrc1 = 0;
    % Z% o% t% d2 c0 Q( e- M
  69. dma_addr_t dmaphyssrc2 = 0;
    0 p( V  W. l: G
  70. dma_addr_t dmaphysdest1 = 0;
    3 ?- B2 c8 ]2 Z1 j3 v# b0 e
  71. dma_addr_t dmaphysdest2 = 0;4 l! N: y2 d0 T1 a- D
  72. / ]: B# q- `% C
  73. char *dmabufsrc1 = NULL;+ s2 d) R, u3 Z* F
  74. char *dmabufsrc2 = NULL;
    6 F! R8 c  d5 F( x7 Q) B; ]. U1 z
  75. char *dmabufdest1 = NULL;6 S/ f5 c7 }' {5 D. z
  76. char *dmabufdest2 = NULL;
    ( Z& H7 v& Y1 T2 ]4 G

  77. . n$ x; `" q+ S
  78. static int acnt = 512;/ g4 O& _% S, D! F. u2 \6 r3 q: Y
  79. static int bcnt = 8;* m! I8 l2 D7 I+ i# {8 o0 R
  80. static int ccnt = 8;
    7 b: M3 c( ?% ^) D1 T- L* N
  81. , J6 h0 ^+ ?% g1 Y' ~: m
  82. module_param(acnt, int, S_IRUGO);
    , M  O. J. P4 V5 h1 _9 |+ c' w5 A
  83. module_param(bcnt, int, S_IRUGO);
    1 `6 o2 N$ ~7 h  `5 X) L/ Z. @+ G
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% p* z+ f/ n& ?. b( q$ p

% ^+ ]! A1 [, X! \- {8 u- ^% V      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* A6 P# f7 Z4 y1 q. M, rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 K6 l8 x$ t$ Y1 l% |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 L" [1 C- W" V* D' A- P) B1 I- o* Z$ ?  Z- `

) G# w& E6 Y) a/ O1 p5 }9 E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-6-15 11:28 , Processed in 0.035807 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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