|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " B! q- Z. @! c: n* {+ }4 P7 b1 I2 t
- [code]EDMA sample test application. k1 a0 A) P4 T; r- ^
- /*
" v9 `" y; Q( Z. S - * edma_test.c9 O- f; p( ~! R# @
- *
+ A) a4 x m+ J: A - * brief EDMA3 Test Application' S" Z$ D( x' v3 j$ l% A0 a
- *
' e- v7 \! P( i$ n+ a& ~0 z - * This file contains EDMA3 Test code.* ^; n! E1 x- ]- |6 m
- */ J1 h" P. U A, [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# f2 X+ V+ N! q# W/ h6 t - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 ^! z6 O6 ]8 u* e y* U3 j
- * TO CHANGE., i' i3 Y. L4 i& e3 K2 p
- *
4 @1 }' N# |+ z3 a4 V. E - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 e9 o4 {" J) V0 I( a5 n
- *" H v( i2 Z3 ]( f0 A
- * This program is free software; you can redistribute it and/or7 Q g( p- e9 K& E$ H
- * modify it under the terms of the GNU General Public License as
. E+ u0 R& b: E+ V; B- @# V - * published by the Free Software Foundation version 2.
4 S5 Y5 y. r4 }" J - *
% i- u7 |, w" }( E+ C- g - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& D9 N4 o4 N$ |. T& p! T - * kind, whether express or implied; without even the implied warranty( y5 ?! i4 ^& W* u( ~9 ]% s
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 e4 ?: W" A+ B( c - * GNU General Public License for more details." o* [4 X' P/ S7 j% _! D+ R. X
- */ f- {' _4 q7 g( ~
- ( \3 G6 k7 `, {9 d
- #include <linux/module.h>
5 `5 q1 o& i3 e7 J, X$ v* e - #include <linux/init.h>) S$ v( x/ ]5 t6 Z0 `1 ?
- #include <linux/errno.h>
4 i( f) B; v7 d2 Z X& c - #include <linux/types.h>( a, b9 Y1 H5 V: q! E
- #include <linux/interrupt.h>; k% g* E6 Y$ E& D4 P. L; ]
- #include <asm/io.h>
* E' O+ H' v( b9 n' K - #include <linux/moduleparam.h>
# u* v5 E2 W2 _# n2 }. _$ O2 W - #include <linux/sysctl.h>" S, C1 b& B/ M: t
- #include <linux/mm.h>, \1 b s( w- K- k# f+ D* E
- #include <linux/dma-mapping.h>
% C( e" b* ~. |0 A0 y- k4 | - & e! K9 S: O$ X) |' ^
- #include <mach/memory.h>- V# F0 z3 l" G- q9 d
- #include <mach/hardware.h>$ L8 N5 H* z/ H9 P2 j4 ] ^
- #include <mach/irqs.h>
" U9 ?. d8 q- O7 r8 H4 @ - #include <asm/hardware/edma.h>
% U9 r ^ m. H! M2 B% W - % p. Z& ^* ~* ~& `9 S8 H& g( O
- #undef EDMA3_DEBUG6 \4 z: j) X2 V o+ H
- /*#define EDMA3_DEBUG*/* P. k5 U% w: v4 A) T
- ) y6 @( c% v$ h. v% H
- #ifdef EDMA3_DEBUG
* E/ W7 p" l5 O: K- V' g6 i. V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 \7 E$ c* A( Y! _7 X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) h' E* H c( h4 W& R" k4 g
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): B: B C& {- ?2 K+ M! L
- #else
& ^ w0 j5 f$ B# b - #define DMA_PRINTK( x... )8 H- r& O5 y4 R, l$ q# K+ d/ `
- #define DMA_FN_IN, A- f3 g: I$ r" L* Z: _6 S1 R' s3 G
- #define DMA_FN_OUT5 P' I! _- i+ H0 C, W
- #endif, ]: \0 u2 i) U
- & o4 z% H I% g) {/ g7 j; R
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% s$ S; [1 M, Q5 E0 h
- #define STATIC_SHIFT 3
# j! u, {/ c. @# u7 H6 H) Y - #define TCINTEN_SHIFT 20
. X9 z/ @6 m& X! Q' h' @9 Q/ Z: N - #define ITCINTEN_SHIFT 21
- q8 C, G- q$ A$ V - #define TCCHEN_SHIFT 22
! u6 v9 R1 ?1 Y% Z* S$ d - #define ITCCHEN_SHIFT 23
E# b3 L4 T# |- `# g
@# {5 U- e) i- C- static volatile int irqraised1 = 0;4 B5 d% m1 } V. x. r% a
- static volatile int irqraised2 = 0;4 u* ^7 j* b6 i# @% b" z! z, M/ f4 z
: }+ ?7 R2 Y" @8 _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ S; R5 H8 h! s7 O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 X( C, ^' i/ {$ c6 M
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 Z! b K/ l0 S0 F/ p* U
- % }2 w5 ], r1 T1 Z+ y, M! _
- dma_addr_t dmaphyssrc1 = 0;
- b0 `5 Y4 L4 Y6 i; U( ]! ]0 O9 E - dma_addr_t dmaphyssrc2 = 0;# r' @4 ?* G' F- x
- dma_addr_t dmaphysdest1 = 0;3 K+ G" i8 P1 v- q. `& [' m O5 P/ a
- dma_addr_t dmaphysdest2 = 0;
. S' _* {5 J, D
5 Z0 z9 O2 o1 j- char *dmabufsrc1 = NULL;
0 j" H: q4 q4 W/ P# R! H - char *dmabufsrc2 = NULL;; Z8 z, P8 V4 [$ y0 n# f# q
- char *dmabufdest1 = NULL;
- C/ ?0 P: i% d6 g$ f9 N$ x- ^ - char *dmabufdest2 = NULL;
# K$ P" v1 m) B+ C$ P- `( g. s$ Q - 6 v$ _- D4 x G' `
- static int acnt = 512;
( d7 @& J2 L h4 `2 V - static int bcnt = 8;% |2 Q+ t; v! Z4 B: }6 B
- static int ccnt = 8;2 P# I+ `, _+ g6 R
- 4 k H- F& j7 k$ i9 y
- module_param(acnt, int, S_IRUGO);
o- I+ Q7 Q& m$ \ {7 X - module_param(bcnt, int, S_IRUGO);
, K1 U2 o6 @: X: E- p, R* z - module_param(ccnt, int, S_IRUGO);
复制代码 + }( r) S5 `& |- D7 t! r* o
) f" A) x+ w5 t2 | 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 j9 i- [ k& P. m4 V m7 |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% u b: }0 G& r0 B4 l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' X7 n+ `* d& Y6 y6 b5 r2 h# y
. t6 B& ^; V0 P9 d
' c; u" v7 o/ n3 A* [+ |6 u |
|