|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 x! Q/ W1 w) D _- U
- [code]EDMA sample test application" a3 A* [7 |0 i- Y+ D
- /*) i8 w* e4 d9 e$ m+ j
- * edma_test.c, }+ E5 _" y& \, v9 H
- *3 {8 D8 Y9 t! R4 k& R; n6 h3 h
- * brief EDMA3 Test Application, f ]5 H6 r3 ~, B* w5 s0 W' _
- */ U3 k, O9 b2 i- T w: c
- * This file contains EDMA3 Test code.
! \5 r* u* n" m1 p/ G1 T - *# t, f `: z- y1 J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 w1 v2 l* q2 P. t2 C; e- p3 M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) ~# I: j# d9 M$ y% d
- * TO CHANGE.3 ?5 @ L# g, p" @
- *7 d, n* I6 H3 e [
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// E" m5 Z8 v4 o
- *2 H8 L: L& F" G2 \( ^ O8 x. ^
- * This program is free software; you can redistribute it and/or
0 p- B; b+ b4 I& Y+ \ Y, G, w- y - * modify it under the terms of the GNU General Public License as
1 r: x/ e- }$ }! u+ s+ O) { - * published by the Free Software Foundation version 2.- ^0 _9 @- G0 U, c/ f9 p
- *" r7 T# z2 l$ P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ e/ a6 c! ]7 P$ ^+ ]
- * kind, whether express or implied; without even the implied warranty
) V4 q( t- d" I1 u$ P& D - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 x0 R# G p8 R
- * GNU General Public License for more details.8 l. k/ K0 O& Y8 a. ^ {4 A7 T
- */
+ _3 ?" i3 b9 o! ?4 W - 4 L/ Y$ o- x' S2 T" R6 a" [
- #include <linux/module.h>
3 x& e7 q, Y. f: l1 V% o4 z4 c; N - #include <linux/init.h>
$ ~& W' [" E/ D% [; e3 O- S% K* | - #include <linux/errno.h>% C# W5 n3 V! s( L6 K7 ~, U
- #include <linux/types.h>
( Z& _& ]1 U: J2 P. j - #include <linux/interrupt.h>4 f8 K; @. }) s" ^/ q/ s# Z! {
- #include <asm/io.h>3 Y/ h7 G" g1 r% {2 K @5 Y
- #include <linux/moduleparam.h>) `1 t3 j1 A+ ?, X. G
- #include <linux/sysctl.h>2 e( r) g$ K( }/ A: ?2 U9 ?" F4 s
- #include <linux/mm.h>% h! _3 }* N+ I- B1 l, s# O8 {
- #include <linux/dma-mapping.h>
( j- W2 P1 g4 V/ K - / { b' _* X1 H, N( j# G1 v- P
- #include <mach/memory.h>* G- ]3 c$ Z5 e' |# q$ s9 s7 d
- #include <mach/hardware.h>% G; m& n3 E( e' M
- #include <mach/irqs.h> Y) e P' U# C9 O1 N# t# G' S
- #include <asm/hardware/edma.h>
) d; ^. n: B& g7 a8 U& h - ( Q6 \. h* h$ E N
- #undef EDMA3_DEBUG
6 C- m7 C( d7 d" C5 C - /*#define EDMA3_DEBUG*/" w/ h! N+ K7 m: z
- / Z! ^) X- s5 ^5 _* m% n$ a0 @) L1 {: p% Z
- #ifdef EDMA3_DEBUG8 d2 X1 q' u9 T( J% K( P! J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
q& T8 Z5 Z! m+ l# x/ u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- n0 S m# l* ?
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) T) V7 Q& }6 r/ l2 q
- #else" a/ K# O1 e. d
- #define DMA_PRINTK( x... )
2 b; p: ~4 z; G0 Z% B" x- D' ? - #define DMA_FN_IN! z) _& W& b$ \( w# |
- #define DMA_FN_OUT7 f N6 R( `. U
- #endif4 s2 l2 K5 t/ n1 U) j
$ A6 |/ ~, \* }( x9 S6 S% K! p- #define MAX_DMA_TRANSFER_IN_BYTES (32768), l- n. x- ]0 d6 X
- #define STATIC_SHIFT 3
# w8 c# f5 y0 x) s* r, M! X% @ - #define TCINTEN_SHIFT 20
( g$ ]5 \8 |" v1 s2 l1 w5 b - #define ITCINTEN_SHIFT 21
3 Z5 }/ w* f9 U - #define TCCHEN_SHIFT 22
5 T! [9 [) x9 ^* f# F7 G9 s) k - #define ITCCHEN_SHIFT 23
- W) V2 O; e2 i% \ - 5 R/ ?5 ]/ S6 a1 v. q4 a* d
- static volatile int irqraised1 = 0;( X: d. Q) N+ l3 N
- static volatile int irqraised2 = 0;
' \2 L" X: B* J- ` - ; S5 _ Q6 {" B* j; ~2 Z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ U$ k4 p8 C/ h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 \6 ?7 @$ a( O6 X) W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 m$ q/ j9 S r: R
- ; ^4 ~9 x3 F# K' @
- dma_addr_t dmaphyssrc1 = 0;6 }" d1 L+ }. y7 }
- dma_addr_t dmaphyssrc2 = 0;: g! L( s. n6 P/ d! [9 L
- dma_addr_t dmaphysdest1 = 0;
% D. m7 T- h$ |7 G, N$ H) K) t - dma_addr_t dmaphysdest2 = 0;
) D$ |+ Z' L6 G, x - * b W8 W8 E4 v5 ]4 g
- char *dmabufsrc1 = NULL;) }% l" L: U4 i. {
- char *dmabufsrc2 = NULL;0 k) m) y2 i5 w0 @7 R; D! o
- char *dmabufdest1 = NULL;, s$ w' c" C% q7 W
- char *dmabufdest2 = NULL;
4 G* b: v( U3 F% d- J! G
4 ?4 B4 d* n/ l+ Q2 C' M O7 g- static int acnt = 512;
( D2 B4 `; O B& M3 \# n8 F: _& f - static int bcnt = 8;: A: @( U ?( z
- static int ccnt = 8;7 i$ M3 b3 t( U' v- F3 m
- & B# t6 k }* a( i- X3 j
- module_param(acnt, int, S_IRUGO);% ~/ c& U9 U8 Y- A8 U) k
- module_param(bcnt, int, S_IRUGO);7 V# w0 J2 d% \5 ?' ?) K3 s
- module_param(ccnt, int, S_IRUGO);
复制代码 ; ?5 U; d3 y' _9 ?5 T& V' k$ x1 l
1 `- A4 J E- v+ K" [+ h+ l7 o 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 P! Y% r9 R9 t/ `1 ]4 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 n( O& x9 H1 B, d0 h# f+ r% b* h
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% Q( p9 a) P' e% i y9 V( j0 Z! `
4 U7 o) X. [: q: _ f7 _+ C
( @- y: ^: E1 m6 [) J |
|