|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) T( E! Z8 F( ]+ h% X" C# n0 {- [code]EDMA sample test application
8 C$ C% z: k. Q! \% U7 R; ^& U - /*8 c% A) h7 W( A. L A
- * edma_test.c
4 _. t b& d( n" m8 h4 _ - *
4 r0 U4 q3 c4 t3 x. H1 M - * brief EDMA3 Test Application" U9 c) d2 M* W9 M: U
- *
Z0 M) q5 K y; j4 G# D/ d - * This file contains EDMA3 Test code.9 a5 ^5 W8 I" @. z- ^2 x: B' E3 k B8 K
- *
$ ?& o( h0 h. e/ Z3 O4 C' q9 _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( y! t# K9 F5 W- H. }/ t8 u - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 Q- E4 E6 O# ] - * TO CHANGE.9 o0 ]1 \5 |3 i( g1 s
- *' G) j1 f' x* U, A( w" p
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# M% P: a5 N, j( D2 O: Y9 c) e - *
4 \9 L8 U7 |4 T" L/ |" V - * This program is free software; you can redistribute it and/or
, \. x3 q# ^2 T3 h6 C - * modify it under the terms of the GNU General Public License as
i3 {% f( Z) P2 E; |( e - * published by the Free Software Foundation version 2.2 n0 s0 l) ]# ^" e/ G9 j2 |1 w
- *6 e$ h2 H" v" {( |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any! o% O* L" s: d/ L: }1 Y
- * kind, whether express or implied; without even the implied warranty" F- w O) v4 k8 z' S' C2 y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
S" X$ w9 k% T - * GNU General Public License for more details.
* E) i+ R2 `& R/ O+ E* H% H/ w - */
6 J) U Y3 A$ x I
* Q% t0 @; z3 _/ ~) |- #include <linux/module.h>. V& D) r! o) E
- #include <linux/init.h>
$ G, q/ E" \$ O; o& R - #include <linux/errno.h>; B& X/ s# Z3 }0 t
- #include <linux/types.h>7 r# v8 O3 m0 P& ?, B' h
- #include <linux/interrupt.h>4 |- f# z9 |/ ^$ l8 I+ w1 \
- #include <asm/io.h>
! S+ H# k5 O2 f2 S K3 e - #include <linux/moduleparam.h>: b1 {8 i* d8 Z6 X7 E
- #include <linux/sysctl.h>( I0 ~" o! X6 o1 P$ @* D2 W$ f
- #include <linux/mm.h>7 \2 W4 t2 A: O8 X6 G" s$ X1 e
- #include <linux/dma-mapping.h> W7 Z" m# C% i$ a7 G0 Q6 n8 E
- , x6 S& I$ w, o" d7 p& |
- #include <mach/memory.h>
+ v, h1 {/ Y9 Z# A% o - #include <mach/hardware.h>
- ?. a6 D1 ~1 V- x ~: K+ v/ @ - #include <mach/irqs.h> z% {6 R& g3 k5 ?* `1 ]' y O
- #include <asm/hardware/edma.h>$ b& M" b. e2 y" z
- 7 q6 B/ U7 h% o9 w: y& [
- #undef EDMA3_DEBUG
: w5 Z, h) m y - /*#define EDMA3_DEBUG*/
! V7 { c0 b v) ?; v7 R
7 v2 K* q' Q- E9 u7 ]- #ifdef EDMA3_DEBUG
! G0 C: a# k7 R( |7 d- G - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( E+ M% P, t5 o; K" ?3 s D$ L2 t. F
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! I- W" c& ]8 X) O - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 `& l+ w% c; r |& {: o) \! k3 ^ - #else# s% {! V) _& E
- #define DMA_PRINTK( x... )2 l; [) `" v. F( l# ~8 \$ m
- #define DMA_FN_IN9 I0 ~% b1 t, v' f) h) T* m/ x
- #define DMA_FN_OUT
/ K# B$ x; V3 c& b y8 j. q A% T - #endif
2 O- c6 z1 c4 \# x$ F7 I4 ?, f
6 ^2 B; U+ Y2 l( o; K- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" i% ]" p' v; Z0 X. ^5 n3 j7 }6 c - #define STATIC_SHIFT 3
* `) L1 D1 _6 o - #define TCINTEN_SHIFT 20: g/ W4 }9 g- }0 B) u# J' V7 J
- #define ITCINTEN_SHIFT 21
) r# K7 ^, K4 E' o9 l9 l+ M - #define TCCHEN_SHIFT 22
~+ x- v x9 p2 t$ A7 ~ - #define ITCCHEN_SHIFT 23+ u8 z: p. c& ~6 Z1 q$ a7 w& e
- ; P x* i+ J" C8 b1 Q
- static volatile int irqraised1 = 0;
g. c# D- {( \3 D8 J' Y - static volatile int irqraised2 = 0;4 c( t+ w& M5 u- _( Q( B
- - E0 P; ]* k d
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) m) h) m3 k' O6 C( [9 g2 v: O* f
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ G8 O% Z# C) J. M& F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' }! r# U$ A) G% u
- ( b. d1 O7 h7 M0 v! s3 e( l7 U$ |
- dma_addr_t dmaphyssrc1 = 0;
$ v+ _) Y' R8 _4 J+ l/ ]0 G - dma_addr_t dmaphyssrc2 = 0;/ e6 m$ s/ k; r! y: g1 T$ n, C( L, D
- dma_addr_t dmaphysdest1 = 0;
* m3 w; w" M+ O4 X1 | - dma_addr_t dmaphysdest2 = 0;
2 E/ q/ N* N" t+ m) F1 T
$ W% K8 ~; S T' Z- char *dmabufsrc1 = NULL;4 f+ Y. y& W" {! \
- char *dmabufsrc2 = NULL;
9 M( V" t9 n6 a% Z - char *dmabufdest1 = NULL; g$ z. q# t! X8 k: S# G. Z
- char *dmabufdest2 = NULL;+ p2 P9 G( U/ h2 d; i# h
- ) _- P3 J: o+ H0 ~' {/ L" ^; S
- static int acnt = 512;
7 g) _! ^$ F( Q6 j& G - static int bcnt = 8;
! H% x- u m" E+ @ - static int ccnt = 8;) t( P6 g5 l% ]8 [
- ! J3 E6 P8 [- H
- module_param(acnt, int, S_IRUGO);
& D0 q* i* s& M7 w - module_param(bcnt, int, S_IRUGO);
; s& N7 s* a1 r* a0 J" |% Q - module_param(ccnt, int, S_IRUGO);
复制代码 4 J/ W5 F; F% V/ P; t0 t% b* C$ l
- Z4 |4 j' }& w( s1 k# m$ o
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 M6 \% t$ _% C; h Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 W0 J2 ^( I" ]) P 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. B) w. q8 z% x- I7 d+ ?/ n9 z, N, N/ M; R
0 I4 ^: M- f6 ]$ F, [
|
|