|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 K0 ?! n# M7 l7 |' S3 E! L
- [code]EDMA sample test application( g1 H2 ^3 R1 J( B
- /*) c- i/ w1 l& @# C9 L3 {9 C9 Y
- * edma_test.c
- u+ p& s; o, U2 O& j - *
8 ?9 C1 }4 u T5 o6 b - * brief EDMA3 Test Application- s4 W5 m0 p/ I9 m- E
- *3 m' e& }( `$ r" r: [8 ~
- * This file contains EDMA3 Test code.1 H& x/ n' `/ M/ W+ x! {" i# x# ^
- *: |8 ^6 i, ~9 p( g" w$ y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
J( Y1 V+ Y$ U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) [" \+ _- D& P( n) \5 Y$ ~% i
- * TO CHANGE.6 ~; p' c5 W0 `4 ]+ |
- *
& {8 T, C6 z |; A - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% ~' u* p: } o* N( V8 | - *
7 |; k6 @$ Q# i/ P8 ]3 J' G* u+ G - * This program is free software; you can redistribute it and/or9 c- f2 c0 K0 Y8 r. r5 T d
- * modify it under the terms of the GNU General Public License as
% J$ f1 D1 i7 C& c1 N# ? - * published by the Free Software Foundation version 2.
6 R% i5 C2 F8 b3 B- ?! |& O8 @ - *& ]- Q, J; b& r; i+ {. s# u
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ E& ?0 j1 v7 [! [ - * kind, whether express or implied; without even the implied warranty
# s( ~. f$ V. c: a, B) d: B) o8 Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 v7 t& @$ ^5 M7 U, I' o: ?- W1 O - * GNU General Public License for more details./ r+ d0 ]' C7 x3 w: u7 a& K, f* H; L
- */, _8 Z9 |7 v0 `' x
" I1 a) y" C; d! R& ^; F- #include <linux/module.h>0 a/ {' ^9 ^# s+ d; ?
- #include <linux/init.h>
, E$ J. ~8 t2 j5 d( _ - #include <linux/errno.h> B& F: z, G5 E. F7 ^* _, y q
- #include <linux/types.h>' K r+ i6 F# z5 F$ [4 q
- #include <linux/interrupt.h>. b- p ?0 H1 l9 B8 C$ {! _. u
- #include <asm/io.h>* O M! _9 {9 i6 Q+ a$ w' l6 s% n
- #include <linux/moduleparam.h>
, w! \8 F6 v1 V4 H, V5 F: u- Y0 m - #include <linux/sysctl.h>/ w* n' V# K) D7 `
- #include <linux/mm.h>
' y" f) ^% S7 n* W f. X7 J4 C - #include <linux/dma-mapping.h>" f3 E' T3 z; c; R) k
- 2 I L; n" ]# K, m1 {
- #include <mach/memory.h>
9 d8 `9 K1 M5 F% u+ ? - #include <mach/hardware.h>
5 J7 r- I4 ?4 J2 y# Z$ z - #include <mach/irqs.h>% O( y q/ A2 y* {( T+ _
- #include <asm/hardware/edma.h>3 {7 @5 I8 _' V/ n2 ~6 C) \
- 9 t% J( V+ g' U& q5 a
- #undef EDMA3_DEBUG5 ~* L+ T: f7 n8 D# F
- /*#define EDMA3_DEBUG*/2 _1 o& e! g! K: A1 k) _, L, S
' R g/ @, n5 A# y% Q1 y/ i- #ifdef EDMA3_DEBUG- b! i. u" x+ N% Q& U! P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ n3 v; x d* v - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 o ]% ^) G; U( a" Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) Z6 P: H# L* z2 \2 \) B
- #else& w$ f1 D Z9 |5 {
- #define DMA_PRINTK( x... )2 n0 Y. I5 i0 ~. @
- #define DMA_FN_IN4 M4 I0 W, w7 h. f+ f0 f
- #define DMA_FN_OUT
/ V7 m# s: J: n1 Q5 G - #endif
9 p$ ^. l) {! [' v+ o% g2 P: P# G - / ^) s, x" _* x9 U9 H2 w
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" m) R7 n# t5 ~3 j1 w
- #define STATIC_SHIFT 3- |$ |2 c% M+ L6 H9 C
- #define TCINTEN_SHIFT 20
. ~0 u- N/ M1 n7 I& {& _9 D5 {+ O- s - #define ITCINTEN_SHIFT 21& ^. c- Y+ E, I4 ^( [
- #define TCCHEN_SHIFT 22
& @ w. ^. n1 G0 c: U; `. Z/ Q - #define ITCCHEN_SHIFT 235 j* x7 {+ b9 q; {2 y6 t3 V
- ) |9 p8 P; A Q; ]# H/ R6 C" R
- static volatile int irqraised1 = 0;
" {1 A3 i$ G( a G3 T - static volatile int irqraised2 = 0;( Q# A j E7 i3 u/ V9 w
- ( X: U! n% n6 D' i9 B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* N2 j" ?# x9 v9 p6 z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: O8 H) S/ t, A s8 ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* a$ {5 j \! r - 5 i/ g2 \/ v7 D0 u
- dma_addr_t dmaphyssrc1 = 0;0 y |( o- b5 @* }
- dma_addr_t dmaphyssrc2 = 0;
7 c$ |6 x" p2 I0 H6 A9 o - dma_addr_t dmaphysdest1 = 0;
2 D& q3 S8 e* b5 L - dma_addr_t dmaphysdest2 = 0;
+ `1 ]$ Y; o0 {& h( ]6 v o1 z - 2 L( L: `$ w0 W& r. F" g
- char *dmabufsrc1 = NULL;
& A, u8 m4 N2 B, q - char *dmabufsrc2 = NULL;6 U' U8 _1 k# I" h
- char *dmabufdest1 = NULL;0 R) C+ c. S" D
- char *dmabufdest2 = NULL;
* H& v' i8 r% d& S# G2 X- n
& E6 _( s1 }7 c- u( T% |- static int acnt = 512;
% y0 z8 ?; z6 P9 H. m A0 H$ s% b3 y& o - static int bcnt = 8;
0 t" L* ^1 T' q+ u' F - static int ccnt = 8;
. e( w2 u3 y' K% w ^% U" [ - 6 s% Y- M" w. c, r2 z
- module_param(acnt, int, S_IRUGO);
. h$ m3 _' X3 W U/ J Y8 w - module_param(bcnt, int, S_IRUGO);7 m1 \7 |4 u1 E$ _9 W
- module_param(ccnt, int, S_IRUGO);
复制代码 k$ g& P! w" s/ w4 e
3 r: K* Q8 z& I/ X' y) d 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) X# Z' U2 P! Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& n8 ^# h$ b# B$ Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- w2 v0 h- L. K# j6 y2 y) e
) P8 p# H0 z1 ?" ^( B- N/ I! l' k( Q/ T& @- u
|
|