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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , k+ K' z" H  {2 Z% u$ h( I. h
  1. [code]EDMA sample test application
    7 D. `3 r# E3 G% Z1 F! J
  2. /*" |8 R; Q4 l& }" O2 C$ _! z: }( N* W) B
  3. * edma_test.c: G, o% D* _) ?$ {1 E, ]0 N8 D, C8 c
  4. *
    ; p' W2 w% j+ M6 ]* G
  5. * brief  EDMA3 Test Application6 V! P8 H$ Q% d# b6 `& `
  6. *% [8 J  i. Q: _; t4 [" x$ P
  7. *   This file contains EDMA3 Test code.
    & H# y+ n6 ]) R8 a) n% V3 b
  8. *
    0 a8 Y5 e; ^6 b+ ?4 z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . L& T" j, \; N0 s( U: _! L$ a8 e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 [  P' S* W1 [$ x
  11. *         TO CHANGE.
    - D2 s' W8 @# M. d2 ]! B# x& {9 C
  12. *
    * A# K# j4 g8 d* R: z7 c8 K8 f0 g4 ?4 I; E9 [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      f2 Z& s. ?2 m% d% i3 x$ z' t0 s
  14. *" ?6 m) ]& R: n" w
  15. * This program is free software; you can redistribute it and/or  j" f0 L: h, ^1 Q9 x7 H
  16. * modify it under the terms of the GNU General Public License as
    9 n3 D" L/ A* J
  17. * published by the Free Software Foundation version 2.1 Q  X, a  X$ J1 O! l
  18. *
    : d- v% u$ a9 h3 Y7 w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& Z% f1 V& i  M, a1 y
  20. * kind, whether express or implied; without even the implied warranty6 O/ @4 h) Y/ L1 t! V! c, S
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 B, W3 f' x, x+ E( k. R
  22. * GNU General Public License for more details.5 q3 \) _, V8 y5 @
  23. */
    * m2 d1 e9 Z! [
  24. ( R. Z$ d' [# s$ M5 D  r5 |  Z) C* @
  25. #include <linux/module.h>* L% X- p7 G1 U9 f
  26. #include <linux/init.h>
    4 R$ Z* W5 G6 |' c" U
  27. #include <linux/errno.h>
    2 D: X5 S* d' r' T
  28. #include <linux/types.h>& G& `1 q! S4 p) i/ N1 I5 a" v
  29. #include <linux/interrupt.h>
    7 A0 h3 u; p4 M. Y
  30. #include <asm/io.h>) ~' v, b0 A" ^0 K. X' W
  31. #include <linux/moduleparam.h>
    ! s1 l" T. o$ r& }: }
  32. #include <linux/sysctl.h>$ U7 w4 S5 w( p! `  Z
  33. #include <linux/mm.h>
    ) i7 R$ T+ N$ a* U! c
  34. #include <linux/dma-mapping.h>( K' z. t( m5 u0 N! W, t
  35. ) D2 y2 d; f$ d8 K& N- [1 F
  36. #include <mach/memory.h>
    7 j( ~2 I5 z# y0 `
  37. #include <mach/hardware.h>) `" e- Z' T/ H0 o3 T) i. a
  38. #include <mach/irqs.h>
    ; g% c' T' H7 k9 k
  39. #include <asm/hardware/edma.h>
    ( ?% _. ]8 i6 e8 _, g+ K4 X

  40. 3 H) I" T- n' n. t3 ]; s
  41. #undef EDMA3_DEBUG  s- }" g4 S' `3 a
  42. /*#define EDMA3_DEBUG*/
    ; Z, ?% i$ p! _1 U8 g( {

  43. " B; P% O% |! K/ ]) C4 Q' u2 H* s
  44. #ifdef EDMA3_DEBUG3 Y+ H" @8 X& b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 ]0 R) q" v( K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ k( H; h0 y! T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 J5 z6 H$ Y# F" M# S5 F  z
  48. #else& J1 a0 [" i4 J3 ?* s
  49. #define DMA_PRINTK( x... )3 a3 y# e  P& d9 g. S1 Z
  50. #define DMA_FN_IN4 S, @0 P$ `+ c7 x) O! S$ E* l
  51. #define DMA_FN_OUT- E9 G$ y3 E- Z" o4 q6 u" m6 V5 T
  52. #endif1 i+ I& M9 T6 T  e& \1 K! x# n
  53. ( u; v. g  `# ^, B: n( t" Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - z  Z6 }. P7 f- |1 b3 F% H5 Y
  55. #define STATIC_SHIFT                3
    / |1 M1 C5 l- ]% E" \" F
  56. #define TCINTEN_SHIFT               20
      h# g8 w5 P' f7 d
  57. #define ITCINTEN_SHIFT              21
    , ?4 S% l, B. X
  58. #define TCCHEN_SHIFT                22' e3 N' m, F! }& C7 W3 t4 @
  59. #define ITCCHEN_SHIFT               230 i0 X& J' A$ h9 o: d
  60. 5 s0 _( L; k4 W: K2 b& o
  61. static volatile int irqraised1 = 0;; i9 k) _$ G2 y  h, @2 a/ F2 U: k
  62. static volatile int irqraised2 = 0;3 T/ v+ }" l. \0 R7 G# j4 l' r

  63. * s3 [/ G- u: t5 h. C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% p0 b' c2 G9 I( h: q# r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 n6 b4 _7 g/ H1 Z: @& O2 W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 s7 P* {' P0 S
  67. 6 L7 p3 h6 @  X+ O6 x& I
  68. dma_addr_t dmaphyssrc1 = 0;9 _5 R6 V! R5 R# O) n0 x" ^3 i
  69. dma_addr_t dmaphyssrc2 = 0;) E: B" P; J& X" I0 S* |4 g6 E
  70. dma_addr_t dmaphysdest1 = 0;
      `/ _4 U. Q) |1 [8 w8 Z9 q9 L
  71. dma_addr_t dmaphysdest2 = 0;. w$ ~3 ~$ O2 h7 C* P
  72. " Y) H  k& {" A+ o
  73. char *dmabufsrc1 = NULL;
    4 Z/ I. n0 N- Y4 E/ R- M
  74. char *dmabufsrc2 = NULL;
      g6 [) ?7 h7 e# B$ Y" }
  75. char *dmabufdest1 = NULL;: G9 D% Q0 X0 s" v! ?
  76. char *dmabufdest2 = NULL;
    - o# F$ S3 }% j  w) R

  77. " q3 X3 s0 Z1 @) Z0 {, f
  78. static int acnt = 512;0 e# E; ~) L' M
  79. static int bcnt = 8;- _6 o% P; I+ @! p7 V! M
  80. static int ccnt = 8;
    # Q: }$ o, w6 r$ T) k) R

  81. 5 j1 o" i# U% I0 |/ f( ]6 ~
  82. module_param(acnt, int, S_IRUGO);
    5 W* M/ v( N1 h6 I' U- O
  83. module_param(bcnt, int, S_IRUGO);
    1 j! W. O( a/ y6 H5 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  F" Z9 R7 j' ?( e# O

4 Z# {' e8 i0 `7 p7 U9 \  }1 j7 x$ H: N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  J" }. l8 v0 y# e5 |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# F9 N6 P. ^) a. Y9 _1 K/ E1 E$ O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, f3 K/ L/ h$ s2 Y% k& e6 p
, E' r5 r) z' ]* S, q4 @5 x
2 W4 T9 I0 E$ B) V) E- z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 13:00 , Processed in 0.039327 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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