OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! \* R! S' H2 M8 ]* {+ r. V
  1. [code]EDMA sample test application
    5 S8 a) ]9 }6 L" `, q& w  s# E
  2. /** p  `2 Y" h. |( v+ }
  3. * edma_test.c
    # W0 c! y: q- [
  4. *2 o) l0 M" T( y& f. y( z
  5. * brief  EDMA3 Test Application
    1 f- M+ Z) k8 S3 ^3 q0 R9 }% o/ |
  6. *6 P/ f% c/ I, V6 \# g/ W
  7. *   This file contains EDMA3 Test code." t. k! P' L1 u# ~' Y7 P
  8. *5 V( S/ F9 U2 x( g3 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' Y7 ^4 j  J7 ~; [! h/ M! a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & G6 B7 V# i4 d* X* P4 d
  11. *         TO CHANGE.
    * T6 a; g9 k2 W. }, o: V
  12. *
    + _+ v  T/ g; C7 }$ W$ Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * J. y+ p7 [. A- q' L1 Z1 _
  14. *! {5 D& L  ?7 `
  15. * This program is free software; you can redistribute it and/or
    + K6 e  }8 q) k  z
  16. * modify it under the terms of the GNU General Public License as- Z9 @' ]! m  H( @+ D- q
  17. * published by the Free Software Foundation version 2.
    * _! J: i. s4 Z1 K# |
  18. *
    ' v, p6 e: G, r6 G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * w8 x% k4 P2 g; n6 f2 R# n7 i+ ]
  20. * kind, whether express or implied; without even the implied warranty
    & J" }! M4 E4 u' o1 _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 a# H- {. G& X. M0 t
  22. * GNU General Public License for more details.5 b9 I3 E/ ~2 p" n. v3 c+ _, K) `& j
  23. */
    # e! d# A# [+ R1 Y# G4 x
  24. ! T2 u! ]# L# X2 G- u  y& \0 Y" I
  25. #include <linux/module.h>. C5 H, |, @; ^& O. l% X
  26. #include <linux/init.h>
    - I# ^! y1 X7 n/ Z3 y
  27. #include <linux/errno.h>5 U; M1 J' \, x. F( _7 `' Y4 `! Y
  28. #include <linux/types.h>2 c  P0 Y$ H( I1 u2 I) U
  29. #include <linux/interrupt.h>
    2 ~* h4 A0 a- N
  30. #include <asm/io.h>! `7 l5 {% ?# S
  31. #include <linux/moduleparam.h>
    + C, C% h; i7 B! O: G3 S
  32. #include <linux/sysctl.h>
    4 _: j; M" p: M8 Y" q, s
  33. #include <linux/mm.h>( z( ?9 E% a; R! P% S& c
  34. #include <linux/dma-mapping.h>5 Q$ C) g( [0 w
  35. ; j  }3 j- r5 ^9 P$ I1 `, }
  36. #include <mach/memory.h>
    ) w0 ?- _) L1 `3 C& ?5 c
  37. #include <mach/hardware.h>% X! a* P5 |) N. L9 N8 G
  38. #include <mach/irqs.h>
    / z8 P/ m5 i/ x9 W
  39. #include <asm/hardware/edma.h>
      ~" c$ z0 v/ e. l

  40. : `4 S/ A# Q% p% |0 @% Y9 j7 E
  41. #undef EDMA3_DEBUG
    8 Q5 k  O: i- R
  42. /*#define EDMA3_DEBUG*/% _+ M1 D# r3 c7 S7 r, r
  43. ; ^1 r1 R# X2 u/ l
  44. #ifdef EDMA3_DEBUG  D8 |5 Y4 c8 X% R. p8 u2 `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" w6 o8 O6 b. R, b' r: {' `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), q7 L8 j" a& b( f" n2 T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) o* {0 w& }' P& \9 M
  48. #else
    ) i4 {, i5 x1 W* n6 v0 o* @% u% Y
  49. #define DMA_PRINTK( x... )
    % u4 F7 C, N. M* _8 F- p3 W
  50. #define DMA_FN_IN
    ; W) i- L% \- J1 E" m1 y
  51. #define DMA_FN_OUT2 U) N6 g) F0 _0 _
  52. #endif' j+ `3 T. Y& C. n) F6 m8 p
  53.   I* Y) X) H0 Z5 v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 ], ~* b  C3 X% V# s
  55. #define STATIC_SHIFT                3/ Q0 A! y* a! J3 Q
  56. #define TCINTEN_SHIFT               20+ l: j) w6 r/ t% P: Z) @! V
  57. #define ITCINTEN_SHIFT              21. l/ v! \  g; ^# w; j0 P
  58. #define TCCHEN_SHIFT                22, C1 F4 K! [/ x8 A+ O! A7 F, ^
  59. #define ITCCHEN_SHIFT               23" F. ?+ b# r5 J

  60. 9 |8 P& X) q! v! P* H
  61. static volatile int irqraised1 = 0;
    ' M6 a1 ^8 _# g* S4 N% H' o
  62. static volatile int irqraised2 = 0;: ^) ]4 F3 _6 h) m/ @. L! E
  63. " T: Z1 [$ Q3 T+ L# h( L+ E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 I; A1 e2 |/ W5 d, P2 f0 M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 m* ?! @/ v9 d8 {& o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + D& ^! R% k0 f! d$ z! u2 Y* I2 j
  67. 8 s% v+ B' L. A3 |9 U% _' C
  68. dma_addr_t dmaphyssrc1 = 0;
    4 A9 s$ W0 g/ L: u
  69. dma_addr_t dmaphyssrc2 = 0;  S1 r3 A# \7 A6 F; e. L
  70. dma_addr_t dmaphysdest1 = 0;
    & f: o7 L6 `& |  H& p& z
  71. dma_addr_t dmaphysdest2 = 0;) L. M1 a; k, N' V/ v0 A
  72. , D! t9 J; k6 l3 f( W
  73. char *dmabufsrc1 = NULL;
    # }" x/ I: _$ G$ k( e+ o
  74. char *dmabufsrc2 = NULL;  M% R. E/ }( h/ d9 g* P
  75. char *dmabufdest1 = NULL;1 Y( C7 e+ O( m0 h: f
  76. char *dmabufdest2 = NULL;% |& j% M4 Q0 o- [8 M% M
  77. ! r% D5 f9 j6 A
  78. static int acnt = 512;
    # N, b7 o/ i, @  U3 r- e
  79. static int bcnt = 8;$ @$ s$ V, X! K: H9 N" {5 k/ d
  80. static int ccnt = 8;
    8 _4 ]+ r. F% E" n" |

  81. ! e% ?2 g. b) \1 @# r
  82. module_param(acnt, int, S_IRUGO);- r. D. P; a; v4 d$ v) f7 A
  83. module_param(bcnt, int, S_IRUGO);
    # y/ k  J9 C. `9 Q3 w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) c9 W+ F2 p3 r6 [: I

/ ~! W/ ]( T% \$ M: _: b9 X. O0 Z% `      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# t4 I3 v' B, K& ^4 r' @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! e2 L- R$ f+ T9 {! Z( q8 L0 M
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 {* p4 O& E$ l6 G
/ @( c& _7 D$ ~: ~
: o. ]2 G* n6 E% z1 x- k# `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-10 13:17 , Processed in 0.040785 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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