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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( u0 E) v+ w8 g3 s  r: X% Y( H
  1. [code]EDMA sample test application
    6 y4 n6 T- f" S* `7 w
  2. /*
    3 l, Q: w# H6 Z" W5 g4 N( ?
  3. * edma_test.c9 i5 r8 g8 N4 q5 z5 O9 j
  4. *0 t! I/ V2 v" {6 \8 U; a$ c
  5. * brief  EDMA3 Test Application
    6 \$ \8 Q" Z, ~3 S2 _
  6. ** P/ P) f2 C" Z. W
  7. *   This file contains EDMA3 Test code.
    5 o- M7 ]" p" _( J; w% E5 i$ c1 w, \
  8. *3 A4 [& f# j% |  H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& R/ K9 B1 s8 A6 k# }5 U  k. y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! u9 u. H& V, ?
  11. *         TO CHANGE.
    - K" ~! O9 V4 S/ M- ~/ c. _
  12. *5 @+ b; r9 E/ |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 e: ^: d6 N' L/ s
  14. *! o) [# r& Q+ h# \
  15. * This program is free software; you can redistribute it and/or
    0 M7 y4 _5 `# b
  16. * modify it under the terms of the GNU General Public License as
    & s+ A# J* z$ B  R. R
  17. * published by the Free Software Foundation version 2.
    9 x- e* v1 ?+ G$ L0 S& @+ C
  18. *+ T+ e# P' A$ d: h9 ]2 o1 l  f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 H% Z8 o& @1 P7 D8 u! y2 b& Q
  20. * kind, whether express or implied; without even the implied warranty' l/ G, ^$ n! N+ R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 m  Y! X4 @( z! Z: k  p) X
  22. * GNU General Public License for more details.
    1 u- U$ K" P" \# |
  23. */# g& w  D( P2 I! ?9 Q
  24. & ?+ p6 G3 z1 S) D3 Z
  25. #include <linux/module.h>
    + C1 o) f  g' K0 Z% g. e( q/ X6 q4 H
  26. #include <linux/init.h>
    7 y" Z. E0 J) y8 P7 A! M
  27. #include <linux/errno.h>" \  r$ r3 j% o
  28. #include <linux/types.h>' v3 _  v1 N$ b) v8 I* c. q
  29. #include <linux/interrupt.h>
    - K- S  a& |: u
  30. #include <asm/io.h>. w, i" d) d! E! C  A/ O3 D) B
  31. #include <linux/moduleparam.h>
    % ~; ?3 ^4 o5 V  v3 }( e1 C
  32. #include <linux/sysctl.h>1 Q5 K( C, N' c* }
  33. #include <linux/mm.h>
    1 }* v- }% O/ B2 U5 F8 o
  34. #include <linux/dma-mapping.h>
    2 y" N" }+ f' l* X6 p$ a. b& ^
  35. 9 C' C, F0 e5 s1 P' t7 ]% z) u
  36. #include <mach/memory.h>4 ^3 H+ H; n! S/ i2 [8 f2 ?
  37. #include <mach/hardware.h>
    ! l# Y% _7 M. A( Z7 T6 @8 }
  38. #include <mach/irqs.h>
    6 i4 d! \1 l: B6 F
  39. #include <asm/hardware/edma.h>
    + f3 l" A2 x) O+ H: U- M. x$ m( U+ e
  40. ) o" M8 e' W. }2 A
  41. #undef EDMA3_DEBUG- \+ ^9 V+ ~5 o/ K; o$ Y
  42. /*#define EDMA3_DEBUG*/
    . _" e! g' l0 j% j) |

  43. $ F2 c, \3 ?: z. u5 j
  44. #ifdef EDMA3_DEBUG% R2 k, P% c; e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ {- u! M+ J' c4 S& k2 L! I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! a5 q8 M2 y/ I! r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . A! c4 l, B5 E& E+ U# l" ~* e
  48. #else  a! g6 Y; U7 y% P, p. J! _/ }
  49. #define DMA_PRINTK( x... )
    . X( l( z& X6 o! j' W
  50. #define DMA_FN_IN- d# G) [0 l  f5 O. B( G
  51. #define DMA_FN_OUT* q* E6 Z! n( j! f+ R+ ^) H
  52. #endif6 V5 K+ r: X7 x0 n! p
  53. - Q3 D- K% {% Q, Z0 m  u$ ?/ V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 {" N/ S) `7 O* z. V8 `5 L, G# \
  55. #define STATIC_SHIFT                3
    9 V; a# G3 P( y! _! r6 \& @, ^
  56. #define TCINTEN_SHIFT               20; _) H; }  Q$ Y" l( `0 O
  57. #define ITCINTEN_SHIFT              21
    , }! {& ]0 N/ }6 e9 R0 i# e6 R- m
  58. #define TCCHEN_SHIFT                22
    5 w- N+ W% V1 l% M
  59. #define ITCCHEN_SHIFT               23
    / J9 p, i0 @* c9 j# k3 u

  60. 7 n0 Q9 D! M0 `% Z
  61. static volatile int irqraised1 = 0;
    , X8 {, q! D0 l# {' c; N
  62. static volatile int irqraised2 = 0;. X* @$ R8 A, w. w+ ]3 W

  63. 7 R( N4 X% X+ d0 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( L& x+ B% V9 m& ?7 z9 ~4 u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! m+ `( y( `9 D8 ?( @8 W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: v4 A" Y* `: z8 `
  67. 8 ~8 t! S5 X( Y+ H! g7 v& {5 i) D0 ?
  68. dma_addr_t dmaphyssrc1 = 0;
    . Q& ~" M8 x8 k; X
  69. dma_addr_t dmaphyssrc2 = 0;
    6 D  Y4 Y# X9 g$ j( z
  70. dma_addr_t dmaphysdest1 = 0;9 K9 \% e  _- [, s, C% U# V
  71. dma_addr_t dmaphysdest2 = 0;; {  j% E/ d9 C/ d" t$ z
  72. 1 Z, n! q( u9 j. r
  73. char *dmabufsrc1 = NULL;1 K/ t- [" ~$ R. Y
  74. char *dmabufsrc2 = NULL;
    ' T/ d! i, V% A: m+ [# @
  75. char *dmabufdest1 = NULL;) f  A; u; S. l$ A
  76. char *dmabufdest2 = NULL;5 e  q( g- G+ A% T: F: h. F

  77. ; g, s" e& f6 Q- R4 X( e) \
  78. static int acnt = 512;
    0 y  T$ |  m  X1 e3 h
  79. static int bcnt = 8;0 b1 e/ E& W4 m
  80. static int ccnt = 8;/ }& R' c3 \, l! V
  81. $ N* @  r- N8 b& R7 h
  82. module_param(acnt, int, S_IRUGO);# y8 W/ v4 g# D; h* ?
  83. module_param(bcnt, int, S_IRUGO);
    ' O2 O$ n- L* K
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  ]) v) e3 Y3 `" U6 o6 Q% I1 m
: _% f% `7 A8 L
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" v2 R  O6 H/ k! F! Y6 m- K) ?  zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, V% D) `% U2 Y4 h5 x9 `/ q5 M" @4 L     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 K# Z: B. X" Z! i3 u/ ?1 b. X1 Y: ^6 T  r- j7 d* [
6 C1 t6 u. l2 I5 R7 L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-7 12:21 , Processed in 0.049732 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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