|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 t3 A/ u6 t3 |; t
- [code]EDMA sample test application+ h' H! m" P+ {, a5 v' e
- /*: R- ^- h$ m" v. z2 T. a
- * edma_test.c
' I. N P! Q* a - *
9 F# K5 \) _1 V. s5 V - * brief EDMA3 Test Application+ d$ o8 N) f9 m
- *
7 p( E) e1 Q5 K9 E# J. @4 {7 @ - * This file contains EDMA3 Test code.1 |: i! }' Y, z
- ** p' o+ h- M x+ M$ {, D! v+ V4 }
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 z O9 ?$ z& g9 \3 I. f5 v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
Z# s! k: r+ ~' ?6 Y- { - * TO CHANGE.% K( C" d% ?. q# b4 @; ^- g2 E5 v
- *# A( [/ z% P/ x6 }- O+ X0 {* Q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- s# K3 W2 y7 ]) U
- * Y* K9 {% @& ]( F U
- * This program is free software; you can redistribute it and/or
0 y/ A8 ~# O+ c. b( [/ N! x: A - * modify it under the terms of the GNU General Public License as
/ I! \7 X( b% v2 m# W. U' X - * published by the Free Software Foundation version 2.
3 R$ J% e- v& [5 R- f - *- T+ R6 Z& n+ @+ _2 p! H4 q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# L* C2 A3 V9 ]& ^ - * kind, whether express or implied; without even the implied warranty* F0 Q7 E' I$ j8 t5 J6 l0 y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: P) Z3 U) j: T' f$ o) J( A - * GNU General Public License for more details.
5 p2 L. v0 U3 f# H4 F - */
; T+ r/ L% b0 z0 F1 y - 0 `6 H; Y$ q$ M4 ^* ` U" _* y
- #include <linux/module.h>
) A5 [+ M# }0 u( l& z, H" o F - #include <linux/init.h>
( }0 `6 g/ M# y: l' j - #include <linux/errno.h>+ ]/ w5 r W' n: [/ [
- #include <linux/types.h>3 I: Z- X9 }3 z9 G# J& u
- #include <linux/interrupt.h>- I. `, r% N' K
- #include <asm/io.h>
" v# B1 Z6 }' M0 r8 f8 i - #include <linux/moduleparam.h>
6 j! p7 F0 V; X, S - #include <linux/sysctl.h>' l, X$ N# h- a( S L% }; W
- #include <linux/mm.h>8 {+ Q% f1 a/ R% [- N: b
- #include <linux/dma-mapping.h>- V8 o, ~ ^( n
; Q4 R4 V$ h! E( E, \/ {- #include <mach/memory.h>
( G$ b6 d" @# s' I3 \ V4 \ - #include <mach/hardware.h>2 y& c5 {5 T" q( G8 N
- #include <mach/irqs.h>( D: `5 b- U6 l+ @. z8 v
- #include <asm/hardware/edma.h>: V/ B$ X/ f6 v% l1 H) k( j
- . T5 S& `+ A; O3 `+ \+ Y
- #undef EDMA3_DEBUG
; J! g3 K" `1 A. r - /*#define EDMA3_DEBUG*/
" C A8 }: |6 Z - $ e4 ` ~: [% I6 v2 }$ v) X% v
- #ifdef EDMA3_DEBUG
, C, {. L" i* S/ { - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 M$ ?- g! g) i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' ]) \0 r; e' {/ g: `. M+ v' s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- @4 t& V/ B. {& X - #else
0 z7 c0 \* ~2 ]& v' W1 t# J - #define DMA_PRINTK( x... )0 K& Z9 `5 m9 W! i; X* c
- #define DMA_FN_IN7 C/ H3 v8 a6 j j9 P9 o' Y
- #define DMA_FN_OUT$ ~8 u1 [. K/ [% v3 K
- #endif
' c; p. V, E6 Z$ e - : q0 Z4 E& b- z& X6 U- A
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 j3 S: e4 r+ K$ j( U
- #define STATIC_SHIFT 3) P5 B5 ~- l6 X' j: B$ R# p
- #define TCINTEN_SHIFT 208 m: L2 A% U/ t+ h5 v" s
- #define ITCINTEN_SHIFT 21. @3 U: [8 f9 }* \ d
- #define TCCHEN_SHIFT 22
8 v/ l% M) r0 N2 l2 G( K" P/ A! Z: t - #define ITCCHEN_SHIFT 23* j; K3 q6 B- Z- g
- ! `: U+ l! A x, w4 U: ?
- static volatile int irqraised1 = 0;5 c( L9 h: ~! Q1 b0 o5 }3 T0 m
- static volatile int irqraised2 = 0;
w9 \9 k4 C# E - - Z5 P) p: E7 ^; ?
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ A) t( w# H+ M, ] - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 D; P. M% I+ N% p5 {9 e2 X
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; r: T' B5 Z! g/ k7 B( b5 K - ' z% z/ A! }: k) X; [% M3 X Z2 S
- dma_addr_t dmaphyssrc1 = 0;
6 Q" I+ R3 D! N - dma_addr_t dmaphyssrc2 = 0;
4 {; X/ d4 X& e0 g - dma_addr_t dmaphysdest1 = 0;
8 R' C9 F4 e# \- w - dma_addr_t dmaphysdest2 = 0;
4 c! |- g; W2 j m/ F2 s1 M; | - 7 @. R0 l0 h' }5 ?, G
- char *dmabufsrc1 = NULL;
6 G! H$ s' r* n; d6 N" d - char *dmabufsrc2 = NULL;* F/ Q% O* d* V1 x# X& j8 [
- char *dmabufdest1 = NULL;
/ p) ^9 R* z+ ~% K - char *dmabufdest2 = NULL;
. o, N+ Q6 P+ a) B - C7 P) j+ B" P! U, z
- static int acnt = 512;
* W$ k" G S3 h7 z" k5 w% @ - static int bcnt = 8;
1 R0 T! O. F+ g - static int ccnt = 8;
! M( u1 M( |! ] - ! L& c8 I; |! |+ U A( F
- module_param(acnt, int, S_IRUGO);
3 P: R9 w, _* j% H( T - module_param(bcnt, int, S_IRUGO);
: J4 j- [$ n" Y% u3 M - module_param(ccnt, int, S_IRUGO);
复制代码 9 C2 n2 b3 X: G& ?
4 f' x: R5 D p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ E7 }3 M6 z* g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# p& k$ n4 S4 C5 ~, ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 Q7 @4 A& Q M6 D& _% _
6 I; M5 B3 N8 K
/ r' e1 b* e: n! k |
|