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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ O* j1 Q% ?4 |& e2 Y$ M3 E
  1. [code]EDMA sample test application
    . e. R8 ?3 J# M  ~1 B2 P
  2. /*
    ' b- e+ H8 f" \5 |
  3. * edma_test.c; T1 {9 ]* b" J. ]$ C* z
  4. *
    1 @; I5 _( N! R0 Z! J$ D
  5. * brief  EDMA3 Test Application$ F( U5 G% R/ K& E
  6. *, N, N3 D5 k* P6 w) d
  7. *   This file contains EDMA3 Test code.) w7 F0 m, o3 q
  8. *+ d  W0 W0 Z7 t9 P& T1 ~- F+ s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * B/ Y; ~: q/ p6 g0 O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + U* E, I/ y0 s5 r! i) u
  11. *         TO CHANGE.
    # U! y  r* G5 j9 u% S
  12. *: T! {4 q6 {  Z( c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ f$ d* U1 I, I4 r, X
  14. *  @  E1 @1 M" S' M. \
  15. * This program is free software; you can redistribute it and/or
    9 v; A8 i5 |" \* d3 q
  16. * modify it under the terms of the GNU General Public License as0 o1 [& s  |3 o5 l0 g5 g9 K
  17. * published by the Free Software Foundation version 2.
    # \( `, s( ]2 q) A9 E' N) ~3 O
  18. *$ G/ `+ x" Y* y* t
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - S3 s  C5 L4 W2 g
  20. * kind, whether express or implied; without even the implied warranty
    * a' ~9 b/ ~2 V5 y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 h0 `9 `9 U' p, V/ t
  22. * GNU General Public License for more details.
    9 w: e& p1 u5 {+ ?* c
  23. */
    : e9 ?; P% \# n3 w

  24. & `! B. O/ n7 C1 x' c5 s
  25. #include <linux/module.h>2 Z! `) `9 `( N: z5 t! {; N
  26. #include <linux/init.h>, Z" h0 e# O* k# _0 z- A. K
  27. #include <linux/errno.h>) {1 c/ Q' a& ~
  28. #include <linux/types.h>: A# Z% Q+ f+ L$ r9 c
  29. #include <linux/interrupt.h>$ J! \' ]1 W: |
  30. #include <asm/io.h>& l& V! m8 f) l# P. i- r
  31. #include <linux/moduleparam.h>  c8 k; P7 U3 ?) f; s8 b* D( ]6 _
  32. #include <linux/sysctl.h>
    * }3 U2 K8 z% s5 m5 l5 K' g
  33. #include <linux/mm.h>$ \. m$ c' X3 l! u
  34. #include <linux/dma-mapping.h>* U. m1 Z  c% s/ R0 p

  35. ! R6 G& W% N/ W
  36. #include <mach/memory.h>$ ?& I2 F- `% N- n5 z
  37. #include <mach/hardware.h>$ x# m3 v% K1 L$ E% J
  38. #include <mach/irqs.h>- r- ~3 O1 x+ K* W& k/ u  j
  39. #include <asm/hardware/edma.h>
    ' A- y9 b& [. B

  40.   ]* o* [. v3 n7 t6 V7 ]
  41. #undef EDMA3_DEBUG
    8 h! q+ l$ G- l
  42. /*#define EDMA3_DEBUG*/
    / v* G3 x" g$ O% g- C
  43. 7 g& i' ^% P6 k& E- w3 i( c
  44. #ifdef EDMA3_DEBUG9 C8 t8 Z. ~  P! i' P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 o8 r& g6 U( {" V: S3 \# E8 J* s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . B: r% h8 f6 ^) R3 U: t, ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 k3 N9 T7 L8 v
  48. #else& x. M9 F, o# W9 q* S2 u  I
  49. #define DMA_PRINTK( x... )
    3 b) r0 f8 d& E' c
  50. #define DMA_FN_IN
    % A4 f# T2 Q" A6 d6 T; ~
  51. #define DMA_FN_OUT
    1 _- S/ d1 F6 n/ `3 l. i
  52. #endif# }9 j7 M" v, y( k# Y$ g
  53. % s, G7 ]/ J4 y* z& D& i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& z4 T. l, U4 {3 `- Q3 j+ e2 s0 _- A
  55. #define STATIC_SHIFT                31 d: P. s5 X6 J% ?4 y  Q& J: V
  56. #define TCINTEN_SHIFT               20
    " ~/ ~7 E" \1 Y8 L4 i1 @. X1 ~
  57. #define ITCINTEN_SHIFT              21
    / Z. k& p4 U2 B  V7 v  G( b
  58. #define TCCHEN_SHIFT                223 _: f! X- O/ H- o, ?& e7 {7 O
  59. #define ITCCHEN_SHIFT               23
    0 O% w4 a% }( d7 A6 l

  60. 3 M! O1 f* o; |1 F# E8 s. Z9 c
  61. static volatile int irqraised1 = 0;" T8 b! r7 F: D9 n: O
  62. static volatile int irqraised2 = 0;0 ^6 `/ N4 C  L' |6 L" \

  63. ' M3 g' \& w" t( k) v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  z' j2 O0 E: b" J# J2 X  L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 r. N  }( T) |+ R" {; `4 y! ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 _) Y" h! D* r) t
  67.   c1 O# e/ J$ y; O6 j
  68. dma_addr_t dmaphyssrc1 = 0;! F. H5 K$ V8 R
  69. dma_addr_t dmaphyssrc2 = 0;9 H0 U1 a; D2 A! c) K1 K# ?
  70. dma_addr_t dmaphysdest1 = 0;
    8 W' X7 O# U8 I% l8 S* W- M
  71. dma_addr_t dmaphysdest2 = 0;
    : L- C8 ^: G2 z' b
  72. ) g: J& K0 m3 Q
  73. char *dmabufsrc1 = NULL;
    , ~/ S6 ?! i9 w: L% H
  74. char *dmabufsrc2 = NULL;- h1 P- G& R  }# Z
  75. char *dmabufdest1 = NULL;: h4 Q3 q7 b5 j
  76. char *dmabufdest2 = NULL;. V' h! M8 k* y
  77. 1 {7 I7 V  t" ]0 h
  78. static int acnt = 512;( {  X5 t8 E8 b, }$ x4 f
  79. static int bcnt = 8;
    2 A* m& \$ S7 T. U" v
  80. static int ccnt = 8;
      C$ v" ^3 ~! G) |4 B/ p! F( i
  81. ( ~& J1 Y+ c7 N' ^( d7 i1 R
  82. module_param(acnt, int, S_IRUGO);+ P1 v6 \9 e5 v: T0 J( ]
  83. module_param(bcnt, int, S_IRUGO);
    ( X9 H/ Q& k: f: C, q9 T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 d5 _6 A+ N3 q' p8 D! C0 Y3 q$ V
3 O% F# N2 j* [  g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- k5 I% l, y. r0 c4 i( {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ o8 x8 [( q4 O' S; N. g1 J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ l1 M: }' E' k4 @
) ?8 P8 O/ l0 s( t9 j( W7 g' E( s6 U; i, C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-10 00:53 , Processed in 0.460627 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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