|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# p# Q( l1 S( c9 l- [code]EDMA sample test application
_3 A! \) N) {! J3 I4 W - /*
3 s4 g, ^; O7 u$ p - * edma_test.c
4 A( L( W" S" r( s - *
$ L( e T" z, R$ @& } - * brief EDMA3 Test Application5 i& R+ k% V. V$ G H
- *# o b) R# p4 i8 @% }
- * This file contains EDMA3 Test code.
4 ~4 R; B. i6 J0 S% Y& z - *
" X& l. i5 ] d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 b) r4 `/ l) N9 F8 |$ _& J4 J9 L - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 X S, u* R( F+ N7 y/ Y: |" m
- * TO CHANGE.( C, ~- ~; H. k. U" o I
- *
" [$ R9 O9 K* S& [ K& D+ g9 c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: x$ N; i; v. |8 K, r - *. j# w0 K6 b* Q; R
- * This program is free software; you can redistribute it and/or0 T) E; F, ?5 A% j: G
- * modify it under the terms of the GNU General Public License as& f) }# g) M6 u8 p% E
- * published by the Free Software Foundation version 2.1 V+ X7 O" R+ _' E: c: H
- *! u6 [: n7 |( b/ `: `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" u( D2 x4 h3 j1 `" I2 I - * kind, whether express or implied; without even the implied warranty
, C+ I0 L" I4 |) S5 j - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, N: N- e9 C; G0 ` - * GNU General Public License for more details.. O9 \9 c* }+ h' L8 |
- */
7 s5 i v( s7 r6 L/ ? - * ~; f0 ~! z4 s Q+ ^. _: c+ a
- #include <linux/module.h>
6 Q% @9 k; L9 |; U' x9 } - #include <linux/init.h>( D# H0 }, {! r& W
- #include <linux/errno.h>
' b) ?: c, W& u2 D1 ` - #include <linux/types.h>
( s `1 c: E% ]$ N& c( K- x - #include <linux/interrupt.h>
6 r @2 V# Q8 g5 ]0 } - #include <asm/io.h>) O% @9 ^! ~; r# ?4 G
- #include <linux/moduleparam.h>
0 y# T! p2 S7 q - #include <linux/sysctl.h>
. M7 o' t6 w1 j2 ^) @& N - #include <linux/mm.h>$ o, F( D4 z# [/ i% e3 E
- #include <linux/dma-mapping.h>/ q4 A5 ^. i1 g) j8 w Y9 ]+ V( P
- 5 y9 `# k( N2 e; ^) j
- #include <mach/memory.h>* {+ I, {8 E( J4 Y6 x
- #include <mach/hardware.h>5 M1 N$ ^, Z: h: N
- #include <mach/irqs.h>
8 v! O) Q/ }/ { - #include <asm/hardware/edma.h>
; T. x$ j& J% ]" A# _7 ]% e8 o - / J1 h% v2 x+ W" {
- #undef EDMA3_DEBUG
* \% m8 f3 {5 K, S$ b - /*#define EDMA3_DEBUG*/
7 ^. w3 j0 A0 `4 F! z
5 Q* l" W, _. N2 t, V8 ^" ?5 I- n- #ifdef EDMA3_DEBUG4 O+ L: D6 N `* f
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. n1 K) O5 \ { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' V3 s! Z3 ?. o) b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* v$ I0 L$ E9 ^9 y2 D% H. L
- #else
" E8 T0 s3 n! J' o# S4 O2 [ - #define DMA_PRINTK( x... )
4 |# X7 O5 y$ q. _" v - #define DMA_FN_IN
) Y; F) B1 o( ^! p8 K m1 E - #define DMA_FN_OUT
' X4 e1 l- k; ^ - #endif, ~& Y& G. [* ?% @, M" h
9 @7 h I' o0 B, v3 h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( V7 C! L) g0 E2 D6 U+ o - #define STATIC_SHIFT 3. J" W: z V3 j5 r% }' h* O- W
- #define TCINTEN_SHIFT 20
& X9 \: _" s# Y: p - #define ITCINTEN_SHIFT 21
! z+ [* _# m# {' L3 s' W9 }) C8 A, y3 c, l - #define TCCHEN_SHIFT 221 K' r0 C0 W. v: l4 g. R
- #define ITCCHEN_SHIFT 23
4 H V0 p$ Z! C+ D9 s - + P- n, E7 G) C, m j* i8 `
- static volatile int irqraised1 = 0;
% Z: g8 ^# k3 a6 B% r9 k - static volatile int irqraised2 = 0;
% w& B/ Z2 Q0 f* z1 O' V) E - 6 w4 Q3 R- f3 P) e
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ G( {1 |/ w: a+ x ?6 S# L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" ?. L# V) ~" E+ K+ F+ m8 x8 } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" P" @1 e5 k0 [. e& Y; U8 B) G" C! s/ C - , B$ w$ `2 a3 c' T3 I* ?
- dma_addr_t dmaphyssrc1 = 0;" S4 s/ L2 E3 v' B2 w- m
- dma_addr_t dmaphyssrc2 = 0;
: {! P* C- d' H - dma_addr_t dmaphysdest1 = 0;, R* G3 T! a. G3 N' z. T" R
- dma_addr_t dmaphysdest2 = 0;0 r0 d+ K0 {, M j, U1 w! u
- 8 g( Q3 p- u! t2 ?& p1 f% M
- char *dmabufsrc1 = NULL;
9 |4 a h1 d! D# X" `& B: O' I! O9 _ - char *dmabufsrc2 = NULL;+ Q6 ^' ?, {/ E- ?
- char *dmabufdest1 = NULL;
* L$ ~9 k) `9 y* }9 t& Z; D - char *dmabufdest2 = NULL;
: M+ f6 |: Q- J# R( g! h( s# J: C - 9 R4 W% D! n1 C
- static int acnt = 512;
2 ^# B5 A! J+ K7 A, w3 A6 I# j - static int bcnt = 8;. G+ V6 x- |- K( y, _ n
- static int ccnt = 8;
, m) z8 B: \! O, Y" V8 w0 q
8 s, ~% x- w+ E- p! x- module_param(acnt, int, S_IRUGO);
* a/ J2 E3 z- n' a. A - module_param(bcnt, int, S_IRUGO);
, M; u& Q; s0 }) ^) X5 n0 Y - module_param(ccnt, int, S_IRUGO);
复制代码 5 X1 E& {$ Q# ?* Q
5 j( Q" S0 |2 B. i5 `( x
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( j1 i" m0 e2 x3 ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& L; U7 m A* v6 y) {9 \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
E3 X) N8 _4 Z/ h1 \8 o6 A+ R$ ~3 q7 ~& l. k1 c+ V- f8 s
* X4 I1 T' Z% w. u+ D |
|