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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- T& d% u) i, \0 ^$ T$ ]3 Q$ d
  1. [code]EDMA sample test application
    5 G. I; h. v" s! S! U8 J
  2. /*1 X* y* j6 e7 ~" R! R, b
  3. * edma_test.c
    ( Z( t: M1 X* M, ^/ V( n
  4. *
    # _: U- f% R* \( {
  5. * brief  EDMA3 Test Application
      r; P5 d& ]7 o
  6. *  v% p( @5 }5 E6 L
  7. *   This file contains EDMA3 Test code.% X; K& A" g! }! O1 |* N; o4 G
  8. *
    / v  J: S3 y) N+ j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 i' O+ g! f0 K7 }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 @$ m! x. F7 o8 G9 U0 }
  11. *         TO CHANGE.( \5 r  p% u8 E' e
  12. *1 x4 F- b, f( J3 R/ ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 R4 w( D4 O( I2 ^- Q, ~  z6 p
  14. *4 `( k5 o) S3 t# o
  15. * This program is free software; you can redistribute it and/or& i6 E+ M* }7 l% Q
  16. * modify it under the terms of the GNU General Public License as
    0 Y' K& {, F, @: z) v; L
  17. * published by the Free Software Foundation version 2." }! e& I7 [3 O  h8 c) e
  18. *% k* P1 I( K9 [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- f) P3 {1 i& G0 t, r/ V
  20. * kind, whether express or implied; without even the implied warranty* m& ]& W3 ^6 D# w1 U7 q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % F- V2 }' ^( I, l- F, w& ~
  22. * GNU General Public License for more details.
    ; B& s/ w* f' `" N
  23. */! A5 J" i2 k: T# r0 _1 ]# P. z

  24. 2 \: f: x! A5 j* q
  25. #include <linux/module.h>
    $ a% C4 N( o( Y& Q9 J
  26. #include <linux/init.h>
    7 ]$ c! [& y' [) D5 Q! t
  27. #include <linux/errno.h>
    # g; V: n. w8 j4 R4 I; ~# b8 W
  28. #include <linux/types.h>6 ^# m' m3 L2 R! }5 h
  29. #include <linux/interrupt.h>2 q& Y8 Q* x8 H( s* S; `0 Y: y
  30. #include <asm/io.h>
    " N1 @: n1 k" a# T" ]
  31. #include <linux/moduleparam.h>
    ' v) Q! [: p/ N  G' C- ~
  32. #include <linux/sysctl.h>
    . w( F4 l: [5 a$ P7 r4 F' J$ E+ h
  33. #include <linux/mm.h>
    $ N. ~' O) {- k- a
  34. #include <linux/dma-mapping.h>7 p# V- @- X7 |0 v' V1 o3 Z

  35. . y* {, ?# L0 R; \& `
  36. #include <mach/memory.h>
    ; G3 M& e, e$ A! |" _9 G
  37. #include <mach/hardware.h>
    . q* G& L, B) l  [
  38. #include <mach/irqs.h>' L8 c" a: ?) p# B0 I% }3 x
  39. #include <asm/hardware/edma.h>
    # V3 r9 j% x1 m" V4 {9 w9 x9 h
  40. ) n7 r. g! y3 j& w9 T; V
  41. #undef EDMA3_DEBUG8 C8 n5 b; F7 c3 E( s+ j
  42. /*#define EDMA3_DEBUG*/
    1 i& v) ?! c. ?  \* U4 ^
  43. 9 A3 b' h- W/ u. b0 ]$ J( E
  44. #ifdef EDMA3_DEBUG4 m5 @7 J: G' @- M; {! Q) ^5 T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 x7 P+ R! A$ R- L6 P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' n6 J0 \/ ]8 `# N* m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' K) {, L3 F, [) Y
  48. #else
    * l4 x, N; w' s' |0 {5 f, m
  49. #define DMA_PRINTK( x... )
    2 \. [1 a$ g+ n/ p, R5 |+ b8 g
  50. #define DMA_FN_IN' v% H: q+ k' A( h3 Z
  51. #define DMA_FN_OUT. Z! M6 m$ j9 ~
  52. #endif3 ]  G1 d" m9 ]8 E. b; M+ Y$ _' E3 M
  53. ; f" |% ~, u1 _7 D: P' X* E% l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 T! Z6 W' \5 p. D1 e. \
  55. #define STATIC_SHIFT                3. I, |* J' J0 D# O5 V* R
  56. #define TCINTEN_SHIFT               204 L: p( o( m4 B/ `, @. I- W
  57. #define ITCINTEN_SHIFT              21! c6 P( X. q  s
  58. #define TCCHEN_SHIFT                22, V. u' ^% _1 L# F% c
  59. #define ITCCHEN_SHIFT               23
    . p7 Y: |7 d, z: G- B2 t2 e

  60. ; B; p: ~9 f- `2 |1 w$ v
  61. static volatile int irqraised1 = 0;
    - _( r& T5 [6 i: V& D( N4 A7 C
  62. static volatile int irqraised2 = 0;
    " f7 N' x9 y9 I2 a# ~3 `* x
  63. # V5 z; D4 n4 x; ]4 Q& x8 [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / w# P  P/ H; R" d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; n! u7 q, j2 W9 m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 r# G) N$ J, i1 g1 h% D
  67. + U. o% W4 b: N
  68. dma_addr_t dmaphyssrc1 = 0;
    4 k) o; ~3 w4 ?
  69. dma_addr_t dmaphyssrc2 = 0;! y- k1 \1 d1 f1 c  \6 _( t% i
  70. dma_addr_t dmaphysdest1 = 0;; R/ A( d2 k* ~5 r! y
  71. dma_addr_t dmaphysdest2 = 0;
    " k2 f8 S% ?& j: k* x
  72. 5 V. f& k, M6 I" U
  73. char *dmabufsrc1 = NULL;
    9 x' o- ~5 g% Q# r, o2 V
  74. char *dmabufsrc2 = NULL;3 P3 b7 u% _# z! _) o
  75. char *dmabufdest1 = NULL;
    3 _" k$ ]" f/ r1 s
  76. char *dmabufdest2 = NULL;: m( k  X' P6 d7 m7 `

  77. * I- m" a1 \5 f) E
  78. static int acnt = 512;9 @0 q; P- F  X! z9 k( K
  79. static int bcnt = 8;$ ]& u9 P4 q+ Q5 v" G
  80. static int ccnt = 8;
    * L( e* P* \1 ]9 j
  81. # a; ]& C5 S: l2 s8 T6 Z
  82. module_param(acnt, int, S_IRUGO);
    , g4 k, J' c0 X) G( e! K! q+ k# R( I
  83. module_param(bcnt, int, S_IRUGO);
    " C* Y# ~+ h0 O" P" e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& f" W( r1 Y0 A0 q$ m

! t! |3 }8 C% s4 d' {' a" ^      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- V" }! K; ]; k: qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( |, y" |4 I) Q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& M2 }" \. e8 f6 A. L& u8 E, `$ [7 z# c2 r* {9 q. [( {/ v9 l
! ]' p% R7 @! V1 a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-30 22:43 , Processed in 0.038030 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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