|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& a" p! Y* ]. C' X' q) f( c, `4 M& R- [code]EDMA sample test application7 C- s& n+ z5 Z6 x$ E: q2 o w2 e6 X$ V
- /*; m; i; I$ z2 T. {0 `9 g+ h$ L
- * edma_test.c, |; _; A1 `; k+ m7 t- N* @
- *; N3 [- X; t) f7 ?: t O! D
- * brief EDMA3 Test Application
* Q' f# p9 ~5 y - */ u# S9 D1 P" i+ B7 s
- * This file contains EDMA3 Test code.2 k! e; ~" g- N. U7 R8 f
- *1 p$ M2 X1 j% |% j' I/ o* x
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 S' r h, z0 O5 F1 |( y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 o! Y: [) j& j0 [) F$ B7 @; l - * TO CHANGE.
7 g$ f+ d; E; h( q+ k# Y - *
: _. Q: w# i+ h% [2 {/ |) o( P - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ u" m5 ^4 X6 w- W1 R) y6 X' f - *4 V5 q! G- w" X \" ~* m. z
- * This program is free software; you can redistribute it and/or1 q( `$ I/ L" x6 `, t3 Z8 N# n: Q/ A3 |0 I
- * modify it under the terms of the GNU General Public License as
* X2 V9 x2 N/ T8 s: U! f; ? - * published by the Free Software Foundation version 2.8 J; ?4 D; r; K& T# P
- *
; d, Q5 D+ {/ \$ B' W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 s9 s) Q2 G5 b) a3 G2 I
- * kind, whether express or implied; without even the implied warranty/ ~, @3 r) q) m
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% F3 L8 @$ f# y0 s- }/ G# V% \& X- k/ g/ Z7 z
- * GNU General Public License for more details.
1 ]5 @; z4 ^$ o - */
% E$ {7 P3 ~. l7 ]. C - 3 G7 n" N( |9 C& H0 U# Z: \
- #include <linux/module.h>3 y: h7 G6 H5 |/ m6 C7 y) x/ i# H
- #include <linux/init.h>
5 r8 a, z0 R& n/ g% e& z# O, [) r - #include <linux/errno.h>' Y# V# i9 S; _7 \0 |0 P( W
- #include <linux/types.h>
) ?$ i4 v7 l5 Z - #include <linux/interrupt.h>+ ]8 o# C6 K/ S# g
- #include <asm/io.h>+ C5 J: E* |1 f! P5 Z, \
- #include <linux/moduleparam.h>
4 H% T0 o0 N4 b% X+ R. ~ - #include <linux/sysctl.h>; H- l- c* b/ j2 `
- #include <linux/mm.h>
8 r# S% d$ A9 n* z0 x - #include <linux/dma-mapping.h>+ j* X( p! M! T9 B; I
- % x) [. P' h; W; ^$ F( T4 @8 l
- #include <mach/memory.h>% N @: V; j* j) F- u" r7 E1 |9 \
- #include <mach/hardware.h>7 @5 Z/ P9 ]1 Q0 P; D4 d; ^$ X- ~
- #include <mach/irqs.h>1 T" Q6 D) q0 ?5 I' V1 q/ Q
- #include <asm/hardware/edma.h>
! t; [. M* ^ D) F$ X - + K* ?( B: s: ?/ C! t( g
- #undef EDMA3_DEBUG# f& S% \( [% R( b% G& B* X
- /*#define EDMA3_DEBUG*/
( v* F- O3 T' P! }( q6 g - 9 J3 U( S4 D/ @7 I2 Q& _& F( ~
- #ifdef EDMA3_DEBUG r( ^& U: Q5 N
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ V& s5 Z0 t' t8 k8 g% F/ i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ z# a9 z: I _
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# ~; n$ D8 Y$ d( w1 @
- #else
/ O# s1 `& I- r0 E - #define DMA_PRINTK( x... )* T* N+ z- G9 v" G
- #define DMA_FN_IN6 W: G+ N; |( z/ n, n* y5 v
- #define DMA_FN_OUT
7 y* f! N0 @; U' r - #endif( o; p, B: D- ?) E$ x9 J# z
' d7 Q8 ?& v7 a) O. d1 N/ p* G- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 _/ m2 O+ C, I& r - #define STATIC_SHIFT 3
" [3 W' `1 F4 O$ v - #define TCINTEN_SHIFT 20
3 ?+ H' T v9 M, s6 n7 k* i( W1 ]5 e9 r - #define ITCINTEN_SHIFT 21- j- x* N# ]+ O) \ h, R, g
- #define TCCHEN_SHIFT 22
5 `: C& L0 D, i2 Y' f+ P8 ` - #define ITCCHEN_SHIFT 236 I4 Z$ Y6 z4 n* r
* Q! B' w; l# t, r/ ?- static volatile int irqraised1 = 0;
' I1 D9 x7 r$ q( f& p: \ - static volatile int irqraised2 = 0;* x0 o2 V4 r) ~% `5 k2 ?/ S6 ]. J! a
- R: X( i/ @, v" p; L. h3 O! d- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: p- V h( o4 u6 {* A- B) b - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: R# o+ ^0 Z+ d
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, p- M3 B9 n- b/ E9 L% C. T: W' n$ M
% @- a7 I9 V$ R- P! B9 O/ m& }- dma_addr_t dmaphyssrc1 = 0;
: @% ^4 E( ^' `& @3 o - dma_addr_t dmaphyssrc2 = 0;
; e; N- t2 K Z4 Y: o. b - dma_addr_t dmaphysdest1 = 0;: n* l. \/ o8 f4 k/ W
- dma_addr_t dmaphysdest2 = 0;7 s( x+ U2 v) N# u/ ~
- ' P7 {: z. m! k; V% m/ b6 l
- char *dmabufsrc1 = NULL;' `$ }. `- K# l$ d
- char *dmabufsrc2 = NULL;
9 z3 a- _3 f. ?! f% v8 e! p - char *dmabufdest1 = NULL;
) A$ a) p3 h. L1 y - char *dmabufdest2 = NULL;
9 i% X7 E% F2 ]) G Q) e) e - D8 M1 L3 F$ Z1 E$ J8 G2 x* k$ O$ o
- static int acnt = 512;
" _7 X, A0 Y' S2 j - static int bcnt = 8;
7 ] C" C7 e. @; Z - static int ccnt = 8;" F( \& i) q, L& ^
* u: O( _1 g0 Y; q |- module_param(acnt, int, S_IRUGO);" d2 ]3 k7 {# ~" s W( O, Q' ?
- module_param(bcnt, int, S_IRUGO);, N. S) \* |0 `5 m
- module_param(ccnt, int, S_IRUGO);
复制代码 # E4 y& D% k7 e* b d. x! t+ k$ S2 [
5 b& v' a8 Q4 Y5 _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
L( p d* _" m" yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- E4 u0 B2 @3 V) b& Q9 l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 L: w0 {( O; m5 O" Z& ~
}* |0 Z' t J
* y2 `5 J- c- b. ? |
|