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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  q$ v( W. b: T9 h# V- t8 X4 U6 q
  1. [code]EDMA sample test application* L+ A2 i7 E8 T8 Q; `8 g
  2. /** d8 J, j/ [6 i0 D& X9 E0 Y
  3. * edma_test.c
    + j/ S2 s9 R; l6 n8 @) Y& r; R
  4. *
    6 M% a" m* n; ^! ]3 Q+ d% G
  5. * brief  EDMA3 Test Application
    1 K. V1 l7 r& M  M% @4 D
  6. *) n6 P- X6 Y9 {+ i
  7. *   This file contains EDMA3 Test code.3 d1 e9 g7 ^+ {) s# B0 ]) @
  8. *3 Z0 r7 f, q1 w% o: f# b6 Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) ^, Y9 _' L' L, e' @; H6 X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , D8 y* `7 L/ \9 T6 d
  11. *         TO CHANGE.
    1 z, d- o) c! M1 }
  12. *
      H1 Y" n' @8 C8 N2 c4 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 }: n- E9 f1 O1 ?5 F( C2 n7 z
  14. ** k6 @9 D& X: U: v* B5 Q
  15. * This program is free software; you can redistribute it and/or& R# l; n$ w; R  v. W
  16. * modify it under the terms of the GNU General Public License as+ D6 _( ~# T# A5 z3 ~
  17. * published by the Free Software Foundation version 2.
    4 \& A% o6 \" c8 Y! ~1 v
  18. *% i- V4 U9 k2 [! N, q4 Z- H2 K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: Z/ }2 ]$ [2 _8 T; m4 m8 e
  20. * kind, whether express or implied; without even the implied warranty
    6 b( j. q3 s$ ?) `1 |, g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( V+ ?( x+ j! ]  l
  22. * GNU General Public License for more details.% J6 R+ l1 `- Z7 p4 }
  23. */& v9 Z3 N9 \9 y/ P1 Y
  24. , Y: G1 g% L* R0 f0 F* W- T; n
  25. #include <linux/module.h>& A  M: P8 }* P, a
  26. #include <linux/init.h>, E5 L6 d2 r$ Q7 }1 u6 t! j+ Z
  27. #include <linux/errno.h>& p3 S6 v0 v4 H9 }  K! d
  28. #include <linux/types.h>
    " O. ?: y4 h: V6 e7 m
  29. #include <linux/interrupt.h>$ M4 c, e- \  l+ D
  30. #include <asm/io.h>
    6 m+ M$ n* C( G" t% k
  31. #include <linux/moduleparam.h>8 s. w$ u: L  U
  32. #include <linux/sysctl.h>; k' o; |' E/ {; e, b! h
  33. #include <linux/mm.h>9 {; f  E6 s# t
  34. #include <linux/dma-mapping.h>
    ) S/ n5 B$ Z" A* ^% G3 I

  35. 9 J1 k: `- Y9 ?) T4 |" K
  36. #include <mach/memory.h>
    % f7 e. r. Q3 @1 o' q
  37. #include <mach/hardware.h>4 B( f+ I2 v6 ?  q( d5 W
  38. #include <mach/irqs.h>* Y6 m# E$ {4 Q% \6 \" m
  39. #include <asm/hardware/edma.h>
    ) B) N! t9 c4 h3 j
  40. - R, ]4 `5 P: w4 v
  41. #undef EDMA3_DEBUG
    9 W9 P5 ~( D& _: P8 g
  42. /*#define EDMA3_DEBUG*/
    0 N# F  ]7 J( @1 R3 E7 L
  43. 7 E" N7 H+ s4 |4 R  \
  44. #ifdef EDMA3_DEBUG' @' Y) D1 B  L5 I. L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ p; S  J- a: i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 A6 O5 g9 i6 z3 }& N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 o! M) T3 y5 J3 C
  48. #else. I1 A  c0 i- @3 [$ s# _9 i
  49. #define DMA_PRINTK( x... )
    4 ^' Q( `. L/ ^* |8 ^- P' J
  50. #define DMA_FN_IN
    6 b7 p7 c- t5 T. v! a
  51. #define DMA_FN_OUT
    # W$ M" {6 _" n+ I4 i3 I
  52. #endif* D0 y% Y) M9 i

  53. , Q3 u3 K% D5 [. Z  S  C1 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # w+ a: \( B6 I1 T* x/ c8 l
  55. #define STATIC_SHIFT                3  q/ v& c* k3 f3 s6 U
  56. #define TCINTEN_SHIFT               20
    8 y6 R* f) E! p+ e+ a
  57. #define ITCINTEN_SHIFT              21
    " D3 L6 t# I; c0 m; S) ^
  58. #define TCCHEN_SHIFT                22/ h& g. Y7 y1 u8 K% `* n
  59. #define ITCCHEN_SHIFT               233 W( s3 @  n1 `, U( d/ f% \

  60. 0 t2 ]' x: U; d  ?1 o; `) t, U  _
  61. static volatile int irqraised1 = 0;, t. Z' X" g; A# J( G9 v
  62. static volatile int irqraised2 = 0;. h3 o7 C+ K) v& D  }; K& ~& Q

  63. + {) e+ C) f2 g% k, \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 k: X' Q" l6 V2 K% a2 r6 p. h9 r3 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 s1 m  E  Q2 Q: s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. e8 b- ]8 A3 A3 J* u( P& M

  67. * b& ?: f8 _3 e" j- f1 @
  68. dma_addr_t dmaphyssrc1 = 0;/ ~* i" ^! i7 y2 [
  69. dma_addr_t dmaphyssrc2 = 0;
    ! H. ]% L: E  a
  70. dma_addr_t dmaphysdest1 = 0;: s  W' x- _" _) B0 Y$ @1 X2 i
  71. dma_addr_t dmaphysdest2 = 0;
    ' u0 o- l0 C9 F7 f: w4 S. }- w0 X
  72. # M. @  _  T4 S1 V9 Q: I/ b
  73. char *dmabufsrc1 = NULL;" ~) A+ p. ~& h( l0 N$ Q  }
  74. char *dmabufsrc2 = NULL;3 s7 H' S. W5 o/ K- x
  75. char *dmabufdest1 = NULL;# Y+ B8 p6 w# s2 \: b5 X
  76. char *dmabufdest2 = NULL;
    + F" `& B9 ~3 Y. z( l- `' N4 L

  77. 3 v+ O! ?2 B& ]5 w  b8 U; I
  78. static int acnt = 512;  j* \& p$ v3 O% M' i6 b
  79. static int bcnt = 8;9 ?- B4 I" y- v* Z9 @) p7 x2 x5 l% {! }
  80. static int ccnt = 8;. j8 U; b( Z# {2 h
  81. 7 B' u) z  l! u2 r$ m( i7 U4 l
  82. module_param(acnt, int, S_IRUGO);
    ' J! n. s$ d  G. j, O( U# X4 P7 L
  83. module_param(bcnt, int, S_IRUGO);
    7 O9 Z" Y' O0 d; {  R6 _3 e; @3 x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 t( ~1 |2 y0 Y9 h% K, c

9 e. h8 r  J! Y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) n: d" _- [: }9 r& d* S4 tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# D5 h7 W" ?6 \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& b, N6 B  B; @6 J. L/ g# W$ k
5 B2 C3 u1 a  B7 H/ a
8 ]# k2 I* H8 k: f* o& B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-19 01:15 , Processed in 0.042669 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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