|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 ?5 \* l( C/ t% Q a3 i1 b2 [
- [code]EDMA sample test application/ M0 ]# W$ C1 E
- /*5 X6 X R' C8 P3 W0 Z4 }, D7 C, r
- * edma_test.c
2 D( O/ D7 j ^- o0 h - *
! @$ l2 ?. E8 U k - * brief EDMA3 Test Application
7 ~+ G$ c1 y% Y0 G! }' f - *$ d' J; |4 R& U1 L0 `
- * This file contains EDMA3 Test code.1 P; n* _( d- O4 d
- *
4 x( }8 n+ P: H$ K - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: G7 `2 p B/ V! Q! u5 B& l
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; t* V1 _9 r# Z9 | - * TO CHANGE.
8 L1 Z' t/ E& C0 @ - *
% Y$ |+ z, q3 P9 ]3 }) D3 H( [ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ g; e9 g* n* W - *3 V3 S# o; a0 g# y
- * This program is free software; you can redistribute it and/or6 i( [: i: L0 O2 z; E
- * modify it under the terms of the GNU General Public License as. f4 {* a$ C8 \+ d$ u6 L
- * published by the Free Software Foundation version 2.
s6 J2 y; r/ ?4 Q4 N, |9 S: Z4 N2 \8 m - *1 k- K0 h7 z8 ?' e2 M' _2 c' \% s
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( C+ r4 h( G- \ A' u/ x7 E - * kind, whether express or implied; without even the implied warranty
; h6 Z$ c1 W+ @6 e* O3 ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) b7 _5 a& i! d7 C; _! Z - * GNU General Public License for more details.
+ D# d& w" K9 w! o5 q - */& x1 c4 E4 {2 q" v
+ C1 r1 Y! ?! t2 {: d! R, Y' G- #include <linux/module.h>
% n1 a4 ]0 J1 T8 V" n! f/ D - #include <linux/init.h>8 o- V+ M( u3 O- n
- #include <linux/errno.h>! c1 U" P! w2 `0 R4 F/ a7 \* C
- #include <linux/types.h>
7 `6 s/ a/ \" \$ |4 K' n - #include <linux/interrupt.h>
- y. D* ]: F$ |1 w - #include <asm/io.h>4 m% C2 }) w0 A9 I/ t; n
- #include <linux/moduleparam.h>
( {# U( t q. _9 ]$ U9 K- m$ V9 L - #include <linux/sysctl.h>- V4 [3 G+ u+ w6 g/ D9 x
- #include <linux/mm.h>7 w3 y5 ?, o4 r4 h& l
- #include <linux/dma-mapping.h>+ k. G! s& t+ B6 x8 R! ~6 S
- 8 U' `0 b+ j$ c& d& _( p2 |
- #include <mach/memory.h>6 X$ I* O# c, @, O- z9 l' M
- #include <mach/hardware.h>9 E" \ f/ r/ P, ?1 O
- #include <mach/irqs.h>
# c4 J# D' R5 g4 s - #include <asm/hardware/edma.h>
" u) Z4 j2 l0 ~, {+ w
/ ^$ ?7 j9 s' R6 F! M# O# y- #undef EDMA3_DEBUG4 Q" q7 T7 @5 m( H
- /*#define EDMA3_DEBUG*/( E; e1 D. S& Q/ L) V. Y( g
- & Y) ?" ?) l' ?( u
- #ifdef EDMA3_DEBUG
) s/ m. I- L( I# H4 R! G - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" I+ }8 S9 ~; \7 Z8 j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* n3 [" x0 o+ C3 v8 z( x
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. s8 |0 z5 ]) C9 K: r) I! ~7 P - #else) R& ~* c/ D$ [, T
- #define DMA_PRINTK( x... )* u5 @5 n r! j/ c J
- #define DMA_FN_IN
+ R+ X3 P& V/ b( n: ?" { - #define DMA_FN_OUT. q; D+ ^/ c& ?; A" u6 t
- #endif
# P" o/ X* V: d
' ], E! o. s; q9 X& L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 Y8 N8 Y/ O9 j6 i4 a - #define STATIC_SHIFT 3
2 C5 }9 o( l7 J/ L2 g( H - #define TCINTEN_SHIFT 20
( k9 a- k; ]" o7 z- `1 Q8 s. ^ - #define ITCINTEN_SHIFT 21
6 {- w8 ?: z# z - #define TCCHEN_SHIFT 22
: R1 b$ f) a' t3 t2 B - #define ITCCHEN_SHIFT 235 Y, l1 j6 ?- F5 U5 P+ L6 h
- , I9 r4 z1 @6 s& ~
- static volatile int irqraised1 = 0;& o* S8 u) Q$ I
- static volatile int irqraised2 = 0;
, o: W! K) ?/ K) y0 D6 F
; |% E, H$ f3 T' X8 x1 R0 ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& D* x$ \+ u! u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. L0 `2 p2 q2 e6 n6 S: s2 N2 D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 `. P1 y* o: L4 [! Y4 {
- ( Y# D$ P/ J6 W n9 h0 ~
- dma_addr_t dmaphyssrc1 = 0;
8 m% k# \# p4 v3 B+ F - dma_addr_t dmaphyssrc2 = 0;
# {7 W# z# Z0 X: A4 I0 m" [9 ^ - dma_addr_t dmaphysdest1 = 0;
, R7 Z: b' r6 g8 W' } - dma_addr_t dmaphysdest2 = 0;
- {. {9 ]! ]7 f' ~9 Y: q
4 |% X( b! u% t2 F- char *dmabufsrc1 = NULL;
2 Y6 a( a+ O. X' a - char *dmabufsrc2 = NULL;/ G. C+ `' g* P' B$ L
- char *dmabufdest1 = NULL;' u" I+ i E$ R
- char *dmabufdest2 = NULL;2 V; I T! O% Y, u. R' f( `( Q: e
& \2 E# g. c* ]. O Z- static int acnt = 512;/ S# r L+ |1 @+ Q
- static int bcnt = 8;. m1 S& g" ^* o
- static int ccnt = 8;
' E; t/ u! }7 a
- n! U# o' c1 a) J. w- module_param(acnt, int, S_IRUGO);
6 e" u$ }7 s6 Z) U - module_param(bcnt, int, S_IRUGO);! L" J: a z# u, l w) G( ]( d5 L
- module_param(ccnt, int, S_IRUGO);
复制代码 - h1 p! j6 W- k, I
8 b9 {) u W: K1 s9 A& K" P
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* e# z' v; G+ w% k4 Y" n4 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 t0 D0 e- q) F, Q7 p- y( I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% {. d* L; R0 s4 D; z8 t
) T: H7 m; S+ Z" ]% h
! A; z* E& N' D) _2 C2 H4 ~/ ^0 m |
|