OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* Z/ U( _6 F$ g3 h) S4 s
  1. [code]EDMA sample test application" l3 r0 h# i6 [; I" p/ y! n5 V
  2. /*  ?3 L' L  R- ]+ M
  3. * edma_test.c, Z' C' m4 L: x$ h: E
  4. *0 U. L: k1 \' t
  5. * brief  EDMA3 Test Application1 p) W2 D& N$ g! \( p1 r: b$ \
  6. *  a4 Q* i/ i* a& c3 M) x4 n
  7. *   This file contains EDMA3 Test code.! p4 @' d: V' {+ l) r6 ?5 C4 i
  8. *' C0 y3 P+ e8 W4 l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , H5 Y% o7 [* `# `- U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . V0 A0 n3 w* M1 D) E/ L. k5 l
  11. *         TO CHANGE.
    ( i9 W6 a; q: g. p" {
  12. *, u* E' u% P! P5 A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% @5 j9 A; j+ T5 A8 Q
  14. *
    / P6 F% N" V. x# }
  15. * This program is free software; you can redistribute it and/or( Y: {$ X6 \8 ~* x' p- O0 ~
  16. * modify it under the terms of the GNU General Public License as4 u3 y) q( E5 t2 G
  17. * published by the Free Software Foundation version 2.; }& K2 C- Y5 D; r
  18. *
    4 b( i1 w  l# p7 `% F/ M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! l5 J/ c7 w  V5 x; ]/ [9 f
  20. * kind, whether express or implied; without even the implied warranty, l6 {2 c9 Z# s1 C' K& y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ A0 T% V# L; R' q5 X) M1 e
  22. * GNU General Public License for more details.! p. K* o7 |* Q* B! i/ i1 J* A: v+ K
  23. */+ i4 }! H2 ~0 j. W0 K
  24. # t  O) c' Z. [
  25. #include <linux/module.h>- r9 B) \6 i6 L: O- K7 ]
  26. #include <linux/init.h>
    ! ?1 ^3 c, u- J( R$ ?5 d7 E, i8 n
  27. #include <linux/errno.h>5 _8 u' [, i* t1 d# f  m
  28. #include <linux/types.h>8 @$ s" W; ?  U; J
  29. #include <linux/interrupt.h>1 w9 Q9 F; [; ~0 s+ N# ~
  30. #include <asm/io.h>' J  O4 r/ P+ C! X6 Z
  31. #include <linux/moduleparam.h>
    . p+ t: Y1 R$ o  }" F2 P5 M
  32. #include <linux/sysctl.h>
    $ D1 q- x  h2 ^$ a/ {  Y
  33. #include <linux/mm.h>
    - y7 b, Y: \9 J2 ]3 S8 q, O" v
  34. #include <linux/dma-mapping.h>
    8 k2 ~; d* `) v2 M
  35. , K+ Y, M8 D# K  H
  36. #include <mach/memory.h>
    - a! F+ o: B$ y+ M
  37. #include <mach/hardware.h>
    / K- ?7 d; i& @" R) R7 T
  38. #include <mach/irqs.h>7 f8 N0 D( z$ E* p2 g. b2 f
  39. #include <asm/hardware/edma.h>/ g  @3 W6 o; K$ G
  40. 5 I; ~. ?) T4 w$ |* J
  41. #undef EDMA3_DEBUG6 D! ~1 ]& B" {  k) A' E% L
  42. /*#define EDMA3_DEBUG*/8 G, G" b  n$ U6 B& K$ G

  43. / j& t9 A9 R6 |" r# u# W/ Q  ?
  44. #ifdef EDMA3_DEBUG
    6 s# N9 a0 P! ?2 W4 J7 z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 w1 i' }. s5 a* k7 y7 g2 _" _# u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 ^- Y/ t9 L' t% z! ^; C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  b/ Q0 K3 t) q6 b
  48. #else% V3 o4 A) Z$ \8 D0 w' E9 J# y9 H
  49. #define DMA_PRINTK( x... )
    7 y- |) k0 ^) p. y/ c
  50. #define DMA_FN_IN; @8 |. b$ e! y+ K* f( r# l
  51. #define DMA_FN_OUT
    + F! N( P/ X) b2 _; b, ]5 S$ ~4 y
  52. #endif
    ( u+ j2 r5 l0 @, T3 |( h

  53. 8 h% {2 E+ R% u( u1 p) C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 j1 G1 s2 N$ h2 S/ s* D
  55. #define STATIC_SHIFT                37 Q% m0 u- Q, f, \( k
  56. #define TCINTEN_SHIFT               205 G, [; w+ V: u; }
  57. #define ITCINTEN_SHIFT              21
    2 N3 f6 K  |& S% K& m, x2 q
  58. #define TCCHEN_SHIFT                22- s' u6 K" G1 y* m3 E+ x6 s3 G
  59. #define ITCCHEN_SHIFT               23  B3 |5 A  s3 H$ T

  60. 7 F% n5 g) v' u" T3 f& K1 s
  61. static volatile int irqraised1 = 0;
    . R+ W5 R6 B, Z* S
  62. static volatile int irqraised2 = 0;
    9 m6 x/ a( K/ O$ S
  63. , ~8 K" D! X6 a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 u4 `  }) }2 b: v, Q/ H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 f0 Q7 p/ o* w" P* ~3 Q: W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / x% W$ W+ F$ t0 l. X. x; }

  67.   v) E  {* O6 f8 H* e" p
  68. dma_addr_t dmaphyssrc1 = 0;8 d0 D1 ^6 |  N3 |
  69. dma_addr_t dmaphyssrc2 = 0;0 V0 U0 f& X3 I9 o$ W
  70. dma_addr_t dmaphysdest1 = 0;3 \  }4 o, P3 g0 X$ Z
  71. dma_addr_t dmaphysdest2 = 0;
    8 x2 _: {2 x9 V' p) @+ Q. c2 |7 D/ j

  72. 0 u! c7 D: K2 ]! J# F. o0 r, F
  73. char *dmabufsrc1 = NULL;1 f( i  m* }6 y% Q
  74. char *dmabufsrc2 = NULL;
    . i4 i# t8 }# e# i6 p- B
  75. char *dmabufdest1 = NULL;0 K1 y& c- O% D7 V1 `5 m3 c
  76. char *dmabufdest2 = NULL;# Y8 c1 ]* L6 D: F; A5 j* B
  77. - X9 A8 j" r2 D% u) [  ~
  78. static int acnt = 512;
    & M, T5 ?3 g) t! e7 a8 u
  79. static int bcnt = 8;) G" L; {4 F8 n3 }5 [3 `3 n- y
  80. static int ccnt = 8;
    * J& h: u* s* j. w5 y

  81. ) L" O5 z( J; M
  82. module_param(acnt, int, S_IRUGO);
    ( \9 Q6 B4 U* R
  83. module_param(bcnt, int, S_IRUGO);
    . r; a, `: t5 _) l* F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; D  X- v/ B5 \5 m' J2 O/ g- i- g" T1 a; ?" P% V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. u. a8 b4 f& e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% B3 P2 e- L5 l; l1 i& b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 Q6 D/ }7 `# n
: M6 _; t; _! R% A6 W1 e% _7 X

2 X6 y* m0 _1 {: U4 I6 ]7 v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-9 12:37 , Processed in 0.035379 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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