|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ ^& W" M; w/ O/ `' b- [code]EDMA sample test application+ k8 Q `$ d7 p( h& _2 [" ~
- /*& _! m$ W; Y/ o+ ~
- * edma_test.c; w; {: E- A( N$ O
- *
5 Q* m6 d* O X$ p - * brief EDMA3 Test Application
( Z! d% Q) ]' P2 A: i7 V) f - *8 k- p# S9 H! G, O. q* [
- * This file contains EDMA3 Test code.
. S0 e) X& X# e+ K0 M - *
- m. M% z/ R/ {7 `1 Y( B - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( ?3 k* k/ E8 b/ |: } - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 q8 y2 ]6 v% g5 Y. ]. M u8 _" i
- * TO CHANGE.
& h1 e% W. y) W) w) n - *9 ]* D7 W; v6 ~$ P
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" `* T* F, ~$ L1 k: S/ C n - *3 T2 F+ a" Z5 v
- * This program is free software; you can redistribute it and/or
% [. M2 p( o/ z' A& u( _; k( G# f - * modify it under the terms of the GNU General Public License as- m! V( w: T8 D2 g6 M4 C) F" \
- * published by the Free Software Foundation version 2.
/ P2 b9 u; E6 e - *% e. }+ e& s' s8 K: }2 [) O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; z h" _1 C+ i/ g* @3 ]8 a; A% L - * kind, whether express or implied; without even the implied warranty/ k: u$ \0 s$ i1 U$ M1 v* U$ r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" n9 b4 _' }/ L4 \' F" [* Q/ Z( c
- * GNU General Public License for more details.3 N2 L; l; n/ B0 o9 b3 \7 n6 \
- */7 [* g- B2 c, b3 Q& F
- & A2 z! Q0 ~# Z2 ^. X( e B; G8 Q
- #include <linux/module.h>
( l1 ]! w- W" o! F* @$ t - #include <linux/init.h>* S( t& n8 L0 H1 p3 @. t+ E
- #include <linux/errno.h>, t# {3 n7 Z0 l$ I; x0 j
- #include <linux/types.h>( I# g; f/ T7 j8 @( ^3 @
- #include <linux/interrupt.h>
" m$ d" E' l8 p( g9 E - #include <asm/io.h>: e1 c' V+ N9 Y. Z/ @2 J) Q* l. e# r- e
- #include <linux/moduleparam.h>" Y% J% v' l) H+ A( r; P& |
- #include <linux/sysctl.h>3 { R5 C4 G; g# A* ?, V( R
- #include <linux/mm.h>
$ a6 [. g5 ]3 @1 p7 R" t - #include <linux/dma-mapping.h>, E: L& |* x- I/ B- v
( J! ?8 q1 V' f$ S/ Z2 K- #include <mach/memory.h>3 x. H+ g3 y" }* S# i& }% |
- #include <mach/hardware.h>" i5 G$ Q3 z3 \% h% {3 c
- #include <mach/irqs.h># f a2 U: l1 G4 K
- #include <asm/hardware/edma.h>% C5 r) h+ ]+ I2 i T, {% q
- 2 r' x9 F- t. u) Z
- #undef EDMA3_DEBUG
E9 J2 l) B! `. P6 g5 W - /*#define EDMA3_DEBUG*/4 H9 f+ i) {1 s- M6 ?
0 s8 I; O+ n# c2 ]3 o9 d- T7 R- #ifdef EDMA3_DEBUG& R5 y r, K% m& r# `( p
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ U' }5 x, t' d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ m8 j! O3 [/ o8 ^8 {% f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 e( X0 ?6 W: d; @ - #else
6 I! @7 s3 Z; q; G6 Y: w - #define DMA_PRINTK( x... )9 L, Z: v: ^/ Q3 S0 D
- #define DMA_FN_IN* o5 e4 [- |) [& H @6 P
- #define DMA_FN_OUT
- U v% Q: C$ O, G5 F0 a; u# f5 s - #endif
! d* ?5 \/ [: A+ d) l - ; p7 C# K1 d6 F
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& i+ v. r! a$ K3 O, O7 V& T - #define STATIC_SHIFT 3
& ~7 K& x+ Z0 u9 ?) d. r - #define TCINTEN_SHIFT 20
. o7 E9 A8 N; D6 R9 @ - #define ITCINTEN_SHIFT 21
5 x$ |! s H1 z% C. R+ ~2 p - #define TCCHEN_SHIFT 22: N2 L" H7 F ~
- #define ITCCHEN_SHIFT 23& z! j7 L& H3 o
- H1 y0 m8 r$ u$ k' E% t
- static volatile int irqraised1 = 0;/ H3 L' N, T2 I& h% x3 D) R
- static volatile int irqraised2 = 0;
0 b+ X1 m J6 M - 9 x& ^7 c( q5 @8 C) B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 w* e& L8 ?/ |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 `: {0 E- p6 N- q: q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) V5 J! q* y& X9 M' F
( }6 P' `3 _. h& S- s4 @) m; m- dma_addr_t dmaphyssrc1 = 0;
5 M' R9 ~/ u) m8 U0 ` - dma_addr_t dmaphyssrc2 = 0;
5 ^. E% L) V, n - dma_addr_t dmaphysdest1 = 0;
# h4 g7 w5 O! l" s, ^ - dma_addr_t dmaphysdest2 = 0;% ?0 ?$ k7 T% {& i3 ?
/ C* J1 N4 r+ L. V6 r- char *dmabufsrc1 = NULL;/ ^/ H f5 h) k" W0 g p
- char *dmabufsrc2 = NULL;8 e9 l: H- f ]7 g( o5 F
- char *dmabufdest1 = NULL;' y0 u. H6 Q) K4 t/ V$ M
- char *dmabufdest2 = NULL;
. O' y' r. q3 N0 d% Q" C - 2 R0 ^* E! O5 p# S8 D% W* }; B
- static int acnt = 512;
' R5 K. h6 f/ H - static int bcnt = 8;8 b3 t3 f! z1 r/ [$ `+ z9 |
- static int ccnt = 8;
; Q" b0 J3 z: Y4 n9 x! k% S; @, j - " S& w( v9 Z3 q( {
- module_param(acnt, int, S_IRUGO);
2 c3 a7 l. r1 E4 P) b V - module_param(bcnt, int, S_IRUGO);: k) S9 c& g- N# K$ c2 s
- module_param(ccnt, int, S_IRUGO);
复制代码 ! b9 f; u6 r6 S0 q
* W/ A% h; q/ r$ {/ L/ O% P3 ^ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, p; t2 }# C) ~" g; o# E
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 R$ P4 g* Y+ b0 Y1 q" X8 O8 ]6 J
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 r9 \* n: J1 A2 r6 q
3 R1 O- {1 ^0 \4 [4 V) U' S! C3 p
9 Z# A' ?" ?: G. Y5 @ |
|