|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . E8 M) U% @! d
- [code]EDMA sample test application
) p0 V: {6 a G5 `! H x e - /*
b8 {& L/ w/ u: w - * edma_test.c( ]! O2 b% `, y0 E2 H' I9 _
- *
' Y; `0 P7 m V" u6 _# V( k - * brief EDMA3 Test Application
8 `9 Z5 j% v/ K9 ^4 T - *
7 q. J0 }* z" O& I: u/ u% B - * This file contains EDMA3 Test code.
2 U1 p" R1 F3 @ - *
- |+ l) O6 M/ l" ~. Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 [4 y) @( W* G l9 a7 o# b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 O/ d3 E1 ?6 o3 { - * TO CHANGE.
" y( M1 I' b8 N Z) e c8 U - *
; b6 b& S {! j+ e& ~- V - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( {4 u' I( ~$ U0 u/ _3 s
- *! _1 n- f- X' Y' v- _* z1 K
- * This program is free software; you can redistribute it and/or
% T: i0 a& t+ C5 P6 J - * modify it under the terms of the GNU General Public License as$ d1 j9 K/ ^+ S, o
- * published by the Free Software Foundation version 2.0 C j* E+ l. v7 N* C
- *
3 r' f7 Y2 B$ b7 R) Q) n& _/ v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, s( C2 v& e" Y: X* r t' r - * kind, whether express or implied; without even the implied warranty
+ F; b3 r1 \6 n9 o( h4 d& e - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( P( ~1 s3 e) X- ~" u! |) m+ d5 f - * GNU General Public License for more details.; I% j7 E/ ^+ h* v- N- ]$ }
- */
" ~5 U* n8 x0 E: [. y - 5 p# Z+ K: I: a9 j$ u
- #include <linux/module.h>- E( k4 J: c G3 t
- #include <linux/init.h>
& O" a) J6 n: w; }' }$ V - #include <linux/errno.h>
% n& a& Z, t3 g' x/ A% X! @ - #include <linux/types.h>
j( M; b$ l0 u8 W" V" C R - #include <linux/interrupt.h>
0 q! g0 N" P+ @( W/ o, G2 M+ ]& R - #include <asm/io.h>3 j" L8 \! f3 d, Y7 u; i: l0 R) ~
- #include <linux/moduleparam.h>% q/ N% |4 ]. u, F
- #include <linux/sysctl.h>; n+ l, F% p+ o/ F
- #include <linux/mm.h>/ O, p/ H' R+ O/ [# D, a' J
- #include <linux/dma-mapping.h>
( w2 L, `4 D* v( h( [
% b) E% g! W! c- #include <mach/memory.h>( s6 E1 {0 I- n2 l; o: X+ _9 q
- #include <mach/hardware.h>- [5 I- d* ]% D6 m# r- ~! |
- #include <mach/irqs.h>4 E# \! K4 g' }0 o+ J6 m8 Q6 @
- #include <asm/hardware/edma.h>
8 N5 n8 p* A- w2 w: d
0 p D8 O( k: C8 _- #undef EDMA3_DEBUG
5 N( x' `0 H9 g - /*#define EDMA3_DEBUG*/! B$ h0 A; Z0 R2 p" f) F& \8 Y
- 6 v3 o8 F% j- H! X3 I
- #ifdef EDMA3_DEBUG' u* h7 d3 T" J; H
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 C+ p" Q2 v% v - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
E7 M# Q2 u/ ~) O# G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' b# t. h! V0 _! f% Q - #else
6 O! K* B' Z5 Z' U7 I/ z( |" z - #define DMA_PRINTK( x... ) k+ @" ]' z% y* G5 V: \
- #define DMA_FN_IN
, l7 q' V( d( d! N( Z7 ~2 S8 ] - #define DMA_FN_OUT
- m8 w/ H: b, Y6 W4 ^! I/ ~8 R - #endif, {0 {4 b( V0 G: |! U% D
4 R" S$ N; D% R2 U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 q- T5 m/ B7 f$ Q9 H5 o
- #define STATIC_SHIFT 3% }0 n- X5 w7 u9 a. l. Y9 A
- #define TCINTEN_SHIFT 20. n. I5 H5 E6 i# f3 M
- #define ITCINTEN_SHIFT 21
M+ J) r! {3 e# q - #define TCCHEN_SHIFT 22 X( G. f+ W/ C. \' E# Y0 P! x
- #define ITCCHEN_SHIFT 23
9 V; {+ g: a' h/ m) s5 d - & C" I$ I& A7 ?* g j. @
- static volatile int irqraised1 = 0;
# e! A- Z, Y$ j0 \$ m - static volatile int irqraised2 = 0;
- |- C+ U& l% R! X7 N
, V0 K* G* ?6 |3 F0 @$ u& _$ W- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: M' a3 w" j, o: x3 m4 I
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 b* s( n6 d1 V. O4 G - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( g) c0 o6 E3 p6 o; J5 ] [
% M( Q j" g: e; B- dma_addr_t dmaphyssrc1 = 0;. S& g; r- F7 E7 |
- dma_addr_t dmaphyssrc2 = 0;
/ y3 W& E& K8 `) d' R! a. T0 l - dma_addr_t dmaphysdest1 = 0;
+ ~* \/ p# B- o( ? - dma_addr_t dmaphysdest2 = 0;# t* a- H1 I: v
- L0 J. e% O a! _
- char *dmabufsrc1 = NULL;
" d, d0 W4 o6 Q. {$ ? z4 } - char *dmabufsrc2 = NULL;3 T/ ~4 w6 }, h V: P8 B
- char *dmabufdest1 = NULL;
! k; n0 A7 E9 e% f5 e - char *dmabufdest2 = NULL;
1 B- h _3 w9 Z+ `: |0 U - 2 j9 a) H' f4 f0 o0 {
- static int acnt = 512;3 i( i7 E1 q% Y2 I- g/ A
- static int bcnt = 8;4 Z8 G9 h) x, s" c
- static int ccnt = 8;1 r4 C }" ]3 G Q; W3 y' P3 j
) x0 b0 g' e0 C7 x6 T3 A" c- module_param(acnt, int, S_IRUGO);
0 h/ U* s. W: b2 f" z: I - module_param(bcnt, int, S_IRUGO);
' Z, k5 _+ y" i4 {1 q - module_param(ccnt, int, S_IRUGO);
复制代码 0 D ?4 S4 O/ i9 o( N; B: K- T
% \5 W* v' J& o* ^# G& N4 H$ G
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( Y/ H0 \) }* C$ w3 u" g6 darm-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 d ^2 w* m6 c! y8 \( Z8 f$ X* I, H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 W y+ y, v6 q9 W% M6 B3 l# b4 c
4 I" H' M. Q- ?' o- x. U2 Z# X4 i6 I5 q( m5 `# K
|
|