|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! J& q o* D; Y1 l% y
- [code]EDMA sample test application* ~/ R7 w; f, o9 [
- /*, p- y! Q: S0 d4 A: N" I( O, E
- * edma_test.c
& U5 V% m! Z( N2 {; E - *
) v! N+ Q# Y1 Y! u - * brief EDMA3 Test Application6 Q2 s+ j5 ]7 r2 ?( w
- *9 ?$ @% K5 G) ]) |/ n
- * This file contains EDMA3 Test code.
. O) n1 W: t- T7 u - *& e ?) n1 u% u( H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, J/ @( _ c& ^" c3 t& Q3 c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! k" d6 [8 b: U" W0 ]+ o - * TO CHANGE.
9 Y: _- N \3 T# {. T, \ - *7 q- U. V" a% T, ?( C3 i
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! r& J o4 b& ~! m( [ - *) i; w, l8 l3 h
- * This program is free software; you can redistribute it and/or. G& ~, T' ^( S' I, j2 \
- * modify it under the terms of the GNU General Public License as
! R5 F; Z" M2 R+ O8 m8 W8 F, [ - * published by the Free Software Foundation version 2.; T, p% s% g# t
- *) a- m3 Z8 q1 d5 c+ }2 _1 g
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, d( M5 e( A) U) ]. M
- * kind, whether express or implied; without even the implied warranty
; v, i: i- F5 o) T7 N - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" ?# f$ I4 S. {; [: }1 v - * GNU General Public License for more details.7 B+ Z3 @( T. i. j
- *// X: S+ k! Z+ b( `
- - Z- U2 B% D/ P3 w# p
- #include <linux/module.h>
8 q/ ^1 n* w9 f" F8 J% `& I& }4 @ - #include <linux/init.h>
7 W5 @% g9 S9 G0 v3 C* K - #include <linux/errno.h>
0 b+ m" U2 k/ y1 s8 v m - #include <linux/types.h>
' y2 K3 m: I8 m2 H8 g - #include <linux/interrupt.h>
# K7 X5 f! z9 |& p2 Y! {0 y$ x+ V - #include <asm/io.h>
+ t/ P) f* D: `1 C0 x" o - #include <linux/moduleparam.h>
2 a3 _7 a2 d. ~, @" Z% d( v - #include <linux/sysctl.h>
5 h: w/ E+ b6 Z7 l+ f( } - #include <linux/mm.h>8 V1 l/ I' l' g3 Z. z& ~% L
- #include <linux/dma-mapping.h>8 a4 n! V9 i- g% R) X2 s) C
- ( g6 U' B6 o/ s% ^
- #include <mach/memory.h>3 X! N# r) u8 M' x
- #include <mach/hardware.h>
0 ~5 z6 @) n: ]; f4 @ - #include <mach/irqs.h>
7 @' o! @9 F0 k - #include <asm/hardware/edma.h>
& i, j8 ?$ T9 A& T5 e( m - L; \* l" e' w4 S
- #undef EDMA3_DEBUG J! z% |& G1 n3 z8 t9 e, X
- /*#define EDMA3_DEBUG*/% B5 s" E) l) p, V: L
( S7 o! @7 p0 h5 x& ~1 O) G- #ifdef EDMA3_DEBUG
, k9 C' O) Z4 h$ o9 \6 }) h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), h M0 ^) Z4 F" Z( \
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" H) Y! K) q& d: w' I5 z' ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 `$ R. K1 R/ L# t1 M8 i - #else# [- y( T# t2 o# M
- #define DMA_PRINTK( x... )) y" V% G- P6 d8 C% j! [& Z
- #define DMA_FN_IN! x& c6 C) @( k: u$ U8 B" X
- #define DMA_FN_OUT6 _5 X0 a% N. c- c0 C
- #endif3 v) F3 q0 W' `1 ~
; V& \ _* F4 x" c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 R, G1 Y$ j; I7 `6 }+ _! s
- #define STATIC_SHIFT 3$ _& M7 I# x! a" s8 t7 }1 |
- #define TCINTEN_SHIFT 20
: S7 J, P0 ], \& R - #define ITCINTEN_SHIFT 21
) b6 \ J, G3 L7 } S - #define TCCHEN_SHIFT 22$ W' M. u ]' a0 Y
- #define ITCCHEN_SHIFT 23* G/ v( G5 |2 W0 {; w8 N8 n
; z" n5 s5 l( r4 k% i( _- static volatile int irqraised1 = 0;6 N* M$ p% i7 ^/ l) p" Q
- static volatile int irqraised2 = 0;
, d& {6 ]+ C2 Y6 O
6 K1 V( q( w; e- U/ @, v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) l: w. |" j! h9 i( T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. ^3 m8 B( |, W% h. a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: z7 q# H' n: l, n
- 1 S0 ^: w4 x( |$ D$ e2 f% k
- dma_addr_t dmaphyssrc1 = 0;+ ^$ {0 y" B% ~2 X# V
- dma_addr_t dmaphyssrc2 = 0;
; G+ E3 M" b9 H2 z1 O - dma_addr_t dmaphysdest1 = 0;
. f8 N+ ?4 T- e - dma_addr_t dmaphysdest2 = 0;- o+ J1 H5 t2 c' p% f+ E: ]8 X& p
9 ?5 C" s2 B9 Z7 J- [9 r# D- Q- char *dmabufsrc1 = NULL;5 W: w! H# f0 `5 H
- char *dmabufsrc2 = NULL;
& ~$ q5 S: a1 g+ [ - char *dmabufdest1 = NULL;5 n- A. }; ~& h5 s9 g* L! w
- char *dmabufdest2 = NULL;
) @' b, C+ \4 r/ k8 t - & q: F" Z( G3 W0 d
- static int acnt = 512;8 z6 k2 V/ k; ~
- static int bcnt = 8;: b8 s$ `7 i- l6 d# [( |
- static int ccnt = 8;
( o4 ?3 ?6 H4 F- L - " N+ V6 E, k$ g' v% L
- module_param(acnt, int, S_IRUGO);
0 e& m5 c1 V* Z - module_param(bcnt, int, S_IRUGO);
7 l4 o+ h7 G& s/ B& e9 D8 K' X" W8 I - module_param(ccnt, int, S_IRUGO);
复制代码
( M2 i+ A# e4 p" u
- y( T2 W. C& D# U- M6 w, m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: e# k' C3 M& s% x: marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 t' X. X' |% \! j* N
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 c: B: E1 m, g" h
. J+ E# l! Q( x
7 a' U# Z K! _ W) ` |
|