|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ K/ O& l4 h7 N3 D- [code]EDMA sample test application/ q2 Z" I& D5 m: S* S5 E' c
- /* {0 k) ^, ~; D5 V; L6 z
- * edma_test.c
; h$ W0 z1 _+ s: b! X5 [0 G+ B - *+ U& J6 [) U9 [ c$ M9 m, y7 D
- * brief EDMA3 Test Application' C) u, T! w& |2 g- w) h
- *- j# w) u3 Z: Y3 C/ x. n' t9 D
- * This file contains EDMA3 Test code.0 P3 ], `) o/ K, f/ @# ?) K; f
- *0 `% U4 d1 r. G" G8 k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 J7 u( F5 `7 l" P - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 w# P* ?$ d; W/ d- b - * TO CHANGE.+ E' H- h: y& f" B( |, s
- *
6 _* R& ?' Q+ Q# g% I3 u - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 P9 n4 W& b. @/ s - *
' `& A/ K3 U( h) y8 ]9 e - * This program is free software; you can redistribute it and/or
* {( ?% Y; Q/ | - * modify it under the terms of the GNU General Public License as
5 |6 b1 \1 S6 z, I+ M - * published by the Free Software Foundation version 2.
8 m) p8 U) j& ^$ x3 J$ ]! |- O - *
0 {- \6 N. [4 p0 \2 R/ z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 T% k% r1 L2 I% N! D
- * kind, whether express or implied; without even the implied warranty
8 k% S. K; w2 I. `" s% N* w1 i/ Z1 s9 j - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 F3 {: I- k" I5 F
- * GNU General Public License for more details.
9 v$ I8 E1 q3 R( C* h5 ?7 r - */+ F E; T7 A4 x z5 {0 q
- + |! X7 y) B3 m$ G6 `7 W
- #include <linux/module.h>
, C ?4 Q' O1 b - #include <linux/init.h>' R C7 A3 ?) ~/ g6 a& B
- #include <linux/errno.h>
4 n7 Y3 p! y/ c - #include <linux/types.h>% z: e6 F g6 g
- #include <linux/interrupt.h>
0 n8 R, v7 ^6 W. H# Q, r - #include <asm/io.h>$ D1 `+ V7 z5 i8 X* C g
- #include <linux/moduleparam.h>
+ a; ?6 `) ^7 _( d, P0 Z. _+ \ - #include <linux/sysctl.h>9 `1 O1 s2 E. A# U. @9 ~+ N1 b
- #include <linux/mm.h>
$ ^9 r4 |- q- @0 U& h+ Q \3 r - #include <linux/dma-mapping.h>. Z4 g3 G2 _7 S" A3 y$ |+ W; w
. ]' o1 d' [7 v) }3 u- #include <mach/memory.h>6 n- ]1 G5 H) _. s8 a
- #include <mach/hardware.h>
/ ~! r& e2 A7 R; Q/ w$ z - #include <mach/irqs.h>
' K# _9 K5 f7 q5 S9 [' f5 ?# h. l - #include <asm/hardware/edma.h>
. j P6 {; I6 t% e$ i9 i' h - + h' @% `) a; b) f; r! }
- #undef EDMA3_DEBUG g7 q5 A9 h$ Z% \* ~
- /*#define EDMA3_DEBUG*/
9 `3 m% h+ _+ o6 q( A* d - - @, V+ ?8 Q: Q2 _5 M0 }
- #ifdef EDMA3_DEBUG
9 n& m! N: r: v1 }' L* m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 [. H* K2 l! E% i/ m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): W8 Z5 D8 Y+ i3 h& e* B
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
p5 N% l' w: j9 {( r4 d# _$ s% O4 p, @ - #else
3 j$ B: y; g% G: Q1 g/ C. x; i - #define DMA_PRINTK( x... )$ S; k+ |3 v7 i. P! S
- #define DMA_FN_IN
# P0 {5 i/ k! _ - #define DMA_FN_OUT% U M$ z* F U* _: K* N9 g
- #endif1 p z& Q: X/ U
3 _7 M' p" H8 M2 o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- o9 Y8 |& G& c - #define STATIC_SHIFT 3
4 u0 U: W: ^0 D" F L/ T1 u2 h - #define TCINTEN_SHIFT 20( M- N4 u. f2 q: v1 R/ @
- #define ITCINTEN_SHIFT 216 o) y* p; O! L+ q
- #define TCCHEN_SHIFT 22* N' C8 P! r8 F# p3 b
- #define ITCCHEN_SHIFT 23+ y& a! X( J/ u
- - R4 L f$ H$ B4 ?9 C
- static volatile int irqraised1 = 0;
* a6 m& _# w/ n" L9 g- @5 P' U - static volatile int irqraised2 = 0;9 J2 D+ |; C, E& \9 W4 N4 v
- . M$ S" X( V7 u# U& t8 d% }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 `% @3 E) X6 A' K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ x/ [% n% d% |% Y# P3 N( M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' E5 S% N% W. t - % `( c0 L' x3 P% o( {; o3 u! V6 w
- dma_addr_t dmaphyssrc1 = 0;8 G0 {2 x. c8 V) A: X1 y
- dma_addr_t dmaphyssrc2 = 0;0 }/ l) ?* ^3 u& X
- dma_addr_t dmaphysdest1 = 0;% B% [; J" X: w; _( H
- dma_addr_t dmaphysdest2 = 0;1 w5 F6 P, K. i' ?
- # A2 i0 l8 A2 t) J* I2 u' ^2 O8 O
- char *dmabufsrc1 = NULL;& ^! e( {4 X( w o2 k1 M4 v
- char *dmabufsrc2 = NULL;
6 f0 G% e2 H+ w - char *dmabufdest1 = NULL;
3 J: t) k2 R$ J - char *dmabufdest2 = NULL;
, h; Q% K7 U8 z" N$ g, E" u; v+ | - % V" R. } x( P& U$ \. A" v3 P
- static int acnt = 512;( q; [" W0 Y( W8 ^' R/ t
- static int bcnt = 8;
+ Y8 |" T) y2 }# t$ e - static int ccnt = 8;
" \! _5 Z+ k+ i/ Y: H5 E - : z, ^1 H' v, V: q* [) R: ^
- module_param(acnt, int, S_IRUGO); Y T7 [- U4 [
- module_param(bcnt, int, S_IRUGO);3 }4 l5 @8 ^: O2 ?( K- j1 s
- module_param(ccnt, int, S_IRUGO);
复制代码 # o" [" K5 [7 q: Q, w. f; u" Y
7 C1 u" n# I9 F# H/ L3 G7 O' ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 ^: }1 ]' b, parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 e5 w1 B- X; ?. O- H
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; f4 `$ m7 s P+ R3 q7 Y# ?2 [) Q
( B4 y/ |. x& M$ d, y- ~. O* G9 n4 ^; a2 C8 s( X
|
|