|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! Z# Q% W6 N4 F: L4 f
- [code]EDMA sample test application
+ o5 q) Y. r9 a - /*# t t6 N5 \7 w' t0 ^
- * edma_test.c
- y" v( }8 j9 A9 @# U' \* I; R - *9 ]( O6 T/ e; ?+ v- l1 S$ B
- * brief EDMA3 Test Application8 h2 L, i, _; k& A, `
- *
5 h c9 T9 ^+ b4 ?7 k - * This file contains EDMA3 Test code., u v3 j! q# l) ?" I* F2 V8 W
- *
! Q/ A$ F) G$ T( M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) `7 N: c. @/ S* ^4 J) p8 B$ b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ @. e% J- [3 S - * TO CHANGE.
5 B# E2 p9 k* L+ x( D - *. I0 e; \+ e5 N) j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ g. c: P% ~. l# ~, v8 ^3 _( m, I
- *; E+ A; p; l9 k k$ l3 i
- * This program is free software; you can redistribute it and/or
9 S( i& ~' R; ?& u% \: H- h2 t! Y - * modify it under the terms of the GNU General Public License as' B) R5 R7 d1 v" Z
- * published by the Free Software Foundation version 2.
& Z0 x e/ Z5 m& G4 m/ P+ q - *; A) g% V# Y! b
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% S0 ^% _ L2 F) k/ B) Q
- * kind, whether express or implied; without even the implied warranty) l9 g3 g7 I* y6 v+ v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% n$ A# ?! z4 T1 m; J9 S; b - * GNU General Public License for more details.' _7 O! K+ F2 _8 ^* c6 N" j
- */1 j7 q6 `2 ?1 ~, z" D2 ?' e& }
- : {- j9 c/ @! \7 C4 }6 v# c
- #include <linux/module.h>/ Y# Y5 z4 r6 F& E3 \# S( l2 D
- #include <linux/init.h>/ h. `! L8 ~) e6 n' v4 B
- #include <linux/errno.h>- z- J1 u3 u9 a+ S; p
- #include <linux/types.h>
/ @$ c; V% m3 l9 w2 n" r: e - #include <linux/interrupt.h>0 V, c3 @7 m) `' F8 x
- #include <asm/io.h>! h' R7 v% _6 P9 {
- #include <linux/moduleparam.h>
3 P+ b/ t- S% n. ~ - #include <linux/sysctl.h>5 }* E3 [0 ` f/ j: F1 k/ x5 Y5 n; {
- #include <linux/mm.h>0 f1 V3 d6 a/ b9 f& d4 ]5 H4 U1 \
- #include <linux/dma-mapping.h>
. Y1 ]1 l0 e, b' A( K
& u8 s: C6 u, h, j. [9 O- #include <mach/memory.h>9 j6 r5 m& N& r" P! N
- #include <mach/hardware.h>' E, z' g, c/ ]# ~ K
- #include <mach/irqs.h>
3 j+ e; ^0 y: L - #include <asm/hardware/edma.h>
3 @, ^$ _9 b9 v: N. `9 p7 g - / z7 m: q9 i; ]$ }- b5 R
- #undef EDMA3_DEBUG6 K" I0 `# `' D; P1 `, T) o9 F1 s
- /*#define EDMA3_DEBUG*/
+ k0 r# a' u6 \( x/ M& p
$ `! L) S+ m( B# R3 G- #ifdef EDMA3_DEBUG
7 X2 R5 H8 ~$ r; l3 E5 y$ ^ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 L/ e) q j% L. ~8 }" F4 L+ V9 x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* z! Y. Y K/ | A4 P) d - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 M6 z1 j0 r _) b C- Q( |( H - #else
' w) ?: E1 v2 ? - #define DMA_PRINTK( x... )- R8 l4 ?+ T6 j/ F D6 J' ?
- #define DMA_FN_IN2 H# u/ O- v7 U7 e9 T
- #define DMA_FN_OUT
3 R& q" u x% `% ]. B8 {, U - #endif
0 j, S7 c# t5 _ - 0 f V4 U j& M% ^ _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 t5 b+ O. L1 K1 K" K; s3 v8 m1 D - #define STATIC_SHIFT 3
5 [3 y# m7 H( z# t - #define TCINTEN_SHIFT 20$ s4 P* o) d& H6 [
- #define ITCINTEN_SHIFT 21! B5 w4 ~8 s% B8 x+ O
- #define TCCHEN_SHIFT 224 _1 }& A* U7 R
- #define ITCCHEN_SHIFT 23
/ _% A1 T7 o& g
; H; j! O/ Y" B0 h" n$ s- static volatile int irqraised1 = 0;( P6 z7 ]5 O) h; R7 ?
- static volatile int irqraised2 = 0;2 `4 H& A8 S' r0 x" ^8 u
* {2 ~4 S# Y% x. b6 ?5 A" |# c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% ^5 s9 o4 r& a; h, U( H
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 f; P: p0 d( a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ t% t$ o$ @& a4 _$ X - & f8 G" {% R/ s) H; x' Z! r: t
- dma_addr_t dmaphyssrc1 = 0;
' \$ D0 ]2 Z" o. H& i3 P - dma_addr_t dmaphyssrc2 = 0;' v! K5 Y4 y) e, G- w
- dma_addr_t dmaphysdest1 = 0;% A1 U* \' M. {% g# D$ L; \
- dma_addr_t dmaphysdest2 = 0;3 I7 k, f; M& Y+ T/ s
8 C3 |+ P [5 j4 b4 X3 ~& ~( `- char *dmabufsrc1 = NULL;& q+ U; K# `5 s, z
- char *dmabufsrc2 = NULL;
8 ~0 F8 U5 U: g" l2 l* P - char *dmabufdest1 = NULL;
. ^" A( Y0 T. Q - char *dmabufdest2 = NULL;: Y) U7 D! B$ z
- . E- a! O" V1 M; v( E X
- static int acnt = 512;
. v6 n" G/ R0 }' x& i - static int bcnt = 8;
3 r# F$ o$ W' S ?1 v - static int ccnt = 8;4 B. |$ T: K8 m
) ?3 R$ ~% v7 E) r( A& I- module_param(acnt, int, S_IRUGO);2 B9 F# E" E+ b; ~
- module_param(bcnt, int, S_IRUGO);
" r* a- ?6 u* @& ]& V - module_param(ccnt, int, S_IRUGO);
复制代码
, P+ D: i1 ]' |7 g3 @' i$ k% X" Q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" L) {. R$ J1 {; R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* ]: p5 l/ f8 ~, v& G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 ?9 _8 h5 ~8 ^; H. n) ?5 A# y6 a5 W$ \% h( r! [ j: d9 q
2 m+ b/ W' G5 y) Q |
|