|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 @+ C, Z+ ~! Y8 Q$ z9 k$ k6 u- [code]EDMA sample test application- c" Y6 y" Y; B& l9 Q* P
- /*) L# Z& s" x' A! h5 }
- * edma_test.c3 W- @# t" B# }5 \; E' Q
- *
& b7 M+ X7 Q7 J% ?3 z7 F - * brief EDMA3 Test Application/ @& J# k1 C; v8 } l5 I
- *3 m8 _. c! b1 ~# A; k* q! O
- * This file contains EDMA3 Test code.
% v6 m, t4 B- U7 B9 G1 ]9 E - *
$ q* F% Q* i% V/ ]( U - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- t; A$ x$ T7 p9 N* A6 e
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% K( G# D- W# R" E T) s) A( w - * TO CHANGE.
8 D! Q h( H3 a9 C/ C# X) y5 _* s - *
% _/ M8 a+ [. K$ d9 ~, d - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ F6 V6 B U$ | - *
- P* Z* R# G+ R$ r - * This program is free software; you can redistribute it and/or
7 D' u' J3 G! \7 H+ N, k7 W - * modify it under the terms of the GNU General Public License as4 D% {+ R+ _, l. W+ e, H; w: P
- * published by the Free Software Foundation version 2.* |1 a+ d- O) X: }* r2 E `
- *
8 _* u* `* f3 y! u9 @% _( {! U - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 K6 l* b! ~' V0 K* ? - * kind, whether express or implied; without even the implied warranty' b1 x4 {0 C6 F2 f W4 y1 r1 o1 P% E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( r3 K$ i7 r# r+ n2 y - * GNU General Public License for more details.# H+ c2 ^; `# E
- */3 _+ g4 d1 q1 }) N0 g: K
- ! K$ O; y; D: G5 V
- #include <linux/module.h>/ ~8 h7 |+ |! j4 q' o& y s1 w
- #include <linux/init.h># _. ]/ ~& T+ T8 G$ j
- #include <linux/errno.h>9 ?0 R) {1 Y9 W5 e7 V& y1 H+ f$ `
- #include <linux/types.h>8 h! m6 ~) h1 d
- #include <linux/interrupt.h>1 N( z2 K' R4 e2 }( u4 l. i! S
- #include <asm/io.h>% d/ Y8 A- U, s- g
- #include <linux/moduleparam.h>9 ^' v4 e9 C2 e$ f4 w: e% z6 w \' `
- #include <linux/sysctl.h>4 ^9 ^- [* J! R* x _0 V. P+ f
- #include <linux/mm.h>. z ?; r/ a( ~4 L1 R: B. r& d. k- S
- #include <linux/dma-mapping.h>+ m0 K; m5 S. q) i b
8 a: E a. {) N$ V6 W5 U; u- #include <mach/memory.h>; P' I( M' l; W" u* J7 q2 [8 t2 @
- #include <mach/hardware.h>: _1 r) p9 L1 }- {$ H+ h
- #include <mach/irqs.h>! _" j! U4 p9 h/ N& l6 z
- #include <asm/hardware/edma.h>
; i" h: j& v8 l
+ x0 ~% r4 w, ~) ~) A1 b8 l2 {- #undef EDMA3_DEBUG
9 t* v; s' I& N' V1 o2 S+ \7 x - /*#define EDMA3_DEBUG*/5 L2 g) _) J4 F
- ; I6 R( @+ g+ x' x0 z
- #ifdef EDMA3_DEBUG
" }) W% J6 j" o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) n5 H( Z7 x# h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) y! E0 _ h/ [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( \7 S2 X% L! n% [. m
- #else
" n9 X& M. V9 N - #define DMA_PRINTK( x... )
% z/ S! k, H: P# X# J1 \$ A$ ^- G - #define DMA_FN_IN2 B4 V* M: O ?6 {$ E+ f7 H& `, u- t, b
- #define DMA_FN_OUT
) a! L: S" S5 [( G$ t% I - #endif/ A" r2 A, L: ~) X, _0 n2 C
* J# n0 U3 e2 L! T- g! w x" K0 _- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 c3 t$ ]7 q: M - #define STATIC_SHIFT 3" ]9 r2 @8 t, s! u% l7 n- z
- #define TCINTEN_SHIFT 20, D: E& ^; g# T' P. B6 ^% j
- #define ITCINTEN_SHIFT 21
$ L) N' j8 W N; l3 A4 D - #define TCCHEN_SHIFT 22
2 x$ {4 I8 @6 ]0 W. H$ c" j - #define ITCCHEN_SHIFT 23" ~2 A/ |8 X" K+ ^
" L- p; ^: Z; R/ w8 E- static volatile int irqraised1 = 0;$ h5 H6 R! n; G4 X9 X" {
- static volatile int irqraised2 = 0;
% V. n n& z* u4 o: z
( w1 ~3 {+ c# i8 i7 o; Y1 i* p- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 I' d% S% I" S+ n/ o# ^- C - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 r) L k0 p" X8 E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 x2 n v" n( l* q
- ~' u0 \- ]9 O9 j) w$ k& ?( b3 E
- dma_addr_t dmaphyssrc1 = 0;
0 [# ~- L# F& j6 Q7 n5 m - dma_addr_t dmaphyssrc2 = 0;5 x( q, q c: a# Z+ A4 g
- dma_addr_t dmaphysdest1 = 0;2 Z" b6 g* g1 \$ F' k* t1 F2 k' G% N
- dma_addr_t dmaphysdest2 = 0;
1 b: A( I! H* m3 C
3 ~5 Z* Q6 F" j' w8 i+ r4 x9 M5 J- char *dmabufsrc1 = NULL;
) |" H/ a" R3 q( F - char *dmabufsrc2 = NULL;
- r) t6 _9 c9 @0 X' n7 X - char *dmabufdest1 = NULL;& l# G/ t2 ?' O' o7 f! T8 [& X
- char *dmabufdest2 = NULL;
/ V( J5 q% n% ?3 w, B2 C
9 T" Q2 @, F7 {: b2 Q- static int acnt = 512;
( L6 {& K4 [8 |6 B# \. l' | - static int bcnt = 8;
6 b6 s8 v6 a/ j) H. W - static int ccnt = 8;4 Y+ P% [" N7 m9 m0 `& @
- ) [8 s/ ?3 J1 i: D, p: e6 d
- module_param(acnt, int, S_IRUGO);
& ]# v# b v! N5 B - module_param(bcnt, int, S_IRUGO);
) p/ ]1 Z r3 f( `5 H - module_param(ccnt, int, S_IRUGO);
复制代码
1 ? Z6 J: l# y6 [# L) B; K5 _8 f1 w, |/ d) L* ]
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* g0 V$ X' @8 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: O0 Z: N. z3 r5 C& R+ W; X
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% Z. c) b* n" z& a3 W
0 S, i4 U1 n7 V( ^( {% H. d
6 @( O1 g$ |3 z" p( k, Q2 s
|
|