|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ q1 z# T3 \7 c$ ]: Q- [code]EDMA sample test application1 m7 ?) y0 s' _9 s" E6 W
- /*) o8 D, d3 {3 z8 ]2 U3 t
- * edma_test.c
) A, E, q. L* C+ \" ?7 ]# I. V$ f - *0 z+ B) V d) K* e
- * brief EDMA3 Test Application h* I- |8 j# V7 c9 a# ^7 W) \
- *: u& I0 r. i7 \! z' }& Y
- * This file contains EDMA3 Test code.
0 n# U2 y5 h1 S0 Y, g R; D - *! x7 @% Y9 @% {2 h
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: b2 B) x% d4 m( n% \, d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT C: Y: G( s& S3 B e
- * TO CHANGE.
2 e$ q- W n4 v3 ]9 i - *
/ S8 ~6 D; j1 {! i6 e& V; s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 v5 t, G, v6 c& b: Y
- *6 G: f$ x- k( o" Z9 Z! t
- * This program is free software; you can redistribute it and/or4 t! g2 R5 W; Y! d
- * modify it under the terms of the GNU General Public License as- Y* F! j: u! M( Y& ?- R4 l
- * published by the Free Software Foundation version 2.: l% p, ]: z. I" C
- *" k" g3 G; k% d; V, d$ M1 |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 ~, Z+ C: h! Z
- * kind, whether express or implied; without even the implied warranty- }/ B* B& o4 [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! { I @, l% J
- * GNU General Public License for more details.& }7 v$ x! Z1 k, j2 `" E+ D
- */
! g+ D/ y) L3 K* t: _ Q - 0 L; m, w! f* q3 U1 j
- #include <linux/module.h>9 g7 v" \& K. d2 D
- #include <linux/init.h>4 N' D' N! U% K0 r
- #include <linux/errno.h>
4 n6 W1 W- C( D" ?1 c& l8 O+ c - #include <linux/types.h>
5 [* p! q0 C4 C5 u - #include <linux/interrupt.h>, A6 }! p( K' R
- #include <asm/io.h>
' Z5 k& p5 o4 E1 o - #include <linux/moduleparam.h>
' p% d+ [" c8 v4 ^( b - #include <linux/sysctl.h>
+ X& L6 t. M( \7 i& @ - #include <linux/mm.h>( C0 y0 F0 E* Y
- #include <linux/dma-mapping.h>5 a# b: ]9 x$ e; R+ G8 W
- " C& X. |1 E+ A- r9 m) A2 C( Q
- #include <mach/memory.h>$ ^/ i6 G6 [0 {* Y( H! o7 l
- #include <mach/hardware.h>
0 ~( E& D2 V5 c1 w ]2 k; t - #include <mach/irqs.h>. h% o3 z! t6 O: i+ y4 \- m! H
- #include <asm/hardware/edma.h>; P- q X$ [" l" U. w/ Z, Q
- 9 {) B; I3 D( f- b' L- s* V. W
- #undef EDMA3_DEBUG
: V f; @1 |) ^7 P2 X O( ~9 ]$ Q - /*#define EDMA3_DEBUG*/
H+ ?$ v7 m: b% _/ n) e1 ^
! i4 o6 R! P$ n; `: o- #ifdef EDMA3_DEBUG
) c3 O. g3 H/ a7 I8 w0 ?1 d, i; c - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# i% Z9 h: ` U) x( L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& F# n) n: R' N- `3 | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* P* r) l9 k( l - #else
* }; f3 `% v% g7 n - #define DMA_PRINTK( x... )$ ~1 ?) R- O% D* ]% L! N/ G
- #define DMA_FN_IN% F; m( i1 D3 x* y
- #define DMA_FN_OUT
% O L7 t# h( ^2 A" | - #endif! o9 m; b, n8 y' y
" B+ K8 Q; B/ o" c% R- E% {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 B' B$ C( K6 }2 b; ~) I! i s+ ?
- #define STATIC_SHIFT 3
+ h* w5 G- a/ h' W4 ? Y - #define TCINTEN_SHIFT 20. R) w! h- }% J: n
- #define ITCINTEN_SHIFT 218 x" L( ]1 K- w- N& k( v1 A
- #define TCCHEN_SHIFT 22. A% ^# m& F% W% O7 p8 ^
- #define ITCCHEN_SHIFT 23) V% J* m3 o& L3 |) v$ n7 z4 `
0 J0 {6 ?3 o5 y# J4 ~- d {- static volatile int irqraised1 = 0;, m' t, d. @; f& }
- static volatile int irqraised2 = 0;+ e/ A2 s; P) M$ A1 }' f
- : a- ]2 S9 e' |/ O9 ?8 R1 ?
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 J6 e" Q5 ^$ m$ s* j6 n - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) F$ P8 f" y1 @# w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, V1 r* M# `& I y
3 @ n" s$ l7 e- dma_addr_t dmaphyssrc1 = 0;( u i4 X' c0 g1 ^5 y" u
- dma_addr_t dmaphyssrc2 = 0;5 Q. T( t8 S: r0 I
- dma_addr_t dmaphysdest1 = 0;# d$ S. s( ?' g) I: V
- dma_addr_t dmaphysdest2 = 0;
; f! l" [$ ^$ v# Q" {+ J
( n+ t8 i+ B2 J% O9 `, S- char *dmabufsrc1 = NULL;
]/ _0 @# p% R: H% ?2 d - char *dmabufsrc2 = NULL;
' }9 ~) @) S) B& W/ b5 c+ H - char *dmabufdest1 = NULL;
4 A+ ~( W h9 s) L! D - char *dmabufdest2 = NULL;8 [. P% T3 y, r5 ?* K
- : e. v8 `0 ^! @1 Z. t# g
- static int acnt = 512;' j2 v+ d6 p8 _& Y4 M. Q6 L: U
- static int bcnt = 8;
, z9 G; U' y# \( g+ v E - static int ccnt = 8;
9 [3 j0 s0 \9 M* _" d4 z# h - 8 m: Y! R1 U( H2 R1 q8 v
- module_param(acnt, int, S_IRUGO);
% N. d) Y9 c s0 }% F) { - module_param(bcnt, int, S_IRUGO);5 E: a+ A" F2 {2 K
- module_param(ccnt, int, S_IRUGO);
复制代码
. B/ q3 P6 n& `, n7 |0 `: y* ^8 V, X+ U6 {* C* k/ Y" d R9 X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" Z1 ^* h0 ~3 Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 L% _0 ?9 ?4 \; `
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 j S* e( m& S, g2 x" L' q3 Q' w2 J* w6 j6 }( W
' c& F; E* m5 ] |
|