|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) @. e$ }. w3 l3 q
- [code]EDMA sample test application( |* j4 z ^+ f7 F
- /*; }: q: C2 p$ i3 {$ L2 J* ^) t
- * edma_test.c
# x, ?! q! i9 `, q' b" [ - *
4 L$ X4 K" H( L( R* ~4 L' w - * brief EDMA3 Test Application3 t+ s0 w0 ?% w9 k& i2 U1 o) l
- *
' G" t+ c V3 w: u - * This file contains EDMA3 Test code.5 {: O: X5 }; j- R7 P& h, M6 V
- *( i$ {, h4 l, T @) D2 L) `0 I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 H; R" [5 q. O W! R! j! q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 t( N3 @. c9 t; N' Z h - * TO CHANGE.- W) a9 T. E2 P8 {* G
- *
2 I5 R* @8 n5 Q" T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ W I: G& E5 c. }8 {
- */ E: t# p) s" ?0 S
- * This program is free software; you can redistribute it and/or
* `; i' c1 P1 V- F7 W - * modify it under the terms of the GNU General Public License as- D8 O1 k" N. y# i9 _$ G x+ j
- * published by the Free Software Foundation version 2.
! U8 e V4 M9 } m8 @' W - *
& x9 W, i, n F* Q, L, v2 o$ \ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ T( I( F2 P3 ]: k" _) ^/ y - * kind, whether express or implied; without even the implied warranty9 ?2 U: A3 R7 I% I) R9 t2 y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 Y/ }$ {* Y; r' F$ b
- * GNU General Public License for more details.% g4 l1 U5 B4 F$ i, G1 m
- */
4 j# E: e3 B5 K% M
' Y4 q7 n0 U- J8 t% S- T; |0 q- #include <linux/module.h>5 [2 k" a/ D9 d' w/ o$ O4 o
- #include <linux/init.h>
" E" c6 r: K% d" m9 c8 U2 L6 S$ f - #include <linux/errno.h>! _2 W! @4 w9 g: K4 e
- #include <linux/types.h>& x: x- g: X" n
- #include <linux/interrupt.h>4 N& c: s. r; ^8 V6 k8 h1 ]
- #include <asm/io.h>
3 V, J, A% n& W& E& d R4 ]0 W - #include <linux/moduleparam.h>
3 d& W' H6 C; Q y; x. ] - #include <linux/sysctl.h>
b1 a7 x4 G) R9 w' P - #include <linux/mm.h>5 F1 ]/ I9 O2 p, e: Z# p9 ^% H
- #include <linux/dma-mapping.h>
& P" L- m2 ~) a" D# O - 1 |0 j, z- K. O! K1 C Q8 |& L
- #include <mach/memory.h>- e& S1 J/ g: n1 {
- #include <mach/hardware.h>" w" [2 n$ u. d) q- X
- #include <mach/irqs.h>
1 ?2 b7 L/ {( r- O - #include <asm/hardware/edma.h>
1 o1 I+ y0 f9 r2 I2 B( J3 a - : `8 [8 d4 \. a- X
- #undef EDMA3_DEBUG
# H/ B0 M" v3 [- t - /*#define EDMA3_DEBUG*/+ J f# y* W% c, y' A
4 ]4 V1 P4 T( ~. @4 w! s6 J- #ifdef EDMA3_DEBUG) \2 v, o T0 G9 p+ d. F/ O/ ~1 r
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% W$ q9 e; G- h- `$ d3 m$ c - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); [, {& U) r% c3 ]" [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 b$ n' C3 x9 X1 Y# f# D6 B
- #else
( L7 n( g/ K9 S& [% J7 h - #define DMA_PRINTK( x... )! s+ g# F" n. \* x( s
- #define DMA_FN_IN
. W8 X2 T6 `' y) k d" M9 W3 W - #define DMA_FN_OUT+ L* h2 o) U6 A9 l; F. @+ J7 I6 K
- #endif R( [8 P( q% ~3 [6 B0 L# ?
- 9 O: Q. I/ H. z( s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 j: V4 O! U8 H9 k+ {1 H" k9 ~2 B - #define STATIC_SHIFT 3
0 u. m* S4 A' j2 M - #define TCINTEN_SHIFT 20& F7 {) v' o' J. E0 h( o0 v5 o3 N
- #define ITCINTEN_SHIFT 21
p, M: o! g( D Z% a# U- u. F - #define TCCHEN_SHIFT 22
4 @1 D* ?( p% w: A, Y, _$ e. J7 S- W - #define ITCCHEN_SHIFT 23
0 L& y/ i k; S/ H# m
s+ q i u$ Q$ B7 ]/ k+ `1 a- static volatile int irqraised1 = 0;: A7 h2 {; m- `6 Q3 U+ \- x) h
- static volatile int irqraised2 = 0;8 P, W. N/ X3 r9 x& P
- 8 j4 f3 \$ f( P b6 C X
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); F3 b5 Z& E; @/ ?$ U' y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 b1 G9 \! l4 l9 n# x3 S; \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 d; ~! I) t0 W. {' h7 G
. g4 c }0 ^+ L# p7 H- dma_addr_t dmaphyssrc1 = 0;8 G& C7 E7 a( a
- dma_addr_t dmaphyssrc2 = 0;3 \3 G3 u: S, e* h1 G4 d3 g+ N7 T
- dma_addr_t dmaphysdest1 = 0;
$ ^% C" X$ u q - dma_addr_t dmaphysdest2 = 0;. K# h( z/ {' M- m0 t
- 6 X! V% G9 o- Y# n3 H6 n1 S' l8 D
- char *dmabufsrc1 = NULL;
3 v& \- ^: V' l$ I - char *dmabufsrc2 = NULL;
* r' B7 I5 G- Z* N& b2 R - char *dmabufdest1 = NULL;+ }+ q" Q' t! h" ? C/ h1 r# D0 |* z
- char *dmabufdest2 = NULL;$ P* H) S+ f) \* L" l9 R6 y
. u* j I1 U( E- static int acnt = 512;
, S1 r f1 F5 l7 _ - static int bcnt = 8;
/ o' u6 o& o; [6 D% a' W - static int ccnt = 8;4 P' ?8 W- x2 m
& X' f5 Q" W9 j; Y {) i6 w- module_param(acnt, int, S_IRUGO);
5 v$ C! |2 `1 u. R) E - module_param(bcnt, int, S_IRUGO); i! s! L- Z) P5 t2 _; j4 K
- module_param(ccnt, int, S_IRUGO);
复制代码 3 H+ I3 G5 S. H4 F( t
1 ~' f2 P! N2 v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 d- ~3 {) @4 B' L/ {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 R, N& G- }: y$ |- {1 X3 P3 o* G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) e) i- a3 Z; O( {
- [+ [ ?4 D6 l" X+ z- ]& y# m( c- E7 G1 }9 {, f, Z9 L F
|
|