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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 p, {) c& p& X6 Y
  1. [code]EDMA sample test application3 w8 p7 Q! ]& E# d# F0 w
  2. /*
    3 ~8 Y! s( x9 }: Q2 q" O3 @
  3. * edma_test.c" j( w2 h  c  v  S& y
  4. *
    ! B0 [. V6 K4 I8 D; l" {
  5. * brief  EDMA3 Test Application& E. K: H9 K8 z; E# \
  6. *
    2 Y! j6 u/ J( D/ ^, M
  7. *   This file contains EDMA3 Test code.
    + e, }  Z* H, \* ~9 |+ V
  8. *
    ) G- B+ y1 D! q) A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% v5 L0 }. x2 K5 j0 E5 H. X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # G# X. c# _9 A$ }
  11. *         TO CHANGE.
    : Z$ l: x2 A8 f* q4 L, @
  12. *+ G; c$ a9 I5 d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, U; r9 K) t. U1 m1 x, _! R. o
  14. *
    / ~/ }( L6 Q5 o/ N. P
  15. * This program is free software; you can redistribute it and/or7 M9 p3 D: |9 g$ W& U5 a
  16. * modify it under the terms of the GNU General Public License as" W! z, a/ ?- k$ v4 U
  17. * published by the Free Software Foundation version 2.
    + _! @# X" J& h% ]. l% f+ R
  18. *& y6 ]+ s2 }/ |4 q; v1 R2 d& N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 v4 F9 V) E3 i* J6 H+ H" p
  20. * kind, whether express or implied; without even the implied warranty: N: t' Q+ t+ w! Z+ U% L$ k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & D! x% F  _" {4 S
  22. * GNU General Public License for more details.
    1 u! y9 S$ T$ `/ a0 N  G" E
  23. */. ]' @2 k; W5 b$ y
  24. 5 i5 y5 z: j" ?! @
  25. #include <linux/module.h>; E2 G% o  T+ F* {
  26. #include <linux/init.h>9 m3 h' ^% A% M
  27. #include <linux/errno.h>2 k2 y% k" _6 E$ g, c- I
  28. #include <linux/types.h>4 i+ [: i$ J8 `- z
  29. #include <linux/interrupt.h>  y* x6 I6 H7 }" a9 d( V, m  E
  30. #include <asm/io.h>! _1 _* J) o4 v: ~( n
  31. #include <linux/moduleparam.h>
    4 U6 S: K- e2 F3 ~
  32. #include <linux/sysctl.h>
    3 W4 Y5 v  X8 j
  33. #include <linux/mm.h>
    " ^/ Y9 ?; G9 x3 [* |2 H
  34. #include <linux/dma-mapping.h>% k9 H# A* d8 c7 d- N# J
  35. 7 |& F/ r4 l, T& N5 o) `! H
  36. #include <mach/memory.h>7 ^* a' i3 ^4 P% Q0 {
  37. #include <mach/hardware.h>2 P! @4 m" I& z& p
  38. #include <mach/irqs.h>
    * Z1 c4 q! V; O7 k! s) k- e; w4 B
  39. #include <asm/hardware/edma.h>: P/ f/ A8 l( [! A) K' [
  40. 3 m6 w3 g5 d9 _3 z& J1 F
  41. #undef EDMA3_DEBUG8 @3 f' e$ ~; O( s3 t9 E" N' f
  42. /*#define EDMA3_DEBUG*/
    9 j7 h! @$ H: e7 O, l, O+ r2 j. ?

  43. & L; S$ }& g5 o& P% ~# y
  44. #ifdef EDMA3_DEBUG
    $ F! {  Y' [& O8 y. g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 T9 H7 U& B9 y+ `& Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 T/ p4 J# A/ i8 N4 h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 V4 }8 M: p" D; L7 g0 p
  48. #else6 c# h( B7 ]# C8 t+ k
  49. #define DMA_PRINTK( x... )
    ' u$ {# `/ Q* A/ P
  50. #define DMA_FN_IN
    - e/ k, r9 ~# z% D
  51. #define DMA_FN_OUT5 T7 @' Y2 w5 q8 h
  52. #endif0 f1 b2 C- \/ U+ Q' p% V

  53. / N# T+ H. Z4 O/ n$ S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" ^2 }9 Q; Z7 [* a- l
  55. #define STATIC_SHIFT                3
      F+ z( U9 R  T( B; V* T4 D' u. }
  56. #define TCINTEN_SHIFT               209 ~1 f6 p$ D& o: P& B0 X. `0 f
  57. #define ITCINTEN_SHIFT              21" [7 ^6 O; ~# c9 _1 i
  58. #define TCCHEN_SHIFT                22
    0 `! `' O# r7 k/ h
  59. #define ITCCHEN_SHIFT               23* p* |" F6 C$ o3 e/ t" Y; I& C
  60. " p9 q  B+ Z1 i
  61. static volatile int irqraised1 = 0;8 p) t9 U. z2 k' J! L
  62. static volatile int irqraised2 = 0;
    $ j% P" B6 Z' F/ l' Q2 f+ x
  63. 0 b, b; k3 `- h& q2 b: J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& Q# K# i( w4 L8 Y+ e0 F# y0 I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 ]  v# E' T3 {" b) V& m/ @/ ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  |* @8 r1 D) {2 w
  67.   W6 c( G3 W: `- m( H6 l
  68. dma_addr_t dmaphyssrc1 = 0;
    8 t' ~, w$ }$ V  W$ M
  69. dma_addr_t dmaphyssrc2 = 0;2 a8 O  J  D0 a: Q% O) v
  70. dma_addr_t dmaphysdest1 = 0;
    ( [; E  i! ?% R; s
  71. dma_addr_t dmaphysdest2 = 0;
    ) K& f* V4 u' c* [
  72. / D6 N/ ?6 m' P  |, N
  73. char *dmabufsrc1 = NULL;: q. {( t+ D1 G+ x
  74. char *dmabufsrc2 = NULL;
    9 o3 }) r& U3 S! y% H
  75. char *dmabufdest1 = NULL;8 G8 l8 T* r( @6 Q6 {
  76. char *dmabufdest2 = NULL;
    . X" n2 k  x; h  c
  77. ( N' t4 C( e6 P( T+ K3 c: u$ I
  78. static int acnt = 512;
    , J5 w1 c" q7 r: A+ c0 Z" X+ M
  79. static int bcnt = 8;4 u, d" F" ]$ R$ w* \: J
  80. static int ccnt = 8;2 s! u" ^: L% u7 q& Q
  81. ! `3 T8 ]4 ?4 h: I4 S+ Q
  82. module_param(acnt, int, S_IRUGO);4 l6 A7 b* S) D& S, g- E/ ~, J  ^
  83. module_param(bcnt, int, S_IRUGO);
    - a+ ?+ P0 H! w3 E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( I3 g1 o$ m; Q- \
: c: j7 ~( n5 v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 Z: p0 F2 R$ e4 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) s6 v3 ~/ G" @7 Y0 W
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ q2 V( o8 ^- J2 {- i
, ?; b; M' `) r# l3 B

) K, @' d0 A( r9 H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-24 02:29 , Processed in 0.037570 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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