|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 e# M; O$ Z# o( `, e8 R
- [code]EDMA sample test application
' E1 j8 i4 ~: A. W - /*1 @% E1 d4 v, O7 h( y) b
- * edma_test.c
1 O9 L1 c: e; q" l - *+ e: _, |( c. x c/ J
- * brief EDMA3 Test Application
/ M- y1 O5 ?: \ i - *
& S- b: v: c3 Z) Q8 a - * This file contains EDMA3 Test code.
+ y8 v+ d1 [: S ]$ K6 X* p - *
4 i9 b1 K0 g! S1 u( y2 ]7 c( V - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 O! q% k5 [- x, q1 {/ L( \6 ^# h3 K4 S
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 M4 d* G( R& G9 ~ x$ @ - * TO CHANGE.
* P/ Y! ?' Y# a8 J3 x8 B - *
8 d1 W7 l1 w8 U- V% f! r - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 U* r+ W) A: K( @* Q
- *+ m, @ R5 \( L& X$ R+ u. C
- * This program is free software; you can redistribute it and/or
3 ~0 r4 b% G! Q6 Q; c8 m! v - * modify it under the terms of the GNU General Public License as
" c; u- q2 ]. f% n M* } - * published by the Free Software Foundation version 2.4 s4 I6 i8 K; c# R# h" k {* M
- *- p4 j7 Y6 \2 O Z" B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 y6 h7 H% \% }2 E( `
- * kind, whether express or implied; without even the implied warranty
; `5 F5 H9 v y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& n+ D; J3 @$ F/ u' v( S: s - * GNU General Public License for more details.' m; F! a C& e! {7 o9 F
- */" `) G/ A) ?/ A2 B }: ^; E
/ e/ r# D" `, ~% {" T- #include <linux/module.h>/ W& o% i1 ?2 g
- #include <linux/init.h>- f' M+ A: T! i/ ~8 r, }
- #include <linux/errno.h>
1 O8 z7 g2 q9 U) d - #include <linux/types.h>8 [1 _9 F1 i$ Z& B4 {; X( L
- #include <linux/interrupt.h>$ q& n; Y6 \; e0 k: a' c5 F
- #include <asm/io.h>
& ?0 I L7 k/ n. Q9 M+ f/ w4 ^ - #include <linux/moduleparam.h>
4 ~% @" z& f s; H7 Z ] - #include <linux/sysctl.h>% b7 z* L/ K! R! Y* G W
- #include <linux/mm.h>
2 o6 o0 d7 h1 H0 B, Y - #include <linux/dma-mapping.h>( e- O J/ l0 \
- ' p8 q7 S7 d2 b0 N9 b1 i8 U2 {
- #include <mach/memory.h>
( o4 j7 Z. L, z- x+ \' h0 X - #include <mach/hardware.h>: @8 z6 }- k) k+ X# O' @
- #include <mach/irqs.h>
$ H0 t2 p; o8 u" r! ^) c( V - #include <asm/hardware/edma.h>
$ A, Y, n4 ]4 w. N. {* [
2 M, j5 A* F( U0 m/ V; ^- #undef EDMA3_DEBUG
* h3 @5 r6 M- @5 ^6 \8 }7 m0 L - /*#define EDMA3_DEBUG*/
) O0 t2 p$ N* d
7 Z$ a& A- [1 b- #ifdef EDMA3_DEBUG
9 J; G2 C& C% u: c - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( [7 J' m$ p d* M% M: W+ o! a
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 u. t, j; o3 I9 W5 y4 k1 s3 Y8 _2 e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ H& l) [8 Z& q @- U& j
- #else$ O, @- _$ x0 p' E$ x: y
- #define DMA_PRINTK( x... )
- P" d, @7 H9 r9 V7 S' Q - #define DMA_FN_IN
2 S( }" P( z Y' K2 g3 Y - #define DMA_FN_OUT1 {. d6 k* _* a+ M
- #endif
& B, }$ v0 d; f7 z# v - " X R; h g$ m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 X A" O( o7 J$ d" j, O: o0 |+ W& t6 e - #define STATIC_SHIFT 3
( r4 W: a& X. a* \# g: T# a4 C - #define TCINTEN_SHIFT 20
* d+ i5 M# {+ p6 o7 Z; g$ F1 i - #define ITCINTEN_SHIFT 21
- C! g6 V/ ^. Z: j" m; i( \. Z/ M" w - #define TCCHEN_SHIFT 22
& _# c" {/ w3 [. U) P s - #define ITCCHEN_SHIFT 23 Z* |% v8 q4 e, H% |% B5 J/ w
2 V) Y/ s" E$ s) [0 E6 b3 ?- static volatile int irqraised1 = 0;: ]3 I/ {8 E2 o! I5 p
- static volatile int irqraised2 = 0;& I' T5 E' B! k% m7 P# |4 Z1 X
- # M( X5 d; D: W4 p6 J* @& r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ `8 |8 a, i) {( g: d. F
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: G/ @) S& |% ?0 O5 p3 j/ w6 |- [# K - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! T# {" \2 k8 F8 ]# O. I$ |% Q! S - + A. ?' o: H5 Y \
- dma_addr_t dmaphyssrc1 = 0;( W Z, L! t7 [5 `* w2 r$ I) Q4 \
- dma_addr_t dmaphyssrc2 = 0;# T0 E4 k9 i* n- p0 Q* l4 U
- dma_addr_t dmaphysdest1 = 0;
3 W( A* ^- g& c+ E% o - dma_addr_t dmaphysdest2 = 0;" C& j* Z& U; q9 G: ~3 x4 [6 o
; w5 {* t) D+ |- char *dmabufsrc1 = NULL;
. H2 r; T1 q5 n) ?! \$ H& F" V - char *dmabufsrc2 = NULL;$ H8 G( J7 e) X8 b" Q& ?
- char *dmabufdest1 = NULL;. O. B0 g5 D2 g. e5 g
- char *dmabufdest2 = NULL;4 Y0 f% d: s, B H) C* Q
- D* r1 S/ r1 V
- static int acnt = 512;
" o5 [! ]) c( l - static int bcnt = 8;! x% Y4 |) `, n; K! ]6 u" k
- static int ccnt = 8;" Z0 z: v! R1 z' h; K
9 n Q8 W6 \- z5 q2 H9 \9 ?- module_param(acnt, int, S_IRUGO);
6 _. i6 z q$ ~ - module_param(bcnt, int, S_IRUGO);
% ~1 s$ N# q2 Y. M - module_param(ccnt, int, S_IRUGO);
复制代码
( H. k: C. Y3 I' C7 A
) I) y& E7 `. h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& M$ h Y5 {( L& c7 J5 U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: G- T) U( Y. H# f3 f4 H
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; _" _% e$ s+ |5 k; E- |$ L, }) m! y' M
6 t. R H/ E$ a3 d4 l" N' X6 C6 o |
|