|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 C5 a! M* [5 X- @: h. f( i9 G
- [code]EDMA sample test application2 F0 s6 T9 L; I
- /*
$ F+ S0 Z7 C8 ^8 r4 @: V/ S - * edma_test.c
; U' C# H/ {: O0 u4 V! P - *
- @: }& |5 u. }( N- j# M k0 \ _3 D - * brief EDMA3 Test Application
; E% c) h9 r) ^' \ - *
0 n8 o8 {; w7 H3 a% [+ ^5 i# U0 a4 O4 c - * This file contains EDMA3 Test code." Y/ w/ ], v1 b6 R2 H* M' e p
- *1 B( Y% i& c. n) O2 D* t# r
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ G. d0 h: h% }/ ]2 C/ J0 o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. |4 X2 S1 q6 R' E3 D3 U+ f - * TO CHANGE.+ j* I5 L% y, ]3 c
- *0 V6 S/ F" U9 K9 P7 f3 h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, _& M0 ?: C1 _0 D$ Q1 n% Q! M! u' s( T* x
- * T) X- g/ u3 A9 }! c
- * This program is free software; you can redistribute it and/or0 z Q/ T6 }0 i/ B* i# {
- * modify it under the terms of the GNU General Public License as
( |- W% }2 r& ?$ T - * published by the Free Software Foundation version 2./ m; j6 ~1 f/ ]" Q3 `0 }6 F- c
- ** M9 b8 Y; H6 O( B4 X- w) u0 X
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 z: K( v1 z# H7 E$ g2 y) O4 f - * kind, whether express or implied; without even the implied warranty
+ [ h {0 ^3 |5 Q8 W - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 V9 P6 N; ]; T h - * GNU General Public License for more details.
0 {+ Y$ }- C4 K. |* q, B - */! ?4 I& R5 X) D8 z6 J' S
- t! |( [/ T" R8 ]& x- J, ^
- #include <linux/module.h>+ k% M& R W, s$ ~
- #include <linux/init.h>. Y9 F( \- Q1 N( N. u
- #include <linux/errno.h>
$ \/ g- W- V* P - #include <linux/types.h>9 ?8 e/ D, L9 w1 Z( m
- #include <linux/interrupt.h>
; y1 O \+ @+ Y7 P - #include <asm/io.h>& N' b: I8 `6 ?4 B
- #include <linux/moduleparam.h>
- {/ W9 d2 {* N$ } - #include <linux/sysctl.h>
+ q: b% U# k+ i! ^ - #include <linux/mm.h>& s& [) O4 x6 {% a# l3 j2 ? h
- #include <linux/dma-mapping.h>+ j/ |$ y+ @7 V2 P) t0 M9 g
- . k/ `0 w; w1 h7 ]1 P `5 D! _: \) P# Y
- #include <mach/memory.h>& `1 O6 B/ J+ Q! e' a2 q
- #include <mach/hardware.h>
' V2 Z/ I7 C1 H1 L' T - #include <mach/irqs.h>' |7 x: B! V' G- q) W
- #include <asm/hardware/edma.h>
. W# [% c0 b0 f( }! o% @ - 2 J9 o! V# ^; Z, E
- #undef EDMA3_DEBUG& N2 S. E2 H. Y6 {' S/ q% M
- /*#define EDMA3_DEBUG*/
2 B# \, T2 Y( j9 {, k9 f$ u
: M! {$ P1 K& J- #ifdef EDMA3_DEBUG' h8 c6 o! {4 F: j% y% T; z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" {1 P# G4 G* y7 f1 P5 W, M# X3 Q- E- A
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 i2 R6 R1 _& O6 _* b) }9 C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 q4 P/ m# V- o+ W! R
- #else
6 G9 D5 D5 N1 Q$ V( _ - #define DMA_PRINTK( x... )* d: @) B. M M$ I/ |, H( x
- #define DMA_FN_IN
5 \$ l) d/ x+ ~ - #define DMA_FN_OUT- y% E a& m" C* O3 T
- #endif
) n2 s& O" E! I$ a a - / j/ W" G7 {" @9 I* Q# T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# {. P* Z# f: P8 v4 n
- #define STATIC_SHIFT 3
9 A, R3 [2 m" E- ?* V) p' ]. g0 ~ - #define TCINTEN_SHIFT 20
: o& d. B/ h! @0 R" e% n - #define ITCINTEN_SHIFT 213 X$ _( e" f! d/ Y; Q
- #define TCCHEN_SHIFT 22/ Y. H- ^ y2 ^" h
- #define ITCCHEN_SHIFT 236 G( V( k; L3 r# n% ]& b1 R
; k4 ]( e0 @, S) B- static volatile int irqraised1 = 0; y4 { Y4 y( T7 c1 z9 @
- static volatile int irqraised2 = 0;
) Q& M, E/ \8 h2 y, R" Y$ U0 [
- f: k |: U9 x: X* R* M+ ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. [: E. ]1 p V" R. F! T
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' G$ K: h6 O, c H* P5 u8 h( U* p7 T; x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. E( H( z' ?6 | g- l
1 S5 |1 d$ R7 A2 a& N* H4 y- dma_addr_t dmaphyssrc1 = 0;: f8 Z, O" h; F: \
- dma_addr_t dmaphyssrc2 = 0;
0 I5 e( `; p9 U) k - dma_addr_t dmaphysdest1 = 0;
5 q/ @; k. x9 u- \$ E2 ` - dma_addr_t dmaphysdest2 = 0;' ^! H1 U$ `; K# z, P
9 m+ |; E7 O& M' i! R7 T k3 I- char *dmabufsrc1 = NULL;& _8 b8 V7 A" w* o- Q) Y' k
- char *dmabufsrc2 = NULL;* F$ p/ B8 D2 a( v" A
- char *dmabufdest1 = NULL;
2 F r' N. A, V8 u+ W - char *dmabufdest2 = NULL;
: z* U! K$ x; C - 9 X- K3 _2 o' K' [) u( h% J5 H
- static int acnt = 512;' ]) r+ E" ^+ i9 ?8 @
- static int bcnt = 8;
( F' z3 y, d3 d+ [* a - static int ccnt = 8;, H4 O) Z+ w# t' _
* Y; x0 |8 |+ t- module_param(acnt, int, S_IRUGO);+ E5 V: q9 C) M( h
- module_param(bcnt, int, S_IRUGO);& p! t* S# R/ M% K, X: s
- module_param(ccnt, int, S_IRUGO);
复制代码
( c2 _$ {$ P/ d$ H- Q3 \; S7 p! X4 d3 K3 i$ ^' ?7 q1 Q. j
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& Y, T5 Y; W4 q) H, G6 X6 I+ O; C$ H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 T4 O) j6 N8 A# e- K# D
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ g7 |: p% Q2 @/ f w/ s6 V" R8 h: F5 p- Z: ^! }4 u
3 N# w/ J0 j3 ]: ?7 k$ j* |& K |
|