|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* Q& x. q, {( J5 Q8 w, `5 {# h# p- [code]EDMA sample test application4 x& d, F2 L: {
- /*: C5 g$ U( v3 w" H
- * edma_test.c( I$ S5 \' W% i9 A- \( B/ h
- *! P, W5 V; X% G, ?+ z* @ ]# @6 z
- * brief EDMA3 Test Application
; h- t, D" @/ h - *
8 I2 l, r8 K% I! T. K( i - * This file contains EDMA3 Test code.
1 b8 Y2 @; h- W5 w7 O7 j - *) T: [ T; x8 Q9 a3 w0 |) c9 _3 ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( x D* e" j$ {: F, g4 d# ? - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" S4 G0 d9 ]6 E6 U% ^* \" l - * TO CHANGE.
1 w, Z# y" o$ R) e! _' t - *
. A! c$ s5 q s! c6 q/ p - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) U7 W" Y) Y9 W0 [! n) B
- *
0 E7 u3 v( H3 l1 e2 C - * This program is free software; you can redistribute it and/or
& r8 `1 w% a" R! M* ] - * modify it under the terms of the GNU General Public License as3 I) Q& k. t; ?/ x
- * published by the Free Software Foundation version 2.' H8 M6 E' K L/ Y
- *4 B) J+ I# Z! U" W! Y. x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 m1 N1 a3 P; |( d
- * kind, whether express or implied; without even the implied warranty1 t8 L& d7 _) R& h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- c4 N; \, }% w+ M7 [
- * GNU General Public License for more details./ ~7 Y2 U& i3 ^; J3 k. n
- */) {: S/ B8 {; A7 ], O
1 x7 A$ D5 ]& X. s# ?- #include <linux/module.h>& _* q8 e' x7 f2 k# H c7 ]9 ~ X
- #include <linux/init.h>
$ f: j+ f% L' a9 S - #include <linux/errno.h>" D0 d9 a3 {! E& K o/ k2 L! p8 i
- #include <linux/types.h>, v3 \6 l/ [1 B; F
- #include <linux/interrupt.h>! t8 ~' T7 [* e7 K8 l- |; K8 D
- #include <asm/io.h>8 r$ x# T/ x& K. T( @+ x1 q
- #include <linux/moduleparam.h>6 g8 Q" o6 U5 V; |9 R
- #include <linux/sysctl.h>7 r! c3 C: j9 L$ b3 Q, D
- #include <linux/mm.h>& [4 u: e9 F+ K
- #include <linux/dma-mapping.h>0 t1 G0 G; R9 ]$ S: \
# h. Y, O* a+ ^3 W7 D8 ]9 T- #include <mach/memory.h>
! _% F' k+ x/ V1 o* k5 T* o% t- Z - #include <mach/hardware.h>2 W8 B5 b0 b- u3 d s* C
- #include <mach/irqs.h>
! u( o3 z( h) R7 I5 ^& X0 C - #include <asm/hardware/edma.h>1 @( D; h5 Y4 M" w3 _
- 2 v l" S# C1 M+ b
- #undef EDMA3_DEBUG; s5 E [% Z( W% l3 C+ @- T* l; m
- /*#define EDMA3_DEBUG*/
2 Z$ W5 s! q: j4 [1 p, V" @7 w6 q - ( }3 V( T7 |0 i% ]* K' X# G+ \3 [
- #ifdef EDMA3_DEBUG
* U9 {- H( ?4 S9 c& a g: C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( w7 z: L9 C0 W( ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# G4 Z" e1 m3 p' l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); L$ V$ [8 r D. {7 B: C7 p
- #else5 l# x5 u" R% P, g. O
- #define DMA_PRINTK( x... )
$ ^2 g) K6 R+ T8 n! y5 i* O( T - #define DMA_FN_IN6 W3 R& l( w: Q! o
- #define DMA_FN_OUT
- a6 o* ?' R( \7 T) L - #endif
4 @4 g8 F+ G! D
) G- I, o) Q- h" c8 ]+ {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: M2 q/ C; m9 U+ _) m* f* B3 i - #define STATIC_SHIFT 3+ G; y, l6 o2 \( H1 T7 W6 i
- #define TCINTEN_SHIFT 20
8 L% D% g. y. G1 a - #define ITCINTEN_SHIFT 21& M; K2 W/ z% V$ h! K1 E5 y" x
- #define TCCHEN_SHIFT 22
X3 `% m, k5 Q- W* I: } - #define ITCCHEN_SHIFT 23
: Z; F5 P' w* F$ E - 7 H* a6 ^2 L9 Y) O
- static volatile int irqraised1 = 0;* @( w2 W. Y1 e
- static volatile int irqraised2 = 0;
+ X z( D# |( C5 d2 W1 b, T+ Y/ n - % _7 P# N5 a# u, x
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 H1 S) i; P' O; t8 d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 x9 X2 H! }, O2 _1 s" |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% r% g; x) r3 f- F7 s( T+ ~
7 Z s# o+ ?6 W! v' u- dma_addr_t dmaphyssrc1 = 0;
# G& g& H9 ]" O3 C - dma_addr_t dmaphyssrc2 = 0;8 t! c( n! |7 ~8 |9 j, W
- dma_addr_t dmaphysdest1 = 0;* ?$ q9 ?6 f% [: g* A9 I
- dma_addr_t dmaphysdest2 = 0;
0 J {( ]- k4 i w0 s) A+ ?. v. x - 9 b0 s+ j4 C2 ?3 C
- char *dmabufsrc1 = NULL;. T& q7 | I+ A4 Y. }: t
- char *dmabufsrc2 = NULL;
) I% C q! d! G: A4 t8 I$ m - char *dmabufdest1 = NULL;
, @( D# i* p6 Z( s0 C+ ^ - char *dmabufdest2 = NULL;
; W9 t U, }' r `0 q; u - 5 L) m7 v- l4 @1 o, ]9 ~) G. W& j, ?
- static int acnt = 512;
. s: U( w" @( m0 p/ m* Z) [/ C: P; K - static int bcnt = 8;
5 b" g! M( i% {4 b& v! J3 \ - static int ccnt = 8;
2 h+ g( B( D- E# f+ N" o- R* y - [1 }) }0 ]! D$ | |% M
- module_param(acnt, int, S_IRUGO);
X0 Z' o; @" e+ b4 T; H - module_param(bcnt, int, S_IRUGO);, E3 p8 A6 ^4 M( }4 A C! E
- module_param(ccnt, int, S_IRUGO);
复制代码 4 r7 o' w9 X( d6 i+ m
, {+ [3 }# b8 g& { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 D& m5 }; G& {/ M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
j' w; g: T% L* ? 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 }( `0 n$ o6 h6 R8 ?7 \' C) ]5 Z/ v" l. U7 }9 B
w& T( N3 o- p8 C& {
|
|