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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. R! c0 `' P1 `* A' k0 ~5 M! W
  1. [code]EDMA sample test application
    6 j* _3 w: G1 J2 o, L: b! e
  2. /*
    ' N) o; B. M2 S# v! H6 }3 K; j
  3. * edma_test.c
    ) t, ~" s) V% j( O2 X
  4. *6 J' F& n7 Q6 D& N
  5. * brief  EDMA3 Test Application
    0 ^# P3 B) E/ n
  6. *
    , g6 e2 T3 w- j4 B  A
  7. *   This file contains EDMA3 Test code., `5 W: W+ H& ~. ?! K0 r) c* |# ]3 D
  8. *4 P" c6 x: n  [5 c# E  z+ I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 l" n% k& t; d  Z% n5 a9 r( G5 \+ k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 `1 z+ U5 S: z7 D5 q- ~2 L( |& I8 j
  11. *         TO CHANGE.
    - K+ K$ w+ h& {* M
  12. *
    ; }3 q/ r- K- J0 k* [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ f. m* z' K+ T$ c( [/ Y# S) z
  14. *6 _) h8 H. J) j- v3 b) Z: s8 W  G1 b
  15. * This program is free software; you can redistribute it and/or
    0 X% @( P1 [* ^9 V. \& j9 F
  16. * modify it under the terms of the GNU General Public License as
    0 U) F5 e% W, N: ~( e- |
  17. * published by the Free Software Foundation version 2.+ r* w8 V. R7 d7 @6 C$ W& ]
  18. *% O; m7 ?9 M* f. v& w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / @7 s) |8 O6 f8 v! e1 b& x0 F3 I
  20. * kind, whether express or implied; without even the implied warranty2 U" I1 _, s* e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : A( t: t7 \0 \% ?: f' E
  22. * GNU General Public License for more details.
    ) {" P6 K  r  O- K
  23. */
    8 y5 N9 o; U9 x5 k# V

  24. 3 n  B7 S0 j  x
  25. #include <linux/module.h>
    + R& G  v+ k& e: y& C; t- I  m6 ]
  26. #include <linux/init.h>' k; R- E! I, F- x- g. {5 V9 D
  27. #include <linux/errno.h>
    2 Y, @- _1 z8 z
  28. #include <linux/types.h>
    ( ]8 A8 h( f' C1 x; h( e
  29. #include <linux/interrupt.h>4 f# l' k$ R5 w5 L; A% l6 F1 j
  30. #include <asm/io.h># }8 s5 Q+ ^$ ?# o) e4 e
  31. #include <linux/moduleparam.h>
    # `8 ]' D' f" F8 o
  32. #include <linux/sysctl.h>$ a7 g: i; M) l; d. I( G
  33. #include <linux/mm.h>
    , Y' K. `6 Y" M$ L5 d1 X& X
  34. #include <linux/dma-mapping.h>
    3 |3 U  M! k; k# H( x, o  V

  35. / [; u- q; ~) |! \# B2 F6 C
  36. #include <mach/memory.h>
    ) ?* d: w; ~) c. b" H, {
  37. #include <mach/hardware.h>; g7 ?9 Y, }' m; G( R
  38. #include <mach/irqs.h>
    6 ^- W. U8 z2 J! ~
  39. #include <asm/hardware/edma.h>1 o8 `1 ]8 t* [" j

  40. " ?% C+ h. [: m& q$ L! q
  41. #undef EDMA3_DEBUG
    5 s( ]4 a5 m4 Y& H5 w1 S
  42. /*#define EDMA3_DEBUG*/
    1 `) Z$ t3 u. y& Q
  43. ) l+ R! ?% p: r
  44. #ifdef EDMA3_DEBUG) s) F0 e1 p( }" D" P( M9 \. X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 `+ e; G1 S" F. I& ~- h. i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ C6 R- ]$ e* }/ s7 R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 f# E4 z9 K* Q, ?1 y
  48. #else
    6 ?. r* ]- k  ~1 k. }' k9 W
  49. #define DMA_PRINTK( x... )
    * i8 @1 {3 R' G3 J* ^. [1 ]/ l4 F
  50. #define DMA_FN_IN: \7 {2 B: L0 E
  51. #define DMA_FN_OUT* n5 u$ N& V! |. ~
  52. #endif  q- b+ J- n. p2 ?( C# t: r4 Z

  53. $ O7 J) W2 l8 e6 B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 w& p% i7 G: ~, k6 F9 E
  55. #define STATIC_SHIFT                3
    2 s' F) Y3 h& y' D6 f5 C$ t
  56. #define TCINTEN_SHIFT               200 E: k: t3 p7 ~3 K, P, `
  57. #define ITCINTEN_SHIFT              21* l) x7 O( C4 N4 l
  58. #define TCCHEN_SHIFT                22
    # X- P0 N! }$ g, l6 ^' {
  59. #define ITCCHEN_SHIFT               23
    1 `: L, p% F) ^) A2 P% I+ I

  60. # `' l8 o/ q3 o3 X+ [4 p
  61. static volatile int irqraised1 = 0;
    4 ^* I, T7 ]3 {+ Y
  62. static volatile int irqraised2 = 0;8 E$ P2 ]8 b- p9 g5 Q
  63. " m; g9 s4 B9 d% V* T; V. b) n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 I( [5 p& ^0 N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # G3 x& r9 `$ ]7 W9 I: {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 `# n. G8 C8 U9 \/ E4 d

  67. + l: K( r) z" c
  68. dma_addr_t dmaphyssrc1 = 0;  @9 K" w* p1 k8 E
  69. dma_addr_t dmaphyssrc2 = 0;
    5 P- S" T( d. B# K8 R# u% |
  70. dma_addr_t dmaphysdest1 = 0;' E# @, r4 Q) v  N" o/ y  c
  71. dma_addr_t dmaphysdest2 = 0;
    - W" c( Q" }5 c- [; R; ]5 Y

  72. 1 C% y' k! S  ~  p) P
  73. char *dmabufsrc1 = NULL;
    9 P* D% o( {% I, [7 b! F
  74. char *dmabufsrc2 = NULL;
    # a- R. B4 u6 d& e
  75. char *dmabufdest1 = NULL;3 x, r" N* o0 G- [* _$ N+ w7 M) a
  76. char *dmabufdest2 = NULL;% K. k& R& i; \, V: T3 R

  77. 4 [$ x5 N, n  p- Q
  78. static int acnt = 512;
    % i8 v7 _% M  T: O
  79. static int bcnt = 8;
    5 J: {, L2 g2 T2 ?; i4 |8 H% l
  80. static int ccnt = 8;
    * P( J0 S- M# e+ R
  81. $ Z& }) r- J. D$ C2 F8 o0 o
  82. module_param(acnt, int, S_IRUGO);: O/ F* O1 Q+ g+ Y! Z
  83. module_param(bcnt, int, S_IRUGO);
    8 r6 y  s  N6 g$ v0 n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ C/ j5 ]6 k% ~1 F$ u1 ?3 B( }
, g0 P6 H: S3 J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, J% J% }2 @( 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 P) O' p, r( ~/ V1 u. k- d- }1 @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 s" N* j9 |  w1 \. L' e, a9 C

9 v9 h/ I/ I3 Q4 Q! D# K- P! {/ V5 F5 [6 {* R. A1 B9 {- @" d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 10:22 , Processed in 0.037768 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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