|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 Y8 J/ K5 L* d/ d$ l& B- [code]EDMA sample test application
$ P5 z. V3 X# W! ? - /*. _, x8 e6 G$ }! D% @$ F2 `
- * edma_test.c
( L( S: s* j! d - *2 R+ Z$ W; D. {$ X
- * brief EDMA3 Test Application: p" v9 a- k3 }* l
- *
) J% E) i3 J' f) L - * This file contains EDMA3 Test code./ X7 V1 ?) R4 T" ?7 Q `
- *
) n& K# r3 h l- K6 o7 k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: `4 o) M* s# p6 y |9 H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 _1 |& R6 S+ u1 T: r - * TO CHANGE.( u9 @; _7 `# S0 v1 M6 e
- *
" e9 e2 X+ \" X& ^9 l - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* m O2 E8 t! D" @3 M - *
) q. r3 j, Z I8 D - * This program is free software; you can redistribute it and/or
3 W/ w% j0 e4 ]3 I - * modify it under the terms of the GNU General Public License as' _* y1 P! E9 _% Q2 i, F! }: V& T
- * published by the Free Software Foundation version 2.) G3 _; g1 O+ I2 K! g& s3 B3 [
- *) c0 Z% u1 R. g5 W r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 @4 E* X5 ?& ?6 k$ B) [$ s+ R# y$ A - * kind, whether express or implied; without even the implied warranty
8 ?8 a' b( D' ^2 N% B, n - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' j; {6 M+ Y3 h
- * GNU General Public License for more details.
% J1 t5 x& c0 h) m7 s* X7 w0 N - */4 ?8 p+ R- @- w" C
4 S6 W1 o! R5 R9 X. }- _6 Z- #include <linux/module.h>
: {9 u3 x' a0 l/ L" k, i6 ^: R2 R - #include <linux/init.h>
* j. Y; D2 i, f - #include <linux/errno.h>9 t i. |1 @: B& A' ?' g
- #include <linux/types.h>
3 L1 {' N. p6 w2 J, F - #include <linux/interrupt.h>4 {/ n5 r, K/ l2 e/ U
- #include <asm/io.h>& Y6 `6 _4 a: C& K' m$ B8 q
- #include <linux/moduleparam.h>
9 u j5 i u e9 z1 v7 ^7 y - #include <linux/sysctl.h>
: k- T0 j6 c8 J/ s9 L6 B: I0 }/ u. ^ - #include <linux/mm.h>
) P' b: s. {5 b% y8 T3 l - #include <linux/dma-mapping.h>
% I" o+ Y( |# C. C. g
2 z! H$ h8 F( A' Z3 p$ H6 k# g: y- #include <mach/memory.h>' }$ y, ~! J+ q6 @
- #include <mach/hardware.h>( a) b! z. M' J) s9 w
- #include <mach/irqs.h>: d5 D; V- B) w- g. {8 x1 W
- #include <asm/hardware/edma.h>& l- D* y7 a! i! k& t
3 C |+ N2 x3 w( j- #undef EDMA3_DEBUG8 q% d2 O0 u; F' k; y
- /*#define EDMA3_DEBUG*/+ x ?5 ~' V4 v3 B9 T! r1 Q
- 3 R6 K* G3 _% p8 o$ ]. B
- #ifdef EDMA3_DEBUG, V. }6 w, W" d0 i, i
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* \/ f5 e, Z3 G" _3 o2 b
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) j! d% S8 m& O' {+ r
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* s( t! g- a3 X) J' L - #else
2 S b+ S8 z& V2 q7 A - #define DMA_PRINTK( x... )7 ~. ]7 l7 G! B: q6 {3 {1 O4 R
- #define DMA_FN_IN6 K0 x5 t4 d6 x
- #define DMA_FN_OUT* D3 E. t7 x6 i/ S* R
- #endif- r! S' ^$ Y$ t! r
- 1 U* [' ]/ N* U$ C; R4 P7 L" y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% q' Z. w. x3 f6 u, I1 y( Z$ L - #define STATIC_SHIFT 3
; @& `& ^: {: m - #define TCINTEN_SHIFT 20
, G- K' F2 b! n/ T8 c5 N - #define ITCINTEN_SHIFT 21
: p, A& o+ r/ D - #define TCCHEN_SHIFT 22
1 |. R) {- z; {! B - #define ITCCHEN_SHIFT 23
/ {3 f) Y/ V: F) U - " D4 v5 \( T" \) F: }
- static volatile int irqraised1 = 0;
2 C5 d8 d+ `' D3 T% }9 y - static volatile int irqraised2 = 0;. m0 [ P% A( H, _- }. ^, m
- + A2 _- Z% e. G& I3 \2 W. d w& J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; n2 _* J/ v6 B2 w' c6 s1 G3 R - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: j- U$ G( A1 e8 ^8 {+ v0 P
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 g3 I) t% S$ f2 j0 D |: k
; g3 H3 Y' {$ t- dma_addr_t dmaphyssrc1 = 0;
) }. i* v6 o9 `) m. g: K* \ - dma_addr_t dmaphyssrc2 = 0;
# S/ e' w1 h5 Y; P/ A/ f - dma_addr_t dmaphysdest1 = 0;3 ?4 B- `( P# m6 J
- dma_addr_t dmaphysdest2 = 0;
q- B r+ K2 [
% N. p8 X r1 m- S0 R- char *dmabufsrc1 = NULL;4 d7 n2 L1 Y4 b* u- L
- char *dmabufsrc2 = NULL;7 g- O! @# ^: w8 N5 p4 D6 y, V
- char *dmabufdest1 = NULL;& _: ~. a4 M, @$ }- F. ~: P
- char *dmabufdest2 = NULL;+ R7 M f1 S. P. m6 k: a0 Y' Y" x0 C
. d+ v; i6 Q: W: u5 Y- static int acnt = 512;0 ]) K/ k B5 f N- H
- static int bcnt = 8;
) L$ ?4 y( `! ], i* h" \ - static int ccnt = 8;
0 F1 U! i* a; | F9 o( N
& c9 H: I* L# f* S- module_param(acnt, int, S_IRUGO);' ]$ t* m: H. A0 y8 z3 f
- module_param(bcnt, int, S_IRUGO);
2 _3 r" S: R8 ] - module_param(ccnt, int, S_IRUGO);
复制代码 5 K* ?: O/ r6 }2 y. }. x& G! F8 p2 r
- x1 t) }# w' {3 g, W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% T! Y. d- N3 n9 f0 Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ H3 B* r, N$ V! ]7 t 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 r2 x. q* Q1 N( ^" [1 e5 O1 m
: u: g5 [+ C/ C; [2 v
2 ~1 V0 l, D- Y0 ^# u4 K. }- t |
|