|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # c$ Y) N8 d! l2 e1 I8 l, A
- [code]EDMA sample test application
- n( D8 i' Y; K - /*
& |& C4 a1 y; |* m - * edma_test.c2 u' p6 x1 r) _( j0 R3 O
- *
! Z7 X/ J0 }* z) d) L; J+ ? - * brief EDMA3 Test Application
. G6 Y4 S1 S# b; H+ {' } - *
5 u3 A/ _% H- h9 q; _+ L - * This file contains EDMA3 Test code./ b" h. ?# ?1 a1 r% O5 z8 g
- *) `/ R' c" m5 z( z) b7 o. o' E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 ?/ m# N# A. t+ T& x3 T4 i - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( i8 d7 `" ^$ L! G, Q - * TO CHANGE.' l, k4 H$ W8 s8 T; r
- *
0 \, q9 R" F6 U- r - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 W, f! O/ q/ |" J0 N4 ] - *
& H. e I X3 K - * This program is free software; you can redistribute it and/or' k! Q6 V L' e! ^# w0 M
- * modify it under the terms of the GNU General Public License as/ ^/ \% j9 k& o1 a3 M9 w, Z6 r5 r, ~) B
- * published by the Free Software Foundation version 2.
D* w# J- \( Y. _. X0 u$ n/ G# w - *& f2 y# ^0 I! |4 `7 y- m
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% z- Z; V v+ k0 O3 G
- * kind, whether express or implied; without even the implied warranty
: L3 q8 l. t* J n6 i" v3 {8 ^( g - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 @5 O7 m* T* w+ n; d6 F2 p
- * GNU General Public License for more details.
6 ]1 a ]: p) B- f( J2 r: O5 y - */
' ]; \5 V5 i" `- n# n4 H4 q - 8 I1 H9 E* F, f i
- #include <linux/module.h>
$ b, l2 ^' V) D+ V4 I - #include <linux/init.h>
2 V0 z8 F2 n& j3 W9 `4 N - #include <linux/errno.h># U, z3 w7 u5 h' E# \! H: Z( S' s3 r: Y
- #include <linux/types.h>
7 G* X5 y' d! w! `0 j6 K+ S- W6 u - #include <linux/interrupt.h>
' P5 i+ a3 o0 C5 m7 ], @: | - #include <asm/io.h>
* H/ k' ^9 b! V, ?# l - #include <linux/moduleparam.h>5 H: W2 v& @$ v
- #include <linux/sysctl.h>4 o& G- a- d( @' u8 [" m: f' y
- #include <linux/mm.h>- i' J9 c5 O v" v
- #include <linux/dma-mapping.h>
( g, k9 n! J @( Q& ?! G, y
7 j. x/ L6 }, K/ G2 G4 D5 P. O- #include <mach/memory.h>0 ^ A# I! w0 l6 S* U
- #include <mach/hardware.h>" z4 v) v+ N+ |2 E: L1 h
- #include <mach/irqs.h>
7 V; B; L' O( O - #include <asm/hardware/edma.h>0 ]# P/ ]* h* \2 P6 {
- 4 C8 H7 G! d4 Z+ M5 w
- #undef EDMA3_DEBUG0 F2 e% [& z& e8 e9 ~, v1 B) l) F
- /*#define EDMA3_DEBUG*/
! @1 g7 @+ O2 B3 F2 h1 b1 y9 F8 }7 Y - 4 N }# ^6 G# ~
- #ifdef EDMA3_DEBUG/ _- \ e1 s( T5 G. c+ B
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 T. K7 n: K, t8 e
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), F7 K. R: q: x' P3 l3 ~- U
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 a% B, p7 w, Q) e8 [
- #else- x7 I# y/ p; x+ @, Y
- #define DMA_PRINTK( x... )
# i* M! ]0 c, E; r3 ]5 ~9 J - #define DMA_FN_IN
5 z" E) s6 \4 s {, w& D- ~, L - #define DMA_FN_OUT
( J; n( t, h( [4 m5 e - #endif2 P' R2 {# P! ]( c4 ^5 m
+ ]5 o g$ u/ G9 [+ ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 ?4 ~9 a l0 V, x* ^3 ^. L
- #define STATIC_SHIFT 3
( t7 Y1 V0 H, Z - #define TCINTEN_SHIFT 20
, F1 q0 p( L% I- |8 Y% R - #define ITCINTEN_SHIFT 21
`2 }0 S& X( u$ ` - #define TCCHEN_SHIFT 223 H, G+ y+ E3 V' S: M: v6 J: [
- #define ITCCHEN_SHIFT 23; e) L5 }, H) c, A \
- % W5 ~# J3 ]/ E- f4 ^. ~, j
- static volatile int irqraised1 = 0;
# o) \$ t/ a {9 t# R, d5 g - static volatile int irqraised2 = 0;; R! I& D% Z) E" U! {
- 2 z* ~: ] z( h% [7 W# i: L; I
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. H& }/ Q! ^# f# C* \; a! m/ C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 x8 ^/ n+ [2 X: l0 r0 G9 c# J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); [, j+ {, h% x ?6 x4 c
8 f: X& r0 Y6 X2 f) U2 k* e- dma_addr_t dmaphyssrc1 = 0;: s/ C+ F# m2 e& j$ C4 \
- dma_addr_t dmaphyssrc2 = 0;
7 b$ q; r& P0 v U - dma_addr_t dmaphysdest1 = 0;
" |0 d( y- A& w f - dma_addr_t dmaphysdest2 = 0;0 n" f( H, S, [& ?$ ~3 w" h
! m" f( ^" k/ ^4 _% X, ?! F0 ~3 q- char *dmabufsrc1 = NULL;9 x$ u0 \" t" J/ x
- char *dmabufsrc2 = NULL;
& f9 P' t8 s# l' [ - char *dmabufdest1 = NULL;* U" @6 G; G1 Y
- char *dmabufdest2 = NULL;
% n$ [2 t; k" C, B. y( L: d) D - # L7 v1 D8 c6 h5 m" v
- static int acnt = 512;
3 n0 T# ~ X1 Y7 u8 l$ z - static int bcnt = 8;2 v3 S R) ?7 A5 y+ z" y
- static int ccnt = 8;
) X: R" `- w% l* u! M4 B2 R5 o; G - 3 m3 D3 }" _) B* a' N; f
- module_param(acnt, int, S_IRUGO);& _2 m! O! a- Q$ D- k/ k, I
- module_param(bcnt, int, S_IRUGO);5 c) g2 D' b2 }- i6 i& e
- module_param(ccnt, int, S_IRUGO);
复制代码
& |- J4 I; m% k$ J5 ^: u
( {2 _5 G. F0 [% C* c 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) T9 q2 [5 T. H) s" m+ Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" K1 @$ S, A S+ v3 k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 k& T- T( |$ S' Z* b5 B
% w, O( k6 o) X* r% ]8 J
; \6 [5 i# |8 `2 g' H6 M T8 e* ^
|
|