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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) O8 V" ^- h, x/ t; Y9 T
  1. [code]EDMA sample test application2 I8 |- O) c$ Z
  2. /*
    ! |, C" t" C* L1 t  f$ z. y
  3. * edma_test.c
    & Z3 H8 F; r( y6 C# d
  4. *$ r, t, i) V6 c
  5. * brief  EDMA3 Test Application
    / B  s; |# B. T. ?
  6. *
    0 ~8 k; w, T- ?2 Z
  7. *   This file contains EDMA3 Test code.
    + o& V8 O2 |/ e/ B  }
  8. *
    " N" E" s& G% e- S7 V0 d# ^, O3 ]! w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" o/ v8 q# ~+ `/ e! \" P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 u5 t% W* P  a. l
  11. *         TO CHANGE.
    ; |, y: Z# U* ?. d# Y
  12. *
    & d0 e0 O( `" f3 z* G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( n# \$ {+ f# V
  14. *
    ) c- A- y5 L3 d7 ?* `' ~! {' S
  15. * This program is free software; you can redistribute it and/or; i1 K+ b1 S' A4 x6 k# I- r
  16. * modify it under the terms of the GNU General Public License as
    . K. r+ w& j8 l- i
  17. * published by the Free Software Foundation version 2.
    $ ^% d7 J; h' j% G+ q
  18. *% w# U& U% d* `0 U1 K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / i$ f4 B; P3 O% W
  20. * kind, whether express or implied; without even the implied warranty
    1 q8 B2 V  q. T) M- U: I+ w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , t* W' N. Y5 s' B# @
  22. * GNU General Public License for more details.
    & g3 o6 t$ w1 E- h
  23. */
    / n, n' x. M% C" U4 j

  24. 9 i  C3 w! H. y9 U0 o( f
  25. #include <linux/module.h>' B* }/ F; {1 I. ^/ w0 h
  26. #include <linux/init.h>
    5 R/ C/ f7 I# c# s* q+ ?- K: v" B. @: |7 q
  27. #include <linux/errno.h>! U+ _1 E" u. z0 n( @' \
  28. #include <linux/types.h>. Y& i0 J6 U0 y" z% ~. n
  29. #include <linux/interrupt.h>( f" G4 v& R7 |7 s+ j2 o! m
  30. #include <asm/io.h>% c9 O% S* e$ I- K, u
  31. #include <linux/moduleparam.h>  N* ^, e% b- [4 u& t9 F
  32. #include <linux/sysctl.h>
    ! G' @1 g7 R+ a5 O, k- ]  g3 Q' L
  33. #include <linux/mm.h>& s2 j8 r$ }' R! w0 x
  34. #include <linux/dma-mapping.h>1 U. z( ~- @3 x, C4 V
  35. . W8 ?0 R, K9 p9 Y" E; j' L% G" E
  36. #include <mach/memory.h>4 m% {+ g# D# |. e# X& D3 c
  37. #include <mach/hardware.h>
    0 E4 _0 m% e  C( v$ v$ k
  38. #include <mach/irqs.h>" z! F  h6 |" r  o/ C
  39. #include <asm/hardware/edma.h>* |1 f$ h4 ^2 H
  40. ) Y) ?3 e2 Q; N+ s' M& Z3 M
  41. #undef EDMA3_DEBUG" I) C; e3 v2 w9 ?
  42. /*#define EDMA3_DEBUG*/$ ]: [7 [& b/ {" P( s# o& T

  43. : j5 {+ @  s- l9 W( i% }
  44. #ifdef EDMA3_DEBUG, ^4 M' J  M0 s# v/ l) H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 E0 r4 Q) W0 J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ P! C' E3 i4 N3 x2 P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): m! Z+ y) s0 w$ L- i: j) v+ H' u
  48. #else
    * t9 b  v# @/ [
  49. #define DMA_PRINTK( x... )$ n( L8 U8 H6 F; {
  50. #define DMA_FN_IN: M/ T4 Y0 G/ ^. q% X6 a6 l
  51. #define DMA_FN_OUT3 }3 s% _& U" s
  52. #endif
    + y$ r! P6 m, t# _, k4 U. K9 E
  53. 1 _( t" y" [: L" C4 ?! X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), F- b. y! {% |) }
  55. #define STATIC_SHIFT                34 J3 X6 D7 H/ D) Z+ }
  56. #define TCINTEN_SHIFT               205 s3 a$ [1 D3 f' k, z- B' b
  57. #define ITCINTEN_SHIFT              21
    + P3 x8 t! Q( e- J# O
  58. #define TCCHEN_SHIFT                224 X% e; D/ u6 p8 r1 [
  59. #define ITCCHEN_SHIFT               23( }' W' P" c* R0 X4 S
  60. 0 }/ P2 D/ Y( z
  61. static volatile int irqraised1 = 0;( @% g8 j6 K* E7 l+ y
  62. static volatile int irqraised2 = 0;
    ! f0 d" i  t3 T. T% Y5 ~3 t( R% k

  63. 3 V, y" ^0 u5 y( P7 _) Q3 a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " Y# o5 r* K! F# O& l. j/ J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 z* [# ]$ X9 l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 i  c# c9 K8 V$ |

  67. - |0 w1 V, r7 T' p* H5 Z% H
  68. dma_addr_t dmaphyssrc1 = 0;
    % Q, e# h5 X0 D& q
  69. dma_addr_t dmaphyssrc2 = 0;, o: K9 i! B8 S- A7 H
  70. dma_addr_t dmaphysdest1 = 0;
    6 i& A9 d0 W7 A8 s0 g5 B
  71. dma_addr_t dmaphysdest2 = 0;. g. w1 w. z- \4 Z# R. O( q  C
  72. ) `0 r& w9 {; t
  73. char *dmabufsrc1 = NULL;% H4 H2 X7 w8 w7 _2 T% X
  74. char *dmabufsrc2 = NULL;
    & Y0 [$ i0 Y7 B* P  f2 i1 R
  75. char *dmabufdest1 = NULL;
    & @  i$ r$ k9 v7 T/ Z2 m# b5 b
  76. char *dmabufdest2 = NULL;
    - A2 m$ D+ T4 j' n) e6 f

  77. & T9 L0 S) W8 J4 M) {! A9 W8 C; r
  78. static int acnt = 512;
    3 q9 r. m# P/ x: N* z6 p
  79. static int bcnt = 8;% j. T0 Y* O2 P1 B' U2 e1 R4 i
  80. static int ccnt = 8;
    8 t8 `/ |+ k& B- n  o7 m- n! u
  81. 9 m4 |! b! q$ x2 W& C
  82. module_param(acnt, int, S_IRUGO);/ A. D1 A9 m0 b: J$ i9 N( `* f
  83. module_param(bcnt, int, S_IRUGO);; C+ j+ Y4 m6 v( q% L8 \2 M
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 E1 h( l4 E  Y: s# ?

3 l' k9 u4 T* i) s" F$ Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 x% v* x9 `! `/ ]# i- C4 zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; p$ f" X* Q# t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 y* z2 _" }  Y! S) y7 L- L7 a, V& t$ n& ]( c
' @' o* {8 |# z1 u! O1 k  }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-11 06:06 , Processed in 0.038857 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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