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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 h" p, X0 X$ m5 {$ X/ @; o
  1. [code]EDMA sample test application
    6 r4 a4 I9 w( l
  2. /*
    9 g5 Z/ i1 I7 _$ ]
  3. * edma_test.c
    ' O# |7 R7 T) A2 Y0 q. H
  4. *  W# O* K, o  x& O
  5. * brief  EDMA3 Test Application7 t# V. P) i7 L" }
  6. *8 f- c+ C& r5 J' c3 a
  7. *   This file contains EDMA3 Test code.
    8 Q5 B& C+ f9 ]  u7 S# L
  8. */ m0 h# x. l0 I3 z! G) `7 f$ o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ p8 `1 D. S3 C, @5 H! n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      p. _# N5 c0 [7 W
  11. *         TO CHANGE.
    5 m3 F0 S1 D3 o' S  U, }
  12. *+ f0 t) v2 U$ h' ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ _) h/ u- R! Z3 }
  14. *
    ( H& e' H% D8 n- V
  15. * This program is free software; you can redistribute it and/or0 M4 M- b5 m, G3 J! X
  16. * modify it under the terms of the GNU General Public License as
    / t1 ~+ G4 f$ c% O
  17. * published by the Free Software Foundation version 2.
    : P( h3 J2 _, z4 D5 V* H) M
  18. *3 N4 H. z5 t  i  F9 h$ s" w& c! F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; b) G, V  O& _. _2 E* Q6 b8 B
  20. * kind, whether express or implied; without even the implied warranty6 L' X) l8 _: e( z9 n5 ~" @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 x) C+ P+ B! k' J8 B9 y7 t
  22. * GNU General Public License for more details.
    5 B  D& J" e" u, A
  23. */  B8 E+ ?) U9 H7 H9 i4 s

  24. 4 K) y  d! u( n
  25. #include <linux/module.h>. m8 L% h6 F* v
  26. #include <linux/init.h>- q, V7 Y% g+ c
  27. #include <linux/errno.h>
    : Q& I  b5 C8 ?9 w2 B0 ~
  28. #include <linux/types.h>8 {7 R# k( s3 ?: h( c
  29. #include <linux/interrupt.h>
    / T& k6 I/ a" K  y7 F8 s
  30. #include <asm/io.h>3 e1 n1 b8 @& a% p  o; E
  31. #include <linux/moduleparam.h>
    : s1 }1 N+ {( f3 i
  32. #include <linux/sysctl.h>- O( P, X" g4 n$ z2 u% s1 n2 Y% U" L
  33. #include <linux/mm.h>- i7 n' M, Y' s% g5 x
  34. #include <linux/dma-mapping.h>
    6 ^9 |8 O0 w8 u3 v) P
  35. 6 |; y& c! h, w: L# ]% q( E
  36. #include <mach/memory.h>: Q3 o5 X% s' Z: G
  37. #include <mach/hardware.h>: F" s# l2 h/ i' _4 H, b8 f* a
  38. #include <mach/irqs.h>$ I3 `& L! Z8 m' n2 _
  39. #include <asm/hardware/edma.h>* C& [' m7 `* f
  40. ' ]8 j. L/ M" u/ O7 f8 `. _9 |
  41. #undef EDMA3_DEBUG
    7 X' V: o2 o% W! p& r
  42. /*#define EDMA3_DEBUG*/
    9 s( N% v8 v( x
  43. # l; ^0 z. A9 L0 R( b- q  Q
  44. #ifdef EDMA3_DEBUG3 N1 g% Y. j" K8 g. U' h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - a2 H9 A+ L1 L( M8 _9 R' @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# L" |5 E; b7 _' p6 o2 r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 b7 u+ R. M8 g& B- K$ ^) P, j, t
  48. #else
      ?( u) k( g% T2 }; a- r1 c, F& X1 J2 [& R
  49. #define DMA_PRINTK( x... )
    ( y9 l+ v! \3 b1 T0 c
  50. #define DMA_FN_IN
    6 K; C  _" L% q& B) T
  51. #define DMA_FN_OUT9 q" g7 O* U( X1 q2 f% I
  52. #endif
    , D! ~; z4 ~( P$ b, H
  53. 9 \4 c) _) q  C% C- U8 c$ ~0 e  i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . d& x; m" w6 }7 k1 |& u- d8 c. y  I% w
  55. #define STATIC_SHIFT                38 }" T# X% f! Z' D3 R. h
  56. #define TCINTEN_SHIFT               20# _$ N+ T& b1 z: b
  57. #define ITCINTEN_SHIFT              21
    & |* G! X8 Z2 k  z% z
  58. #define TCCHEN_SHIFT                22
    : Z4 n# M% C3 ], c( V8 Z
  59. #define ITCCHEN_SHIFT               23
    ; l+ X. `) s7 E2 Y

  60. 1 N+ ^$ Q7 k" |: N0 O
  61. static volatile int irqraised1 = 0;1 S% e7 z9 K' f" U
  62. static volatile int irqraised2 = 0;3 k, B# n) D3 v4 V0 E3 t/ C3 e

  63. 8 n- M0 b5 V# {5 i5 a& F4 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 z' A+ y. g7 ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) e% P8 y  v% K, u1 C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- D" S8 T# f" h- y/ d
  67. * \8 I6 `8 j) ]0 s8 v+ Y
  68. dma_addr_t dmaphyssrc1 = 0;
    $ M( {2 @- B! b" l
  69. dma_addr_t dmaphyssrc2 = 0;+ F) [/ Z& Q4 q  ]9 N8 D* c+ O; f( Q
  70. dma_addr_t dmaphysdest1 = 0;
    ; B( V2 n4 ?$ N! r# u) b1 Y
  71. dma_addr_t dmaphysdest2 = 0;  y) O- N3 p: M# I4 T# {! Y3 a
  72. 5 ~# l. e3 N8 L; Z0 n6 n
  73. char *dmabufsrc1 = NULL;# f8 S  `! `) _
  74. char *dmabufsrc2 = NULL;
    * O2 y$ `1 l. `; v* o
  75. char *dmabufdest1 = NULL;
    . ^: t, ~5 [0 @0 F! f, m, `/ \
  76. char *dmabufdest2 = NULL;
      F# \8 |9 K- j9 ?; d* A4 j

  77.   W+ H2 ?( H6 ~4 \
  78. static int acnt = 512;$ Z. k4 Y1 P5 F- p7 M. J) @9 r
  79. static int bcnt = 8;
    + U' ]! W, ]( f- s# {2 Z8 `2 i  _
  80. static int ccnt = 8;
    4 x' n, n+ r; K! B6 ?6 ?4 n* w

  81. , `/ M  L% P1 g( r; A4 k
  82. module_param(acnt, int, S_IRUGO);( B2 B' @8 `! x* C, I0 h
  83. module_param(bcnt, int, S_IRUGO);1 r1 H; a) g7 v) C' \0 f" l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 u: a& v0 |3 p) V- Y2 b/ v6 @

7 U3 Z2 z/ M$ H% [$ L& }, W( F0 r      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) w4 M4 D9 {) x' ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 L/ b! Y' g3 Q- W# y, T0 A
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ t/ \! L& j, y

6 B$ o0 \# q5 Z% C4 ?* B- b" e" f; Z; q- C" U" [% \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 19:27 , Processed in 0.039410 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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