|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& O. K4 ]* t' z0 _: S0 l- [code]EDMA sample test application) \/ g1 ]+ J) R
- /*
. d x3 c2 t8 r - * edma_test.c
1 Z: H4 B5 s, ]/ R) ?4 R& V9 u - *
& v! X. N0 u4 ~& \! ^4 e3 `; h - * brief EDMA3 Test Application
% Z2 f7 f) w3 P" E9 N( x4 ?( L - *
; b" ?5 v H) V% L# \9 \ - * This file contains EDMA3 Test code.! Z4 F; b7 |8 I' o4 h
- *) C- H. R3 Z2 }* c
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ t( l" A3 l3 g - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, v4 S1 e% M8 W x - * TO CHANGE.& R2 W. J1 [3 f. l$ S: l
- *
$ m( A0 {+ v4 l0 ?( Z) w - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 D8 w; w7 ]# Q3 T, A3 e/ n - *6 S7 Y' h+ U: q; K t7 k, a
- * This program is free software; you can redistribute it and/or6 a+ q, [: g+ \
- * modify it under the terms of the GNU General Public License as- K- H& `/ i% s: m- j# B o3 i
- * published by the Free Software Foundation version 2.9 I4 c# \9 K0 V$ z7 z" D# w( ]# I! e
- *+ s8 S/ H! N: w; {- L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: J$ C- [0 t$ `) G6 K7 C6 C; C
- * kind, whether express or implied; without even the implied warranty( R0 ?8 @$ u6 Y1 A; {) }- d" K
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ B& M, k, B: m1 W3 o h$ ?9 n3 v - * GNU General Public License for more details.
4 I! N* b u+ M* u1 ^# y! ` - */
4 ^9 S. X5 `* o7 ]2 ] - : W1 Y# R5 t! c. d
- #include <linux/module.h>/ F, u5 o0 r" z$ F3 Y1 m# F
- #include <linux/init.h>% }! P) _$ {. X( B
- #include <linux/errno.h>
# L' Y$ n8 ]* t: u B - #include <linux/types.h>
1 e' B: ?5 ~8 a - #include <linux/interrupt.h>$ W) y* ^% O3 _' @+ j' g' y
- #include <asm/io.h>
! x' w ]: `4 S, c/ W - #include <linux/moduleparam.h>, K) L, S9 t& ?% K2 L a+ F
- #include <linux/sysctl.h>
- A0 S; J# f6 {7 {) A - #include <linux/mm.h>7 Q, d$ E5 j" W4 W
- #include <linux/dma-mapping.h>
! i; z; |5 p' V9 J! }
4 q D' b6 z: J- A- #include <mach/memory.h>
" D: g" k$ \6 N5 c+ I8 a - #include <mach/hardware.h>! }1 K1 W6 r# n3 X! q; C" ]
- #include <mach/irqs.h>9 f; o( e5 h) e+ p; j" n0 d$ _! C
- #include <asm/hardware/edma.h>- x+ s4 S! l z
- D D9 s! n* F: Z& v) ]1 o
- #undef EDMA3_DEBUG; i8 p2 |5 A5 G0 c9 m) y
- /*#define EDMA3_DEBUG*/
2 `4 O" x$ H! |" h& F) N. w
& Q1 n9 M/ J1 U" l) f- #ifdef EDMA3_DEBUG
( A& \) |; q" U6 f# g3 d% J; ~ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" C. E0 t: r3 v: _
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& G0 F; t$ e9 A8 q& l E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ Z9 A* r. P( O. M6 S" i1 w - #else& W& I# l: j$ D y) d- u; U9 l
- #define DMA_PRINTK( x... )
" z8 M& s5 J" z - #define DMA_FN_IN% @. R+ |9 Z, l% B! N- {; a
- #define DMA_FN_OUT
. b4 V8 {* C, J% {$ _/ m - #endif
8 `8 _' h& G; I0 J1 O$ @" Z) B - ) Q0 e5 ]( ^( @3 Z6 v* D4 `, |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& k; q; G9 {; I) @ - #define STATIC_SHIFT 30 q9 P) n2 G8 @: }3 `
- #define TCINTEN_SHIFT 202 {+ U, k# \0 K) N0 m
- #define ITCINTEN_SHIFT 21# |2 e; \7 E- _, \& U7 U
- #define TCCHEN_SHIFT 226 y1 X" g/ R1 d
- #define ITCCHEN_SHIFT 238 [# q% m, R1 r" z9 g2 }7 P$ l1 x
- - M" Y2 r7 o1 g' J. d; C
- static volatile int irqraised1 = 0;2 u" P& F8 _. n8 A K& ]
- static volatile int irqraised2 = 0;( T6 ^- |' l. K7 a5 P/ |$ u
/ }# R# R% n. q' R! W u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& m0 k4 _" D: @5 s z5 n
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 O( u+ u! r3 L1 B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 x0 N& \- ~% b u) R - 4 K, {$ J; v- Y+ T+ j N
- dma_addr_t dmaphyssrc1 = 0;
4 c T. X9 N( U& q1 z( n7 ~ - dma_addr_t dmaphyssrc2 = 0;$ A5 h, e; S2 ~8 J) C
- dma_addr_t dmaphysdest1 = 0;( T# ^" s R9 ]$ E: _+ Y
- dma_addr_t dmaphysdest2 = 0;
4 n1 U" G R7 ?% }& {3 b - 9 [# a4 q" g6 b" ^8 ^) Q6 \$ u
- char *dmabufsrc1 = NULL;
% k) Q+ ^1 | {1 M- l" g2 ]! k5 _ - char *dmabufsrc2 = NULL;
* G1 P/ i/ B; L5 E4 `6 S- E - char *dmabufdest1 = NULL;
7 q8 k+ T7 _% ^% A! j. J - char *dmabufdest2 = NULL;! A4 f& q8 E/ a" i, y
# j+ T: s: l. |' b) m& g% K2 ~2 i- static int acnt = 512;
6 s1 `. n0 K8 g$ E! J, Z) Q - static int bcnt = 8;
$ { m5 z! H" f+ X4 B2 s - static int ccnt = 8;- h, P' c, g8 i& u( w$ l2 V' K8 ~, g
2 }9 g0 m. |( E p* Z; S" f$ N- module_param(acnt, int, S_IRUGO);& Y3 i& u8 E, p1 Y* a
- module_param(bcnt, int, S_IRUGO);
1 Q) O. ^- S7 w/ h, T, L. _' h - module_param(ccnt, int, S_IRUGO);
复制代码 3 X/ A* k% N9 c6 ~ `5 l1 x
5 Q/ M7 s1 B' k9 v2 M4 o 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ F2 ?0 Q0 w2 Garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) t0 e! n( \( `' d% R9 L V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: z5 R# L2 x$ v% d
L$ C1 X& a1 b3 e* n+ l4 n4 e
# V3 ] u. G7 f" {' v5 i
|
|