|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, k) H& O7 a! A* J9 _% a! d0 F4 H- T- [code]EDMA sample test application6 y9 Q; w2 N5 f0 x1 i, v
- /** @. E; B! N! a' J% o
- * edma_test.c
( S% Q: ~! I& [( t+ G1 d) ? - *
5 y. v5 s) @2 o/ E - * brief EDMA3 Test Application
7 ^9 x( e) y2 P2 {" F - *+ `: R3 `+ B) K0 m0 n
- * This file contains EDMA3 Test code." P, w- E- J; T W' \' [$ e {- {. \- b
- *
6 |& ]- M( a) m3 R/ D. q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 M$ A- l4 X6 o/ T/ K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 z/ `6 K& X Q - * TO CHANGE.0 d4 s0 y) P8 \. c
- *( D/ r& @) x9 y3 {* w3 V$ H+ J# J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# m+ G4 D8 v; Z/ E& N0 k' u
- *
8 b+ \! f) W R% y9 v5 V, L- C - * This program is free software; you can redistribute it and/or' g) q) Z% ^3 ?" w! ~/ I
- * modify it under the terms of the GNU General Public License as
) O9 b# n4 T) `8 f - * published by the Free Software Foundation version 2.
4 E8 x* g6 w0 h' q* x6 n - *
8 j. t! \; e9 U% o2 n - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 b9 U/ U. @( u/ \ G: d. X: g - * kind, whether express or implied; without even the implied warranty( U0 ?5 a0 ]2 T) U' L6 O* d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 ]# I3 ]; @. ^# L
- * GNU General Public License for more details.
3 m) @/ @ }, R- k* w0 V - */4 B8 ^! _6 P( y9 ?
- & R# p) Y- |. C+ {2 C, T; ~( s
- #include <linux/module.h>
" B' m8 u0 e! c( P - #include <linux/init.h>
$ i3 @; d$ b6 K& O - #include <linux/errno.h>
( N) i* z- U( @ w, F1 e; W$ ]! k - #include <linux/types.h>4 u9 `$ Z7 q$ Y( ^) V
- #include <linux/interrupt.h>
, k; ^$ a" L9 V& B0 I+ n1 j* J - #include <asm/io.h>0 E7 G# h$ V* `6 b5 O
- #include <linux/moduleparam.h>% A! A. b% _/ t1 j1 P- u4 I
- #include <linux/sysctl.h>% `: z, D) T; ]- n' x& B' H
- #include <linux/mm.h>" [0 ^- z& H2 J; z& Y" i% l
- #include <linux/dma-mapping.h># B* G0 S, ?7 i$ b9 d* W# Q
' O6 S# P7 ^. q2 T+ V( W6 Z5 _- #include <mach/memory.h>
2 N8 h1 L$ Q* ]7 U7 {- \( n- W - #include <mach/hardware.h>" T; G9 q& T! C
- #include <mach/irqs.h>
' {& M9 {- G N( v8 m - #include <asm/hardware/edma.h>0 a& t0 [9 u2 Y% {7 E
+ c% B! o: w5 E# Z, }7 `- #undef EDMA3_DEBUG
2 d8 B! |% C5 o - /*#define EDMA3_DEBUG*/
; A4 X' K2 L+ W5 P
, V# ]7 v4 a9 E+ ?* q- #ifdef EDMA3_DEBUG! @# n B& _, z4 }' q( h u1 j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 a) U1 V8 O7 K, k
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& ]% I! T. X: V# A) I6 W4 G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 u+ b/ j7 |% `6 [8 X
- #else. R# }) E( z O% N& K
- #define DMA_PRINTK( x... )& l# U% X0 n1 _# R- y
- #define DMA_FN_IN
4 u0 B: ^1 t3 S/ w- S) C - #define DMA_FN_OUT
- y7 `" K; J- V# W% u0 e - #endif5 ]/ p* d4 T( B7 \& Q
- 8 O, l4 v5 B% P0 t% b! ^2 t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
Q4 k3 G# @8 \% y9 ? - #define STATIC_SHIFT 35 y( |% n% X: G. O
- #define TCINTEN_SHIFT 20
7 }0 t# G+ u8 U% b4 a: `: v - #define ITCINTEN_SHIFT 21
" I* L% G8 G) i - #define TCCHEN_SHIFT 22
5 ]" Q. u. h$ |% h' ~! z9 x; W - #define ITCCHEN_SHIFT 23
( v0 o: L f% _& `- D1 {" f
2 x( n8 a b* O8 o- static volatile int irqraised1 = 0;
$ X6 }7 v$ }9 q - static volatile int irqraised2 = 0;
; a h* N( ^; c6 b `9 b& v6 @0 n - ) k# X" x) t: W# ?$ z f! {* ^
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 d x2 a) c: i' i* N0 H6 s - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 h- n+ `+ t# G F, a3 U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 |7 ~& F7 k4 |' n8 }+ H1 P1 E/ n
- + e, C! {1 }2 F ?- w' e/ L
- dma_addr_t dmaphyssrc1 = 0; x2 U" C& W" O6 u3 P) q4 u6 R* l
- dma_addr_t dmaphyssrc2 = 0;
' A/ W, Z# z+ s6 F5 q' h0 Y% D - dma_addr_t dmaphysdest1 = 0;
$ ~% u3 X, C. \ r. K - dma_addr_t dmaphysdest2 = 0;
: w j$ Z$ H7 T# p+ V' }; Y% X
8 D v- ^) O* A& h- char *dmabufsrc1 = NULL; }, a6 `; B4 B) u5 ~
- char *dmabufsrc2 = NULL;
# i3 ?, s2 G* }6 n. p - char *dmabufdest1 = NULL;
+ l! Z6 J0 C4 f - char *dmabufdest2 = NULL;8 `2 n% a% [/ Z2 c; Q
% h, c& u" M: i8 f+ P g8 l% l7 u- static int acnt = 512;
6 S; _6 ?1 ]6 O* e6 g, J - static int bcnt = 8;
2 Z7 a, |6 D1 I: h - static int ccnt = 8;: E% J) N9 c, ?2 [5 ^2 g% ^
- ~+ E, X( P. @# v- module_param(acnt, int, S_IRUGO);
4 h, E J/ h+ F4 L3 h5 \ - module_param(bcnt, int, S_IRUGO);! x7 x' L2 P7 G' X& w, ]5 F
- module_param(ccnt, int, S_IRUGO);
复制代码 2 {# z( ?+ M I7 b, ~& ]' y% V% G
" l0 o9 T* g; \. c3 a 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 R; R4 {" ~5 s& _, A# M. [$ {. narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 d: d; D% A9 b
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- B, V6 E$ z9 R7 C& R
; i, B# U# v* N( ?6 c
; N, P( m; z, @3 x+ V+ X8 @. z
|
|