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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : b. K& Y: q8 A% O* m
  1. [code]EDMA sample test application2 R7 c4 c. m8 }& Z8 r* T& p1 E, F; q
  2. /*
    7 ]" X, |7 E# _. }
  3. * edma_test.c- y; x8 e+ V) D, H: C
  4. *5 @8 F& b7 W& w/ `# Q" D
  5. * brief  EDMA3 Test Application, c% ?0 h2 {* M% P" U
  6. *, F! Y2 v  h- }
  7. *   This file contains EDMA3 Test code.9 a2 o. M! E. D# C  Z5 x& m
  8. *
    " a0 B$ A" Z0 i) G. `0 @( t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 y/ X0 x9 B, e: a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( f: Y# ^! t/ m: n0 }. A
  11. *         TO CHANGE.
    * p, @4 a! c5 O  D
  12. *1 ]5 F( i% R3 L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; F' z  P7 r7 c/ V. `
  14. *
    - l" j& K+ T* R5 V/ V6 X2 N
  15. * This program is free software; you can redistribute it and/or9 G% L; ~$ x+ K' l; r; O- A% B
  16. * modify it under the terms of the GNU General Public License as. y- r% I' Q. d6 P  g- W" ~0 g
  17. * published by the Free Software Foundation version 2.
    ( T* g9 n* {* `  _/ N9 h; I4 x
  18. *5 e8 P$ v5 z  k7 `/ D8 k. e  R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 a: \; i  J" _$ V9 o6 u. k
  20. * kind, whether express or implied; without even the implied warranty
      I* N4 K$ l3 F8 D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # F2 U1 k+ ~- x
  22. * GNU General Public License for more details.' |, }! D& g8 o$ k2 {
  23. */9 A' i" R2 `+ E4 d. M$ U
  24. ! t3 A  S* x" M; u
  25. #include <linux/module.h>
    9 N0 E/ Q- S4 d6 k8 S8 X4 U; c, i% U
  26. #include <linux/init.h>6 E2 X+ \5 Y  Q# j
  27. #include <linux/errno.h>
    2 H8 l- h: D: ^2 G3 v% ?; N
  28. #include <linux/types.h>
    + l, v# L" L- o! u4 j
  29. #include <linux/interrupt.h>, _7 f: d$ w$ E8 u" |+ q1 c- S) ?: A* C
  30. #include <asm/io.h>. B  @; P4 H2 W7 U
  31. #include <linux/moduleparam.h>
      v1 |4 x* Q8 F5 Q7 Q
  32. #include <linux/sysctl.h>0 z$ ?# [: U: u; f: H# c
  33. #include <linux/mm.h>
    . s! f% b9 _  j! Y$ ^+ a+ W
  34. #include <linux/dma-mapping.h>
      v8 h$ K) K+ ?2 K) c  H6 t

  35. 2 K% y$ r! f7 y& ], V! F2 f& G7 o* B
  36. #include <mach/memory.h>) @: Z, H, j( j  K/ G2 `
  37. #include <mach/hardware.h>
    5 ?' \. u1 N1 k
  38. #include <mach/irqs.h>
    $ t5 S; L) x/ M* G  G. T
  39. #include <asm/hardware/edma.h>
      o, g2 k% O6 D3 X  N- K. a

  40. ! V0 _3 I2 y) n; ~8 R6 ~0 v
  41. #undef EDMA3_DEBUG
    7 K1 J  N5 Z' B; ^6 D/ X4 F# u
  42. /*#define EDMA3_DEBUG*/1 Q3 u( E9 E0 s6 S

  43. : S% B7 P2 A+ v5 L) [  {
  44. #ifdef EDMA3_DEBUG
    9 g$ |& W1 S  B( h# ?( e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . T& V+ s0 g' q) D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). E) t2 {8 e* J* O0 _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 x3 L. s: V0 R/ ~
  48. #else3 a" M. A. R+ o6 D4 f! [
  49. #define DMA_PRINTK( x... )" ~  m- q7 M+ t  x+ x
  50. #define DMA_FN_IN
    2 P8 o3 a: b# e
  51. #define DMA_FN_OUT
    - ]7 {; \$ w! J% h9 x
  52. #endif
    / I4 p" K! T* e, x( e$ N5 v5 r
  53. ! O- P9 E0 ]8 ~( u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & `. m1 _9 ]! ]3 v1 O% e+ E5 O; V
  55. #define STATIC_SHIFT                3
    1 f5 H0 O$ D( p0 T. E" L
  56. #define TCINTEN_SHIFT               209 ~" ^8 Z0 C4 a- s- f9 a- e4 @% o
  57. #define ITCINTEN_SHIFT              21' c5 F! _# X# b+ R
  58. #define TCCHEN_SHIFT                22
    ; q. `4 L% h) B' \% |. M3 P
  59. #define ITCCHEN_SHIFT               23" A: j. @1 {$ ]: b5 ^! Q; F7 C

  60. 5 ]8 x' ?7 N/ ]9 ?1 ?8 q
  61. static volatile int irqraised1 = 0;7 L0 w9 O* v- w' L7 g
  62. static volatile int irqraised2 = 0;3 v$ k' c8 T' @: L7 A

  63. 2 j* F( P! z! X- I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! N/ t0 S( h0 K3 X' ^- {; }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ q4 W7 M; a% W/ ?0 D- ^) ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 i. A2 e: C; G9 K, B% Q
  67. ) H( n. A1 k% e8 j* ]5 J
  68. dma_addr_t dmaphyssrc1 = 0;0 e# Y- o# s. a% }
  69. dma_addr_t dmaphyssrc2 = 0;& d; ?' i  W' _
  70. dma_addr_t dmaphysdest1 = 0;
    , s  B+ i, b; g7 t
  71. dma_addr_t dmaphysdest2 = 0;; |+ X0 v. k1 e$ f4 r

  72. & \( g6 ~3 t# Z
  73. char *dmabufsrc1 = NULL;
    5 R  i4 [, A& z( ~
  74. char *dmabufsrc2 = NULL;1 s/ y; K7 ?+ v5 ~* z
  75. char *dmabufdest1 = NULL;
      j, e( f$ z+ J) t8 i
  76. char *dmabufdest2 = NULL;
    3 |. \# m) w6 E9 C  q
  77. ( ?" |3 K! A0 d7 w0 u
  78. static int acnt = 512;
    , U* g& v- }: M5 b
  79. static int bcnt = 8;
    0 r" E! `/ d% D6 ?% H
  80. static int ccnt = 8;: |( E4 X- Z( v8 g/ U
  81. # |* g* i2 B8 H4 }2 q% ]9 I6 [% f
  82. module_param(acnt, int, S_IRUGO);  T) z' R- c! l- T) |
  83. module_param(bcnt, int, S_IRUGO);
    4 G* A$ W4 G" a( a2 M' W/ D6 L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 F1 ~7 B& b& x- `  ?4 y9 M& ~- [4 H8 R& f) K7 w4 v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' B6 |5 y% [* 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* z, Z# r4 B0 n8 s0 J& `3 j3 A8 |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# A, C" r  ?9 Q+ H2 ^! b# ?  D- G
, s8 V! u" j* ~0 j- p% T' h6 L7 G* C0 R! q; `& j; O) l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 02:24 , Processed in 0.039916 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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