|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" |8 S0 o+ B1 M, F; e- [code]EDMA sample test application8 \0 }0 T6 J. e1 [/ D2 N$ ?& N
- /*
) L7 ^/ y. v. |2 ~/ \3 X* |8 V- Y9 V - * edma_test.c
# N1 q' v5 g7 P% _5 Y( N7 B6 J - *& X5 V) i/ K4 C& {# F9 `
- * brief EDMA3 Test Application# U$ g2 r) Y$ _( I; k
- *7 y) F7 Z: y! Z. q' R7 f
- * This file contains EDMA3 Test code.
: h) `) a, _2 V- B2 c: D - *4 p1 P1 O+ _7 W5 j D: v/ b2 E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! g( M6 J' W" K$ O" M9 |( {! I5 ~
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 X2 y" s. p f$ B5 P
- * TO CHANGE.# [% l( ?7 Z* D3 {. e0 A
- *7 i) a0 g* M( \; u: N1 \
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 u% X) T6 n. E+ |% q
- *, O. r5 z' ~8 F0 m* m
- * This program is free software; you can redistribute it and/or
: \8 x8 A: c* q8 n - * modify it under the terms of the GNU General Public License as
* Q) x9 F% T# k# C - * published by the Free Software Foundation version 2.' M; z7 F; ^ l; K( K$ J3 s' Q0 m
- *5 u @! M9 b- H5 ?$ P' b2 l2 [
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* t+ w* R3 i) L2 h3 p+ Y7 m$ J
- * kind, whether express or implied; without even the implied warranty/ u( P3 W3 I; u' y: X% T5 U( m M/ @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) n/ O& {/ g \7 F# z4 c0 ~
- * GNU General Public License for more details.
3 K9 ]4 o5 H7 x* k - */
6 b4 S( ~0 @7 R( l, [2 P - ( e2 ?5 Y. ~2 [7 R$ l) k
- #include <linux/module.h>
" a/ v: Y: z% a( W/ l2 Q - #include <linux/init.h>+ T8 m, W9 x, \
- #include <linux/errno.h>7 c' C" t. c& L& D8 l9 T% `5 Z4 @
- #include <linux/types.h>7 F8 y; m6 ?* v- N
- #include <linux/interrupt.h>, ?' R6 f0 J3 U, ?! a6 E
- #include <asm/io.h>
: \, [/ Y$ W1 e8 \* v3 B6 \ - #include <linux/moduleparam.h>- S- e: {" l4 W
- #include <linux/sysctl.h>- J" A. ` j2 ^8 V5 \
- #include <linux/mm.h> A5 N- x8 ]! K! y: p$ X1 A
- #include <linux/dma-mapping.h>
0 r& }* ^/ n. x1 w( |1 P - 2 F0 U4 e: X& k
- #include <mach/memory.h>
: S/ L7 m/ H# ?2 M - #include <mach/hardware.h>
5 `' m4 T2 n! g - #include <mach/irqs.h>
+ p5 S) @0 O6 i* `# ^5 v! N# w - #include <asm/hardware/edma.h>
9 x+ N3 b' R7 U8 f9 ?; H! M - $ p& {# }7 w' `* {8 T( {; r
- #undef EDMA3_DEBUG7 u. r2 t. y7 b2 x1 V8 K" \# @
- /*#define EDMA3_DEBUG*/5 ]" E: f# O/ |) t$ O; R$ s; @
- ' R$ _& [( [$ k2 Y3 E0 Q! ]) w
- #ifdef EDMA3_DEBUG
* o" w! ^* g! V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), X# S% E: W2 w3 t1 I$ h
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 t2 b- P. K8 c1 E+ P/ n# j - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ z; {: T0 e" D" Y3 u# H - #else& Z/ X. ]0 y& Q5 k+ p/ h
- #define DMA_PRINTK( x... )
$ [% q* I+ p5 C; z% ?* @- e - #define DMA_FN_IN6 @* s$ W# \" T' H0 N
- #define DMA_FN_OUT6 N/ i4 e2 i; Y+ A2 N2 u
- #endif
5 M- A" @4 m$ G7 A5 H o/ s$ U - ; c5 ~: R8 p8 E4 l
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), `' I- ^0 v- \4 f5 |* e" }
- #define STATIC_SHIFT 3
8 v* e2 Z8 M& R8 k/ u - #define TCINTEN_SHIFT 20$ Z% F$ `7 D+ X' |; K
- #define ITCINTEN_SHIFT 21
5 l: y9 W9 N( \ - #define TCCHEN_SHIFT 22
! S* d; P3 B/ ]( s% F# @% V* U* v - #define ITCCHEN_SHIFT 23
: P1 n5 _ N4 l5 \; z
0 M# R% L; T) k- static volatile int irqraised1 = 0;& _% d! J* K7 Z: c8 J
- static volatile int irqraised2 = 0;
8 V. E8 O: X) l, q; d
J4 v! l3 S G8 b( y9 g4 S1 ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ |/ J% c+ Y9 v' i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 H3 C/ O: r5 [2 n! F1 Q% C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 ~ r6 O* ]# Y! ?8 \8 M
# H. n c; ]% Q8 _0 ~5 @1 v) y- dma_addr_t dmaphyssrc1 = 0;
# X; Z3 z7 n1 x I4 X" B6 R - dma_addr_t dmaphyssrc2 = 0;
& F# p- @" v/ ]" G9 T% B - dma_addr_t dmaphysdest1 = 0;
# p! j2 I7 p4 ?4 l, d - dma_addr_t dmaphysdest2 = 0;
1 M) d- L7 H0 @3 }% L! S) f - 6 K5 }0 `3 W# M5 P1 j! G
- char *dmabufsrc1 = NULL;
3 m# u$ b0 ^& m5 N6 P - char *dmabufsrc2 = NULL;3 ^( _+ t' A- h8 L% U6 j* v
- char *dmabufdest1 = NULL;
+ J. E; \( G; R3 T8 Z& f9 ? - char *dmabufdest2 = NULL;
- F" I- H5 y8 y# P
' @ K+ r: _9 t3 y9 g1 G7 n- static int acnt = 512;1 R+ C R! v; j6 J
- static int bcnt = 8;; q1 L; ~( H: y0 o; W$ v
- static int ccnt = 8;
- Q/ _5 T2 l5 ^2 p" B9 ]8 J5 B
( K+ M6 n7 `8 O' V- module_param(acnt, int, S_IRUGO);5 R1 @- X! u6 E! ^
- module_param(bcnt, int, S_IRUGO);" F+ ?/ u* [# m7 c% f4 m! \6 N K
- module_param(ccnt, int, S_IRUGO);
复制代码
' L1 O/ j! f) G) _% `3 q
( B- O w: r: ~( p0 |! M1 Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 K5 z% _$ j& r$ F/ a& Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 F" E6 j1 _# U: m 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* ^, [- V3 @: k2 |& E4 s
6 k7 j( s, s) i$ J- y, y1 k7 q. y( O/ m% c0 H# t: O$ J( b
|
|