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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 m8 c6 n8 j5 u" ]- Z' t& p/ _" Y8 g
  1. [code]EDMA sample test application
    # s8 L% G- J- R  ^
  2. /*/ F( z, D& k7 }3 r8 ^9 U9 N
  3. * edma_test.c
    6 P1 K) a! J  s2 {  n9 P
  4. *) _* |( W# u) ]5 e0 m
  5. * brief  EDMA3 Test Application
    4 t, R) K8 _- X
  6. *% G2 l3 {) \; G
  7. *   This file contains EDMA3 Test code.
    7 h$ [% b+ D8 `4 }; E/ _* c
  8. *5 L( d2 O6 S' n: U5 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 @; ~0 n0 |8 d1 D/ `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 R, q: t/ O2 a( Z7 z
  11. *         TO CHANGE.0 h0 g+ }4 V8 _  |% w
  12. *$ [& {- J- K! Q% [) ]7 l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 }) ]2 {) q1 {2 R; M& L+ x- D" C
  14. *7 K+ @7 C2 n% m* w' N0 H
  15. * This program is free software; you can redistribute it and/or" _/ r; ?: o, d, U* W' ~
  16. * modify it under the terms of the GNU General Public License as6 t% d- O* g: C/ m7 H/ e4 Z2 f! @
  17. * published by the Free Software Foundation version 2.
    1 u, w6 c" X# T; F8 F$ p; w9 |
  18. *
    ! v& ]8 F8 C0 g' i4 ^5 r  c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% h- ~/ v/ c& b3 A% d9 t
  20. * kind, whether express or implied; without even the implied warranty
    $ p8 s) T/ b9 o: f  u7 z( R& S8 Y1 k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 c: g& d8 w1 {' Q* z. W1 D6 X
  22. * GNU General Public License for more details.( b$ q% b. T6 s4 @
  23. */- w' M9 [, ]) _# q# @" j: e
  24.   V7 z6 A; ]9 |  q$ g
  25. #include <linux/module.h>
    ' d* Y* {2 }- {; ?# ?' |
  26. #include <linux/init.h>5 O# j% \0 x2 b9 {' c' b
  27. #include <linux/errno.h>' E- b+ e" R# |
  28. #include <linux/types.h>  W. H8 ?- O; D  M$ ?
  29. #include <linux/interrupt.h>/ ]* m& g9 x7 f* t
  30. #include <asm/io.h>( F( x# o( H1 S# I: Y' p# ?
  31. #include <linux/moduleparam.h>2 C! F7 e: N0 m5 l. |( n
  32. #include <linux/sysctl.h>) Z/ H$ N( F( l4 g9 r% S1 ]  Y  ?
  33. #include <linux/mm.h>
    0 H& O% l# G; t. k4 {* [$ H
  34. #include <linux/dma-mapping.h>: ]+ s9 q8 E& p- P/ M7 N

  35. ; B+ ]6 p5 ?9 ]- Y# _' U
  36. #include <mach/memory.h>
    9 p; s4 n! |& c/ G  F
  37. #include <mach/hardware.h>
    4 k  F- N' a# \% \, z8 V6 [
  38. #include <mach/irqs.h>
    $ E5 ^) _& y) u6 k: {
  39. #include <asm/hardware/edma.h>, H( f2 r/ [6 O
  40. % Z6 C. F; _4 g+ T% T+ R: U
  41. #undef EDMA3_DEBUG% Q9 ]' I9 Z7 }6 ~
  42. /*#define EDMA3_DEBUG*/
    $ Q( _$ j4 c5 q2 ~& _
  43. ' f/ t1 o. N% L$ V8 T' x8 Y
  44. #ifdef EDMA3_DEBUG% U6 Q* C5 p& m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 J& D0 c" m: J6 ^/ E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 u: @* d+ d0 F; i, W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & n) q. u. B/ {! V
  48. #else
    3 W3 K+ T# {* Y9 t
  49. #define DMA_PRINTK( x... )% O- u, Q* o' B- j
  50. #define DMA_FN_IN
    ( F  ~% A$ L& {0 a
  51. #define DMA_FN_OUT/ K* R/ O0 ]; l$ S) v; ^1 Y
  52. #endif
    * s6 R( Y: s7 H$ T# F, f% S- P
  53. : o5 N- z& h5 J% S& _0 z% h% `7 o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 n5 C$ _! P( E" A! U/ E$ ?
  55. #define STATIC_SHIFT                3
    3 c! ?% `) I7 L4 |0 q' r
  56. #define TCINTEN_SHIFT               20# p+ r: F0 X0 F  f% w+ j$ w& ]8 I2 p
  57. #define ITCINTEN_SHIFT              21
    $ u/ @2 g  c1 u: \8 |' L  y
  58. #define TCCHEN_SHIFT                22/ x' X) y& c/ q& l8 ?0 z# P
  59. #define ITCCHEN_SHIFT               23
    0 d) t4 W9 U4 |7 N1 e$ y- _
  60. 8 g  z" [( T' K9 z, _
  61. static volatile int irqraised1 = 0;
    " w/ H! S( f! L/ J
  62. static volatile int irqraised2 = 0;
    3 |4 t* {9 T! W2 Y# f
  63.   g  Q6 L8 s7 N' R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / _* a* ^( @/ `: q& V! \9 J) ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 h' w# k- a4 I& T2 a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 ~6 H0 _0 ], O2 f

  67. * o$ B* e8 b  n- \  p
  68. dma_addr_t dmaphyssrc1 = 0;; {+ x& ~. e/ e! l
  69. dma_addr_t dmaphyssrc2 = 0;
    - p' e5 W+ _% l8 a
  70. dma_addr_t dmaphysdest1 = 0;
    : T$ g8 j0 Z* o* b' b
  71. dma_addr_t dmaphysdest2 = 0;
    * ^# k5 @: Z6 i1 m4 T5 R. d
  72. 9 Y6 ~' Q: g8 f/ c0 t* q
  73. char *dmabufsrc1 = NULL;& J$ K! o: e+ |
  74. char *dmabufsrc2 = NULL;6 \( I: M+ i0 M8 M
  75. char *dmabufdest1 = NULL;# f. I( F) q/ f- C# I5 ^# R
  76. char *dmabufdest2 = NULL;
      q. W# O$ k+ ?, Y$ A
  77. 3 }9 y' n/ I2 M! ?% j: H
  78. static int acnt = 512;
    : o+ N4 c0 q% p/ M" I" V3 K; P
  79. static int bcnt = 8;
    $ u' P/ w  o' f* v/ l6 t" {
  80. static int ccnt = 8;
    + i; [2 h* Q  F* J( ~2 g. \* d( N' |
  81. - |+ d: y" r2 D  ^
  82. module_param(acnt, int, S_IRUGO);3 Y& T/ a1 e# j( X% e
  83. module_param(bcnt, int, S_IRUGO);' p  m+ g- W8 v) v* {
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 B, c! G- g5 Q) R  h1 s& H2 ^. |; a4 U% W5 D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: {; W' z) Q* x, F) E: d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# O, s- t, e* V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 @9 J5 S& N6 q9 q" m: c7 B/ k) h6 g/ ~
$ M; B. j, E3 E3 g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-15 02:08 , Processed in 0.044382 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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