|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 N4 I/ C- z) F# s. N
- [code]EDMA sample test application3 W. P7 {8 L e
- /*
& a& q0 a5 V+ A% K3 w% H - * edma_test.c3 y" D; D+ P% c/ _" J/ K0 }3 P
- *
9 s6 L( x; [ f, `1 j- Z# u - * brief EDMA3 Test Application P" H6 I; w" G# ?) h( ]& o
- *: S3 _* L7 J, W9 i+ z( w& p
- * This file contains EDMA3 Test code.
" |% w2 K, M' {4 Y) C% v6 x# y+ ~ - *
3 y' J1 V8 n3 L, c2 @+ Y2 s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 ^/ L0 g: c/ s/ d
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! s& U( f( \7 o$ C
- * TO CHANGE.8 }+ F% y% K" b& X) e# a. Y
- *
D2 o/ [+ R7 | - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ M$ g6 N2 l% Q, j7 {5 |; { - *5 y( D: {) [% n6 ?
- * This program is free software; you can redistribute it and/or
% z; m* q; e+ E$ D( p1 M6 l - * modify it under the terms of the GNU General Public License as# Y6 D" ?6 [' L7 D! O
- * published by the Free Software Foundation version 2.: G1 W! b* y( H! e7 l! v' Q2 Y
- *
6 U/ f3 D$ I! x$ w9 X2 { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% Z8 [/ S! S5 U; W1 W; X$ N
- * kind, whether express or implied; without even the implied warranty6 |: z' J9 Y8 l' m; o# b5 p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! v/ k2 Y2 Y5 c0 T n- O) d - * GNU General Public License for more details.
! O" a5 ]* x7 x, g; f - */& j! E9 j3 V4 m* D! J
- ; q# p5 W( e, P' W. B) |
- #include <linux/module.h>2 C' b9 C4 w7 p8 j# ^
- #include <linux/init.h>
" Y; e) v8 S$ U1 ^ - #include <linux/errno.h>
8 S- p; d0 O9 R# Z) A - #include <linux/types.h>
- H+ `8 X3 U7 Q7 g - #include <linux/interrupt.h>* }1 B8 G' i7 |, U; i. ?
- #include <asm/io.h>" ^" v8 V1 y* S6 S7 Z& @+ y y
- #include <linux/moduleparam.h>
8 K0 d+ l0 u* C: C2 Z3 B - #include <linux/sysctl.h>
* a" q: W& d( g( c6 Z+ h1 \ } - #include <linux/mm.h>
- B$ p; v3 |" `. _ - #include <linux/dma-mapping.h>
; M9 p2 Q7 f9 \% Q
' _7 h. w, v" }4 c6 I3 z- #include <mach/memory.h>
6 l5 [8 e4 s7 }; o+ l - #include <mach/hardware.h> B u, W' C8 Y6 f# f, T0 t, ?
- #include <mach/irqs.h>
$ H" m& I5 l) w: L& n6 O - #include <asm/hardware/edma.h>6 G2 I( H8 f' ^ q) E1 b5 y
- 7 _9 v; H2 B* c
- #undef EDMA3_DEBUG
2 K$ _. v3 M( ] - /*#define EDMA3_DEBUG*/ b5 J+ F9 ]- U8 J. R U; N; ~+ }8 \- C
3 _1 Q }1 Y' T+ s/ ^/ [- #ifdef EDMA3_DEBUG
& X) {0 c4 Q$ Q/ k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' d2 J* ]+ d- V3 C5 R0 I1 x: R2 H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 L0 x1 J5 h; e! d7 I9 [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, g! n" s6 J# e) X1 H' I - #else3 p. `4 W; d$ Q
- #define DMA_PRINTK( x... )3 V4 P( S& a9 m( D7 \, `( x
- #define DMA_FN_IN0 D& ?6 I. X7 q6 y6 g) `' Q0 L# \
- #define DMA_FN_OUT
/ ^& S" T8 k$ ?) Q8 s; l& ^ - #endif
- `/ d3 L4 ]5 B4 x8 N - : y% U3 g; C: }2 U) |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# c/ n" Z% R4 M4 ~
- #define STATIC_SHIFT 3
- F( Z- M& P7 l$ h$ u7 v) X - #define TCINTEN_SHIFT 201 t8 B, T4 J; j9 |8 U- y( u C7 z
- #define ITCINTEN_SHIFT 21: n$ b# h( i% c: A8 X1 x; f: o
- #define TCCHEN_SHIFT 225 S: R& M- U1 ~! i4 x \: _
- #define ITCCHEN_SHIFT 23 b2 f& ]( r, E: ^
- 7 t& @2 c1 i3 u) d8 j, R& H5 `/ f# z
- static volatile int irqraised1 = 0;
O, {( W* R& X! s6 `7 {8 Z2 S - static volatile int irqraised2 = 0;) b- P7 c0 ~9 H. A. w7 ]) G
: [! H2 u. @3 _4 n4 k3 a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' T' ^% w% K& i/ a& J3 u( r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: ^0 R0 V P0 q p - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; U# D' s! C7 L; C9 W. i* i; P# [
8 W: B2 C5 `3 Y1 J$ E6 U4 h- dma_addr_t dmaphyssrc1 = 0;
1 d8 Y/ x: @4 t - dma_addr_t dmaphyssrc2 = 0;
% r" ^( }+ q: X0 H - dma_addr_t dmaphysdest1 = 0;% j+ `- U" U1 \4 ?/ j: K
- dma_addr_t dmaphysdest2 = 0;
( y% F. p# _% V- n - . R, |) V: C, S w+ f
- char *dmabufsrc1 = NULL;
/ d8 i( L7 B/ W" r - char *dmabufsrc2 = NULL;
8 \4 U& O: W, u - char *dmabufdest1 = NULL;( T" s; z: N3 y/ s$ a4 y
- char *dmabufdest2 = NULL;
% v1 P8 l: Q' o - . F1 t9 F' l) i& c2 r. i) l9 [
- static int acnt = 512;: F* p4 ^/ H/ L$ |" c+ b
- static int bcnt = 8;$ t- x- O) G% O6 D
- static int ccnt = 8;
& J- F* [" N8 [+ q5 \ - 7 F2 {& U* s3 d: f5 z
- module_param(acnt, int, S_IRUGO);& b5 [! H. }" y; ^& h* T
- module_param(bcnt, int, S_IRUGO);2 l5 d0 x$ C& h+ X( ]# w0 M; a; R
- module_param(ccnt, int, S_IRUGO);
复制代码
7 E3 M3 ~1 { @) v2 ^+ i% z& s
8 T% O* z! | s7 f 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, d! L* }( F& [; `+ [- c5 T" M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, u* ]/ Y' m5 K' P# t8 ^7 Q7 g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ B- Z; q* u5 t: y1 g( a; q
/ I6 W$ C9 n3 N
) x3 @% x; k; {+ d
|
|