|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 L2 e; g% y5 ^+ j
- [code]EDMA sample test application1 g; N% N" C! t: \+ `
- /*9 R0 y$ [8 w# N+ T; j0 F' F
- * edma_test.c
7 v v1 ~) a- E6 K( B) H - *7 e- G3 J& L9 j4 b4 [% s& k2 G9 @
- * brief EDMA3 Test Application2 b! K$ P7 N/ [ R- C
- */ l* d2 K1 Y! ]6 N
- * This file contains EDMA3 Test code.$ }* l. ~& j+ S9 t/ `$ c
- *
4 ], S' I. X! a% E0 f- a- S5 n0 S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 d( W: X/ t: F" m( }! m8 q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 d* ~5 ?* J( n# }
- * TO CHANGE.. |4 u- U& o4 Z5 B
- *" m9 F) m% P# V }* w1 B
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 @4 }: @0 ~' T! M - *
& g0 C& |4 {3 i2 C - * This program is free software; you can redistribute it and/or; C+ |' p& Y% ^: `# |9 z( Z
- * modify it under the terms of the GNU General Public License as6 s* @- w; Q: z2 W" |
- * published by the Free Software Foundation version 2.& g- N! d# \9 z, N. l
- *! z! Z8 J1 a3 {$ _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ X& c) {% [2 B6 J/ y8 {& g8 B* ^
- * kind, whether express or implied; without even the implied warranty# [* E- B1 ^6 H9 w6 R# B+ Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 D+ e2 I) N/ X' [+ ]: y2 D - * GNU General Public License for more details.
- R& ^% n4 g* G/ y1 B! q$ x - */9 T2 P8 P& d: d8 S, x
- 8 D8 U6 ?) A$ b- X' C/ z# p: \
- #include <linux/module.h>, x7 K6 n# X7 F0 x" D
- #include <linux/init.h>
& M6 y! G$ ]. _% y - #include <linux/errno.h>* o- I' @. Q, E2 h
- #include <linux/types.h>
4 i; ]: [ }9 j. r$ `) g6 c& F - #include <linux/interrupt.h>! O9 S/ R3 N0 |5 @ F1 _ A6 W( d
- #include <asm/io.h>
8 u l/ M" S, [ - #include <linux/moduleparam.h>
% ^5 W- c5 M }: g9 C; o, e - #include <linux/sysctl.h>2 Y, m7 u3 W4 V( D
- #include <linux/mm.h>
3 n4 X( a: P3 j: Q1 ] - #include <linux/dma-mapping.h>
" p2 x1 i; R; E - & g; A- u9 g! q/ t0 t7 }
- #include <mach/memory.h>/ j6 D, L$ F/ V" ~$ n
- #include <mach/hardware.h>
8 G( ?/ f9 ^& u- B, [: r0 K - #include <mach/irqs.h>
) \* j5 ]+ q8 O3 l - #include <asm/hardware/edma.h>. `" ]: [7 g( p, i; I9 k, K. K
' T% H( T9 o! ~5 l) q- #undef EDMA3_DEBUG: v9 }8 k4 t2 @5 g' L
- /*#define EDMA3_DEBUG*/; q6 e9 o$ M+ r/ x" L8 M
% o3 v+ ]6 {" y2 L% i5 _- #ifdef EDMA3_DEBUG' a+ Z. D, T3 K5 [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 G! A. ]& M. i% K, W7 ~4 Q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" e- G& u5 V' t: k! D0 z y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 [! b& @! B! c( ~ - #else3 t4 ], ?- u7 o; Q6 r! L# |% z
- #define DMA_PRINTK( x... )
+ X7 M0 s- z* N% D+ k/ X - #define DMA_FN_IN
! {# ?0 s& s% [- a - #define DMA_FN_OUT
( C5 W& N8 w( i) k4 y - #endif7 Y2 |/ U$ U+ ^; _
- 0 v0 Z7 ?9 E/ ^6 E' t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 A/ A3 [. d, m2 G X
- #define STATIC_SHIFT 35 \# B5 r) V5 @" p
- #define TCINTEN_SHIFT 20/ g) t" [* ]1 i- a) [, M% x- [
- #define ITCINTEN_SHIFT 21
9 B, X9 E! i2 L* p - #define TCCHEN_SHIFT 22% l/ W' H5 ]: f
- #define ITCCHEN_SHIFT 23
# }9 O8 D2 u& @1 Z7 H( G - / g; [/ c5 B; G- t) \3 Q0 J
- static volatile int irqraised1 = 0;
& `( S- J: ]" } I: I - static volatile int irqraised2 = 0;
& h1 b: }2 n5 L% s+ Q
$ R, `6 \2 L6 d( j, z( ~# Z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ G9 {( x0 ]$ q: h( m
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) L7 r# G' J" [; T0 E
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& W# G; W4 j, l: s `
; [( m& K6 B& R q; ~- dma_addr_t dmaphyssrc1 = 0;" c! N; l+ d/ n) S) y
- dma_addr_t dmaphyssrc2 = 0;
( V) u {7 f: E2 @: q' S - dma_addr_t dmaphysdest1 = 0;: H0 i1 O" |# _# p
- dma_addr_t dmaphysdest2 = 0;
6 X1 i5 ?6 W& `: k& z
% I0 |+ U/ `: w5 F, ~8 g- char *dmabufsrc1 = NULL;$ P; |3 f1 w9 O' S- o
- char *dmabufsrc2 = NULL;; b& |) q1 K+ U# j" _ v/ f! k6 [. c
- char *dmabufdest1 = NULL;, S3 x& o1 H( S2 T2 s
- char *dmabufdest2 = NULL;
+ d2 [' c+ }$ `3 A% |8 w, w/ e, S% N - 2 A5 j8 c+ \: v1 C, A/ {
- static int acnt = 512;
, h0 \1 Z+ A8 b. d9 T0 q - static int bcnt = 8;: ] M Y& L& x e
- static int ccnt = 8;7 z4 ?' [# ~6 l: d
8 \; i7 g2 \0 E4 J* k- module_param(acnt, int, S_IRUGO);
0 c6 ?7 H) Z% a4 e4 k9 ^: ^0 B - module_param(bcnt, int, S_IRUGO);; J: T: @2 L* c4 ? R# B# I" P( n1 ?, P
- module_param(ccnt, int, S_IRUGO);
复制代码
/ |0 X5 z8 e. n. ^. L, [ N! o) K2 q1 T# Z) H) D, S/ H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! d! u( a. I* A6 k' S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ a( E. C% d6 j V5 ? 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ z" K" W; }, l* J. _: f
" ^) K5 [4 T' B4 x5 L: w
+ ]% [: S* b& V$ I3 X
|
|