|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % G; F( R3 P+ Q K
- [code]EDMA sample test application
$ q1 q( C: `! Y9 N d8 _1 O* D" V - /*
, A2 T3 r' e" U- m - * edma_test.c
6 T& Y1 V( A, ?7 o+ [ - *
# U& A* ~% Y0 O' } - * brief EDMA3 Test Application
. X1 t9 l) t# V+ G/ k* {" i - *
. H7 e6 i9 f3 I+ D! n" N( ^ - * This file contains EDMA3 Test code.
5 R4 }* v& m8 |- [8 e2 T - *
|. V' e0 K9 X5 h I4 o, F! i( z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' v- h5 W- n7 Y& r$ U" N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ W+ `# T4 a& O5 B% ^$ c/ K - * TO CHANGE.
. c1 \2 W% ]! O0 y" {; H9 @" F+ ? - *
2 ~4 u4 ^* E; M: Z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 Y( u4 ?- o, t6 L
- *: p# B1 b, V: g5 V0 y. N
- * This program is free software; you can redistribute it and/or' v4 ]; F% W& x
- * modify it under the terms of the GNU General Public License as
6 Z) Q& }- K5 R _" ~6 z* L! ^ - * published by the Free Software Foundation version 2.
! F1 [' _( m# Q6 g' D9 E9 n8 U5 ~: w+ [ - *
) j6 z" L- s1 k1 C; U) K8 p* B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 Q: \* _: P8 C3 p - * kind, whether express or implied; without even the implied warranty
' j- s/ y; y8 M. w) D0 f0 u - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) n. \9 |2 J) j) ~2 t
- * GNU General Public License for more details.3 T6 k& w! H+ R* W1 C G; C2 }
- */
0 ]- t0 T% B( G& C8 L - 5 E h/ z! K1 f w- o
- #include <linux/module.h>
8 J g1 t b3 G! p4 S5 N - #include <linux/init.h>
, B: v6 {/ v+ b9 V5 y5 s - #include <linux/errno.h>. ?; B( G8 r/ s. n: ^
- #include <linux/types.h>
$ t' `) f+ o' k8 m. K% B - #include <linux/interrupt.h>
, ~# t& B n3 }( U - #include <asm/io.h>1 @9 J, J+ w" g. W M- l' w
- #include <linux/moduleparam.h>
# D4 ?9 b- b7 s$ k, M5 B+ e9 [5 n$ F - #include <linux/sysctl.h>3 T0 e7 T, e7 m$ O) M X5 ?8 `
- #include <linux/mm.h>/ [/ r( Z7 }$ m- W2 V
- #include <linux/dma-mapping.h>* q8 b" z0 }0 A, ~# E: J& {
- + h, j9 c% u' i% m
- #include <mach/memory.h>
X8 J) p1 t! o( ]! F - #include <mach/hardware.h>" O1 ?0 ^9 u7 ?* x
- #include <mach/irqs.h>
; i' M( [& n9 Y! R& W% I5 a - #include <asm/hardware/edma.h>
+ n3 l2 D8 O1 Z! D' K - 4 x+ K3 l- J) y5 F: D
- #undef EDMA3_DEBUG% ?- Y7 Q- H. V, l
- /*#define EDMA3_DEBUG*/
; q5 S3 M- Q" \. U. T - 0 X* ^- F0 Y& x* n% c1 S2 I
- #ifdef EDMA3_DEBUG S! z1 w& }6 K1 y% @3 C- x4 I6 m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 ] L: c! z Y+ j& f- u* y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); l/ e0 j2 D9 R' S
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 k. B2 c8 h2 R; y# | - #else/ |/ y0 N3 a0 F' i4 P
- #define DMA_PRINTK( x... )/ |- u ~! V* R1 i0 y$ N
- #define DMA_FN_IN0 V j; @/ J0 e4 E: i0 j
- #define DMA_FN_OUT8 i1 {* H! X% G+ s' }0 v7 t" Q
- #endif" Y* U0 ~- h! S5 O
- ( Q5 r6 D* |5 p$ B, ^) C$ A1 A
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: ^* }& D. m! A$ O1 Y0 @/ }6 s4 M - #define STATIC_SHIFT 3& V" O: r& Q; Z, U) u
- #define TCINTEN_SHIFT 20$ u8 q5 f# A5 G) {1 v/ i
- #define ITCINTEN_SHIFT 21
1 G3 R) ^3 _7 ]: j' d - #define TCCHEN_SHIFT 22. `! N1 i3 [- w* o+ R: |
- #define ITCCHEN_SHIFT 23
* D7 @, X/ Y' |6 u- @ H; u - 9 `3 G$ L0 ]; x4 c( K0 {' W. P
- static volatile int irqraised1 = 0;
& V" Y5 z- n1 E7 ^& f- O9 b6 @; I5 Z - static volatile int irqraised2 = 0;/ f. y) b1 G h3 ^* P
- 7 N, W0 S6 ~8 J/ x8 e8 h4 D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& W2 m* T/ a: j, t2 ] L: A
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! Z7 ?! j. A. P% K% @8 F* I( R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* b3 K/ e0 c6 H" T
- , ?9 [) j& L! \4 a/ o
- dma_addr_t dmaphyssrc1 = 0;# L' k7 G3 _: O$ n, _
- dma_addr_t dmaphyssrc2 = 0;
2 t9 t' G/ Y& | - dma_addr_t dmaphysdest1 = 0; f6 c( W' Y5 a! a5 p% g
- dma_addr_t dmaphysdest2 = 0;
2 K4 l7 A m. l+ P" Z) l/ t% Z4 z
+ z+ e, ^! w( n- H" }- char *dmabufsrc1 = NULL;
: T+ v/ b0 S4 P' M ]1 _) A9 O - char *dmabufsrc2 = NULL;
( f1 z7 E/ B) o0 P% o! K O( `5 K - char *dmabufdest1 = NULL; t. m \, B$ H- s
- char *dmabufdest2 = NULL;
0 \" ^8 H* t" W) Q! }
4 n# u- J# B3 S( ~3 K8 Z- static int acnt = 512;& {' T" ?7 D' p" u7 A
- static int bcnt = 8;+ |$ t5 q! |9 ` w
- static int ccnt = 8;8 x8 Q) Y8 r. F: s, v
/ j/ i& a$ I& K. ]+ v- module_param(acnt, int, S_IRUGO);
, d9 R7 @3 y' f - module_param(bcnt, int, S_IRUGO);- R% m5 H9 V5 q% Q0 }
- module_param(ccnt, int, S_IRUGO);
复制代码 ) Y ]0 O- ?2 q3 H. A
4 r7 d; b: T+ |+ D2 q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) F8 t8 }# x, [' v! ?$ u2 W6 `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 M* V' R/ s$ W4 j# i( T
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 n$ s& E; H% i4 E' @
9 S3 W# _% v& O- \0 M: X0 g6 Y+ a% `3 @
|
|