|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 F% r, F& W/ _& h, r( v9 G( ~- [code]EDMA sample test application* t4 q( V8 z5 G2 ~3 s
- /*) K2 u+ Q" K! Y$ l/ N! g# J
- * edma_test.c2 ? H$ Y& ^! |8 Q
- *
% F2 a, w- ?5 \ - * brief EDMA3 Test Application
$ J; _8 ?# e+ y" @' e, ` - *. U" m$ z2 A$ W% |
- * This file contains EDMA3 Test code.: B/ r$ U& ^- [! j
- *
o6 O$ Z' O' B5 [ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 ~/ ]& D5 M, W1 o1 H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% ]$ _+ q8 X) w4 |* f
- * TO CHANGE.4 h2 f( d4 c. _$ f) H) g7 B
- *
! o- |. ?1 Q( F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; {9 T6 K _& ]4 u - *: q, o% r/ k- j- \" y6 p
- * This program is free software; you can redistribute it and/or: l9 `* P0 i% T; l3 ]
- * modify it under the terms of the GNU General Public License as
) G: c6 Z5 C! [/ D O% X9 [ - * published by the Free Software Foundation version 2.
+ W% J% h+ k+ t" ~) D5 C$ T - *0 {3 @) q5 Y' u2 U; q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 q/ ]# c+ s. D0 N) h, L - * kind, whether express or implied; without even the implied warranty& I$ H- ~9 {( x, W4 J' l3 K( O
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 F; @# x6 b, o3 o3 t4 n3 ]0 K3 H2 j - * GNU General Public License for more details.
% P0 D2 j ~- O. V( [2 A5 C - */
% m: D/ _& Q- t' L" c" a7 a: i& G7 S
5 S$ u+ `5 O' e M- #include <linux/module.h>8 {( K* L( t/ h+ m% J
- #include <linux/init.h>: S U8 S% }8 ]5 ^8 h4 E
- #include <linux/errno.h>4 q% @" G8 Q$ X4 I4 Y' |( ~- D: G
- #include <linux/types.h>
* l( `) e5 j+ \' D- Z4 D8 { - #include <linux/interrupt.h>" @( n, k+ K) Y# K _; g
- #include <asm/io.h>3 d" ^( l1 z: L! i
- #include <linux/moduleparam.h>2 F5 b+ N" a" x
- #include <linux/sysctl.h>5 w; k3 H2 e/ G. n9 L8 \$ T) K
- #include <linux/mm.h>
5 d6 b j2 i' z. \. n - #include <linux/dma-mapping.h>
, `% V5 i' u* T8 S2 i
- h% `9 G* r3 o) b0 D j j, p- #include <mach/memory.h>
8 d1 L1 F% O$ ] - #include <mach/hardware.h>5 l/ D: ?" K3 P. A3 Q* Z* X
- #include <mach/irqs.h>. h) `$ }7 u8 d- k7 m
- #include <asm/hardware/edma.h>, {5 z6 ~6 B2 ]1 }. K* E
: w$ B ^5 G9 n) W8 h8 U- #undef EDMA3_DEBUG! H4 G2 r6 W( G
- /*#define EDMA3_DEBUG*/
5 v' G% p" @" K/ n - + D# |4 T( d0 D
- #ifdef EDMA3_DEBUG" A. I" Y7 o% j/ k7 q6 @6 [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. g9 H X# c# V$ o# { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ M {' n5 k+ Z7 R
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' j" Y% ?1 E! ^9 k
- #else
) n" Q: \& v6 N$ h. Y$ _8 o2 E - #define DMA_PRINTK( x... )9 K: G% e3 z. y. p7 h" l
- #define DMA_FN_IN8 i- O1 v+ @7 c: [3 x' ^, S) V) p
- #define DMA_FN_OUT1 d( @3 g" a3 p* Z2 s
- #endif* }9 d" |, i X/ @- G1 x' ?
- ) L2 B5 F2 ^8 P. B9 x, T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 ^& K" C# o" N7 @( U - #define STATIC_SHIFT 3
. J' B! r& E @" Q - #define TCINTEN_SHIFT 20
) v" ^8 ]$ E) C+ M' Y% Q - #define ITCINTEN_SHIFT 21
, d- a/ C4 n' r - #define TCCHEN_SHIFT 22
9 p% G, r) D! i% t& O5 J5 H! I7 U3 ? - #define ITCCHEN_SHIFT 233 ?; H5 C/ \: u1 c
- 4 Q( g/ B. J& Q7 [' Q' S
- static volatile int irqraised1 = 0;9 {- `# n: h i" g' [$ c( }; K
- static volatile int irqraised2 = 0;
# d9 A8 W0 ]$ E2 l6 [# f/ J9 s3 @) e - 1 T7 `# J. u/ Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 C2 T1 D, ^, I; ?3 c
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& r: ^$ g+ U3 q0 u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ~! }( J5 n. _" I& q$ j$ \+ i/ B
- / S% T O( y" y$ ]! a0 T
- dma_addr_t dmaphyssrc1 = 0;
( @0 m Z, k j - dma_addr_t dmaphyssrc2 = 0;- p2 x' q4 B& @
- dma_addr_t dmaphysdest1 = 0;
- i5 O% _" Z- o; {) n% H - dma_addr_t dmaphysdest2 = 0;
) y% G7 J' U* i: v- K - # ~3 K0 [0 j/ O) R' f# s
- char *dmabufsrc1 = NULL;( N/ Q/ L, {: q2 w \, Y0 Z
- char *dmabufsrc2 = NULL;
% P' S7 r. N! H. [0 c2 ^ - char *dmabufdest1 = NULL;
" l, C3 T4 S1 ~9 d1 U4 `4 H( M- h2 f - char *dmabufdest2 = NULL;8 m9 D) v0 a$ W- q* V" m, E. m
- & m6 y9 u8 c( s- k0 E7 Y6 G. X% Z+ c
- static int acnt = 512;
+ W" T- d; c, @6 c8 Z - static int bcnt = 8;
# Z' z+ }7 `5 ]5 T5 Q; B/ `) ^% s1 v - static int ccnt = 8;6 ?+ F( r9 z. }7 ]" u/ Z& U1 W/ Z3 x P
+ y# }1 C6 K. U0 m s5 x- module_param(acnt, int, S_IRUGO);
$ J* e0 k% F: J0 e4 l) p/ a - module_param(bcnt, int, S_IRUGO);
3 \+ T) b" v0 a) F& {; a' Z, k* T" b - module_param(ccnt, int, S_IRUGO);
复制代码 ! b+ ]2 X4 J+ j% |% t0 C: d! z$ Q
: R N: E U* t9 a 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: N+ v8 [4 j6 A" X0 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ E$ W4 `/ a+ j* I
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- u2 N( g1 M G- R1 g9 L. K
7 M$ ^4 Z2 S6 H0 x+ B& m# T# _0 f- a0 a; s& s
|
|