|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . v* }, Y; w3 F4 K U% B* X
- [code]EDMA sample test application" C" t, e |9 G6 K
- /*
! ^+ Q7 n' s3 \6 ~0 ] - * edma_test.c+ {0 f T5 ?: t, e
- *8 \* O$ Y/ H4 Q4 k& E5 e. y$ e/ o
- * brief EDMA3 Test Application
$ J0 i2 u# ~$ Q) E/ H9 l - *
) u/ T( y# u+ F, [9 I; h1 Q - * This file contains EDMA3 Test code.
& ^4 G' w2 @9 F- }3 { - *: m4 p+ X% L! k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. v/ O% R% k1 b' j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 D4 W' s7 p9 o5 r7 P
- * TO CHANGE.. A3 |! U0 T9 s, Z2 x
- *+ L" A0 e! Z( W9 G
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( f6 f4 H% b2 U& g
- *
, L% D/ a' d9 ?/ u8 w( `$ z9 [1 | - * This program is free software; you can redistribute it and/or3 K! ]9 Z5 K) I$ [2 o
- * modify it under the terms of the GNU General Public License as* ?+ P" F l- s7 T. f) X
- * published by the Free Software Foundation version 2.' U( w/ v; B( {! r/ @3 f( y
- *" h/ J# x/ {! e4 U" S; f: z- O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ ^/ a2 e. f# l - * kind, whether express or implied; without even the implied warranty0 K: ?: K$ ?: w% e( T
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! m0 T3 G& X' c& z7 E" |: x% c
- * GNU General Public License for more details.
, ^; B1 c5 d( E2 w! n - */% H. u1 F' e+ y* p% o
6 @5 H( c, h& | T! j; c0 Z9 T) ?- #include <linux/module.h>
2 }2 W4 o8 a: {. k; {2 T - #include <linux/init.h>
3 Q7 X& V0 _; O - #include <linux/errno.h>) _9 t, q" t0 K" C* x3 Q6 X
- #include <linux/types.h>
$ |" L' M/ k7 q# E, w - #include <linux/interrupt.h>4 o# }7 D! [ j. g# `+ w# H0 h5 d
- #include <asm/io.h>
/ N1 I4 I3 b+ H1 {, h - #include <linux/moduleparam.h>- f: ~5 Q$ c" _2 N8 I4 e7 }# x( Z) s
- #include <linux/sysctl.h>& S) W! s; L3 F
- #include <linux/mm.h>' B+ R# G0 S8 V
- #include <linux/dma-mapping.h>
, O* e) }6 o1 E6 Q
& w5 K1 P+ D3 K# L- #include <mach/memory.h>; p4 u/ X6 u! {1 c. f# m! G: z
- #include <mach/hardware.h>
- U# y+ G* E. e! ^: ^9 }1 A, i2 { - #include <mach/irqs.h>
4 i6 j& G; M$ L2 o2 E5 Y - #include <asm/hardware/edma.h>4 N: l8 p: e; M: ]$ B3 d
- % v) u M* U8 O' s# j
- #undef EDMA3_DEBUG9 S, d" Q. l% f- i: p6 L6 Y5 X
- /*#define EDMA3_DEBUG*/
( x( u' U, R1 @! |. f4 Q; L - 5 a" u, D8 B- ~ o% r
- #ifdef EDMA3_DEBUG
$ H. z2 F3 m' {4 [1 ^ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! _8 p3 ]7 f h
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ `' E6 V5 ~0 F3 E+ X$ U - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' w0 M! p, X% l* Z( k
- #else9 z/ v8 e1 y* L3 X$ U
- #define DMA_PRINTK( x... )
9 c1 L' v% {2 u. t% Y7 }+ } - #define DMA_FN_IN- ~ c/ Y0 d/ @8 U4 _( Y# o* Q
- #define DMA_FN_OUT
9 A$ X9 z. M6 X4 }6 D - #endif# N) g: ^* e( X8 h
- ( C, T) v) F J% G0 n4 M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 i" [/ i4 P8 }7 x& |( j! c8 P2 f - #define STATIC_SHIFT 3
: a' V. g' X& Y( ~# B" d) t - #define TCINTEN_SHIFT 20
3 M1 w6 `* U' y3 G - #define ITCINTEN_SHIFT 21
1 X ?4 f8 k# o/ [3 c( v - #define TCCHEN_SHIFT 22/ F2 O2 T2 A3 l! A
- #define ITCCHEN_SHIFT 23
7 h, ?( y3 P; q# l# F; h% R5 k
6 L/ f7 O' P5 A' ]$ v% m' i1 G- static volatile int irqraised1 = 0;
4 O' {! H- ]1 y1 p3 T3 w8 ] - static volatile int irqraised2 = 0;
% _2 c- m W; g. |0 y5 | c9 {
! z; P: k9 H& J2 b M$ i5 X3 L& x9 v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); F+ I- E7 O5 w
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& `% N" H1 U/ `' \) f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 b$ {) [$ ^# a$ _4 i; X
- ; Q7 C, w( }# a4 e) h
- dma_addr_t dmaphyssrc1 = 0;# o! P* E+ ^2 N- e }# T% g
- dma_addr_t dmaphyssrc2 = 0;
& `- j% Z) G, a0 h" n) X7 O - dma_addr_t dmaphysdest1 = 0;: V+ U6 B5 f) Z f
- dma_addr_t dmaphysdest2 = 0;' x; K' F3 ]5 A) r0 V( `2 r- `
) t7 ~" j1 W" w# m& G4 w m. c- char *dmabufsrc1 = NULL;
: l/ D) o9 E% r2 W7 Z - char *dmabufsrc2 = NULL;
5 v k& ^' A& v% ]: e, N9 B4 z - char *dmabufdest1 = NULL;
* o6 U0 }0 d; ~5 h& X - char *dmabufdest2 = NULL;
, l1 {" M9 T2 _* }, p) A1 A
" R0 Z) T0 w5 ?3 j- static int acnt = 512;2 X' ]: U! M& S" n9 q
- static int bcnt = 8;
$ a8 y! ^: h4 q: l - static int ccnt = 8;
* i9 n9 U C8 D. |5 |9 [
( \1 R/ P( |' [# l" Z- module_param(acnt, int, S_IRUGO);
9 t' w, T1 R8 Q" B' E: t: t - module_param(bcnt, int, S_IRUGO);5 j) {# M3 w; M+ { c) A- m: A) F. g. B
- module_param(ccnt, int, S_IRUGO);
复制代码 8 x$ U2 g6 }. w7 a% A
3 _/ T1 q5 d# e 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ e& ^$ F* i/ G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 T7 g* ?: g) ]0 B) x) L! E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# g! w( q/ C8 G$ e. K' v$ g3 ^, S+ o8 \4 a' q* _7 R; j
9 m( U' N0 O- _2 H5 T# C
|
|