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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 e5 L- b* U, N
  1. [code]EDMA sample test application
    . i6 `& S( Q) Z+ Y8 {6 r
  2. /*7 x  l* c) D, y
  3. * edma_test.c. \. ]5 @* ]$ R# |& l1 s' Z. F# F
  4. *! N$ _9 Z% j& v
  5. * brief  EDMA3 Test Application- R9 ?. K) J9 K
  6. *
    , W' i0 g* J. f% ~1 H
  7. *   This file contains EDMA3 Test code.
    $ t# N9 Q! s  c# c! u1 u
  8. *+ _0 y. c5 O& C6 z% ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' I) b! h* [" g  S8 g8 G/ S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 ?; b& p7 _- s' K# m
  11. *         TO CHANGE.2 J& D$ K4 ~  f3 t  L
  12. *
    - y' e$ O; @  q9 c: z$ h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) A" S/ t: W2 Z3 K& Z- s
  14. *
    * M  v% q. I5 Z! T9 o& P7 M
  15. * This program is free software; you can redistribute it and/or" g$ ?# |: R8 f* |8 L
  16. * modify it under the terms of the GNU General Public License as
    9 C: D0 `; ]# p4 _: L/ o
  17. * published by the Free Software Foundation version 2.
    % }( U5 w* Q+ l: C
  18. *
    : U6 ^! n& L- i+ x$ {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 S# N0 _. u) @( @( `
  20. * kind, whether express or implied; without even the implied warranty! E0 ]. l- j* ?  }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 G8 y+ n1 O$ B7 A3 S4 ?- ^
  22. * GNU General Public License for more details.& Z. \% O8 g3 a
  23. */. A; r: A4 G# `

  24. 0 m( N+ i- @/ e
  25. #include <linux/module.h>+ ?1 P! q: ^- b) S' l1 A1 W8 Z
  26. #include <linux/init.h>$ ], k$ r3 V. C9 p
  27. #include <linux/errno.h>
    / ~* d7 w; ^0 S5 f) K( _9 m0 u
  28. #include <linux/types.h>
    - R0 b! X% w" M9 X  m( M2 D
  29. #include <linux/interrupt.h>, V& [0 O. V: r' t
  30. #include <asm/io.h>* ?7 y: [) c! p  b$ Y3 x6 \
  31. #include <linux/moduleparam.h>
    - {4 y: `; E; d6 g- Y
  32. #include <linux/sysctl.h>
    ( u6 [- J0 \5 A# A7 T; X
  33. #include <linux/mm.h>7 x/ R, I9 p0 M9 l% `" w
  34. #include <linux/dma-mapping.h>+ S( D! f; o( l

  35. , ?' P  H; r: |2 X
  36. #include <mach/memory.h>
    4 w  P% ]1 A+ M  e0 {) e
  37. #include <mach/hardware.h>
    & F% C! \* l& n( [. D5 Z5 C
  38. #include <mach/irqs.h>& J2 C* ]# y  ^6 u
  39. #include <asm/hardware/edma.h>% K7 o0 k$ U% x* v5 H5 P
  40. 9 P7 X( A$ N/ V" l/ y
  41. #undef EDMA3_DEBUG
    . V1 I: j1 \0 n. Y5 c- X/ J
  42. /*#define EDMA3_DEBUG*/
    9 d8 L, W+ m6 ]) f4 V& a8 ^
  43. 0 A5 `: U9 G; `& j! m
  44. #ifdef EDMA3_DEBUG  F3 [  @& \( b& J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), g  z+ S, \9 E' Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* W. t" d! K" W2 C2 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  n* t+ _3 o! b/ V
  48. #else
    : W  z3 q7 T2 k9 g& T) a" J
  49. #define DMA_PRINTK( x... )! s/ C- s6 i9 N7 q; F5 U
  50. #define DMA_FN_IN( o/ N3 \1 L# i4 P# V' r
  51. #define DMA_FN_OUT1 [% ~3 t2 i0 ^& e! N
  52. #endif
    9 A. L8 y) V0 E) q5 f- ^# \, p
  53. 1 W1 s* R" o1 n. O' p1 B2 p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): d% c! J1 r( E/ N
  55. #define STATIC_SHIFT                3( `4 `  }+ j" @- P0 f
  56. #define TCINTEN_SHIFT               20
    5 Y# e) |4 u2 r5 h
  57. #define ITCINTEN_SHIFT              21& M: y. o* H9 T: X
  58. #define TCCHEN_SHIFT                22
    ' d1 r( f2 V% b' A
  59. #define ITCCHEN_SHIFT               23
    4 U+ _9 f) G8 `8 a, u. V* C7 g

  60. ; v$ s* W# G) ^: q2 A  T6 X' b+ P7 N
  61. static volatile int irqraised1 = 0;3 M- i* ]( C( K: S$ J7 B" b' k
  62. static volatile int irqraised2 = 0;
    + X8 I3 Q) @. C1 d- m' X5 Y( z& o

  63. 1 _$ e  Y9 f# F# N9 g* Z: w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 V1 s6 C- I5 W3 ~2 C5 f4 W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 M. W1 x9 j! Y0 R( r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 }, Z$ Q1 @3 S5 x% H
  67. 4 E: H8 |+ S; Z  I  v0 a6 D
  68. dma_addr_t dmaphyssrc1 = 0;
    6 }# w2 [7 z4 L  M  ^) Y& E/ n
  69. dma_addr_t dmaphyssrc2 = 0;
    ' B: A( r) P0 L
  70. dma_addr_t dmaphysdest1 = 0;2 P, f" s4 V1 ~% ?8 Q  v4 {
  71. dma_addr_t dmaphysdest2 = 0;) X- B1 F  T$ C% ?8 F% y+ s* d3 ~8 \

  72. . v& \! o! B( T5 Y+ V: S8 K
  73. char *dmabufsrc1 = NULL;8 {1 I. J1 `* y# f/ y8 E# U
  74. char *dmabufsrc2 = NULL;7 O) g5 c6 _' }% R6 C
  75. char *dmabufdest1 = NULL;
    % _3 o+ f8 M- q3 l% z
  76. char *dmabufdest2 = NULL;
    2 h' P. D8 `: c  b
  77. + Q& e* X3 R  h- Z
  78. static int acnt = 512;
    & Z! A3 i: F4 r7 B0 Y8 |
  79. static int bcnt = 8;$ z2 h- _% z# I
  80. static int ccnt = 8;
    + _0 S8 K8 g% V6 K7 g
  81. 4 b5 b: t. Z2 p% ~; y5 b; w4 T8 _
  82. module_param(acnt, int, S_IRUGO);
    % a  Y( t. q7 ?
  83. module_param(bcnt, int, S_IRUGO);0 w. \3 J0 u0 ]' y9 P& K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& n0 s4 I7 C6 Q% U0 q" D) m* Y
5 z  N2 [, p' y, }% K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# n. V7 ^& ~3 Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 F7 D& N2 b  W7 |2 C0 M- D% e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: T2 X! D4 b% ?! H- y( I, M

8 }" N! U$ L3 u' j5 l
/ |. A4 D# y0 ?+ E3 `( N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-26 12:31 , Processed in 0.039381 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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