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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( L8 z1 I- C7 h6 D6 M
  1. [code]EDMA sample test application( w9 B' b, C  q: v6 I
  2. /*6 f. ?. y1 J( y$ p$ Q. C( R
  3. * edma_test.c
    # I7 H( H  e8 U! `6 G" Q
  4. ** g6 i& `! K3 e
  5. * brief  EDMA3 Test Application' z' |; A5 L. n" q2 z+ d! b- R6 M; D
  6. *) G7 s! B# f% R: a6 A3 T
  7. *   This file contains EDMA3 Test code.* g3 V8 H0 |) c4 v
  8. *5 s- }: s0 y5 n$ B  Y  p: f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ Q9 S; n2 R) @3 ^3 {; o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . y2 H6 k% N) P" G2 J7 g# B$ h* b0 d
  11. *         TO CHANGE.
    8 A# g0 v6 _4 M# g) r
  12. *+ ]5 [4 T9 m6 `* [# m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " a* _) N; T/ x% A. ~
  14. *
    & T  w/ s7 c2 L0 S
  15. * This program is free software; you can redistribute it and/or2 O2 |) }: w3 l
  16. * modify it under the terms of the GNU General Public License as6 W, T0 |& U/ |. ]1 Q  Y0 P
  17. * published by the Free Software Foundation version 2.
    " {5 x; I! i" \7 F
  18. *
    0 M) F% Y8 w" }; s8 v3 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; b  g, r- l; x: y3 f
  20. * kind, whether express or implied; without even the implied warranty2 x  e# {6 \4 I& \/ c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 H6 J0 k" O3 [, r# c+ P# g
  22. * GNU General Public License for more details.: ^, p) n; Q+ |; ]! n+ s% f
  23. */
    1 ?2 h! a) ^) C* u7 u% t. [0 z  d

  24. 1 P+ b* s0 \% g5 A/ _
  25. #include <linux/module.h>
    - m4 n  b( G% P) j  u% Y) d
  26. #include <linux/init.h>
    $ e" N) E7 ]% }  h) g4 v0 N$ t
  27. #include <linux/errno.h>
    + A7 G/ Y7 R6 y- ?) s6 Z& k# S
  28. #include <linux/types.h>, h# u' U; Z7 P
  29. #include <linux/interrupt.h>% n5 l% B/ F- }' O& [; R
  30. #include <asm/io.h>
    # y1 x4 \' d4 F- o$ s$ x
  31. #include <linux/moduleparam.h>
    + r9 Z6 I: ?$ P8 A
  32. #include <linux/sysctl.h>
    9 g6 C- T" r: I
  33. #include <linux/mm.h>
    5 I7 c* \; X( Z
  34. #include <linux/dma-mapping.h>
    ) |9 b% j; z, M) e7 k
  35. : p/ J/ |9 j& Z, r  x" d* K: A
  36. #include <mach/memory.h>
    ( F* U! y. U$ h# ~
  37. #include <mach/hardware.h>5 t9 {5 K8 |, }3 `& r5 E
  38. #include <mach/irqs.h>
    5 C0 h0 _0 ~' p+ |1 J- M( }( i  n
  39. #include <asm/hardware/edma.h>& L& ?$ E9 z8 {. m1 j! T
  40. : t0 U4 b+ F% \* n7 D/ n* [2 M2 [
  41. #undef EDMA3_DEBUG
    : Y5 Z% {' P2 ]
  42. /*#define EDMA3_DEBUG*/8 b% ?, |: T3 B9 `) M" H
  43. / g! o7 y& }; ~9 ?0 Z' W2 E% f
  44. #ifdef EDMA3_DEBUG
    7 A; Q! p2 `3 ~2 W8 `) @7 j2 E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): U( e. c5 @3 Y- J9 G9 Z2 g" z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), s# ~. p+ R7 X- C8 {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 C8 H9 H0 ~0 a( s
  48. #else
    7 ]+ t8 M4 K5 ^1 S0 l& o
  49. #define DMA_PRINTK( x... )/ ]0 t1 }3 L+ [( {6 V1 j
  50. #define DMA_FN_IN4 _* r$ g  q7 w7 ]
  51. #define DMA_FN_OUT) }4 k/ [* d7 s
  52. #endif1 k8 B! p7 p& I
  53. & O  u; Z2 A1 Z; s! r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ Y" u: d" I' ]
  55. #define STATIC_SHIFT                3
    - S! ]0 E! v+ v& X
  56. #define TCINTEN_SHIFT               20
    6 n8 Y. q4 P% p, k% \, T% J* t
  57. #define ITCINTEN_SHIFT              21( f- d) q4 T1 i" W" m5 N" ?
  58. #define TCCHEN_SHIFT                226 v5 J% }) Z4 N5 j
  59. #define ITCCHEN_SHIFT               23$ h# x- R6 W; U# r5 y

  60. % V7 T; a- L$ x7 A! B0 V# Y
  61. static volatile int irqraised1 = 0;
    ! [7 @, A. Y; Q9 i. B4 t: {; {/ g5 {( k
  62. static volatile int irqraised2 = 0;4 V( r, u1 `) c. u
  63. / j2 L- M1 G& `2 w5 N$ g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; `; v! w; H" O1 n' s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 f2 x8 m1 @% A5 J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' ]) ~) o, [/ c1 U. |4 S2 x( O" r' b

  67. & p) j( R0 x+ E3 v
  68. dma_addr_t dmaphyssrc1 = 0;
    - B9 u( c0 c/ C3 r6 c0 |. b: b- L
  69. dma_addr_t dmaphyssrc2 = 0;2 G& ]7 T: I- ?' X5 Q% t
  70. dma_addr_t dmaphysdest1 = 0;
    $ |' b  K' u% m5 f  q
  71. dma_addr_t dmaphysdest2 = 0;
    : x5 _, Q! Z% m3 H0 D" W+ L

  72. , d4 |( @" [9 p; x8 S8 l9 I
  73. char *dmabufsrc1 = NULL;- O" k- ?) |- H6 M
  74. char *dmabufsrc2 = NULL;4 P. T3 y0 a3 y9 G$ y, o3 g# z
  75. char *dmabufdest1 = NULL;# G. w. `" ]. e6 h7 q/ J( H
  76. char *dmabufdest2 = NULL;& i; J5 c/ e: S3 I3 H

  77. " i) A8 z/ p: a* i& j6 }
  78. static int acnt = 512;
    ) c4 k2 S# x+ M8 ]+ S5 U
  79. static int bcnt = 8;* J) o8 v/ W( r3 E' K- |1 a
  80. static int ccnt = 8;
    1 u' n# L1 S$ ~* |4 C

  81. 1 Z  x: b2 Y/ c
  82. module_param(acnt, int, S_IRUGO);
    ; _2 ^* A4 F8 m4 o) K! v
  83. module_param(bcnt, int, S_IRUGO);1 c1 D+ C: `* R4 T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 P$ k! c+ {1 Z1 U4 m, n; C: A8 t

1 Q* i+ c% l/ s! Z! z# ^( h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" G9 ^: j  D, @9 l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 ~! \* G0 n9 D! r/ `/ g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ b' V+ n7 T  ~* f3 w; i

* l) T5 d4 t! H
* e+ S& p8 L( [* m/ }; m& k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-26 12:46 , Processed in 0.044292 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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