|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
G* Z& {# Y d s/ B- [code]EDMA sample test application, `4 K& @+ @" T) H0 V" U* a# Z
- /*% m; m( l6 K- U5 P% M
- * edma_test.c) J' C) ]8 f- I- Y+ y$ E% X ]
- *
. V( X8 B3 r" q; q. p3 C - * brief EDMA3 Test Application
; M' N* U( @! a. j9 S5 \: J5 A - *7 t5 f6 \: G& I- P0 D6 M( `$ ?1 w6 o
- * This file contains EDMA3 Test code.
( c6 n5 Z4 F) c" H4 x$ e - *
* o# X5 u7 ?( h7 A. Y" }+ h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' |2 w! M! d" I* W, w
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 X; x) J* [9 n1 h, j( |4 v - * TO CHANGE.
; B# p+ p8 E7 q- z; Z5 e - *, M9 d2 u2 Q6 ?. L- \
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) N; x. _: O. e& T: O( b
- *: S- i; O% `8 c; a! f$ W
- * This program is free software; you can redistribute it and/or
8 A5 Z/ K6 U6 H* I - * modify it under the terms of the GNU General Public License as
% `! g# E; Q6 n1 L0 ` - * published by the Free Software Foundation version 2.
f' l4 Z$ T6 @( Z4 @) ~ - *
" s! {/ X: |# V( `! B( N0 B6 G - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 E T$ g3 {8 r1 \$ d+ r" J - * kind, whether express or implied; without even the implied warranty( R* [; c m S6 c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- L- M& a( \7 s - * GNU General Public License for more details.
- ]# I; G( k* @' D2 \ y - */: u4 J/ b+ m, O7 \
+ }4 {3 |* @6 t+ x7 {- #include <linux/module.h>
* ~" H* m; X8 ~4 d+ [ l - #include <linux/init.h>
$ m% n4 P6 X9 k) w# d* k - #include <linux/errno.h>" p, v! K6 p, g' y
- #include <linux/types.h># y5 q/ p, y! ~; M) ~
- #include <linux/interrupt.h>
6 l) H8 J/ Q" g; K) V) x* r, i9 ? - #include <asm/io.h>) r: {2 l' w% h# j$ f V2 X
- #include <linux/moduleparam.h>
! J& L. H. ~2 O% S - #include <linux/sysctl.h>2 K3 Q- O* u) R, q) R# ?3 u% ~
- #include <linux/mm.h>
; k! `" L3 c k f - #include <linux/dma-mapping.h>. x- P: r) @0 ]& O
- ' i/ \& a P) W% y" P9 F' T* r
- #include <mach/memory.h>
6 X% V' A. _5 T$ g8 |' B7 W - #include <mach/hardware.h>
7 }& Y- A3 b1 k. r% D7 e; } - #include <mach/irqs.h>
. K/ T J8 I+ m+ E4 D - #include <asm/hardware/edma.h>
9 v, \ c' m( j+ q% J
. A1 l K( R& t( j- #undef EDMA3_DEBUG' j- j! l( G8 K( q2 W3 s' D
- /*#define EDMA3_DEBUG*/
* v8 o+ J+ O# ?; R" p* \ - . H& d" V! [* ^+ j' S# h
- #ifdef EDMA3_DEBUG
5 r" b% S& e) a& A - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 R& k* _( w% t B' \- }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% k5 b2 Z2 T( |) c" r4 K- K - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 _: }& k/ i: ]( R6 V7 w: z - #else
8 E0 ]9 F9 W5 I4 [/ H8 r5 W - #define DMA_PRINTK( x... )
* N% G, s' { M B - #define DMA_FN_IN
- }& L" _1 ]9 y* l+ [8 A; C O4 C - #define DMA_FN_OUT
1 |$ p7 }/ t, R - #endif% v* D! x, b0 k% [' G: R
+ h" ?; E7 k0 b/ g1 D- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# J( M8 e2 c0 l4 Y - #define STATIC_SHIFT 3" g, ]: _" m3 {
- #define TCINTEN_SHIFT 202 n7 P! B8 k; {* ^' H
- #define ITCINTEN_SHIFT 21
6 `, R- u9 l7 O1 j" u v" @ - #define TCCHEN_SHIFT 22# N M/ R3 ]! N5 J, S
- #define ITCCHEN_SHIFT 23; n" `8 L G" U
- / N6 T' z5 C4 [' e
- static volatile int irqraised1 = 0;
$ p5 c' E: v) b- k/ L5 r }! @ - static volatile int irqraised2 = 0;
& L1 x+ [2 @( `2 P9 P+ X$ ~4 R
2 H: T/ o; e/ g; o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! r! ]& W" Q) v) o! } - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 @+ [" H) l' Z9 B4 s - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: k! o" T2 g! [2 S6 v
" g- L2 E# [8 I/ Q9 i- dma_addr_t dmaphyssrc1 = 0;" S* g9 l$ M" @6 s3 E
- dma_addr_t dmaphyssrc2 = 0;
' k( Z* N& S; B& l, f - dma_addr_t dmaphysdest1 = 0;
( M5 }9 y2 U2 X& G$ F - dma_addr_t dmaphysdest2 = 0;/ B4 G% F* i; @) _, @' Y
- ) Y) i7 F! A; ]5 k- M$ O
- char *dmabufsrc1 = NULL;
+ z/ @0 p8 a- `" k- ~5 |% C( t/ R - char *dmabufsrc2 = NULL;1 x4 ?: g+ J0 \: {, B" ], a! r
- char *dmabufdest1 = NULL;: U+ x& u3 P+ [0 U) W
- char *dmabufdest2 = NULL;
% U( A- S, b/ W4 q: ~ - " G2 S* s7 U% P' U3 Q4 O1 p
- static int acnt = 512;
, i0 |7 w) f+ z _% v$ X - static int bcnt = 8;5 _* e. x# p+ ?4 c4 J; d5 N
- static int ccnt = 8;
4 G3 Y; ~8 [/ b% |& X, M
; c4 A3 A2 v) _: V6 B2 t- module_param(acnt, int, S_IRUGO);1 q' R; _3 Z' U- e4 e' Z0 y
- module_param(bcnt, int, S_IRUGO);, w& N" g( X5 j+ J
- module_param(ccnt, int, S_IRUGO);
复制代码
2 J. i$ l# g* A3 L( T
8 {! c ?. g8 t6 ^4 C" C5 Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' r6 X+ x: k" _8 T9 W1 q7 {5 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' V6 B4 I* z1 N 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 s) n+ ^6 n# p4 y/ K8 r
- F1 e/ I! {2 U- v' P) T- j% z2 x$ I# e% v! R
|
|