|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 I4 f r0 Q, M! o& r' q- [code]EDMA sample test application
0 s8 Z) w7 I+ }- t - /*& [# B( ?& w8 J7 q0 b
- * edma_test.c
$ R p! P2 \& c: j - *5 o9 `' O5 }+ P- N
- * brief EDMA3 Test Application: D9 I( t, [+ ~' ~* K
- *7 O9 s/ l, b7 ]$ l& [1 A. {8 r+ a
- * This file contains EDMA3 Test code.
- s! p% k, U5 q - *' }; F/ Y! l( m
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 C# S8 w0 e0 @# M9 P9 F0 C @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ ~ J0 v- ]" W a. Y" F( g - * TO CHANGE.
% J8 d6 E0 _/ a$ m3 b - *
. C& r' Y( ~+ _4 `: x: M' ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 Z& G7 f% O( x; d, r1 e! T: k% h
- *) _' W! L: a. Q1 e, y. n
- * This program is free software; you can redistribute it and/or+ E3 M' B' K+ Q: [* }, W
- * modify it under the terms of the GNU General Public License as8 P% T$ V8 J. ?' d; d: Z9 ]" Z T5 O2 w
- * published by the Free Software Foundation version 2.
, y, R/ h4 H8 o/ V, T9 d, F$ ~ - *% D+ R/ j# v" b! A( E. v2 ~. v
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 ?. w+ [& V* ^/ j" l. K4 \
- * kind, whether express or implied; without even the implied warranty; \+ K; V3 |8 O4 a1 G6 ^
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& r7 @2 [, K5 l# ^
- * GNU General Public License for more details.
* {# ~8 A6 R0 O2 ^, @% z - */
) U! u4 T) k/ b H! d
- K; H. `( }1 r9 I0 O0 Y( h- #include <linux/module.h>
- f( R' S) \# n, n- ?/ b/ L6 g) T - #include <linux/init.h>$ e% J+ `* N8 c4 y2 K$ U5 H, j
- #include <linux/errno.h>
B4 C7 l j" h - #include <linux/types.h>4 n8 w/ w/ t' {' W4 [, ?+ S% @) W
- #include <linux/interrupt.h>
) o, ^8 j% k3 Y3 ~2 {7 g - #include <asm/io.h>- K- C" _. B5 d. S. r1 N m
- #include <linux/moduleparam.h># P6 q4 B. d' o( V
- #include <linux/sysctl.h>
8 Y7 a+ B4 L% z9 I8 J4 I - #include <linux/mm.h>: b; Q! H" k$ H0 r
- #include <linux/dma-mapping.h>( A3 C B' l2 _) T" m8 k2 D2 \
1 m9 I. ~% N! ^4 [6 u1 S2 u! W7 n( \- #include <mach/memory.h>
' f# w9 h4 l C+ B - #include <mach/hardware.h>6 F$ Q) c9 W5 P; t
- #include <mach/irqs.h>
& T Y |4 A6 G; m) k ^ - #include <asm/hardware/edma.h>4 I7 t! t5 L o: {4 a! k
- 5 v7 ^" v) D+ ]
- #undef EDMA3_DEBUG7 x1 ~: T+ g0 \
- /*#define EDMA3_DEBUG*/8 q, H3 S: n+ N8 F2 Q; v% T
+ c: O5 Z& q) F9 p! p+ X% e3 X- #ifdef EDMA3_DEBUG
; {/ S) R1 L* |1 n. } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 t* I. x% N2 x- j; Y. M. f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 q/ _& P" L8 x* R& ~8 T - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, P3 `/ l& P% E* T- l, Y/ v - #else
2 N8 z0 M$ ] Y \, ~6 u" v8 v* c( A4 k - #define DMA_PRINTK( x... )
" l" F/ ?1 n( `+ `& Q4 K) g% ~3 n - #define DMA_FN_IN9 J7 o% F( g# o1 \1 B0 E
- #define DMA_FN_OUT7 K( N% w( x+ F Y1 f
- #endif8 M8 ^" y, h. d& p
- 3 }: M" y) S5 `7 [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 _; p O8 F7 s% C1 K5 G
- #define STATIC_SHIFT 3' d- _6 C4 C5 e9 g( u+ i
- #define TCINTEN_SHIFT 201 @# O4 b+ Z6 V
- #define ITCINTEN_SHIFT 21# T8 ^4 P7 x1 E2 M! n
- #define TCCHEN_SHIFT 22% @& P: z% }+ a- d% O, p
- #define ITCCHEN_SHIFT 23
* w9 B- m- S4 S; P
9 n: q0 @3 C7 S! s- static volatile int irqraised1 = 0;) {! w( t; V( C* l6 P7 D
- static volatile int irqraised2 = 0;
2 t" c) B' I) ] U. B
8 J3 I/ T$ V% x! \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% [5 F6 l( j' m. P* R: T
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 p3 R# l% j. \ l- b+ n! k' \$ ^- K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ E; r F& k3 Y - 9 j4 C: ~, K$ u) K
- dma_addr_t dmaphyssrc1 = 0;; b+ n* D! Q3 I! T
- dma_addr_t dmaphyssrc2 = 0;
0 B- W" w2 c1 J7 K: u4 c - dma_addr_t dmaphysdest1 = 0;
{( w. ~8 m M3 [0 Y - dma_addr_t dmaphysdest2 = 0;
- Z, [% j3 w0 y9 t' D2 X: h
, I9 h: S9 U+ q/ i- char *dmabufsrc1 = NULL;
$ V: Q' l- a9 {1 q( W* J+ n$ P1 ^ - char *dmabufsrc2 = NULL;+ n% _3 p. R- u9 e" ]+ |+ H
- char *dmabufdest1 = NULL;
$ I+ G9 V5 ~) E3 q( [+ f* Z - char *dmabufdest2 = NULL;3 d. b& t1 n* o
- 3 v- Z. G# t) ?
- static int acnt = 512;
& I% }- g' y5 e7 Y3 W - static int bcnt = 8;2 i6 [2 C, K) T# a( v
- static int ccnt = 8;, i4 `4 Z3 {0 k
- # e$ R* g( S& W6 s; b
- module_param(acnt, int, S_IRUGO);
8 [8 Y0 M( v5 Z; _* c - module_param(bcnt, int, S_IRUGO);. Q; C# B& X) ]
- module_param(ccnt, int, S_IRUGO);
复制代码 ! N, U' k& D- I% _$ K
; R8 T7 t. x6 b. b- n) p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) Y/ k( z! {& i6 ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- y5 M1 r6 V+ Q8 u2 X; G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ p& L! J$ M! c3 G
# Z5 [- I q# @8 [4 W6 s) I7 S1 P( X% M4 l
|
|