|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 J" b' x8 ^9 I5 z) Y/ h- [code]EDMA sample test application2 a# w1 ?+ q& i( I$ r! G
- /*
' o, M8 }1 o9 v8 ? - * edma_test.c
% l: T8 R) `) P7 } - *
0 ]6 z& W9 z0 a; J6 z1 D - * brief EDMA3 Test Application
6 L. Z* T2 u8 B - *
# X+ m1 b: H6 m - * This file contains EDMA3 Test code.8 r; W4 M; t# f2 S& ~3 P' Q
- *
8 }) c+ q( U ?+ o( F2 y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: m( b& s% R& u/ t5 a - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ J6 ~! r0 R! n# R+ Q5 a; q1 r* q# U
- * TO CHANGE.! i0 B9 g- B, h# G
- *7 i/ d, T$ O' B8 Z8 g' Z( T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" t7 g+ G4 {7 E0 f6 h( h! e9 u - *
e' Z: G, u* o" R - * This program is free software; you can redistribute it and/or5 H6 P: e7 ~- t4 F4 Z0 ^8 t) n" z
- * modify it under the terms of the GNU General Public License as
6 i8 n- V$ q5 f: S$ x: X; t - * published by the Free Software Foundation version 2.
9 S( I! y4 G9 R7 O0 u) v6 D5 O - *
9 \8 w! ]/ L8 C, e, w* e. `0 \ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' F1 L$ [2 O- {9 `- s - * kind, whether express or implied; without even the implied warranty. w9 a O+ U5 g& I( T6 y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 o0 V, Y0 o& o8 g' g9 L( V - * GNU General Public License for more details.' f& z; y6 P, K0 h
- */% z% r( X$ u! L
- # R* z& n+ H4 f6 W v! j
- #include <linux/module.h>
5 w6 i9 }6 o9 K6 w - #include <linux/init.h>3 H$ [# p+ ]3 t1 N, V* \
- #include <linux/errno.h>
. l0 ?% Z5 j2 u3 T4 i m% S - #include <linux/types.h>
0 I* P5 A$ w, I7 T$ w% ?3 h - #include <linux/interrupt.h>
; f% t F5 G S1 Y2 t7 w( ]; B' x% C - #include <asm/io.h>5 R2 ?: A* K' }# e9 f ^
- #include <linux/moduleparam.h>0 P! f3 a, `6 k' _6 t* Z
- #include <linux/sysctl.h>
: a( r, o' z) I - #include <linux/mm.h>
, } x: @4 y' J+ V - #include <linux/dma-mapping.h>3 \$ p7 t5 Z" W) v$ V+ P: h* h1 q) ^
2 S% I' q5 \* `+ O/ e6 D- #include <mach/memory.h>, F- W- u" F: P; v9 p
- #include <mach/hardware.h>
: p9 H, I. Q/ j9 ^( e; r - #include <mach/irqs.h>* ]* a/ r2 i' H3 U. u
- #include <asm/hardware/edma.h>; o/ y2 `. p, i$ h7 ~
. K2 l9 @, f% O- #undef EDMA3_DEBUG/ K! q# \' s* Q' m8 c- V& K
- /*#define EDMA3_DEBUG*/
' g: t+ Z5 v+ `2 G; C - " `; a* z3 y- m) R) p' t! S
- #ifdef EDMA3_DEBUG9 Z3 w1 d5 b4 f) Z' O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! t/ l5 ]6 X: a0 T. l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) E4 G1 z* @( w7 P - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- [# k! e" U# T! g3 j% m - #else
9 w2 {: d" Y/ i% P6 [3 O4 A! b - #define DMA_PRINTK( x... )+ ?6 @2 ?' A* Y' z V4 v1 F
- #define DMA_FN_IN% E4 z& a8 M( M- N4 K
- #define DMA_FN_OUT
4 {# M3 A0 L8 G' C, h, X1 z - #endif
; N% d* P P1 _ - : D7 A" m' y2 f2 f* F& \% `
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 |, b( n2 W" h - #define STATIC_SHIFT 3, C+ @: w/ d1 P2 E
- #define TCINTEN_SHIFT 20! K, _2 K D6 Z4 p8 m& X' Y
- #define ITCINTEN_SHIFT 219 {' [ G9 b$ p1 M* l
- #define TCCHEN_SHIFT 22 m. d% Z; O) B5 Q' D
- #define ITCCHEN_SHIFT 23
, F! k) [1 g; w" C+ j ^ - 9 L/ a/ B+ T4 [$ Y
- static volatile int irqraised1 = 0;9 Q1 \1 I, u* s8 ?7 S
- static volatile int irqraised2 = 0;
m7 A2 x# H% F, x. ?: T8 ^ - 8 t: ]2 T e1 D0 ]# b% R
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& c6 n/ d8 O' x$ p1 L
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- r% M. |$ c. [; I! r$ k; o. g2 r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# |8 L( f( ~ d
' C, Z0 D3 b: b+ k4 M1 K4 e+ ]/ q- dma_addr_t dmaphyssrc1 = 0;
& F' i. y0 }/ c+ `: t+ t8 Y - dma_addr_t dmaphyssrc2 = 0;
2 h$ D/ ]/ g7 y5 B. |) W# O- i% S - dma_addr_t dmaphysdest1 = 0;( D7 E6 F- `% J0 M( A. B+ n2 X
- dma_addr_t dmaphysdest2 = 0;
, G/ J* _$ J" g5 @- d/ Q - 1 ~2 b2 v c+ t4 \& f1 s }
- char *dmabufsrc1 = NULL;
- A! K& S2 D! S' a+ U* B - char *dmabufsrc2 = NULL;
6 K+ E! |% M: d& o* u, ?* G - char *dmabufdest1 = NULL;- \. J7 F0 Y Z" I! J8 s
- char *dmabufdest2 = NULL;
+ }2 D+ @& C3 L
" r& B8 k- U1 j: m4 X- static int acnt = 512;
# K1 j8 C2 B( A3 G# W - static int bcnt = 8;
5 x3 z( O* s4 l- G( S - static int ccnt = 8;
( |6 Q( g( z4 m' ]( o - 9 R8 r5 V; ]& f
- module_param(acnt, int, S_IRUGO);
& K$ u) c; K8 M, ~9 X' v r$ b - module_param(bcnt, int, S_IRUGO);/ A' g" S3 @. J" C: V; Z% ~
- module_param(ccnt, int, S_IRUGO);
复制代码 " T6 c% f/ V4 ]* ?) D1 c* i- o
; C/ b+ P- Y) d* }0 ~- H2 ]0 H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 R1 u8 u9 {, W7 \: l) Z q5 [; x' R0 a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 R6 n$ u, y6 S0 X1 _! v$ G 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ q, I1 m& S8 G! S' I- ^
- F) e* L: [4 u) D8 x5 J4 w9 @
( x2 Z- {5 m t- l+ m
|
|