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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; L- G3 k' l7 G
  1. [code]EDMA sample test application% O- G" d5 B) n0 ~, K1 Z
  2. /*3 p) t8 |* ?3 e8 u% s" _
  3. * edma_test.c
    ! ^9 Q: o9 y7 p  N* p
  4. *
    2 H& [8 y7 s6 c2 Y* V8 q
  5. * brief  EDMA3 Test Application2 w; t7 T) g5 q2 @6 R4 q1 [
  6. *3 ?/ G6 }$ Q! O; D/ ^5 Q
  7. *   This file contains EDMA3 Test code.
    1 R; ]8 `$ e4 H. V) K: G
  8. *) G" J8 P. L1 h9 J5 {* a* z5 t5 g6 t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 F5 q& `+ f1 C; i8 d* j* b( s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + L( e2 J* q0 j: G/ [) U
  11. *         TO CHANGE.7 m2 i- c" a; O
  12. *
    6 S. W0 f  C- j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ W6 f- n/ Z  X' j/ ?$ i$ t
  14. *
    2 `3 ?: S& u, T/ g4 A
  15. * This program is free software; you can redistribute it and/or
    , q; a0 N- d1 _
  16. * modify it under the terms of the GNU General Public License as
    0 ^( @8 Z8 w  ~; F0 d) v* p( F
  17. * published by the Free Software Foundation version 2.
    : R: p6 M, G, Q8 u8 r4 X3 c' ~* G9 x
  18. *
    , `( u- y# y1 p8 B- X. I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! z( g2 Q$ ?  f( l" H: Q9 a
  20. * kind, whether express or implied; without even the implied warranty3 \. h6 o2 ?9 N; w. |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      G7 ?6 M  o. l7 @" ?' X6 W
  22. * GNU General Public License for more details.
    0 ^! {2 e) m5 i( d" x/ @9 K
  23. */
    8 P4 F3 l) U0 v5 v' w/ S: d: Y

  24. * [6 G/ V: A% ]1 H8 e$ ^- i
  25. #include <linux/module.h>+ q8 I2 l3 h/ r4 y! w5 f1 B
  26. #include <linux/init.h>- x; r: A8 k* f3 T4 w
  27. #include <linux/errno.h>% ]  F# y8 R4 Q/ o0 V
  28. #include <linux/types.h>
      Q% r$ G7 _( P8 q  Z
  29. #include <linux/interrupt.h>* n* ^6 F3 ^: C% b" n* b
  30. #include <asm/io.h>9 }8 o! k* L9 V$ A
  31. #include <linux/moduleparam.h>
    3 j% n1 D: |3 M9 Z+ R+ q
  32. #include <linux/sysctl.h>3 {4 @. g5 I# c8 {
  33. #include <linux/mm.h>$ U* ?' `, d, d
  34. #include <linux/dma-mapping.h>
    . L& i$ @$ d* V7 C6 w8 i
  35. & n  C2 e; q$ r+ `* K8 N
  36. #include <mach/memory.h>
    + O7 O7 E% b' M& h
  37. #include <mach/hardware.h>
    ; l7 \9 K0 u' s, D
  38. #include <mach/irqs.h>
    / b# i. v+ \7 C' o- B
  39. #include <asm/hardware/edma.h>- B4 d$ R5 j2 D8 }. b

  40. ( [8 _5 L. d) V) _
  41. #undef EDMA3_DEBUG' U6 N$ C; ?" v8 Z' M
  42. /*#define EDMA3_DEBUG*/
    + _3 s/ d0 v( o

  43. ; j/ O8 x. b5 O  I8 k
  44. #ifdef EDMA3_DEBUG+ `& K' L4 \1 O1 [% L. J6 o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : \) a) i, g) p/ ^0 o+ p6 T3 T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 P* C. d  E: W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 a; c7 }6 S  p# z! B, i+ k- w- E+ O
  48. #else' p. b+ A/ T, n8 G
  49. #define DMA_PRINTK( x... )
    5 a& v/ E* P4 {, D3 }" i8 v4 Q
  50. #define DMA_FN_IN
    6 R  `+ I4 n2 F3 b! _
  51. #define DMA_FN_OUT3 e" |5 U8 J% X1 O( p. W7 [
  52. #endif
    4 w  k! o- r* P! J, i! v/ }+ O1 M

  53. 1 p0 q; D+ H' I2 `! j) x/ ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 d) |  a/ @% f
  55. #define STATIC_SHIFT                3
    / ?2 [3 N* b$ V- x+ \! Q2 P
  56. #define TCINTEN_SHIFT               20
    + u) E9 c- C/ i% s7 N
  57. #define ITCINTEN_SHIFT              21
    4 m; h0 R7 w6 |5 `- M- A
  58. #define TCCHEN_SHIFT                22
    + G- G4 f1 D- ]9 O; {) i
  59. #define ITCCHEN_SHIFT               23( _9 }. G) S1 H9 k
  60. ; B. a+ d' D" U, v& s% ]/ i6 [
  61. static volatile int irqraised1 = 0;8 x% B& O0 }9 a. l' o+ i
  62. static volatile int irqraised2 = 0;
    % A% P7 }/ _! V0 i3 N. w0 W7 ]

  63.   W' z! ~% P0 z+ t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 }8 R' ~9 i+ K, Q9 E: V6 [. L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 X% |3 Z8 e( Z* ?! T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 x. p  O$ a9 X8 V

  67. ) I4 w: b2 G( S0 J# c. c1 U
  68. dma_addr_t dmaphyssrc1 = 0;
    9 ^$ F) c: M1 o& z+ F4 n
  69. dma_addr_t dmaphyssrc2 = 0;$ O% a; u6 h+ V8 \+ G, A
  70. dma_addr_t dmaphysdest1 = 0;. M7 u9 e! D4 R7 p* f8 }/ L! m( y" {3 j
  71. dma_addr_t dmaphysdest2 = 0;( y/ {8 F# v8 r) {2 J% M" W7 I
  72. ( M& j; j5 E- Q2 ~  q, ^
  73. char *dmabufsrc1 = NULL;
      o" w; s6 a' d& ^9 f5 [/ k
  74. char *dmabufsrc2 = NULL;( z4 h( i; y8 e4 q& X
  75. char *dmabufdest1 = NULL;3 L' g( L7 X( N0 v0 `0 w% S
  76. char *dmabufdest2 = NULL;! e& V# l; z8 X  ]

  77. % R7 H( w" |0 k, C
  78. static int acnt = 512;: F! k. p$ S; ?+ z6 z5 S
  79. static int bcnt = 8;
    ( N1 a) x0 O; a# P
  80. static int ccnt = 8;: Z. N7 z6 s0 w# o1 f7 |! a1 R, K
  81. / Q! R/ _& F2 r: _
  82. module_param(acnt, int, S_IRUGO);6 k( y7 l! |  }" N. ]
  83. module_param(bcnt, int, S_IRUGO);
    3 k( i( Q- k7 |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' }" U8 O2 M" F1 x- X  ]* U, {

) h9 ^3 \% V8 k. f2 u. B8 z" G      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% {; v: M, B* W" i' R3 \* f" Parm-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' g0 G* S' j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 O( ?9 K+ J& s8 I

/ T' N$ c/ y5 Q  L8 u4 ]
& w- r0 \% {( R: I, y4 Y. U9 U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-11 23:53 , Processed in 0.040274 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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