|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! e- `3 t1 H6 q1 R- [code]EDMA sample test application
2 k* f" A5 |: Y% F& B! \! q - /*
) l* ]8 E) e( m0 m' h - * edma_test.c
1 ]' k! _% j. {% Q1 n8 ~ - *1 v$ {# [6 w2 Z5 [' f
- * brief EDMA3 Test Application
9 @+ \" T$ A5 E3 q: x1 P - *# {2 P( G) |4 c7 e3 n3 p* k/ S6 q6 j
- * This file contains EDMA3 Test code.6 Q# r3 H6 {# ~
- *; @' o6 j. R) B; G/ S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 {% x5 ^4 @2 X8 M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
w0 K- t0 S6 q7 g& ]; [* B - * TO CHANGE.! @# e! \6 ~8 K2 C2 c
- *
1 Z* V6 b2 K5 n+ @4 l% B9 N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, Z n7 f% B6 `( G
- *; R9 z) ~1 a3 A% Y; s \
- * This program is free software; you can redistribute it and/or2 o% \& i" L, A+ u
- * modify it under the terms of the GNU General Public License as8 N; U- l7 e2 ?9 y* C: L! B
- * published by the Free Software Foundation version 2.
& r: u5 j4 y* p4 E - *! D2 ?# ~; { N! U+ A7 M
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, V g5 P+ d! U) E" U2 @
- * kind, whether express or implied; without even the implied warranty
* s0 X$ t2 Z8 K: R6 Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 I4 f8 i5 ~: N9 i - * GNU General Public License for more details." Y' f+ z1 l/ A4 f' x" G3 p2 l
- */4 Z) u& n9 I y9 t
$ s( v* N2 v% e3 A' H! d; y- #include <linux/module.h>
5 N+ I8 w5 d4 m* N - #include <linux/init.h>
4 f! S- ?5 G* B; W: V J L - #include <linux/errno.h>
9 h) N% @% l+ | - #include <linux/types.h>
# k! B+ R; `7 g, }- W5 u7 s - #include <linux/interrupt.h>) W) v" r: a2 g0 `3 A, R
- #include <asm/io.h>
0 B+ ?, e/ t8 K( K% J7 F% S3 c; V - #include <linux/moduleparam.h>
% [1 m" e, S: I( |: o6 O C1 o) M. @ - #include <linux/sysctl.h>' u+ ~# ^2 Y5 U" K9 _
- #include <linux/mm.h>- J9 `* W" w, Q2 d
- #include <linux/dma-mapping.h>% J1 w y) X( ~8 \2 O
+ G, P$ Y4 `5 A7 W( N7 n) F- #include <mach/memory.h>
# w- n$ {8 G4 j: ~- N8 F - #include <mach/hardware.h>
- F4 R6 D5 C$ E - #include <mach/irqs.h>
8 v( |$ B. T7 c& w6 a7 i* N6 c - #include <asm/hardware/edma.h>
% y" ?8 ^$ H' q9 {' ~
" J h9 j- y7 ]5 X- #undef EDMA3_DEBUG
2 |: z# Y! q* n - /*#define EDMA3_DEBUG*/ T) r1 O0 O" c* i, X( y8 [
7 e) i; b1 i! \9 P( {: V( e- #ifdef EDMA3_DEBUG/ [: Y" ~8 S Y; {. h0 D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 d/ l2 H v0 @2 r" y# d$ W5 r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 l9 s; u; V6 D+ y2 ^# q" Y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* R. r3 {9 C5 X" e
- #else+ K* {* a: h* i3 ~, U, Y. Y3 p
- #define DMA_PRINTK( x... )& u! z! d# ^2 z- S2 u; e1 {
- #define DMA_FN_IN& O/ s5 x' ^! O [" R
- #define DMA_FN_OUT, g) K* A/ q$ p7 e5 s8 s8 L
- #endif6 _% U/ Y+ o3 |* j8 f1 f
- ; V4 o; [8 S8 T- P6 t6 n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 W) ]( r# {' A# Y! r6 K | k
- #define STATIC_SHIFT 3
* @% N+ E6 [; D - #define TCINTEN_SHIFT 20
% ]0 O i1 \( z' o: A" ~, P - #define ITCINTEN_SHIFT 21- C* ?7 D0 ^6 F. ~4 \* C
- #define TCCHEN_SHIFT 22+ I! p6 D7 `( W
- #define ITCCHEN_SHIFT 23
# x( S+ \; Q* w; V2 {" [ - $ U& t6 d# e9 S0 A* I
- static volatile int irqraised1 = 0;
6 \8 P0 Y+ t" w; E- y W# y, ]) d - static volatile int irqraised2 = 0;
& \) {' G* r- n j# R2 t2 ^: w - 0 u' L5 f) w/ j& i
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ p4 d: |6 P8 J9 k1 d/ a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 K3 n: O0 n( {$ O/ N5 t, |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 I, a% d$ P3 p; x - " e4 d8 A0 ]7 e, g" T; G
- dma_addr_t dmaphyssrc1 = 0;. {+ \* E* g( s0 t- J7 P1 E
- dma_addr_t dmaphyssrc2 = 0;
% @; D* ~% W/ T# e3 \ - dma_addr_t dmaphysdest1 = 0;
: a9 @! Q' v4 o4 c' a+ E - dma_addr_t dmaphysdest2 = 0;
o* l- K6 p, T( w% e' {& G$ o$ N - 5 Y2 f. u3 r o. t( m# G# |
- char *dmabufsrc1 = NULL;
8 p! c. a z: Q. T0 T - char *dmabufsrc2 = NULL; z: H) l) i5 \6 @
- char *dmabufdest1 = NULL;. ?+ ?0 p& h2 c8 ^' b3 x
- char *dmabufdest2 = NULL;
. R, l. r8 h4 x( A - & h1 M: x$ ~" g6 i
- static int acnt = 512;
) c( B( `3 d7 f5 m) W* j: Y - static int bcnt = 8;
4 F' Y X, G3 G' O - static int ccnt = 8;+ B7 A2 \1 c1 u9 j% ^
' d7 s, }! Q' |3 I7 `0 ~8 n- module_param(acnt, int, S_IRUGO);" t* E9 f& T" \ |, ^9 O
- module_param(bcnt, int, S_IRUGO);1 [' z; Y3 q4 p; h. g& j
- module_param(ccnt, int, S_IRUGO);
复制代码 ) p% B* D' h. m4 G M
" }5 s4 |- O6 ]5 ?9 p4 B 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 t/ O& d( Q+ @3 S1 f- S+ _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ q# D; `- X4 S- y0 k6 G1 c0 q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- `4 F6 n# f. K- d6 ]
: M6 q+ Q9 [1 B$ Z# K% r. k# s, F; [
* S) ~$ @1 E* t, R7 n \3 R! P* f; q# L
|
|