|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& t. k) v1 |' s, q" t- [code]EDMA sample test application
4 R: u3 P e. M7 p& z - /*+ f5 @/ G1 g; o1 m" b! g
- * edma_test.c
$ \' c/ o) ~8 x- O0 G- }9 Q: ` - *; ~0 v: m9 _" E* s6 \
- * brief EDMA3 Test Application
) L- d7 d! K9 C$ V - *8 g2 e! `& S/ H% a6 Q: ]
- * This file contains EDMA3 Test code.
: N! w" j" E9 X) G' ~' a - *
0 R: T4 T6 C8 M9 z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 E; b b7 n- O4 N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! e9 o6 \. C# Q - * TO CHANGE.
, v1 N* e' p( Z* O" C H! t; s. [ - ** c2 B/ \, ^1 y/ A( u8 `. S4 g6 w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' W( H; l% E x) G+ i) u - *) k6 _$ [1 c( E" P: H
- * This program is free software; you can redistribute it and/or1 m# e/ i9 s; L& C
- * modify it under the terms of the GNU General Public License as
9 a. A, }( C' M# J/ P, F1 {: T" k0 \ - * published by the Free Software Foundation version 2.
1 v( ?1 H8 L0 v& v B+ K% r* M - *8 ~3 G; E# s; p' s* r) I
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) \9 M9 Y' k$ f# S' f) u: F
- * kind, whether express or implied; without even the implied warranty
2 w. o8 J% z! m; |* e) p5 j - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 `' S% k- G) |# \+ {0 a% z6 l7 X
- * GNU General Public License for more details.
+ Q8 |/ u: p* D1 x7 ~6 s - */
2 D5 i4 T1 X% _/ N - ( P" h4 E; j, L- l1 a4 m5 ~5 z
- #include <linux/module.h>' ~* d; o* w( R. u
- #include <linux/init.h>$ Y" I' p4 j2 }! I( V1 o6 z
- #include <linux/errno.h>
B# q5 [2 J0 {+ G- o8 Q - #include <linux/types.h>
( A* @% E) U! B1 J - #include <linux/interrupt.h>
( ?: s( I2 m& X4 _3 S( U9 T - #include <asm/io.h>
6 f2 m6 U- ]8 c& d x# \0 i5 t - #include <linux/moduleparam.h>
5 v7 b+ v$ V! K! g2 _, O6 r) R' H - #include <linux/sysctl.h>& z6 z: u& F' W; i& N) c
- #include <linux/mm.h>4 H+ B( i0 @& s
- #include <linux/dma-mapping.h>. t$ g: ~, @! I: w+ q/ z
- 6 l% i4 U/ W3 q: t- T
- #include <mach/memory.h>
$ d \. O) l1 v; z9 G: Q6 O- Z - #include <mach/hardware.h>
3 E) S3 j9 M6 U - #include <mach/irqs.h>
; [& B2 ^1 H7 o: s/ E# f - #include <asm/hardware/edma.h># n) b& s& ?3 S0 `/ P, m+ k
- 0 \* h* V0 V) v6 e6 G; T
- #undef EDMA3_DEBUG9 f# ~4 H' N: \% P
- /*#define EDMA3_DEBUG*/3 q# I+ {$ b0 ^7 S) q3 E' I
1 @+ U5 u+ y$ L7 q- #ifdef EDMA3_DEBUG* r* ~) G4 ?4 g! V; ]! }: I0 P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 I/ _% }% a& v* f6 ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ P' y! R4 C3 B: F4 K2 x) K5 L - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ x3 w. Y! e2 G* A/ e" Y4 {
- #else
; k8 i) o) L/ ~' b - #define DMA_PRINTK( x... )
2 ^* M- N6 [) }6 u0 z1 ?0 M - #define DMA_FN_IN! ~8 `7 t" C: a2 s0 h
- #define DMA_FN_OUT9 D D+ P" F1 I T8 S# D$ _
- #endif* l. v" @* v7 q8 L- g E
) p2 n6 J3 F! I) X; z h: U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' t$ v0 E% m0 G% t j
- #define STATIC_SHIFT 3- D2 @$ P6 i$ w. i8 Z) _
- #define TCINTEN_SHIFT 202 g3 T9 V3 L, T b0 {+ {
- #define ITCINTEN_SHIFT 21
& s9 B, D X! F8 h4 O% Y - #define TCCHEN_SHIFT 22
* ^# Z* F$ u8 U i- Q - #define ITCCHEN_SHIFT 23
9 O* V9 g6 d. m; U* o
$ d7 U. D7 C/ b+ W7 i* C- static volatile int irqraised1 = 0;
3 I* ~; e$ ~$ r; c - static volatile int irqraised2 = 0;
8 K0 d# l4 x+ S( U - 0 w% X5 k, f( s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) V# [% ~9 V4 E/ H2 w- o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, }! d4 N' ? R2 Z% U4 [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" p1 M/ z4 y2 k# z# m2 X
- & \$ y& m+ Y: {6 |3 T; c
- dma_addr_t dmaphyssrc1 = 0;
5 ^- j t5 H! X3 h* } F - dma_addr_t dmaphyssrc2 = 0;
5 t: c( e0 ]- [9 i4 M$ d - dma_addr_t dmaphysdest1 = 0;( x6 [2 H; q/ z5 @1 L) q
- dma_addr_t dmaphysdest2 = 0;
7 B5 }$ z( w& o9 D7 b7 z9 X
' {8 b. J* y" E4 z- M3 y- char *dmabufsrc1 = NULL;
* z" T& D; M' ]7 `2 A - char *dmabufsrc2 = NULL;
+ p% [3 z8 P3 I+ b& ] - char *dmabufdest1 = NULL;
$ q! i( t3 v& m; N A3 g- r5 K - char *dmabufdest2 = NULL;; A7 O! ?* Q; ~5 s' C
; F5 Y* S$ N5 J- |+ s- static int acnt = 512;
3 a0 {6 W2 b! W3 B) X& P/ C - static int bcnt = 8;5 S2 K1 j) i0 i& C
- static int ccnt = 8;
! J8 R# } f. t1 Q% T. o# X
3 C/ e0 F; t/ O9 ?. y6 @' ?9 V5 {, B- module_param(acnt, int, S_IRUGO);
/ C4 }' ^; G0 D. h8 K% l - module_param(bcnt, int, S_IRUGO);: }9 r$ d! I! ^' t5 n
- module_param(ccnt, int, S_IRUGO);
复制代码 , e$ B. `3 C8 u" i% r4 X
8 n% Y7 P! ~/ p4 {. k5 J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" q# A4 _! Q* I0 @, V, @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! V: t+ m1 m1 q* L
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ r5 e T- ?# b2 C2 P/ ]7 e2 k. b- j4 k/ a1 e; ]
. h8 L/ u% w$ w" N; H
|
|