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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # v$ D. q/ I- p4 m
  1. [code]EDMA sample test application
    : \$ S% w/ i6 ^) t3 c  t
  2. /*
    , p  ~& J- ?- M/ B1 A
  3. * edma_test.c
    ' [) m( q; T8 c* `2 E+ J5 |
  4. ** C7 b) l/ S5 T- h' k- l
  5. * brief  EDMA3 Test Application
    5 ]8 j1 n3 y0 n, Z
  6. *
    4 W4 h- A' }9 r5 M$ R, n8 A
  7. *   This file contains EDMA3 Test code.& v. x3 t5 Y$ z4 Q+ D4 R
  8. *: [/ F' u0 ?8 K$ q% ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* g! U1 s, s! D. i. b8 B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 a* Q! }3 o5 B$ N" ~5 y
  11. *         TO CHANGE./ U- m+ [+ S. P
  12. ** f( v2 H- t( c+ B) G- w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 }- u6 P2 d( H$ R' D, o
  14. *
    0 O# S( x+ {/ G! ~+ V
  15. * This program is free software; you can redistribute it and/or3 x; \! D4 M6 M7 ~
  16. * modify it under the terms of the GNU General Public License as
    $ f# D, N# E& l  H# ~- X1 p; p
  17. * published by the Free Software Foundation version 2.# l' w& W8 D' v$ V: U
  18. *3 y2 ]; n  Z$ t( w9 B6 c$ T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 k( ?4 e$ }! ]: `
  20. * kind, whether express or implied; without even the implied warranty9 O" x& S- J# ~0 w9 n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      M. {( a$ i& G
  22. * GNU General Public License for more details.
    6 _0 p# [6 \" a& L( |2 C. G  _
  23. */
    $ j8 v- F$ I' b; F; W$ O

  24. 0 n4 D: b8 ?+ Q
  25. #include <linux/module.h>$ R' f" W& e! O! B1 Y2 f
  26. #include <linux/init.h>8 ?3 F; B, Y3 V, h- [4 c
  27. #include <linux/errno.h>  D5 o" D1 c' P& n* I7 Y
  28. #include <linux/types.h>3 V, M8 l( v/ k# K4 g
  29. #include <linux/interrupt.h>
    # \; c4 f2 x8 n; j
  30. #include <asm/io.h>% z% q) _% i* Y% I; G4 F6 E" w/ o
  31. #include <linux/moduleparam.h>
    ' p) }! W3 h. @1 C/ z
  32. #include <linux/sysctl.h>$ R1 d) f: \6 {1 I  `- R
  33. #include <linux/mm.h>
    # d) }$ H9 J  l
  34. #include <linux/dma-mapping.h>
    $ X/ S: t& R& s
  35. - R+ K1 w3 M2 [- u9 H* r% C% Q
  36. #include <mach/memory.h>
    , a7 Z5 W" r' U" E0 v+ d. {; u! s
  37. #include <mach/hardware.h>
    : K, \' A5 l0 U8 G* L
  38. #include <mach/irqs.h>2 N% X6 E/ Y7 S
  39. #include <asm/hardware/edma.h>
      g8 }. F9 S+ R4 `; X9 b
  40. 5 y$ H9 f/ P+ C5 e1 M4 i
  41. #undef EDMA3_DEBUG- w; C: c# t/ L4 T8 o; V" f
  42. /*#define EDMA3_DEBUG*/
    ! Q! X$ v0 l1 g

  43.   g' L( U8 t/ e( i) f$ \4 K" x6 Q
  44. #ifdef EDMA3_DEBUG
    3 d0 }- }) z7 e. Y$ D0 e1 V; K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* _& b7 X6 e  T3 u- ]" o( b: O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . p" B7 T! Z; z8 ~2 G3 J" K+ Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " q7 C1 X4 M: Z9 e( {9 W) {
  48. #else
    5 u4 Z9 z- f3 r5 A: W* q
  49. #define DMA_PRINTK( x... )
    ' @5 ]* F2 B6 X( T
  50. #define DMA_FN_IN
    * t, J! b9 n6 ~
  51. #define DMA_FN_OUT
    2 y+ I, h" M/ o4 q) w$ |1 V
  52. #endif
    4 A" Y3 A( a7 D5 L8 m# X# ?
  53. / b* T' K* i  H/ G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" Y! S4 U1 W5 u8 {& v( t" s# r7 A
  55. #define STATIC_SHIFT                3
    7 X8 d9 [0 l! Q& M2 i# o8 \) d
  56. #define TCINTEN_SHIFT               20, e, _% X; O7 t& g/ h$ U; M
  57. #define ITCINTEN_SHIFT              21; ?2 ?! A5 g9 C  G! ?* K
  58. #define TCCHEN_SHIFT                22$ s& y7 ~/ r0 ^1 P( j7 R
  59. #define ITCCHEN_SHIFT               23
    " }  A8 l% d) g; I  V- K* ~& I
  60. 2 l7 ]" O6 b+ o2 ~
  61. static volatile int irqraised1 = 0;
    / i2 d# A( v7 @2 T& Q6 u
  62. static volatile int irqraised2 = 0;
    ! B7 Y$ \3 C  G# U+ ?9 e

  63. , H2 j' z1 @5 n$ n; o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 ]$ ~( y8 ]) C( I' ?- K' }5 x3 d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 x3 Z- ]: Y, j% ?: _$ ^7 r8 o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : `  \* k) M* {

  67. 5 Z9 _+ l. R8 w. |+ q, S6 `
  68. dma_addr_t dmaphyssrc1 = 0;
    : Q9 z4 s' ~" R+ Q3 q4 i* D. L
  69. dma_addr_t dmaphyssrc2 = 0;
    . r# t3 Z: {# y; ?
  70. dma_addr_t dmaphysdest1 = 0;6 S' ?, I4 Z8 U
  71. dma_addr_t dmaphysdest2 = 0;  ?+ K/ M0 s2 t& G0 K5 z3 Q
  72. $ w) E) H6 }) T# z* g/ b2 j4 K
  73. char *dmabufsrc1 = NULL;
    # @. _0 w8 V+ C2 ]
  74. char *dmabufsrc2 = NULL;
    5 m/ ?" D+ E" w
  75. char *dmabufdest1 = NULL;
    4 W7 l* \% k! }! _- b
  76. char *dmabufdest2 = NULL;
    6 v8 z' K0 m* z6 f4 z: h3 a* o

  77. % X9 n' G" B: k
  78. static int acnt = 512;
    5 v1 K, x: U8 k$ r6 ~" N
  79. static int bcnt = 8;
    # ?. T1 q- x8 `6 w
  80. static int ccnt = 8;
    5 h% N7 @7 x2 f! m* _

  81. % a* v9 f! d- k' ?+ |
  82. module_param(acnt, int, S_IRUGO);
    6 B; ]  L8 Z3 O6 e, y) K
  83. module_param(bcnt, int, S_IRUGO);
    4 h1 c8 `2 F( y: l) H$ T9 _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  j0 e2 t/ _! C3 X5 C

) v4 W# v( I) M6 d      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! d6 T0 r, F* z( G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! z0 j7 Z8 T+ c$ @" j6 Q8 w     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  }1 P# Q/ p$ h9 [6 v! f8 S% \4 A
* T# S) {- i! Q- f+ b5 t) l# k/ U* d
9 @. c1 f2 |5 i3 [8 E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-7 15:36 , Processed in 0.040329 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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