|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 U0 T1 N8 T" o# s3 ^" J! r* R- [code]EDMA sample test application' E8 ?( m. [0 n% T5 m' i! }
- /*& \7 `7 U* u7 E4 y9 V: o% P
- * edma_test.c
2 ?) E: `8 Y" k" g* S - *2 L6 o$ g" ^1 }$ Y& U1 J
- * brief EDMA3 Test Application
! | S# F% \7 O$ Z+ b - *
! G% ]. x: q1 w. w - * This file contains EDMA3 Test code.
& H# I* q# {: W) X5 t O2 D - *0 m9 s' B6 d2 K4 e. R2 Z4 e2 Z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; a: S! L, Z! D% [( v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 b2 K# u$ s$ k! A0 J/ r
- * TO CHANGE.4 D3 @, L2 n2 f+ Q; ]3 c
- *
* k" h8 z t) m - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 j! f R. q; ~, n& w) l* \ - *
1 |7 Z9 P6 w6 U$ b& f* J3 y X) S- c - * This program is free software; you can redistribute it and/or* b B4 ?9 h; U) C# l
- * modify it under the terms of the GNU General Public License as6 I8 Z- W* P a, o8 N
- * published by the Free Software Foundation version 2.
) I- Q, N- k. E f - *
3 X G3 ]4 U2 { s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 o$ ^" H5 N6 `2 r# U( _$ t - * kind, whether express or implied; without even the implied warranty& A0 B6 J& d% T) _( y3 a8 C" E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 d1 d4 F4 b# g( T% a/ g
- * GNU General Public License for more details.3 H8 u. O6 z$ E" ]+ \" |
- */
2 p4 k' s7 ^+ E
. ?) K. w! K' \5 s) Z7 p/ y- #include <linux/module.h>
, G, ?: [' t* I - #include <linux/init.h>
. D7 z% m, s. J0 R( g/ S- i - #include <linux/errno.h># n: ]# P/ L( k) s8 @5 n$ O0 b
- #include <linux/types.h>
, \& `) W R" b; H% F- s6 N) @3 t - #include <linux/interrupt.h>) F6 T7 y3 H0 K- N
- #include <asm/io.h>: c {" u9 y9 q- j# d
- #include <linux/moduleparam.h>
}! ]: |0 o/ ?' i: A) C - #include <linux/sysctl.h>
7 n" g$ {" ~4 t - #include <linux/mm.h>
& _" V& [& a6 j/ C; S/ ~ - #include <linux/dma-mapping.h>- \; C" ~# S4 r
! h A1 P8 @6 M/ \2 e, Q- #include <mach/memory.h>
* R$ ] x; M* E; o9 g - #include <mach/hardware.h>
9 B$ x3 U$ G) w3 X. d7 C - #include <mach/irqs.h>) s1 _- `' ~* u/ `4 N6 l
- #include <asm/hardware/edma.h>8 X4 p t# P7 M: f1 {. t1 b
- 2 ]8 M: h& _8 R1 v& o Y7 o/ p; q
- #undef EDMA3_DEBUG
4 J0 j5 l: \; ` - /*#define EDMA3_DEBUG*/
4 L0 t. g. @/ B4 ^1 t
) d" e K; S: H- #ifdef EDMA3_DEBUG3 e8 {" V( ^, T2 J# E- t8 J+ W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- b; x# H0 H9 Z: ~: q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 ~. A, J; W- u7 Y. c& K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ S' F/ t+ V7 F+ j. `4 r7 ]& J) A - #else- f" W3 R. |6 J& z8 O
- #define DMA_PRINTK( x... )
, H$ F7 S) H3 i f$ w - #define DMA_FN_IN
4 l3 h# [" a* V. r) z - #define DMA_FN_OUT
1 V' ?( x* _, I1 v$ N6 Q& J - #endif
! J [! ^% D, V, f+ O# {) N
3 w/ H- x8 j1 X( i7 s0 q- m- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 @! G+ `$ n+ U; p
- #define STATIC_SHIFT 3) x/ Q" Q2 k) S& w# D/ `
- #define TCINTEN_SHIFT 20
1 R. d, M' u/ U4 J/ {+ g7 X! d - #define ITCINTEN_SHIFT 21
9 E; ?; l1 [/ Y - #define TCCHEN_SHIFT 22# M e4 o7 D2 v& B
- #define ITCCHEN_SHIFT 23
3 ~& I1 L0 H& s
6 E! ?# }$ }( Z4 r* ~2 I- static volatile int irqraised1 = 0;
& }( P' k8 t0 V8 I6 G - static volatile int irqraised2 = 0;4 Z5 n) E2 D' K" a9 E
- 9 F: d# q( Q$ V" P6 \+ n5 t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* T! ^" X. l( C z! H4 }9 i0 N$ C - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 p, @; Q T! E1 D9 M, ^" I
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: f5 l( |/ z$ E$ g
" ]. p+ |# t! H% p/ g- dma_addr_t dmaphyssrc1 = 0;
! ^# S2 |# s% u o9 d, L! {+ o6 } - dma_addr_t dmaphyssrc2 = 0;
/ ^) u# `! Z% y8 U Z" b9 C1 H" u - dma_addr_t dmaphysdest1 = 0;- O; ?5 K% x/ t* A! u$ v
- dma_addr_t dmaphysdest2 = 0;# i, a1 w2 E# z9 v; U3 F: C
2 E; ~: k7 C1 `8 N6 B: Q- char *dmabufsrc1 = NULL;3 ?! L7 p7 k! k- w
- char *dmabufsrc2 = NULL;
2 ]. m/ U( }) a6 {( A3 u - char *dmabufdest1 = NULL;
/ _' b7 T/ ^( C, w: A; e% r l& L - char *dmabufdest2 = NULL;
5 h4 s }6 g# J/ n$ r/ z - ' G) `" h% x7 n
- static int acnt = 512;
0 s7 i. V/ j, I; p# {& B; u7 X - static int bcnt = 8;: n7 m: K, B' M* l
- static int ccnt = 8;
* m* j- k/ A" Q0 B, G
. Q+ ]+ M+ ~3 X- module_param(acnt, int, S_IRUGO);8 L3 V" \8 M3 b
- module_param(bcnt, int, S_IRUGO);
0 F' R* p$ |7 z; n4 n - module_param(ccnt, int, S_IRUGO);
复制代码
5 B" P) Y# c. X( A1 N: Q6 y$ c Z
: z7 E4 M+ K& E3 v6 ] 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 y; s) p$ o# S$ Uarm-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- m; | _ ^6 z" Q) E
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- `7 Y9 j! i0 Y' A( Z. C/ V6 s
f" B0 p/ o- v* P* u" C
, g. E; A* p, V, a2 Q. r7 Y0 {! H6 P
|
|