|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
R5 i$ }$ U9 [$ H$ v- [code]EDMA sample test application
8 g- R/ ]4 R- p6 c1 G - /*
2 T. X+ x# o% T - * edma_test.c) E" g/ ^* t% ]; K( f: K
- *( r/ s, f6 _: M# o
- * brief EDMA3 Test Application6 M. i. k$ i6 ^$ `* L5 i# F9 p
- *2 F D; R, E1 P5 c; |
- * This file contains EDMA3 Test code.
: f$ e8 F" E/ y' j - *- c$ S) n+ t0 `, \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ W, }7 ?, v# N9 T' v" ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 F, |: z% M- v, C. P# ^
- * TO CHANGE.7 D0 g7 S. b8 S/ [* z* R; l
- *
1 t4 g8 ]4 \3 f# L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" z" `9 M5 R* h" F& N \0 Q% _
- *% [/ N% F5 `. h. O$ I1 w7 u
- * This program is free software; you can redistribute it and/or
7 E* r! ]8 U* ]/ N - * modify it under the terms of the GNU General Public License as
7 D* T( ^3 J: l+ R - * published by the Free Software Foundation version 2.' v# t/ ~( s7 L) i
- *
, `0 v% u+ }0 n9 a9 Z7 ? - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 C- U, z7 Y% W( n
- * kind, whether express or implied; without even the implied warranty& ^6 j* |" U; i l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the I5 x' B( Q5 z1 ~4 ?# W
- * GNU General Public License for more details.
2 s. L; f* c9 S% Z* N: K7 v/ O - */& x9 A/ \2 X- \# A) m7 }5 T
- 9 H& Q0 w F8 l: }; w
- #include <linux/module.h>
& |4 a4 }7 W) X' W0 q - #include <linux/init.h>
! b% c0 x+ u" u7 I; z5 U - #include <linux/errno.h>- R# N0 X* Z4 z& U! n! U. o6 }
- #include <linux/types.h>$ t( i$ Z! |; {; v$ k! I% }7 C0 j
- #include <linux/interrupt.h>
: {6 I9 o; K" q5 ?" w3 L- L* V - #include <asm/io.h>
% S1 W0 @4 I. M8 x: O$ L/ l - #include <linux/moduleparam.h>
, _ d( F7 B& P1 W: W - #include <linux/sysctl.h>
4 X( S, i- P9 M% U/ l( [ - #include <linux/mm.h>" s) f7 L2 x$ C' @, ]# D( i' B- y/ X
- #include <linux/dma-mapping.h>
2 E( N/ j! L3 @% G0 { - ! }5 H( R6 D/ n* e8 V7 e0 W4 ~
- #include <mach/memory.h>' f' g$ T* h! |: b
- #include <mach/hardware.h>( U' d; f6 \' U1 ~, b1 p8 b$ F
- #include <mach/irqs.h>: ^+ B+ c8 }, p# c
- #include <asm/hardware/edma.h>
6 a6 x- V* y( K - . V* B; j* ?8 r2 R# X
- #undef EDMA3_DEBUG0 ^- }4 B! q: l1 L5 Z
- /*#define EDMA3_DEBUG*/: S5 ~2 ^8 v$ A" p8 J
3 z6 Z% C, r! S1 |# B, p- #ifdef EDMA3_DEBUG: |) f+ U+ M. V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 h4 y$ @: k3 Z6 X2 F& \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" d2 J0 f& g& q% u* _ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ L- p1 E: M+ U2 W$ }/ e9 m - #else3 K" A: K4 s3 j4 _. Y
- #define DMA_PRINTK( x... )
& z6 ?2 F; C" B - #define DMA_FN_IN: y: z6 Y7 _9 Q7 \6 _
- #define DMA_FN_OUT
9 g; e) m6 V% U: y Y) z - #endif* q0 {- Y% M. o% P* M x" h
/ n1 |4 F( u- t, G% Y$ s# l# E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! }4 o7 M5 J0 x& M - #define STATIC_SHIFT 39 F0 y+ K: e5 o5 t+ o% E/ K
- #define TCINTEN_SHIFT 20 T: j9 B9 e* ~7 }/ q5 s0 p
- #define ITCINTEN_SHIFT 21
2 I+ }$ n" I/ w" l - #define TCCHEN_SHIFT 221 j6 z* g' Q$ t6 E6 c0 M5 n
- #define ITCCHEN_SHIFT 23
3 ]8 A7 t- ]+ F) |; J( E - / `, v$ V' Y5 C$ z
- static volatile int irqraised1 = 0;' x- Q; P1 `6 a; Y
- static volatile int irqraised2 = 0;
8 z' k) {; ]4 x5 W, x7 P6 z. U) F) k" W
8 p; r7 d/ C- z1 D+ K: `- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, C# ?& W+ d1 O/ E! Z0 U# } - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 e) R$ w b U. _1 I! B+ @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 k* e4 e1 w& E I: D - ; m, b9 f8 C+ a
- dma_addr_t dmaphyssrc1 = 0;
( K& \& b3 G4 `: l/ o! M- A- q* r - dma_addr_t dmaphyssrc2 = 0;
1 h3 D# b' S; ~% S6 G# N - dma_addr_t dmaphysdest1 = 0;- ?* U, m( G& u6 C: V) ^2 o5 H
- dma_addr_t dmaphysdest2 = 0;5 D# U4 `! e7 j) C) P' X0 d
- ! V9 a/ C* P9 v$ m
- char *dmabufsrc1 = NULL;( v. q: e, t B: \1 N+ J
- char *dmabufsrc2 = NULL;
2 J0 B% E' R8 m' B1 A4 {; v - char *dmabufdest1 = NULL;
" H8 |; D) x* h5 @1 A - char *dmabufdest2 = NULL;
. H6 r3 l1 J' f. K
. a+ t% ?& z0 @9 N% b6 s! @- static int acnt = 512;
; Z9 S) O9 q) T u - static int bcnt = 8;
1 @7 z; V, H/ x2 W f* S- V - static int ccnt = 8;
* g8 h0 k) ]: L
$ ~: R" B! I4 s' T5 P- module_param(acnt, int, S_IRUGO);
. r# n( \3 V9 Q - module_param(bcnt, int, S_IRUGO);) \& D8 u- M) b( ?' N6 q M- S# Z" [
- module_param(ccnt, int, S_IRUGO);
复制代码
8 C+ _% j# }; g. |
, O/ D7 ?4 `+ v; z' m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- ] H7 j2 d% C+ r- G: U, D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 [1 n( A# l+ I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ q9 h- m# F4 a/ c5 c! n9 b( b& V- [( G! |7 {7 @, B
* L6 L, O$ X( n- H4 q
|
|