|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ z$ ~: @; j" W8 b( N; @- [code]EDMA sample test application5 I) Y8 u( W9 U/ Y/ @+ W
- /*
3 e* y/ Z+ l& `# v8 C! L - * edma_test.c
. _& m6 h/ ]3 W6 k - *# s. I- ^ ~0 L7 g0 `' K J
- * brief EDMA3 Test Application
; s' ~+ d# \* C! o2 Q# } - *+ z3 k4 ^* v7 z# N+ s, |, b; H
- * This file contains EDMA3 Test code. e L5 ]" y* @. |- A4 H7 e/ ~
- *
4 x5 D) X0 m3 A9 C& G$ p' Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; D8 P ]$ W2 Q) x( Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 h0 A- z# z3 W0 \8 H3 K - * TO CHANGE.
5 @$ ?- v+ r5 d5 n4 D5 p1 E - *; Q" Y5 n7 ^- _: g% [
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* C' z/ i( J0 j: @0 T% l6 K* f
- *2 `5 \3 G! Q% ` }$ J- Z
- * This program is free software; you can redistribute it and/or1 @; _- v3 H& {: @( W+ A' q1 w1 w
- * modify it under the terms of the GNU General Public License as; X# H" j9 B Y4 b
- * published by the Free Software Foundation version 2.% z3 \; b/ w) ~" Q. H' _
- *1 Z4 Z) W0 B8 }: f$ F
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 g; y$ P% [% z+ x8 q' I# f - * kind, whether express or implied; without even the implied warranty
0 Y$ x. B6 V/ I# e% h0 W - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 m- V( F$ L& }3 c - * GNU General Public License for more details.6 n/ ~, W4 _) i& V2 j
- */: P4 L+ q; ?7 g, }. d4 C. y) k3 i) }
- 5 G' u+ q1 d+ ~" }9 v8 A
- #include <linux/module.h>
+ a$ S9 l, y+ w8 r0 C4 z2 u! \ - #include <linux/init.h>
4 V5 h+ N6 l+ Y3 g: g7 g! J - #include <linux/errno.h>
, N3 g$ y4 j. k; P - #include <linux/types.h>
0 E* M7 K0 p2 H2 F/ d% v8 |. x8 a - #include <linux/interrupt.h>
! e2 R) }4 N3 \3 q* i - #include <asm/io.h>
4 @0 x2 }5 E; o - #include <linux/moduleparam.h>
& _5 }% W+ F, G% H- s! H - #include <linux/sysctl.h>
~& t: B* p, h$ h$ |( N, Z - #include <linux/mm.h>
" h1 ]4 x" c J& c - #include <linux/dma-mapping.h>
+ P$ m$ [, t- |* b# i
/ p+ k, e* e; K5 a- #include <mach/memory.h>3 x3 n/ m8 P/ ~; O1 o. I
- #include <mach/hardware.h>, V" Q- s$ m; ], [1 U" ~
- #include <mach/irqs.h>; e" y- [& b% f( T% F( v6 i% z. N
- #include <asm/hardware/edma.h>9 M$ Y& k5 x/ \: z4 r( [
7 \4 P+ ~* F8 q- z7 O5 j- #undef EDMA3_DEBUG
. ~0 K% k# {& F+ \/ }* L - /*#define EDMA3_DEBUG*/5 H' v, f9 E- `% j1 G; U ~
8 ~4 `& }9 U7 J( q+ `. d- q- #ifdef EDMA3_DEBUG
; z( C8 _- c. U+ G: i - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 L2 H. w3 x- \5 e - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 P+ c7 d% g: z3 H - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
F2 R/ B! N4 o, w - #else2 A- T, q0 F0 ~# w9 n
- #define DMA_PRINTK( x... )
+ h: e; Q. ~% }2 w; A, h - #define DMA_FN_IN
! I4 d% C/ T2 W. s: ]8 G - #define DMA_FN_OUT
' v2 T( M0 q! {$ `+ ^- B - #endif
" T7 @8 b/ N7 C9 A - ! b$ q) ^4 e) a+ X8 ^1 N6 @2 Z& I
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), ~/ V+ P( z# |
- #define STATIC_SHIFT 3
) N3 u3 n$ U" c2 H% y$ s& r- {& q - #define TCINTEN_SHIFT 20, d" F5 G! j/ ~' B
- #define ITCINTEN_SHIFT 21- ~9 C/ H' w1 V4 y/ T: O( f
- #define TCCHEN_SHIFT 22/ J* |6 c3 G2 o' J } \5 x
- #define ITCCHEN_SHIFT 23
) l2 P! V8 [& q% \) J$ C3 L - - \4 `) i& [) ~
- static volatile int irqraised1 = 0;
- k) J: m( {( [4 F - static volatile int irqraised2 = 0;
* c g, o% m% V( x( W! ? - . T/ M' f, j4 c. C) _
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" G1 t. M; P$ G L - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 m m y6 z& v) T% R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 \) T1 j8 s) V) `& V
- 2 e. ~- Q% E9 P0 J4 c$ E
- dma_addr_t dmaphyssrc1 = 0;; D Y: S4 L+ ~1 Z, M( D
- dma_addr_t dmaphyssrc2 = 0;! a+ ~+ f7 x# M! Q3 J. h/ q
- dma_addr_t dmaphysdest1 = 0;" M- I4 `% \* K0 f8 ]2 r
- dma_addr_t dmaphysdest2 = 0;
; p% N% f& E' d( h1 R2 @0 \ - 5 g* \4 X4 x. \" E. i8 _
- char *dmabufsrc1 = NULL;
0 V) ^9 F( ]" E1 U2 V5 G - char *dmabufsrc2 = NULL;; O4 j+ ~: Q; U- Q4 D. Q, H, w
- char *dmabufdest1 = NULL;
7 q6 i+ ~, w: Y0 E1 g - char *dmabufdest2 = NULL;4 q. D1 G+ D1 ^+ s/ v) {
- D3 Z- O' `) d6 _" t- static int acnt = 512;
+ ~! ]+ p7 _* ?# k" v( E - static int bcnt = 8;
6 L. k/ X `2 x) c0 M7 p; E8 k5 c* r - static int ccnt = 8;* ~/ k, _. A; @: _
& i$ H; d5 K7 @+ `" p, `# N- module_param(acnt, int, S_IRUGO);% {1 k! o! E7 o# {
- module_param(bcnt, int, S_IRUGO);6 Q/ C" Q3 d6 ?5 a
- module_param(ccnt, int, S_IRUGO);
复制代码
% I' p; w( U! U; g& [
- @6 F, L, A, f- Z; c% ]% H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 [9 u2 o, Z. ?$ X" i8 iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 R c) ^! g7 e( ^; o* @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- X7 R0 U% w1 ?( W* ]( |
/ I# j! S8 ?$ C& T5 M3 A( _7 I5 n# G3 Z- v3 ~* F3 K
|
|