|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 c9 M) n2 y$ Y. N
- [code]EDMA sample test application
# p- d( a; H Z5 w" v/ r) H - /*
" J1 Q( t& ?0 o5 g$ O- Y4 s E9 A - * edma_test.c
* {% i `0 }# Y9 N3 V" N- m - *
) J" ~/ J9 O8 H0 F) r$ ^( i - * brief EDMA3 Test Application$ k' }) R4 R( v- B
- *
4 l, o9 \. g7 r6 D1 @. R' z - * This file contains EDMA3 Test code.. O8 P2 P6 t Z0 h/ N
- *
9 ~) [, m- C( Y5 M% K4 H - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 a+ M3 b! X( W8 n) {% p* R" } - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- Q g( N2 c9 R
- * TO CHANGE.5 j0 \' _+ f6 [. G
- *3 U+ r0 K, b D
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* d# l% T/ p8 Q7 |4 o
- *& I$ i% ?8 \* H8 S- N2 Y( z1 N7 A
- * This program is free software; you can redistribute it and/or! r- V _$ x! [ A
- * modify it under the terms of the GNU General Public License as& O- Z/ m9 V0 V' P( C" M1 B9 p% s
- * published by the Free Software Foundation version 2.8 X5 s# F- D) y7 i# `
- *
( y2 L9 f& m' v- `9 Y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 q, d/ U- R6 l+ ?5 E4 @
- * kind, whether express or implied; without even the implied warranty
( Y1 {' C" H! n5 D* `: M5 F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& A* v/ W+ {$ |! W- @' O
- * GNU General Public License for more details.1 L1 B7 K+ J" F9 h+ A- m
- */
9 R' F# g, M! w - ! y. |. t" B* {1 d, U! V* G/ l Z
- #include <linux/module.h>
% O& U o& y5 r; v( b - #include <linux/init.h>
" `! I3 p \" Y5 }7 s - #include <linux/errno.h>
- a4 l' A( v. ^1 | - #include <linux/types.h>
; z" A1 b) ]' Q3 \+ \& g1 x' p - #include <linux/interrupt.h># H, _! ~8 m6 ]0 s- c
- #include <asm/io.h>
# O1 k1 q# L4 r - #include <linux/moduleparam.h>
" U; U6 e9 w- Q - #include <linux/sysctl.h>( Q$ O- I7 ]6 c
- #include <linux/mm.h>' Z# o/ K4 h* h1 @, }1 `% }
- #include <linux/dma-mapping.h># Z! ?0 ?0 C% X9 A
8 G ^$ S3 C8 q. M: {% N- Z- #include <mach/memory.h>
* y) l9 K. k2 W6 K - #include <mach/hardware.h>& `4 B* \1 u! c: P' E; l
- #include <mach/irqs.h>$ b6 x: f% f: Z; G6 U* o
- #include <asm/hardware/edma.h>
9 X3 i& D/ E7 a# o- M
n! d: t0 {- S9 }% s- #undef EDMA3_DEBUG8 h, H6 u, ]. I) P& i8 e7 J, ~" D
- /*#define EDMA3_DEBUG*/
8 L9 i( |- @' y7 }
/ ?& m( D$ _& R* d9 T; D- #ifdef EDMA3_DEBUG
& S1 \0 ^! g k P h. n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 v! w# x1 c; W) @ P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 H, L, I7 v& l" A& G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 t- [: i! Q# s8 }
- #else! f, \. x/ _& O9 a+ t
- #define DMA_PRINTK( x... )2 w9 |8 X' A& [2 `5 d
- #define DMA_FN_IN% h. @% p# A& Q
- #define DMA_FN_OUT0 E5 G9 b* S, x% M* I
- #endif, ]* a. j$ X1 w i7 A
9 s- }& Z6 d q6 R' {$ D6 H- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. S* Y$ r/ q- g: [! q; D - #define STATIC_SHIFT 35 f" ^* p' h) V
- #define TCINTEN_SHIFT 20( b n7 S: o* `, m9 d
- #define ITCINTEN_SHIFT 21
7 A: w, A. ^. i- F$ S; z3 J% `4 Q V - #define TCCHEN_SHIFT 22+ v0 h) }% b$ i/ h0 `
- #define ITCCHEN_SHIFT 23* [( U3 H+ e) G; b
# y M* O6 D- A3 n, |- static volatile int irqraised1 = 0;
2 G W9 B$ I+ J5 a - static volatile int irqraised2 = 0;& t. S: H- v" b2 X$ g. @
- 7 x1 u" _4 k) O
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( E& U# P( q/ t& W' y" y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! Q! Z! Q* E8 B; } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. l1 ]# e) J4 c
( d0 i1 s F3 d5 ^/ t5 D- f# V- dma_addr_t dmaphyssrc1 = 0;
/ H+ D) r6 y q) Q( | - dma_addr_t dmaphyssrc2 = 0;6 e1 ?1 B+ G( B& b6 u) Z4 B# i
- dma_addr_t dmaphysdest1 = 0;$ S3 S+ S" \; e$ f. u+ N7 \' O8 P
- dma_addr_t dmaphysdest2 = 0;6 W" b; o9 f! ]: f) e/ ]1 C
- 4 x( ]* [# D! h- E
- char *dmabufsrc1 = NULL;$ q2 f( c6 O+ ?! P* B
- char *dmabufsrc2 = NULL;
$ V0 w0 Q O7 i0 _ - char *dmabufdest1 = NULL;( J) `# u! a, n0 w) g
- char *dmabufdest2 = NULL;9 u: [9 F( D: s/ B
- 5 K8 s- g; g6 c+ v2 e- [
- static int acnt = 512;
: J6 m+ ^( t- V( ?! S$ b) d - static int bcnt = 8;, {* \- }( c3 m/ c; B
- static int ccnt = 8;/ J, V% D3 P R3 O$ }
" M( g( U0 Y' I* g8 g3 W1 l- module_param(acnt, int, S_IRUGO);
, c+ v. r% |, I - module_param(bcnt, int, S_IRUGO);
9 M, r* U, M& Z# V, I - module_param(ccnt, int, S_IRUGO);
复制代码 & ]- r6 F9 A; i* j r% C7 K' C
4 T+ V: J/ k! G
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ m3 h" y u4 \# k7 `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* C4 R6 R& `& U' H) v4 t1 B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ ?* `; m- i2 V1 G4 l
# L# x, W% ^; }5 r; e$ x' a m9 q0 P
, f/ o `& r& }3 B8 w! A2 I% `
|
|