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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 o4 l+ _1 L, r# p6 r7 e( I2 D
  1. [code]EDMA sample test application- i) n$ u  i+ E, @
  2. /*
    # v7 F( N3 c5 `/ _9 e! s  W
  3. * edma_test.c
    " G. A$ I8 n8 w, G+ L5 n- N6 g
  4. *
    & l8 M. z: f  ^* W, h1 g3 q
  5. * brief  EDMA3 Test Application% p6 R4 f9 K7 H* [3 l9 J' W
  6. *
    ! p" d2 I; c+ W
  7. *   This file contains EDMA3 Test code.
    : @  f; r6 A# T
  8. */ R5 {7 r3 x- X5 T. z5 `8 j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! s% ?' n. O4 n1 @/ n7 f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * J3 ]3 m1 Q" j" c/ ?8 Z
  11. *         TO CHANGE.
    6 b' ^" S& Y. j4 z: b' f
  12. *$ ]/ |8 s2 R( P+ h! K8 t* Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 E! z' C$ e) A: y8 T
  14. *
    ' S; F' e$ y$ u/ k0 B6 t
  15. * This program is free software; you can redistribute it and/or
    . l2 }/ v$ w1 s' X7 x& z
  16. * modify it under the terms of the GNU General Public License as* U" ]7 \* {6 c' G- I# t  \
  17. * published by the Free Software Foundation version 2.' n' _; y+ g! p! c$ ?
  18. *
    : v1 t% _4 A% H: I+ ~3 Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 ^8 L: S1 g9 O6 U; _
  20. * kind, whether express or implied; without even the implied warranty% c% X9 V- L. R3 ]8 r: B5 ^2 Q0 F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 o+ Y, ?4 E& s, Z7 S) o
  22. * GNU General Public License for more details.
    1 l7 X, T- a- I8 E5 ~- u% m
  23. */* n4 f! @3 p- S4 c

  24. ; K  t( m# a+ S1 P: o6 G$ V
  25. #include <linux/module.h>, n. T, U/ w9 c6 G+ n& V: T
  26. #include <linux/init.h>
    ( X+ b+ c7 S( I! }8 G1 j; q. w
  27. #include <linux/errno.h>
    1 c: y9 b/ Z6 R# J0 B: q0 v
  28. #include <linux/types.h>
    3 P  }# X$ d$ d
  29. #include <linux/interrupt.h>8 k5 R7 @: _% A9 L
  30. #include <asm/io.h>6 Q( p9 F! B, ?  `# m
  31. #include <linux/moduleparam.h>$ ^9 p, x" w/ \7 A" X
  32. #include <linux/sysctl.h>+ c% C& `' c3 d+ n
  33. #include <linux/mm.h>
    5 j- @' S9 E: R7 ~6 f
  34. #include <linux/dma-mapping.h>  z* s1 H9 K  R2 f' j" [
  35. / ?' K0 d, G" f% k9 ~% |; g# j4 w
  36. #include <mach/memory.h>2 @" i0 {& n( P' h. o( f( V
  37. #include <mach/hardware.h>* |; c- R+ u( W
  38. #include <mach/irqs.h>& V1 m5 z+ Q# E
  39. #include <asm/hardware/edma.h>
    6 P9 F6 a( W& w
  40. 7 a# ?5 I3 Y! M7 c7 n. h& ?, n
  41. #undef EDMA3_DEBUG
    : X& x' M8 G- e9 H$ V1 P6 z
  42. /*#define EDMA3_DEBUG*/
    7 |+ G3 S; X7 d7 l% H1 }4 A

  43. , W6 e- E4 L8 j- C9 c  v; n
  44. #ifdef EDMA3_DEBUG7 w& t( q2 F1 W5 i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      |8 x3 \# _# U9 L1 b9 z( ]4 c* C0 L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- n2 j: l- h3 e- w, [( C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 ~, A) v$ g4 P
  48. #else5 F7 i2 g% h) Q' x- M/ g" O; {$ R
  49. #define DMA_PRINTK( x... )& q6 [3 l' k/ h6 W. i
  50. #define DMA_FN_IN
    ' @7 O1 I) H* }0 D. s; h" M
  51. #define DMA_FN_OUT
    ) \- r2 K1 j/ l$ m/ j2 M" H
  52. #endif; s9 }; j4 f1 n  I& I
  53. % ?6 m7 h* Y9 C5 R2 P! V) K$ b% W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , N3 r, C, }/ a% I" A" b  f2 D
  55. #define STATIC_SHIFT                3
    : y& \& U3 T% H; H/ Q8 c" ^
  56. #define TCINTEN_SHIFT               20
    % b0 T& X& x2 W  y( k
  57. #define ITCINTEN_SHIFT              21
    0 K# @; t1 t- I5 m4 [
  58. #define TCCHEN_SHIFT                22/ o4 U/ `, j: A. N7 a; M; Z0 K0 g
  59. #define ITCCHEN_SHIFT               23
    8 A5 U* @# U( q# L' z

  60. 1 b/ k5 ]+ a' f, i1 _& e
  61. static volatile int irqraised1 = 0;' f6 B7 o5 x8 d8 |) h; {! X; ]
  62. static volatile int irqraised2 = 0;
    4 j( q. c# f5 U9 Z0 ^; T

  63. # q3 R+ t- O$ f! i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , |# m/ `4 `0 r/ R0 v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & @  C5 n% C+ ^) T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; P! ]/ w6 d+ ?* K- J

  67. 0 B' `" L2 B) T* W$ [. N) G/ @
  68. dma_addr_t dmaphyssrc1 = 0;! C1 B0 m4 U8 `' ~) A2 O7 |4 H
  69. dma_addr_t dmaphyssrc2 = 0;
    : U0 W7 z  W9 y& ]5 }
  70. dma_addr_t dmaphysdest1 = 0;, w1 ]0 G: f9 F
  71. dma_addr_t dmaphysdest2 = 0;; l$ M6 s8 o4 U) Z3 ~7 r

  72. 4 s9 J# E! Q/ M* g6 r
  73. char *dmabufsrc1 = NULL;
      K$ A( T5 L1 C# W+ ]! ?# ^4 E# W
  74. char *dmabufsrc2 = NULL;0 B! N8 j- [: \6 z8 f
  75. char *dmabufdest1 = NULL;
    . G2 M6 Q7 K( T$ T
  76. char *dmabufdest2 = NULL;2 W3 j; Z5 J3 K! c$ H. ^0 c
  77. 2 F# ]! p# K3 ?
  78. static int acnt = 512;
    : X* C# M+ g* x' |) ]
  79. static int bcnt = 8;
    ; B3 L8 L. B/ A( i% T
  80. static int ccnt = 8;3 y  I% [. j/ W, K4 |/ b
  81. 8 _3 [: O! O# I
  82. module_param(acnt, int, S_IRUGO);
    2 S, p' [3 G* I& C" ]) z, }- A
  83. module_param(bcnt, int, S_IRUGO);
    * [" Y: M/ N$ {* d7 a( z# D
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. H$ }' H! Z6 L! b, N
, j1 [/ `1 L! |* F4 O* Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 \  w& v* m8 Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 t; w4 p% n# R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( I- I& R7 F0 u  [6 h" X) g7 S
% E, b/ r0 C: y6 r$ |% _
' p6 m5 W" |0 T& [; ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 07:45 , Processed in 0.049158 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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