|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , H4 f/ `% p8 y. }. K
- [code]EDMA sample test application
4 | n2 U0 Q+ V7 F a; C - /*
1 z+ ^8 _7 I- Y/ A - * edma_test.c0 i+ s4 @! b0 q" |; P* y1 o1 L! E: l
- *2 u1 X2 |5 X. G8 x( c! D& M
- * brief EDMA3 Test Application4 V. t" K5 b3 p4 k
- *7 R5 n2 P) f( R" X
- * This file contains EDMA3 Test code.' @9 X. ~; N7 t# _* }6 J
- *! D$ M, h" ?* B- B1 d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" Z+ M' X- i7 t' W( i- M* b1 @- ` - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# N' X& x0 g- e1 p5 R$ M - * TO CHANGE.
+ s" a b, D5 k; A" A6 ^$ n - *! ~0 ?. t$ o' K& \6 J; s) L
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 f( m" `& ?/ T - *
- `% c% V8 c: I5 r - * This program is free software; you can redistribute it and/or
6 h v; E( a, {+ D/ j, E - * modify it under the terms of the GNU General Public License as( `3 Z5 c/ g8 V( ]1 R
- * published by the Free Software Foundation version 2.
Y! c7 `& Z% D - *8 i. m7 p. v- b
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& i3 x! h( n8 A0 [. T
- * kind, whether express or implied; without even the implied warranty
; V( I) k0 v& {+ R - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, K# i3 G; {; i; e' I# R* ~ c
- * GNU General Public License for more details.! u( B; D. y& L: i+ |+ J
- */
8 a: K: G2 |- u' x8 D. ^1 I, [ Z9 l
9 o5 g- G/ t3 p- v/ P. y4 W) E! ~) d- #include <linux/module.h>
0 T8 w$ T5 \+ Q. z, T - #include <linux/init.h>3 _2 f5 \6 C1 s. U5 P4 t# [
- #include <linux/errno.h>
+ V C" C2 H. R: G* A, A* ]; K - #include <linux/types.h>' u: k8 w e& [( ^4 C. `4 B
- #include <linux/interrupt.h>
5 H: I5 f/ L( M9 }# B8 ` - #include <asm/io.h>- Z" }. u" {2 ^; T. S
- #include <linux/moduleparam.h>
h" N; \- x; d4 ~: R/ W- \ - #include <linux/sysctl.h>7 k1 c5 j8 r+ F3 i, C g9 M
- #include <linux/mm.h>
; U5 c# P5 J- z/ ~6 [! Q - #include <linux/dma-mapping.h>* `' A( z5 x" A8 t% T
- ! A1 s# }9 m% D" \4 P
- #include <mach/memory.h>
6 M$ v* n' A" l2 I: r% W/ R - #include <mach/hardware.h>. D. r5 {* }% l/ C% V3 u
- #include <mach/irqs.h>/ I& k8 {$ J2 O* I% A
- #include <asm/hardware/edma.h>
. K/ Y. }1 e+ L- r/ N
6 t; a7 f }* Q/ f) Q+ n9 \5 t- I- #undef EDMA3_DEBUG0 X6 y/ \0 G4 r
- /*#define EDMA3_DEBUG*/
# I/ Y y7 T r7 U! |$ C( w$ j9 V - , l0 a- Y/ U# f2 H
- #ifdef EDMA3_DEBUG
7 X8 G8 Q8 ~, V4 p' t# k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 |4 t6 v' e2 W6 u, w1 @; J9 _
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# X: i2 P1 h i9 q0 w4 G" S* K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ [6 u1 X# U; g& L, R' V1 ` - #else
" Y; A7 P1 F3 h) U/ G! L - #define DMA_PRINTK( x... )
& r1 N% d' O( K; _7 ? - #define DMA_FN_IN
5 I2 [3 x3 H" ^3 S5 s% Z! k - #define DMA_FN_OUT0 A, J) [7 d, Q9 D8 G/ w; \- e
- #endif
7 s5 p2 h& C! n/ [0 p, l' q0 H
5 F, l" a1 d1 P" K" _4 G3 |( x- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* M9 s8 e- J7 v! f0 w2 `0 e' Q
- #define STATIC_SHIFT 38 b8 [2 M! q6 h) u0 q4 e
- #define TCINTEN_SHIFT 20/ i# k; ~$ W, D7 L
- #define ITCINTEN_SHIFT 213 V+ w+ t0 c% w
- #define TCCHEN_SHIFT 22
4 }4 A7 b! d* F8 G - #define ITCCHEN_SHIFT 23( R% c4 l) S; s! ?
- " M7 Y: K( d! |% w; s% P
- static volatile int irqraised1 = 0;# f+ f2 |: @, G* C7 c5 w- L
- static volatile int irqraised2 = 0;3 N% t5 k* Q" t& s
- ' i+ V0 G, S, d7 n
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 n; ]" n3 S, s3 D H# z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( I' _. S$ n# y1 e, s% d, H) w - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ t: {# G; q# z* b - " i0 M" E0 m" W1 N+ u8 X$ ]
- dma_addr_t dmaphyssrc1 = 0;+ s3 O$ w4 [( L, A- i
- dma_addr_t dmaphyssrc2 = 0;+ |5 v+ Y2 H6 s
- dma_addr_t dmaphysdest1 = 0;8 {& ]% @# } Q$ x) }% d1 V
- dma_addr_t dmaphysdest2 = 0;
! F, W/ A7 J& d( N9 w
+ e s0 M& p4 U. x- char *dmabufsrc1 = NULL;' r* y. N7 R* h; g8 t
- char *dmabufsrc2 = NULL;/ D' ^; _/ i$ f7 K, c2 w
- char *dmabufdest1 = NULL;
2 n- {* n, v+ r3 a6 j* o/ j7 s% I - char *dmabufdest2 = NULL;& \3 b4 @" E# ]) I, |; U
' F8 t* T6 i4 Y. t* U3 R/ d/ a" v- static int acnt = 512;/ u! k( T; A; i; l0 b8 W
- static int bcnt = 8;
( G0 A; }% s3 i - static int ccnt = 8;. E$ Y. ~; t" d" g3 z+ v& W4 e9 e" z$ n
4 l/ B! r6 |" t4 D7 w9 s0 @- module_param(acnt, int, S_IRUGO);% s$ k$ W( V5 l
- module_param(bcnt, int, S_IRUGO);+ x2 Y. S2 m* L) c8 p
- module_param(ccnt, int, S_IRUGO);
复制代码 , c4 L7 N! T2 ~# k% I
2 z7 O. }+ ]* B: |" E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 W V9 q4 e7 L4 g4 f7 s- y 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 q- e5 y% D G. D% a7 b4 r. g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 b/ a4 L+ D2 t3 t% a, Z0 r d2 `$ ?; e9 j" e+ v# {# v& Q$ f
& B( z2 g8 [6 F; V8 L3 V# O$ ~
|
|