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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: P+ V) h: p$ Q
  1. [code]EDMA sample test application+ Y+ o! b. w% V
  2. /*
    $ K; t2 J$ q) u, r  T. J
  3. * edma_test.c& E2 u2 F$ ]8 K# S" y: w2 q! j
  4. */ [$ {( y- l7 d. E+ y
  5. * brief  EDMA3 Test Application
    2 G3 T2 Q$ d8 U) @
  6. *
    - V  R" A" L# `  l/ W3 q1 }. @
  7. *   This file contains EDMA3 Test code.
      a  w$ X7 \6 R1 m6 {
  8. *0 d( O* x/ G# y3 U. ?+ z. U; f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      V, R) I% s/ W/ L. W. C- _& e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 k1 Q3 W% Q' Q/ G6 A
  11. *         TO CHANGE.9 J6 I- D; |. |1 l: \: l- j
  12. *
    9 X7 G3 v& q& ]- z; t, Z7 ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / }& P- Z2 K8 `, Z. b
  14. *
    7 {1 r8 ~1 X% |5 J2 i4 K; v" x
  15. * This program is free software; you can redistribute it and/or- Q4 i7 [; G# ^. b
  16. * modify it under the terms of the GNU General Public License as
    ( n: V7 \# f7 a, Q7 ?
  17. * published by the Free Software Foundation version 2.( a5 S4 N( c! @' [6 O8 S
  18. *& f) h* x4 S$ n* q. x1 d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 Y2 {8 x/ J7 I  b
  20. * kind, whether express or implied; without even the implied warranty# Q/ w, m1 g' o1 v  x6 ?5 `$ s  h& F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 V5 o& Z2 I0 x7 M; i5 c7 w$ H
  22. * GNU General Public License for more details.5 d  q. O" A8 i5 b3 s
  23. */9 }( D  }  R/ k- E; O" L1 X! Q' v

  24. 4 d4 M8 K5 }, U7 B, L
  25. #include <linux/module.h>2 N( M* Y' V( A% z( q2 I9 @
  26. #include <linux/init.h>; E. F9 D" N4 s# x; d
  27. #include <linux/errno.h># I& T  @. z! p& V4 y
  28. #include <linux/types.h>
    ; V& O0 J; I* k9 [$ Q; e
  29. #include <linux/interrupt.h>
      D3 }" c5 l, A, T' `
  30. #include <asm/io.h>
    - V2 m9 F) h# ^3 n  ]8 D
  31. #include <linux/moduleparam.h>$ _* F: V6 c7 |4 i+ p
  32. #include <linux/sysctl.h>* p$ F! a" T2 R1 l
  33. #include <linux/mm.h># w. H# |+ a. m9 H  S
  34. #include <linux/dma-mapping.h>
    , `6 ^7 W% U; [2 D
  35.   V7 i8 U5 d& }, F
  36. #include <mach/memory.h>/ Q: Z, n+ N& x6 V
  37. #include <mach/hardware.h>
    0 ]+ I% l6 P. ~5 J
  38. #include <mach/irqs.h>
    ; P; z4 T% o: M6 M" N0 X' d
  39. #include <asm/hardware/edma.h>
    3 \4 G; y$ u1 k9 [6 k) A
  40. # o) N8 S* u. z# f
  41. #undef EDMA3_DEBUG
    & A9 R' Q9 Y0 ^% L' x  k% P2 z& R
  42. /*#define EDMA3_DEBUG*/  M2 x" w( }5 H7 L( @1 r
  43. 0 E. {9 G5 Z4 q" K
  44. #ifdef EDMA3_DEBUG' Q2 R1 r: c# U% H' k% Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 b( I+ I/ ~/ [7 `! f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! C) e% M8 {0 {+ U6 l, T5 N6 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ a6 `6 H6 t# ?
  48. #else
    1 j2 R2 y& W( I
  49. #define DMA_PRINTK( x... )
    / Z5 C8 e( W$ x5 Z; X
  50. #define DMA_FN_IN
    4 ^. N$ _' R* W" W5 U  a, V
  51. #define DMA_FN_OUT
    ; n, M; ^4 M8 c2 x4 }8 }
  52. #endif
    ) T/ c  V5 I5 }

  53. . B/ _4 d$ \* Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , e% c% ]2 ~7 q' s7 v) K  K
  55. #define STATIC_SHIFT                32 V5 Q) a% ^4 l' E, ?9 X- r* A( R
  56. #define TCINTEN_SHIFT               20
    ; M& X1 o+ Y: q; C, e( P! D- p- d
  57. #define ITCINTEN_SHIFT              21  l. V+ W% H. r' j7 ?5 j9 d
  58. #define TCCHEN_SHIFT                22
    : T- b6 V/ x( D5 E+ k  e
  59. #define ITCCHEN_SHIFT               23
    # D! f- ^6 j! T; f( X# Q  q, n
  60. 8 m, I4 X; h! S4 r) x; s+ z: k
  61. static volatile int irqraised1 = 0;
    , v; Y, o( e! w3 V2 V
  62. static volatile int irqraised2 = 0;5 T" j8 N7 f4 I
  63. 9 V- N5 ~! f: |- F6 I0 u5 s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      K: Q  ?: d/ j/ }* {* v, K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 j9 ?# q" q6 T# S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; \  Q, c/ }9 \& O: V+ T; j
  67. ' c, H6 z  Z4 _% Z3 X! ~; @8 v2 O
  68. dma_addr_t dmaphyssrc1 = 0;
      a5 A% L" g6 `: b) r, h, }# `
  69. dma_addr_t dmaphyssrc2 = 0;
    + E; O$ {5 G2 {* H
  70. dma_addr_t dmaphysdest1 = 0;
    7 ~# [2 _5 q4 H* _0 s
  71. dma_addr_t dmaphysdest2 = 0;
    7 F$ G3 q# s8 u
  72. 2 r# Q0 f4 K# U
  73. char *dmabufsrc1 = NULL;
    + }$ z9 B, I, Q5 L1 T
  74. char *dmabufsrc2 = NULL;
    6 a1 F% @: Q. X" L
  75. char *dmabufdest1 = NULL;
      e' i3 _6 p& o/ w9 h2 C
  76. char *dmabufdest2 = NULL;
    , C* P# [" k! M+ v4 q

  77. 5 b! N# w; n$ l4 o
  78. static int acnt = 512;* C" W5 B0 w1 \) G7 Q2 E
  79. static int bcnt = 8;# I, h8 p3 @' y1 i* F6 e: h
  80. static int ccnt = 8;
    , A  c$ f5 D5 V& P: k& z* q

  81. 0 {/ u# ^/ _9 R+ {! Q$ s  n4 f
  82. module_param(acnt, int, S_IRUGO);2 o$ U8 W8 A' ~) S! N! U! @$ Y1 p
  83. module_param(bcnt, int, S_IRUGO);, _6 w$ B; }, j" ~7 m6 X( C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 g- x6 m& X( ]8 S7 g/ v. k* J7 _, I" j' P( u/ `/ h! E2 L* d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% A! _+ K0 K4 a; ~' q. o- Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 b% Z4 s5 P% o& P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 w( X; G; V" H# u
' ]7 q7 Q% o% K5 V8 E9 @0 A5 O
* ?1 |+ [6 R/ C3 p! N5 J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 03:46 , Processed in 0.041274 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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