|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 H+ R) f% \( @8 b; H) [& t- [code]EDMA sample test application- H. v( u( U6 x6 x2 y# ?8 ^
- /*, N E6 v+ d2 _( ^ y9 s: L; m
- * edma_test.c
/ U* k+ ]) w: t7 B' |% Z4 d0 z7 E0 p - *
" r6 u# s3 |1 y9 k& T3 U* @# G - * brief EDMA3 Test Application# t$ {3 |; d* f+ b
- */ ]* x) K% Y+ q5 ^. I; v
- * This file contains EDMA3 Test code.. U" n- ~ Y" T( w# J7 q
- *
* c7 U2 v: J( I0 R. }) I, h! ] - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* z: j# {0 `# v: E6 j& h& X
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, l: x3 O6 {. t4 ^6 b
- * TO CHANGE.
2 l h3 \: t: D( O6 m( a - *6 P9 }9 x9 ^3 K' @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 V8 b9 `( x% T - *
+ `9 ?3 C. g4 m0 u/ z - * This program is free software; you can redistribute it and/or6 ]' H' ?# T/ R: k3 k+ ]
- * modify it under the terms of the GNU General Public License as' o; ~* v X4 E6 r
- * published by the Free Software Foundation version 2.
! w3 \* T H% ]& u$ }/ { - *- T4 y# Q: y: s( H$ e. B5 ~8 Z/ Q( K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' u4 S: V! c U. o% x: r8 Y6 ^" Q - * kind, whether express or implied; without even the implied warranty# } a# H' i( S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* E; w t9 e0 u - * GNU General Public License for more details.7 V0 ]; `( } B8 o! R h
- */ p7 k, R% \7 v9 }7 y
- % K R' @# C2 K6 A
- #include <linux/module.h>
2 q$ y& J s) g* B0 t) Y - #include <linux/init.h>
! X2 w" b, c3 [# j- Y) U/ |/ ]: { - #include <linux/errno.h>. |& a( |( H! x; T& [
- #include <linux/types.h>
0 _' g; I* j$ Z' U - #include <linux/interrupt.h>7 W, d0 h, a4 k6 \* y! X# @0 b
- #include <asm/io.h>9 S6 z* J6 D8 b+ b
- #include <linux/moduleparam.h>
9 c) V4 Y9 v2 R6 \ - #include <linux/sysctl.h>
Y& P9 ^% W( D. r0 G m0 w6 l - #include <linux/mm.h>
; U: @ O, y p9 b' \9 o3 n) A& ] - #include <linux/dma-mapping.h>
* I/ @; y [ s( ?, i' v - / X& U: u8 |0 n3 d
- #include <mach/memory.h>' X/ p1 P7 N8 }, V
- #include <mach/hardware.h>
2 W' Q/ b* L; h- y6 [8 i5 F6 c - #include <mach/irqs.h>
% k) D4 A L, F6 | - #include <asm/hardware/edma.h>- j; E/ `; ?) |3 h: y. q: Q
- , j h, s d9 f( [6 k# H! b- J+ g
- #undef EDMA3_DEBUG/ F$ c! Y5 G% S' D
- /*#define EDMA3_DEBUG*/
[. o& U' T! C# g
. r1 D |% Q7 D3 o0 n4 _- #ifdef EDMA3_DEBUG0 @8 g( ]+ \7 ]9 S. z: m$ A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" Y- J* `9 @& Z( s - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
`, s* t, Z' j* ] - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% U4 c% m; j8 M( J( `5 i7 ? - #else
' ]( ^5 }3 S$ P4 \" ~5 R - #define DMA_PRINTK( x... )
. _6 ?- v2 l1 T$ k* @$ p - #define DMA_FN_IN& i! M. r) H9 e8 B! o
- #define DMA_FN_OUT
& U8 [) P/ V, R- H# ^ - #endif" L, n) h) T- l: C
/ P* i& M3 y L0 ~9 `# ~- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 F* C/ K, k2 _2 y/ \; e6 d# n
- #define STATIC_SHIFT 3
" ?) K4 y6 p H+ R8 A+ B. l- L$ t/ L - #define TCINTEN_SHIFT 20! |* v3 W' b Z* n/ J) c# J! U
- #define ITCINTEN_SHIFT 21
W' o4 m! J3 W! h, b - #define TCCHEN_SHIFT 22( {" M) d: \# [* w
- #define ITCCHEN_SHIFT 23
& `1 q" d3 |* a$ l. R
y) A' L. l4 H* d% M) L" P- static volatile int irqraised1 = 0;( b: z: y6 V. Q2 l v2 `
- static volatile int irqraised2 = 0;
+ M j6 N: \8 k# D' {+ o+ N. v - 2 p- B+ `7 S# Y0 J* ?- d& Q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 B# P) m' \; H8 a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% {" p1 O" X9 M2 R
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: u K: A% P; ?% c1 N
- & @! b' W' x8 `; k) ^) L
- dma_addr_t dmaphyssrc1 = 0;8 |+ \# q- k& S6 Q2 |
- dma_addr_t dmaphyssrc2 = 0;" T5 w6 M: \6 [' o
- dma_addr_t dmaphysdest1 = 0;
$ m* _) e9 k+ ~! Q) t7 |! { - dma_addr_t dmaphysdest2 = 0;
4 K, Q, H6 C. Z8 g( K# [
, M: n( x5 q+ g: `- char *dmabufsrc1 = NULL;
+ I' |8 T+ r! O3 d, M! M - char *dmabufsrc2 = NULL;
$ K/ A% h, Q2 _3 } - char *dmabufdest1 = NULL;9 |& A5 o; o. a9 T4 t+ `
- char *dmabufdest2 = NULL;( p. t" _- Z7 }6 E0 r" B$ o
# I2 n% m) g$ `- static int acnt = 512;8 |% [ F1 a" l# N, } }5 |# q8 w
- static int bcnt = 8;
; L6 ]( s5 n9 x3 j f- q0 v# e - static int ccnt = 8; s( m. i5 K6 T7 r0 L
7 ~4 s; E' f* K" x; z) l/ [- module_param(acnt, int, S_IRUGO);' w6 Y4 x5 r) j0 G
- module_param(bcnt, int, S_IRUGO);
4 p4 `* g6 m2 |/ f( w - module_param(ccnt, int, S_IRUGO);
复制代码 4 |$ B) \. `% X
b3 ~; p ~: C! {- q3 X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) S4 y& ?0 B) m1 j3 s8 Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 g( Y+ @1 c `+ S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 E2 o& i4 \3 i9 S: p
. K$ s, f1 W4 O6 h4 K! m+ I1 R# j' M1 e3 J: c- o
|
|