|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % {' E8 e2 r7 p- Z( w. \" A
- [code]EDMA sample test application6 t! ?- M; Y9 u5 [
- /*, e O E, W2 ~' e. Q5 W
- * edma_test.c
9 W' \5 G- L' v1 Y. o/ k! x& B - *4 W; v3 G6 m* g3 W4 R
- * brief EDMA3 Test Application
5 s5 y2 c" S4 @' l) ?/ x) m; h - *
5 x0 i: O5 x$ E$ G$ J% K# o - * This file contains EDMA3 Test code.. n3 B3 k4 t$ J& m4 A3 J* d4 E6 l
- *9 A; g( E+ m! M" [' J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) ?5 K; h/ }( J: p4 J; `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 Q) @1 i' Y8 r' x9 W9 f
- * TO CHANGE.
$ b- \% O" {: {) L: a! X - *. V B5 a4 |1 C3 u
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
k$ ^5 U. i) x* V C - *
5 p$ Q8 R- n2 e2 r - * This program is free software; you can redistribute it and/or& L( O+ R+ J `: r* E* E
- * modify it under the terms of the GNU General Public License as
! F4 @' I. @2 z+ q! O- T( S - * published by the Free Software Foundation version 2.
w7 [1 M3 J! P% A - *
$ ~6 d7 q- }, O2 X+ H, Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. _/ R( _2 I. a; _4 s - * kind, whether express or implied; without even the implied warranty6 C9 ]8 z+ R% g. e0 L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& e: ~$ e. l% |- p+ F
- * GNU General Public License for more details., }, l, ?* ]/ B; R+ A
- */
) N2 ~8 |" n% b) B* V# g+ ]4 i - 7 W) n4 H% A# R( ?8 z+ M1 a- J, z l
- #include <linux/module.h>9 \% L# @: g" V1 `! m
- #include <linux/init.h>7 j0 ]# H( P- g' H# s" Y/ ?
- #include <linux/errno.h>
2 c9 c' Y2 |8 I5 G; c) C - #include <linux/types.h>
6 S( Z% O9 j! S - #include <linux/interrupt.h>$ k0 G, S) x7 ]9 M. ?3 F2 C* r) x1 y
- #include <asm/io.h>. ] W; Z$ Q6 W: z" X
- #include <linux/moduleparam.h>
0 q) ?6 u, I/ C - #include <linux/sysctl.h>( t+ D' @ z( ?& L! p3 ]5 p z) Z+ n
- #include <linux/mm.h>
+ x6 u6 ^$ A+ K8 U! Q - #include <linux/dma-mapping.h>
# k5 p+ k! p$ I0 k) J
* u7 r) y7 J3 V- F$ J' k- #include <mach/memory.h>: h! m+ ~# ?; a3 I4 i, B
- #include <mach/hardware.h>) e. s% `$ h5 ?9 u
- #include <mach/irqs.h>7 X- v+ |7 Z: Z1 \& R' m
- #include <asm/hardware/edma.h>
, }% Y1 }3 r/ h5 i - . X" B% ]; s$ }3 o: @3 T! F2 I
- #undef EDMA3_DEBUG* |) Y# w5 x, e* C! r# n
- /*#define EDMA3_DEBUG*/
5 L, a% c# z& a# O( k# U& x
; [: z; L9 I% M- #ifdef EDMA3_DEBUG$ R. |6 y; v7 d8 {! z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): N3 {; m( h& |0 p6 q5 O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. z# L7 |8 |6 v2 G/ { - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ h6 }4 R# t8 ^* b4 F" Q, |2 U' B
- #else
4 ?/ Y! }# O: V% ]0 S# \6 P - #define DMA_PRINTK( x... )
" K; s) x! f! E+ Z7 f - #define DMA_FN_IN& e- c( l. p C5 H
- #define DMA_FN_OUT$ S" a& z) g5 n, X0 M; h5 R# x0 H
- #endif7 l* z4 C. G( `9 m1 X% {
- 2 n& N% K2 }" r4 [+ z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 H V, e/ q5 _. y - #define STATIC_SHIFT 3- {0 V- k. T" d
- #define TCINTEN_SHIFT 20, X# w6 @8 S" d2 k5 O, I4 \& u: ~
- #define ITCINTEN_SHIFT 21
2 E4 J* y Z" ? - #define TCCHEN_SHIFT 22
; j4 D. w+ L5 G8 R! o ] - #define ITCCHEN_SHIFT 23$ [& A( J/ ]- m/ c& Z
- + R$ A* {* L% V0 _9 ^- L4 p
- static volatile int irqraised1 = 0;
- d8 o, y4 N0 ? - static volatile int irqraised2 = 0;
$ K0 p+ v& y, ? - 4 [6 w* E( X$ r! K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, H+ t9 z7 [2 x$ w" W
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 c; R; j& u7 v
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ S3 o; P: M8 b& B# j
1 ~, M0 c1 R7 d3 L, Q. {0 B" a" P- dma_addr_t dmaphyssrc1 = 0;0 }# {- E# ^& R, n' d
- dma_addr_t dmaphyssrc2 = 0;
1 ^$ F; h8 j7 z7 N1 [- d - dma_addr_t dmaphysdest1 = 0; A. i m/ y8 e2 ]
- dma_addr_t dmaphysdest2 = 0;
' t* a+ {9 k1 |1 P; X$ k0 Y. _# M- ~, S4 V - ; R! o1 V4 r) Q. Q" `
- char *dmabufsrc1 = NULL;& W( s7 Q1 |8 `) Y2 p% x% i
- char *dmabufsrc2 = NULL;' G4 O T( [4 c4 l, f
- char *dmabufdest1 = NULL;% `$ y' N7 {1 k* f* ^8 i
- char *dmabufdest2 = NULL;
: v; P$ B" L# v1 o+ e* ^ w' [
k, y6 m2 {- j+ |8 O- static int acnt = 512;
, }- ^: T5 i6 K1 u - static int bcnt = 8;* l0 G% I2 V" B4 \; x
- static int ccnt = 8;( B6 h$ J5 n1 o: g+ y& b! ]
- ! R% h; y6 R" p0 X
- module_param(acnt, int, S_IRUGO);+ I1 f( F2 B3 i) |& d% d1 d$ _* Q
- module_param(bcnt, int, S_IRUGO);
- {+ n: R( p. `# s R9 t, _" _ - module_param(ccnt, int, S_IRUGO);
复制代码
7 _! q8 P* b- N# U0 P
3 i9 ?, F1 e, ^9 x 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; s3 u0 T! W: P) b5 ?" L% i5 j* k/ S
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
q7 z- ?8 _: C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. L! x$ h9 b+ J* L0 K2 V" Q4 _0 p! F$ \* k
: t0 u1 Y* C+ r! s, ] |
|