|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 R5 O/ W+ m1 I- P6 J" k
- [code]EDMA sample test application
6 _& O2 E6 G: n# h' R/ l+ S# } - /** M6 b) j3 d7 ]6 U. F+ ^8 ]
- * edma_test.c
2 l2 _- m! z+ R! ]; F - *
* p+ Y9 t/ x# D. l1 f - * brief EDMA3 Test Application
3 G; T$ N' r3 [ G. ~. D! H& i - *% I* Y4 T- Q% Y" v0 o% Q
- * This file contains EDMA3 Test code.& p3 S6 u4 u0 \7 o/ Q: O( F
- *5 E- r9 W1 ^8 Q1 f; u7 y! d' W
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. s; F Q' d- a* S
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ n2 j E: E1 D5 K7 ]. p - * TO CHANGE.
2 O" v0 i& m# c4 l) f' H: h* T - *
3 T' [9 G! O2 [% j8 C3 f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* f% \2 J: R# A# ~; M1 V- I |8 | - *
/ r, W5 o5 ~6 `( D* D - * This program is free software; you can redistribute it and/or
- X+ H+ c& X) ^# A - * modify it under the terms of the GNU General Public License as- ~# _* G5 h3 S+ t% B8 }
- * published by the Free Software Foundation version 2.( _1 o, ` T! l' g( ]2 U0 U: D% Q
- *6 V9 u/ o, n- s' J7 `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 J/ ^# O- ]& ]& d: E# u - * kind, whether express or implied; without even the implied warranty
$ f/ G3 `* [* P0 A& V- H - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 s$ c% C% s' o4 v) r. P1 [6 e - * GNU General Public License for more details.
, P1 z, y" ~5 X# _+ Z4 e - */
, }' D$ h" l$ Q% U
2 Y2 D3 L0 j5 L' a7 b0 L- #include <linux/module.h>. c7 U# K( K% l$ I
- #include <linux/init.h>! A) e a) |0 P- [
- #include <linux/errno.h>
r( d+ N# Q6 L0 g1 W; {& H - #include <linux/types.h>
, O |! z) l, ^ - #include <linux/interrupt.h>
+ `: K) f4 @0 Y8 ^) x4 c - #include <asm/io.h>1 _, D0 [& k3 q8 l, W
- #include <linux/moduleparam.h>- x9 [" \' C7 o& j
- #include <linux/sysctl.h>
( j1 p' {7 k) O' v. \ - #include <linux/mm.h>/ e2 P, s3 Z, Y2 i/ i+ ?4 B
- #include <linux/dma-mapping.h>
" `: Q& I5 E) e% u, M
% B$ G9 v( l+ c" k. o$ E4 J$ {- #include <mach/memory.h>) J/ ^, G5 U6 [* Z4 ~) ] [
- #include <mach/hardware.h>6 j! u+ R% \$ N0 w Q U
- #include <mach/irqs.h>
9 ^7 e& F+ G3 V! o7 p8 p - #include <asm/hardware/edma.h>
5 G4 c: s) |! k! P @& |: e9 C
U/ |9 p/ {3 _6 W1 ~- #undef EDMA3_DEBUG
( c( q1 C# V |* K }$ J - /*#define EDMA3_DEBUG*/2 H, e# Z: D% u7 g' A: o& d- x
- 1 e1 ~8 E+ |) S. [3 t% X
- #ifdef EDMA3_DEBUG
/ y7 Z" Y+ b6 C4 Z* c- N6 K$ a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- U! j$ a5 ~$ v - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ o# G3 h' Z; v8 k) W" O! `* j, I9 v - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). a. {5 U( j( b# B
- #else
! p* E0 v$ u1 _2 Q6 [5 V - #define DMA_PRINTK( x... ): w4 d" A' \1 b+ F4 N& c/ M
- #define DMA_FN_IN( h7 \& s2 B1 i. N+ G
- #define DMA_FN_OUT' i& E) O' e. \% j' i
- #endif0 h. m N3 W: k5 {
- ) @* N* e# O# t& @( D$ e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 H" a% o3 B: W9 s) C+ P - #define STATIC_SHIFT 3
5 m) B5 H- N, M; I3 t5 w( [ - #define TCINTEN_SHIFT 20
/ @- F8 W2 q% L! S - #define ITCINTEN_SHIFT 21& G5 |" k- b# k! \
- #define TCCHEN_SHIFT 227 O' c! Z7 K% j- r. q
- #define ITCCHEN_SHIFT 23
4 t5 Z' E. ]( } - ) _: @) s' m! }8 u
- static volatile int irqraised1 = 0;
& I4 m: g4 Y- y; _ - static volatile int irqraised2 = 0;
8 C4 W8 ~+ _0 f2 E2 \ - ) F1 B ?. O4 X% y# U% e
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& u9 }# a) p& Q- U& E
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 x! @% B- f N6 ] v, `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ ~0 ~* A8 x1 T2 L' w# {2 s
% X2 J0 Z( T. G" e* }, O- dma_addr_t dmaphyssrc1 = 0;
3 h8 `4 t' L4 s; Y - dma_addr_t dmaphyssrc2 = 0;6 H4 a2 o1 B1 j8 H
- dma_addr_t dmaphysdest1 = 0;0 W% W% t2 \+ `; y5 o$ Y
- dma_addr_t dmaphysdest2 = 0;
1 U2 F, H: ^+ w2 j - ( ^/ C0 F2 W1 }% c, w
- char *dmabufsrc1 = NULL;
( b- i; z3 T/ I2 n) T - char *dmabufsrc2 = NULL;
/ c/ |7 T( [5 _0 m# r - char *dmabufdest1 = NULL;
" u) Q9 Q) |. t; z - char *dmabufdest2 = NULL;
3 K7 v6 X% k9 O! D( Q
" k) a1 K& x4 B7 a- static int acnt = 512;- i# F r1 M& K, T
- static int bcnt = 8;1 ?2 f0 q; J' ]7 i
- static int ccnt = 8;# Y* }2 H; H; H" Y& `
$ t) Q) E8 n3 T& @, I- g( z- module_param(acnt, int, S_IRUGO);" K) r2 C" M/ _0 {7 R" u
- module_param(bcnt, int, S_IRUGO);
2 f/ Z' u' s8 }" i - module_param(ccnt, int, S_IRUGO);
复制代码 - F8 C- l! S9 @$ { F2 j
% g! v1 r5 c/ S, ]7 n, w 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: P) N6 P. ?6 y7 j, L; A1 Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% }- I8 v7 ^4 v8 Q3 `
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# c' W ]$ V; h6 x9 k" R- N
! y; ?4 y, p+ Z T0 ?3 q$ z
& p2 C! `( o W$ I' F: E# D8 J
|
|