|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - k/ ~7 t' l' [- j9 A
- [code]EDMA sample test application
0 R+ t- R$ I" o3 q1 a/ m - /*
$ X6 m; i6 h" ^$ e# P - * edma_test.c; z" h6 m$ i) B# B7 d& c
- *
3 V, u$ |: L! ]5 z0 K5 t - * brief EDMA3 Test Application
9 a* S! g& h! Z- l' y# v$ S - *" k5 |; u' G0 }) F& v
- * This file contains EDMA3 Test code.* A8 A0 r2 Q! Y5 a
- *
& e9 A$ T8 E( }* F. U2 a8 | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. Y2 j2 B& }( y6 o( J
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! r5 h5 p" M7 [7 T, B( C/ }0 ~
- * TO CHANGE.6 H/ y) R% J( @9 c$ C
- *$ T9 l: W- J1 b m0 Q5 V) r, M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 S3 d* w; _. T2 |3 F: s+ e9 D
- *$ k+ E* l2 Z# E' t u
- * This program is free software; you can redistribute it and/or
7 K8 \3 l3 U- F3 Y9 ] - * modify it under the terms of the GNU General Public License as
2 {2 {* i* g, r+ ~$ s0 b, y - * published by the Free Software Foundation version 2.( r5 ]8 V% b- S) w6 ^
- *
8 A y. [- F2 `" ]" C' S8 i - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 o% \5 _7 h, `) f - * kind, whether express or implied; without even the implied warranty
# g( M" I3 k/ n& N - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: P+ _4 M# m$ T7 y" X' a" f$ O - * GNU General Public License for more details.
4 g# ^* M. l4 B2 K, q# m$ j - */
; g* v' w) K8 t - : u8 y& r* U& `
- #include <linux/module.h>
+ v' c7 ?& ^! X - #include <linux/init.h>3 N1 l% w" w& [/ }2 K/ H. t" c
- #include <linux/errno.h>; k; _ y: h2 g, \: O" A) J
- #include <linux/types.h>3 ^: F% O( ?! ?' p' i7 D+ @" s
- #include <linux/interrupt.h>% i+ {# J2 q m+ ]( g& h+ f9 |
- #include <asm/io.h>7 a& B9 U- \& E/ k. M: q. _
- #include <linux/moduleparam.h>
# U& @# w/ [3 k- d" ` - #include <linux/sysctl.h>) P4 o5 K0 n* d4 k4 g/ C2 d ~
- #include <linux/mm.h>* g4 k- \! |& h
- #include <linux/dma-mapping.h>$ C8 `8 j! W2 \, ~5 p6 q+ [
- & {/ q5 {- y0 N( S( |; e. e; d
- #include <mach/memory.h>) F# K* j2 G1 ]* a% I8 y
- #include <mach/hardware.h>, G* u5 K/ M6 y8 B$ e
- #include <mach/irqs.h>: f/ _" s! R( v- l& Y7 @* j
- #include <asm/hardware/edma.h>
0 J3 I; ?, a4 u1 b - 6 S! l: W# D3 T, \! p
- #undef EDMA3_DEBUG
( s1 c, G# S; ^1 U7 I! b0 d - /*#define EDMA3_DEBUG*/
! \# W' e+ L$ Z
9 J; ?9 P5 L. R; U1 ?' Q- #ifdef EDMA3_DEBUG
O, K' Z& @6 j& S. p: m+ o' X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 f& |6 R* O" m; q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" i# _" @! U) t& b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): h2 f9 @- M! ?( a/ N
- #else
3 C# B: H: v" y" m+ H3 M - #define DMA_PRINTK( x... )1 |( w5 X3 _" K0 h8 C5 R5 S2 t% Q
- #define DMA_FN_IN$ r% l' t: q# l8 y' Q; R# ^
- #define DMA_FN_OUT
2 B: T v; L+ f. Z2 Y7 L - #endif, \/ S+ h5 _9 X3 B$ d
4 }2 A( Y6 \9 m8 x' b) I/ l- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( |' ^( H; R$ j) z* Q
- #define STATIC_SHIFT 3' q& U+ w1 m' Z) g. f5 |: v) `
- #define TCINTEN_SHIFT 204 Q; |0 P' k( m# v8 m7 A
- #define ITCINTEN_SHIFT 213 d% U& K% q5 q9 P
- #define TCCHEN_SHIFT 22
9 `2 J( N7 z, Y, c( v - #define ITCCHEN_SHIFT 236 L l8 a2 o5 q% J# p
- $ K$ ?1 b2 V( Y3 |+ x
- static volatile int irqraised1 = 0;
& z* W, q4 L! o - static volatile int irqraised2 = 0;
& j! ]6 A+ p j' u3 U/ a
C3 @% r: \0 [7 j* @# J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- u; B. Y% B9 o7 H# a7 D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; m' M, U2 f% m% ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' j, h6 H* x% {/ G1 p
. [$ }& \2 Z# l- dma_addr_t dmaphyssrc1 = 0;! d& y* l2 C7 q* S( q3 a" a
- dma_addr_t dmaphyssrc2 = 0;
# O, [2 X' `9 C1 |( a - dma_addr_t dmaphysdest1 = 0;8 N6 e2 z V7 r# H+ \* i" z3 h
- dma_addr_t dmaphysdest2 = 0;
, g8 r- p# z8 ?% O
: N1 R8 }$ A2 X' |, r& H- char *dmabufsrc1 = NULL;5 i( q* W) x3 Z
- char *dmabufsrc2 = NULL;- E1 z! s; i- i# |0 F
- char *dmabufdest1 = NULL;6 j6 O$ d6 q2 B; x- t' `* l
- char *dmabufdest2 = NULL;
8 q& s" ]4 M! ?) D$ s$ F/ q2 j W
6 ~5 V6 M4 s. W8 n4 X1 n- static int acnt = 512;
1 a ^& Z% q% o* e% _3 m. }9 R - static int bcnt = 8;
: h" M3 p8 ~: ~9 f - static int ccnt = 8;
! }' K) k& j9 i6 u+ g
4 p4 |( ^" m7 Q- module_param(acnt, int, S_IRUGO);
( A9 N& W5 { `6 {+ y5 F$ p9 j - module_param(bcnt, int, S_IRUGO);2 N M+ A. _4 ^5 {5 D4 N; C7 V
- module_param(ccnt, int, S_IRUGO);
复制代码
. P* _2 J) [. j% _5 s& v% Z- b) L; a! Y( y/ M5 a& F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 H: k' B, J; a8 E5 d
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; j! n) M& M$ G5 v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 u. x5 D* |& K$ B& k
: V, R1 T4 Y2 y3 j
( t5 h0 \: R* w7 i5 u, t |
|