|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( X" q) t2 x# D0 E4 k- [code]EDMA sample test application8 C7 [ T& i2 s/ w+ S
- /*
: J+ l5 `7 n0 N& `, v: D - * edma_test.c4 d9 |; z: I1 t/ h; l3 {- R2 ]
- *" F1 R5 e7 w! A7 X! f
- * brief EDMA3 Test Application: k# \% r6 f6 T, c2 V4 R9 J
- *0 r) I! J8 A: r) ?/ j- y2 A
- * This file contains EDMA3 Test code.
B8 \, r$ y( z9 W - */ ?/ m5 L% x. E1 v% c7 K# t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' S7 M6 [8 n" t% q8 p
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 u u/ ]3 _% H$ w, A- { - * TO CHANGE.+ Y8 n3 ?* W2 T. w/ d( [! H3 E# x4 B/ J
- *) |) c( v3 ^, V" F' f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 a Z. ^" m% V4 ~: d! i
- *
! G: T) _+ Z2 _; i' d% k - * This program is free software; you can redistribute it and/or! N7 w' x0 [4 C7 m' x! c
- * modify it under the terms of the GNU General Public License as# _9 l( T u# E# h
- * published by the Free Software Foundation version 2.8 q1 p. d% t: { s
- *5 Q' ^* r( H) F; o
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 f: e! Q/ C7 j B/ y5 Y) c - * kind, whether express or implied; without even the implied warranty
& K0 x* u7 P7 X1 } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the J1 Y% g( }. U0 F6 a
- * GNU General Public License for more details.
: y% @$ m- B8 N9 N% i - */
/ l7 [5 V- A! z u9 w6 p) A
' i2 N% J" H! _" D3 A6 G7 h3 R7 d- #include <linux/module.h>
1 G0 A# s* J# f - #include <linux/init.h>
5 K) L# \ I1 I- {" T+ _+ @1 V - #include <linux/errno.h>6 W# |7 {& j& Y& p' \2 E
- #include <linux/types.h>2 G q( p* k7 o6 W) P
- #include <linux/interrupt.h>
% h3 L4 C; L7 C% r9 X( k' X! P - #include <asm/io.h># x8 {4 K5 M% q! w8 ? y0 y& Q
- #include <linux/moduleparam.h>* D' u. J1 M ?) Z1 K p& h' g
- #include <linux/sysctl.h>* k* q- W; C3 ^# J+ p# S/ S( O- E5 C
- #include <linux/mm.h>3 K, [) [. s( S0 M0 M
- #include <linux/dma-mapping.h>6 b. e8 ?. M- y. S9 U" f: m
- 9 X* R* f2 \/ w/ C8 N- E& s
- #include <mach/memory.h>& b" t2 k. X* b8 u. s# f* {
- #include <mach/hardware.h>
. _0 ^! s; T( q$ a0 ] - #include <mach/irqs.h>* x9 E/ Q, L! K; ~/ M: u6 D
- #include <asm/hardware/edma.h>( |/ I2 z% K8 B# K: {: P7 E( o
1 G: Y, ~: R2 M# ^4 z# N9 \& O- #undef EDMA3_DEBUG
$ q$ `3 }' r+ u h - /*#define EDMA3_DEBUG*/
w$ [$ F k0 s7 M( T - ) R* h/ L- J* Q' F' @6 S1 H
- #ifdef EDMA3_DEBUG- Q ?$ z9 k* J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 V, Q# W9 `6 P$ R& w, R5 t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; u. X: _. {3 g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" s0 X S3 n( S! e+ v, ^
- #else9 m2 _; F1 l a' s0 N1 ~
- #define DMA_PRINTK( x... ) e9 _9 |) D7 S6 Z/ @& G
- #define DMA_FN_IN1 P& K- c0 B9 ^" n' g
- #define DMA_FN_OUT" Q% Q `# L! _2 O
- #endif* }/ U/ m( X+ y
; ^& R8 f' j" r* ]/ b x- {( z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 s, `8 Y% u% e8 h% s6 N/ \0 q
- #define STATIC_SHIFT 3
2 \$ s8 E: `* `! ] - #define TCINTEN_SHIFT 209 A/ @6 {8 X) A4 b2 t8 u# J, i) L$ `
- #define ITCINTEN_SHIFT 21
# z Q) s+ e4 r: D/ Y" }6 R/ `7 L: O - #define TCCHEN_SHIFT 22
9 g9 u/ k! c* A) o8 q3 C - #define ITCCHEN_SHIFT 23
# o8 |; l' @' F# h$ y [. G# T. a - 9 {. n: D/ `( D L# E4 Y
- static volatile int irqraised1 = 0;
7 [, X1 A) k1 @/ D - static volatile int irqraised2 = 0;
! L0 p& N$ G% p8 r - ! Z$ K) {# O1 U3 b9 j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 }5 h; ~6 L7 W9 p! Q8 ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Z- W& X8 S+ \5 h' N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! _& c. y7 r. n8 O" l7 Q6 b
- 2 ]( _. o8 i. c9 t h/ C. o4 T9 G
- dma_addr_t dmaphyssrc1 = 0;6 v* Q& e- Z# L! T( k% j; T
- dma_addr_t dmaphyssrc2 = 0;$ B9 }$ w5 M& S
- dma_addr_t dmaphysdest1 = 0;
3 x, O# | q9 |: `3 X' S* M - dma_addr_t dmaphysdest2 = 0;5 q+ l1 C8 z# N; x: L3 G
1 A9 c& P @8 L6 f- char *dmabufsrc1 = NULL;
" O# a* M% _5 g( W8 F3 A - char *dmabufsrc2 = NULL;
% ?9 k1 e4 E; R9 c1 U* m! z - char *dmabufdest1 = NULL;$ a' [4 B6 e7 }4 D* _" C( g" d
- char *dmabufdest2 = NULL;4 t) A- y3 F* q3 t: h" u
0 p. f3 V% [; T }8 i& n- {- static int acnt = 512;
8 P; ?0 l6 X8 W' u$ @, U4 T1 r - static int bcnt = 8;! o6 T; R2 m- |: R
- static int ccnt = 8;
+ e) c( C3 V! p' r$ {
% J9 X' B0 {. _* a: Q9 q- module_param(acnt, int, S_IRUGO);8 \+ Q8 B" b% D0 C5 G1 [% I
- module_param(bcnt, int, S_IRUGO);
, U% A+ S1 h" F+ u - module_param(ccnt, int, S_IRUGO);
复制代码 / k! ]: {# c# C3 `* V- _$ E
! Q% l( |7 `2 E3 t1 x 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 C2 s+ A5 @; p+ e4 C1 Q4 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 f' ]% x& x$ G3 V0 E9 l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 p1 D `+ B |% u
0 `) G" o. o* P' Y# R/ R7 \3 b7 F
) S+ y6 K' I6 `
|
|