|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 {5 p7 F1 m4 }1 j* l4 T' [* y9 _- [code]EDMA sample test application) `0 O+ t: `& n- h( S( F* ?/ P
- /*
4 U+ y9 ~7 e7 e/ s - * edma_test.c. \* f0 A7 ^! s) z$ r
- *
( D, {7 J3 Z" Z! f' J) j - * brief EDMA3 Test Application
" Y: ~) s* e5 o; w5 }& | - *0 q$ [& n( {4 g! w v, ]
- * This file contains EDMA3 Test code.2 u! l9 z0 I. I, M( q G* m8 g
- *! l) Y$ y+ }5 [4 N( f7 V1 v$ \) O
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: N) V$ [1 E3 H. }5 T
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! [' ~" R* Y: v2 D* D - * TO CHANGE.) G3 a7 @8 T) y* a
- *2 r8 L9 N( v; h! F$ h0 U4 J* U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: i2 Y$ x& X$ j( s- p' Q/ L: V2 H - *
: T6 M6 R# S! B9 `6 N - * This program is free software; you can redistribute it and/or
B+ o: {2 U! f4 |6 @9 S - * modify it under the terms of the GNU General Public License as5 n- {0 u% U2 b: J7 p9 c" I1 K
- * published by the Free Software Foundation version 2.* u4 n0 L* m7 N* n' h# ^
- *, A& x8 L: R! t' |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 ]& x+ Y1 N7 I& s" g4 X/ h# w6 u
- * kind, whether express or implied; without even the implied warranty( }4 b% l# ^' A* L3 N
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 W7 b0 M* {2 j; Z2 _' F w6 M - * GNU General Public License for more details.* F- }3 R, `& l3 V9 g& a1 F6 t+ B( t! |
- */2 p" m. T. ^ s8 l0 K3 ~
- $ }8 f+ Q( R+ [9 u
- #include <linux/module.h>2 H* ]8 H6 h) W0 R
- #include <linux/init.h>% o T* F2 a! h. J+ B
- #include <linux/errno.h>
& }- J7 c" g% L$ o - #include <linux/types.h>
$ J! b3 K' I+ Y4 @' U& D5 @" ` - #include <linux/interrupt.h>
' e- w, s0 ]: K+ d9 } - #include <asm/io.h>
D. v: g: R% V* b - #include <linux/moduleparam.h>, u; J# j0 e0 y( E1 M+ F) u" F/ a. A$ F
- #include <linux/sysctl.h>
% z* f5 p! _0 q3 r- M( @/ \- x0 Z - #include <linux/mm.h>
; t7 J" i, s0 i$ F7 A, ]( U! Z - #include <linux/dma-mapping.h>
: V5 C' C' h9 R( r+ V
0 w1 b3 a3 z- O- #include <mach/memory.h>0 d c/ a! z$ g
- #include <mach/hardware.h>
# {: I9 ~# A" W4 U" `1 ]. J - #include <mach/irqs.h>
8 [% D8 Z N2 a) f. v# b6 n - #include <asm/hardware/edma.h>
. i1 g9 Q k. N' v$ n f - 5 \ \% m; ~! v( f5 b8 r' r
- #undef EDMA3_DEBUG
' a9 `& s" e, h6 t4 ?/ w$ [3 T - /*#define EDMA3_DEBUG*/9 E. J, H% h9 M5 ^; U4 j( W
8 ~8 |6 L& Q% F# H- #ifdef EDMA3_DEBUG
& u# ~5 c* t7 S% f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 ?' O6 \) C. F# N - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& z3 r% F' G" I6 e$ _
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% E# c' C5 E) `& r; \ - #else$ G, I+ r q: W5 _3 n
- #define DMA_PRINTK( x... )
8 u) z1 B0 o% f6 t1 v - #define DMA_FN_IN
7 z2 p7 R# S+ k: ~8 T& V1 t - #define DMA_FN_OUT& K, A: V: K& `8 K
- #endif5 p1 C# o1 W {* g+ K% [
- , P1 Z5 C% |( H5 E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) X! _. Q- u8 H# Y8 P4 {: `
- #define STATIC_SHIFT 39 n! v- F' R2 r( A0 L
- #define TCINTEN_SHIFT 20
1 j7 e8 ~- L: ]& e( t) C6 Z - #define ITCINTEN_SHIFT 21* b1 c2 _: D+ ]' `, Y' [
- #define TCCHEN_SHIFT 22
( s* V# {* N4 T" ~( l0 Z7 m& C6 [1 m - #define ITCCHEN_SHIFT 23
# }7 \7 h5 \( n4 P, R
% E' O M0 J2 y; u3 h- static volatile int irqraised1 = 0;
. d% E& j0 i/ Y) z - static volatile int irqraised2 = 0;6 ~$ ?; \' `9 @. i& A' f) O1 r
- q# r; b9 D. F) \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 B9 F; L/ {" M9 [) q8 c$ z - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' T7 G2 z8 z _) L5 i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ K/ ?! N- K4 d. @! @6 f5 y - 5 y2 J- k9 s+ b5 ^0 T) J- n4 h
- dma_addr_t dmaphyssrc1 = 0;
4 Q$ e, y$ N: n) W - dma_addr_t dmaphyssrc2 = 0;6 S. H' }2 q& p$ T; y! T
- dma_addr_t dmaphysdest1 = 0;/ L, Y0 N. G8 i
- dma_addr_t dmaphysdest2 = 0;
5 d: X) q1 O$ ? - 8 H# `9 q) F) C `/ r
- char *dmabufsrc1 = NULL;
. M4 _' J# }& f% s - char *dmabufsrc2 = NULL;
% [1 o& L" ? r" s5 X - char *dmabufdest1 = NULL;
4 k0 N6 @$ J+ O. g8 K/ [+ w& B' Z - char *dmabufdest2 = NULL;
0 n+ Z5 }$ V- g - 8 H2 ]6 @- y# ?' Z7 ?: {; ^, L
- static int acnt = 512;
" r$ r& z% q" T- Y5 I! \# { - static int bcnt = 8;
+ N, y% e; K) o - static int ccnt = 8;
6 @5 ]# W1 b D, ~; L' t% G
0 ?1 m4 X! L& g: e- module_param(acnt, int, S_IRUGO);
1 X. ]+ R! {5 @3 f v - module_param(bcnt, int, S_IRUGO);
& R2 ^ u+ Z4 |3 q6 n - module_param(ccnt, int, S_IRUGO);
复制代码
" `4 K, C w+ w# M* r4 R/ }3 ^; P# _6 {, b4 I9 R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& k, J# {$ A2 C1 P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, O, A. v7 A! ?$ }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 I! W) Z8 O* `
9 Z6 ?4 D! [7 c$ l. S* y' C+ x
8 q, N" P9 ]/ u |
|