|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 m: @6 \+ Q2 Y1 g. t7 D# |- [code]EDMA sample test application
, m8 C' L& O+ `" Q6 B3 m; D6 O - /*
7 G- B# _; z0 w, _. ?0 p9 y# T# D - * edma_test.c
6 i# H0 p. m6 g - *. q2 w1 Y( N3 l/ G/ I
- * brief EDMA3 Test Application
3 d9 i; I) E/ q- w8 R- P* v7 n' ` - *
2 ^! x$ ^( o4 {. u" X - * This file contains EDMA3 Test code.
: ], o/ D4 W* i, T7 L - *% j& q1 |# Z) O' P$ X
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 \/ L7 D) K1 @" M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* n: |$ k/ t9 N$ G8 q
- * TO CHANGE.
* u* s. c# Z$ z# G6 N1 f - *
# F0 D% w6 e1 l. h: w5 V - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. N, {0 P) C) n( A - *# n: v9 r, B4 P+ T7 ~; u
- * This program is free software; you can redistribute it and/or
6 b: {) G3 }' w - * modify it under the terms of the GNU General Public License as$ u) O/ g9 t& j: M2 j
- * published by the Free Software Foundation version 2.
[7 _$ @4 L* E/ x - */ s* B( f) d7 @4 i! W/ D# l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% F, C& a7 p0 Z3 s; Q - * kind, whether express or implied; without even the implied warranty' h7 m: m# T2 l7 J- b- G
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' n' D( L9 y: V' K( X - * GNU General Public License for more details.
0 K7 t, i$ m9 H2 h% Y/ A, ? - */
: Z+ t5 h) x, {5 L7 _ - , L6 y) K; E5 F
- #include <linux/module.h>6 ]0 g% ~0 o# D
- #include <linux/init.h>
9 }4 M7 e1 ]. \# D+ i: F; D4 A - #include <linux/errno.h>
0 g8 _+ E" ^3 G1 f" o) G - #include <linux/types.h>
6 V+ _' y3 s) s" R5 E4 e1 e8 C9 X - #include <linux/interrupt.h>( W9 X1 {1 S( F7 S" V6 `
- #include <asm/io.h>$ b) M) x7 c! q0 i& N* q! e
- #include <linux/moduleparam.h>& I% u5 {8 B2 |4 K3 u4 o( V/ L
- #include <linux/sysctl.h>' l2 ^% B, w1 {, O8 g# j
- #include <linux/mm.h>
! D4 n2 _3 }, [8 B* L! A: W - #include <linux/dma-mapping.h># o4 O6 D* Q8 f+ a
6 ]" c5 O: C" I8 T7 s- #include <mach/memory.h>% W4 P; b( s) ^
- #include <mach/hardware.h>
6 e! I# b% d9 e# ?6 ~ - #include <mach/irqs.h>7 Z# l) [9 P) E7 ~$ F
- #include <asm/hardware/edma.h>
0 |5 ^# V, M0 a( R8 C
- v! N* E$ i, n- ~- #undef EDMA3_DEBUG
9 W0 s' U0 q* z7 i3 }' I - /*#define EDMA3_DEBUG*/
+ O' b! I0 X2 i- G. K- }
7 R0 p5 G3 ~* u- ?$ \- b+ o- #ifdef EDMA3_DEBUG
2 Z' _* i: g. g' g- v+ `( r3 L! P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 ~. J; u& b$ r* U( h4 N0 \0 O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 z; e( r; o# e% k
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ a: M% f* Q) u8 h
- #else
4 V, r0 Y+ K/ Q: [ - #define DMA_PRINTK( x... ) c" A7 ^# [$ j" ~
- #define DMA_FN_IN
8 C# P1 T9 P- s# _7 F" l/ O - #define DMA_FN_OUT
# e+ X! b/ N L6 I - #endif
1 ?$ e( t {. W) n- S
/ g6 \5 j0 Z8 Y' V: U1 H- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ X% s( O3 G) `5 n
- #define STATIC_SHIFT 3
, C" m) M" R9 h - #define TCINTEN_SHIFT 20
p! K( i: ?; i: }# N+ x; J" c& W - #define ITCINTEN_SHIFT 21
$ J3 e) \8 k6 U - #define TCCHEN_SHIFT 22# b/ m; A9 \( F2 B3 y
- #define ITCCHEN_SHIFT 23
8 V1 B/ H2 O% C+ G - " T/ z+ ~, \! j9 H) G8 P7 [# V3 p
- static volatile int irqraised1 = 0;
0 n8 B' o! S( C) t - static volatile int irqraised2 = 0;
+ w5 Q% g! s. Q - 3 E% E0 E1 Y# K" {
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 E2 Z% j! \& e7 N" ~5 y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 f. ~: ~) F* l g
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 u, O( b+ D+ A - $ ^, |- P2 M) T" ~! M7 E
- dma_addr_t dmaphyssrc1 = 0;$ S) f1 o) z6 z @) ?
- dma_addr_t dmaphyssrc2 = 0;: J8 B' h" I2 c2 C! X
- dma_addr_t dmaphysdest1 = 0;0 H7 [. l! ]8 C2 A1 u, A1 y2 J
- dma_addr_t dmaphysdest2 = 0;2 S# A0 ]: e4 C2 I2 R9 g
) V; V& T" @6 b- U$ C! S1 x- char *dmabufsrc1 = NULL;" U) E6 N: j' v9 f0 z
- char *dmabufsrc2 = NULL;
5 F& W9 m& ^4 ~ m1 G - char *dmabufdest1 = NULL;2 V* `* n, U* f1 m* z' H
- char *dmabufdest2 = NULL;; ~! v7 ~; `5 \ [4 Z2 M0 j
! W. O) B+ t/ T8 ~) l- static int acnt = 512;
8 e2 P2 I( P- m7 ~; r - static int bcnt = 8;
+ i7 a1 F. q* O+ J( c& l - static int ccnt = 8;
( S6 g1 E8 [* `2 K' t# ?* p - . V) v6 A6 ~; {; n: V6 _
- module_param(acnt, int, S_IRUGO);, M/ Z9 |3 @; E6 l
- module_param(bcnt, int, S_IRUGO);0 F" s; H: e# h$ t
- module_param(ccnt, int, S_IRUGO);
复制代码 , [- b% x$ a/ X# O* D
, v' y$ M! t9 I' P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* h$ D% { V- B4 S5 d% Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 v9 X) V5 ]& K/ V* [+ z1 o2 ?7 Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, W9 g+ c2 E) z) K) y1 v% ?9 H
7 }% o4 H6 Y4 W6 G% f
* y k9 v4 v2 F# K( u |
|