|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, T* ^4 ~7 o& e- [code]EDMA sample test application% Y' k8 t9 t) C. H% d% z
- /*
1 Z0 ~* N2 C+ I4 W - * edma_test.c
! w# |) N7 q/ t9 q( @, ~ - *. {) ^7 P6 ]; T- {4 ~/ {& Y: y
- * brief EDMA3 Test Application) i- L! s# Z, @# K" W& H" c8 r" G
- *$ A# X' {( A. G3 h
- * This file contains EDMA3 Test code.- u+ k y: ~( w; T+ m( T N# k9 v, b
- *
% l, M n- U2 `9 z7 M# t3 h( p - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 x. M! L1 f9 E5 B7 K$ F/ H2 G: R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ k: @& G9 B+ {; b( O; A
- * TO CHANGE.
! L1 x* z( O Q M! z \ - *
- G' t7 t+ I/ ?' G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 ?8 t) C, `& j! d0 O+ R B5 j+ g
- *
- q( R- k! _4 j2 f: l- h - * This program is free software; you can redistribute it and/or
+ Z7 S* J: s8 F8 Y - * modify it under the terms of the GNU General Public License as
8 A+ e, o) {3 w4 Q - * published by the Free Software Foundation version 2.
9 M1 d& ?( q( h, A6 \5 k - *
; f* `# s; L/ v: O5 q5 p5 Y1 Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 m- L8 n2 [( v2 @: c; ~
- * kind, whether express or implied; without even the implied warranty
* I. k ~" N8 t" D9 e* O9 X3 i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 `* N" r2 @) d
- * GNU General Public License for more details.5 o5 k! C) X; e$ `- @/ R$ t
- */
+ j0 n& }/ \2 V/ |) e$ z0 }8 x
- m5 u; g- y. [# N% z3 s2 b+ E- #include <linux/module.h>$ M( b) m& b" Y
- #include <linux/init.h>5 m; j K& t! N5 t/ [! {; }8 t7 p
- #include <linux/errno.h>/ i( S0 u+ b/ q) B8 T
- #include <linux/types.h>/ C# T, q3 @# [: I9 R& y
- #include <linux/interrupt.h>
p: Z$ i0 L Y- S, C/ e$ M - #include <asm/io.h>4 @' A) I3 v5 G) I1 ]( W
- #include <linux/moduleparam.h>
) ~. w2 ]( _) H$ f) ?5 l - #include <linux/sysctl.h>
$ G6 q) G! Z0 `% Z$ U1 Z9 } - #include <linux/mm.h>! y5 V; e( t7 r5 h
- #include <linux/dma-mapping.h>( k6 t6 s) a! T0 n# t- W3 o" c6 O
' }/ t1 {7 D. j. \- #include <mach/memory.h>
* D/ d9 l# p8 B3 E) N0 [9 s% X: R$ w - #include <mach/hardware.h>
e/ G' g( `0 [1 O/ l - #include <mach/irqs.h>
2 I0 [+ s! `, a* k1 k - #include <asm/hardware/edma.h>. ?4 e% c0 v, ^: n* Z
% ?% b$ }1 \# T1 P" i: O/ ~- #undef EDMA3_DEBUG
y! _+ J5 B+ r0 o; Z - /*#define EDMA3_DEBUG*/
- W) `2 n9 W/ y0 r* D8 h - F* ?4 X1 a# o3 J5 D" k9 ^9 Z
- #ifdef EDMA3_DEBUG
% z) }4 w1 r1 ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ K P; t* @( R* m
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! N' u. i" g5 [+ C" q8 L" \ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# x8 x- Q9 k- c9 O; q
- #else" P+ F+ ^ C o; c2 x3 b. }
- #define DMA_PRINTK( x... ), K3 K5 v8 {1 f+ \$ E
- #define DMA_FN_IN
4 G) M: b O) I4 Z - #define DMA_FN_OUT
1 d( d& K* @ |' L, X - #endif0 X% v* e( T, L0 S
- - m0 O- e9 S* N2 {; }3 s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 E' q" [4 a) v" U, X- V
- #define STATIC_SHIFT 3
. X, e* r0 G( e& w1 a% `* a0 g; e - #define TCINTEN_SHIFT 20. h+ u! a0 K7 n o% @* D6 j
- #define ITCINTEN_SHIFT 21: y4 n# l! ?& x$ x# H
- #define TCCHEN_SHIFT 22
5 _; p. M9 U( I! @& d - #define ITCCHEN_SHIFT 23" C( g/ \4 K" Z7 s
- + }* P( w; V. O
- static volatile int irqraised1 = 0;4 G- c R2 f: d; Z: ~# R3 v
- static volatile int irqraised2 = 0;
. m& J+ m5 g# l - , Z, ~/ @$ d3 ^
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 C$ G6 h) C9 c7 B- [4 U' O0 E - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 y0 C4 E( ~; c5 D - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 }* F+ e! M1 j( o) _4 N0 t
' S9 f7 |1 P' X" d. p' \* `- dma_addr_t dmaphyssrc1 = 0;+ Y. u# |) I3 C$ l0 n$ A$ U8 ?& G$ ?
- dma_addr_t dmaphyssrc2 = 0;
3 y/ Q& ~" T/ N+ V - dma_addr_t dmaphysdest1 = 0;
8 z5 m* J! {( L2 n8 x. g - dma_addr_t dmaphysdest2 = 0;
! E! E/ B9 s% D% I# x - ' i# p; b& D2 E0 I
- char *dmabufsrc1 = NULL;
7 x7 @& w& d- |4 F; e9 y. D4 ] - char *dmabufsrc2 = NULL;
9 ~0 ^, }3 W5 x2 S$ p6 v( ~ - char *dmabufdest1 = NULL;
9 l3 Q, @$ Q+ g% @" I - char *dmabufdest2 = NULL;2 Z. v5 n, A4 o
! j" Z+ v- }$ {4 G5 `) N: G- static int acnt = 512;
0 j" ^$ K* n% z2 Q - static int bcnt = 8;5 w: Z+ I3 G) `2 h+ ?
- static int ccnt = 8;* k0 m' u$ y' |) r, ]! H
- + [2 E2 {+ s, Y) e& \% v3 N6 X: t, ?
- module_param(acnt, int, S_IRUGO);
$ a# K2 }, ?/ J" y, N; U3 o - module_param(bcnt, int, S_IRUGO);- _( b% G/ n- m5 `( Q0 A& s
- module_param(ccnt, int, S_IRUGO);
复制代码 X0 ?9 Y) S- x% _7 F$ x
" ^& n& k( w% k: [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 A* _0 @% m) K2 _# C& ~# Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 ]+ T! ? U# v B* O8 u/ B1 t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( [" C* S+ x9 D! `
" W8 R& x$ x; ~8 E/ a4 G; o( T+ ^. v9 }0 x
|
|