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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! G$ e" |7 X8 v% M8 Q4 g6 G
  1. [code]EDMA sample test application
    + K7 n9 T) T! f3 x8 l3 c/ F/ l
  2. /*
    ' c/ E0 [5 E# f/ Y) c" Q+ B, s
  3. * edma_test.c" a7 @+ J; r6 d, E4 F
  4. *
    $ c2 O7 K9 b  z- i6 w9 C+ T8 U# L
  5. * brief  EDMA3 Test Application' a- Q8 b* P' m6 }9 J
  6. *7 T5 J: D4 e7 {+ a! s" g
  7. *   This file contains EDMA3 Test code.
    / x) [/ Z1 r! a8 F, g" N
  8. *
    4 p# }+ z! D' ?1 n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , o3 |$ X1 p& J" m. x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( ^) j6 ?" X* r: w, h* z
  11. *         TO CHANGE.; C  j0 i6 Q: [) Z# q
  12. *3 j! H' o1 z, }; L# _! {( s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ ]* \# T: }3 Z1 z* S% e* M; Y' d
  14. *
    9 \# R/ ^% W' E- }2 ~' v
  15. * This program is free software; you can redistribute it and/or
    8 u  p! ]  g% Z. b
  16. * modify it under the terms of the GNU General Public License as5 ^' ?/ X4 d5 |4 I% c
  17. * published by the Free Software Foundation version 2.+ Y" S- B0 ^4 S- O2 l
  18. *' P$ B0 y  S4 H/ _+ h5 v! @/ t$ {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ c- R/ x: |' ~( G) t+ ~8 p- K
  20. * kind, whether express or implied; without even the implied warranty! u8 {2 e. {& }: [/ H3 X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 u) X1 |% P8 t( b! k# `8 e
  22. * GNU General Public License for more details.
    ! u4 S/ F& _* J8 o" t5 B) M& Q
  23. */
    . M% M' L) w+ Z- b' z) _; d% h9 @" ~
  24. 0 p# f9 V# U/ f6 L8 N) Z5 [
  25. #include <linux/module.h>: C" M$ |0 V/ m: A' Z( ]9 Z, t
  26. #include <linux/init.h>; v- S- t& q/ T0 k& |: V
  27. #include <linux/errno.h>' m) J9 v# O, W
  28. #include <linux/types.h>
    : W) s9 U3 o: Z. k" B" r" y9 K
  29. #include <linux/interrupt.h>. C* \' B0 B' v$ X" T' b- L
  30. #include <asm/io.h>
    7 S8 S+ H8 ]" u
  31. #include <linux/moduleparam.h>1 @8 k5 N" B) Z5 x6 X- U9 \7 s) Q
  32. #include <linux/sysctl.h>7 g& y+ k, \/ N: D( r1 Q# A$ c6 n* B8 d2 c
  33. #include <linux/mm.h>1 l; P# y4 R) `, X+ q
  34. #include <linux/dma-mapping.h>: l6 @2 c( _) r

  35. 2 [0 Y8 }: _$ U( I7 m* H: |9 w& ~
  36. #include <mach/memory.h># D% L' h( _( M  d* \& Z" F
  37. #include <mach/hardware.h>
    5 O2 d: z0 x. \! N5 c
  38. #include <mach/irqs.h>
    3 E- j/ a) n" E5 I/ i7 \! \# K0 `/ U
  39. #include <asm/hardware/edma.h>7 n9 c$ t) }6 X" [  H

  40.   }% }. r' x2 ~; R1 k4 m7 j% }, a
  41. #undef EDMA3_DEBUG
    , O" d; T! j6 g- T
  42. /*#define EDMA3_DEBUG*/
    3 x  K, `1 ^7 S! x3 \6 C8 l9 ~

  43. 4 O1 w2 d/ X2 n4 b; b
  44. #ifdef EDMA3_DEBUG
    . N, @( ?0 g: h* t0 q% o- w$ _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), K. C. E1 v2 R; k5 n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      m4 @0 [/ z  Y- |4 D8 Z2 I: T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" W; I) l* k+ g9 w' i: D9 C! H
  48. #else0 l9 E7 J& N- c3 M% k
  49. #define DMA_PRINTK( x... )
    ( s  K( _0 p7 M+ ^! q( u
  50. #define DMA_FN_IN
    5 {" @' L- ?' ]! P5 U
  51. #define DMA_FN_OUT
    % r4 m; }/ ~% E& }4 e
  52. #endif
    ) ]. y0 s' i4 {. C
  53. 3 V" c4 U# Q9 s* U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) a/ t7 g, Y" I* T/ Z4 D& G
  55. #define STATIC_SHIFT                3  W& z' X9 {, p) Z/ s2 f4 w
  56. #define TCINTEN_SHIFT               20
    : F& o- k- z4 v1 l0 U
  57. #define ITCINTEN_SHIFT              21
    6 L. L9 d# M$ |' [& N  v. o$ K' E
  58. #define TCCHEN_SHIFT                22
    & n6 N9 b5 ]. n! A
  59. #define ITCCHEN_SHIFT               238 D5 ~5 a) D. g3 W* N1 R, p
  60. 4 T$ m$ Z0 B! c4 h, c+ N  k; z
  61. static volatile int irqraised1 = 0;0 Q4 l  o- t6 l$ K( Z/ N# O
  62. static volatile int irqraised2 = 0;
      o& o; [0 M* }  n( G  z

  63. 8 a3 ~, q1 j$ E, {, q' S% g& z* z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / i; H* H* [6 n5 @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* r: b5 c( Y+ h% s4 p& g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! ]! a8 g' j5 a& A7 x7 K

  67. - Y0 C* T9 Z; O6 d4 U
  68. dma_addr_t dmaphyssrc1 = 0;
    . K2 ?5 M6 L- G8 p5 K) q
  69. dma_addr_t dmaphyssrc2 = 0;, U( _1 c! R2 a
  70. dma_addr_t dmaphysdest1 = 0;
    3 W4 d( }* j8 S! s
  71. dma_addr_t dmaphysdest2 = 0;
    , Y3 s3 J1 d* m

  72. ) ^# H; f! M- r6 K8 ]
  73. char *dmabufsrc1 = NULL;
    2 C% r, |1 \! V6 v- j' G% K
  74. char *dmabufsrc2 = NULL;
    2 a; @. m' f5 A8 t
  75. char *dmabufdest1 = NULL;
    . H$ d$ N: _# n. f. }+ ~, f
  76. char *dmabufdest2 = NULL;
    , K8 `: |) U; L- [) z: M
  77. * m! }& P; {3 X. X
  78. static int acnt = 512;
    - n2 N% a2 U( m# ~7 C- I
  79. static int bcnt = 8;5 t" }/ |3 o" {, x, N  e
  80. static int ccnt = 8;
    9 T7 o/ H0 _! K" N
  81. 9 l) t' N6 K1 i8 \$ i, L( W
  82. module_param(acnt, int, S_IRUGO);& s+ m( ^0 m5 k( s
  83. module_param(bcnt, int, S_IRUGO);) t: [2 `  a, l1 X* F0 u" ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 C% m$ o. c9 m% X

, D- z# a, F" D- \' z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' J. t* }. r1 J, }5 J" @! `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ w2 ]2 |& E4 y( c! _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' f+ q. o" f- d9 \9 N" D/ b8 U: w$ b  H: K

9 Y% G* y9 W4 ?. s$ N, G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 17:26 , Processed in 0.041982 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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