|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 ]3 ?6 R- F+ o% ^. ]9 I8 o
- [code]EDMA sample test application0 t/ S3 P1 S0 U2 R2 v
- /*
- u5 t9 s# a% ^ - * edma_test.c
8 d! G5 [* C& W4 d/ d6 S! K7 O/ J - *, Z A5 ]7 W1 W. R$ l, i* v {
- * brief EDMA3 Test Application
( o R* r% z, D: g2 ?8 j7 D - */ p4 i5 O4 [* u5 ~
- * This file contains EDMA3 Test code." }& r7 i# r! `, i- j9 h$ o3 Y5 [- Q
- *3 P _- n9 E3 n* D1 l
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ A7 o, V7 R& e" ]) m( f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 I& P5 F( S- U" v( j& G4 a - * TO CHANGE.+ J; j6 e/ j" M" U5 V2 `
- *# d+ g7 f2 p: K% E- V1 z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* L, c5 U6 I% I; Y7 Z
- *
8 S( l$ s, f5 f. s: Y6 f - * This program is free software; you can redistribute it and/or! T% G$ o# @. K
- * modify it under the terms of the GNU General Public License as
* k' l0 w1 b, @; l. N4 s - * published by the Free Software Foundation version 2.
7 Y) a8 T) W( G* t/ l* [ n6 t - *
( I) Y f& V+ A% C, ]6 }8 j3 V* F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! N- M3 n) f$ Y6 n; `
- * kind, whether express or implied; without even the implied warranty
2 r) U S, H3 y( L! T( C% ? - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% B) o& j1 j7 V2 r/ G5 q/ }$ v7 @ - * GNU General Public License for more details.. w# M9 R. ?" M( C3 G
- */+ @- n( T2 Q: U
- * b; b( R) N. d6 I! A0 x" k) ]
- #include <linux/module.h>6 P1 G2 o, |& S7 {+ d
- #include <linux/init.h>
{% }. t/ l1 r - #include <linux/errno.h>0 P! K" B- ^/ c! M! J. w7 X
- #include <linux/types.h>7 V8 ]: i/ J( y- J: w
- #include <linux/interrupt.h>
0 o+ ^$ }% P3 J - #include <asm/io.h>
0 I+ x; x3 S/ I6 C - #include <linux/moduleparam.h>
# Z4 Y: h; ]5 [; p# N" F7 i9 b2 o - #include <linux/sysctl.h>
3 W# |/ L2 o8 r- } - #include <linux/mm.h>
1 Y6 g1 p d! _. i- U) N* F) { - #include <linux/dma-mapping.h>
+ L4 {! y3 o" x) B4 F& }( M
. ]6 L _0 Z5 v) k5 s& [. v- @- #include <mach/memory.h>
' v1 D% ?( _) [. L# Z4 M! x5 y! E; w - #include <mach/hardware.h>! X U8 ^7 X6 j$ C1 p8 e+ n
- #include <mach/irqs.h> S/ \ N2 p- K; L& l$ `4 E" P: F
- #include <asm/hardware/edma.h>
* r q# u, ?; k - * N) S& n3 O8 q: R$ [
- #undef EDMA3_DEBUG
- n3 A. w" F: B! G2 A$ B - /*#define EDMA3_DEBUG*/6 p$ q% z8 [/ F
- $ {& s8 v/ z$ {( U
- #ifdef EDMA3_DEBUG8 t( S) ~$ p2 }1 M9 T; _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). e. ]/ ^7 y: S/ Q+ s: o8 l' D% B$ P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ s! W7 |& U7 G/ o, _, C! b Q5 i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 B W; }1 ^4 [- j9 i8 E/ v- u: V" U - #else* o! o: J- @- F
- #define DMA_PRINTK( x... )
N. D' ]5 v& k5 {( { - #define DMA_FN_IN2 U# W& M/ N9 o4 q2 i% {
- #define DMA_FN_OUT# l. k. f O# r0 s Q
- #endif% h8 R& G& k( e2 W. y
/ x9 N8 W8 p4 D4 G9 {: p! F4 i2 B1 L/ {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# @" w/ w1 [: I# x7 J8 ~
- #define STATIC_SHIFT 3) N7 Z, ]- ^2 T- y+ R0 O
- #define TCINTEN_SHIFT 20
8 n' Q$ J4 ]/ y8 x- q - #define ITCINTEN_SHIFT 21% A+ l* _% n/ E: h
- #define TCCHEN_SHIFT 221 Y x$ a8 R/ U1 \1 h- _) I
- #define ITCCHEN_SHIFT 23
, I% C& j9 @* q8 ?$ Y m
! @. l5 Z- M- Y& K% c- static volatile int irqraised1 = 0;2 @- E6 o4 K) }: N% \
- static volatile int irqraised2 = 0;; L+ w; V- b1 i; C
' J1 V' B9 V) ?: ^0 w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) U+ O3 T" K; ~" A# H5 y( h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" b/ T* N' M" ~1 H; ~- `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% z r! G. p! I0 q
- , h9 f8 h; F7 c' ^2 Z
- dma_addr_t dmaphyssrc1 = 0; r% l2 M. B3 \ |( U- P3 M
- dma_addr_t dmaphyssrc2 = 0;
U$ s! d! e" {8 a$ L( T( a" |# K - dma_addr_t dmaphysdest1 = 0;# Z, _: `, D; k$ \4 ~
- dma_addr_t dmaphysdest2 = 0;
6 y4 z) Y, o- n0 w( ~0 j9 c0 u9 h
4 P% ^3 s8 f9 \. Q& p2 O- char *dmabufsrc1 = NULL;) s1 _0 z2 ^6 @1 P
- char *dmabufsrc2 = NULL;+ X% O2 f0 {3 D1 A; m1 g, }
- char *dmabufdest1 = NULL;
1 [' o: ], z/ F) e: \0 H5 [ - char *dmabufdest2 = NULL;: i# k% L4 a7 X. @' ]
- * t) w& l% D2 F7 {" t M) S
- static int acnt = 512;! E. k1 u9 u: a# S
- static int bcnt = 8;
& J7 s; J8 h/ D - static int ccnt = 8;
6 ]' G6 L0 B5 k+ F- y8 c
) v2 {1 \# }! ^% W$ M7 `0 Z- module_param(acnt, int, S_IRUGO);
8 x( i+ |7 `7 s1 ]: t - module_param(bcnt, int, S_IRUGO);
/ U& {8 s& B& V. ?, G. _( w* D - module_param(ccnt, int, S_IRUGO);
复制代码 9 z- O) C) n! Y( W9 P E
) o9 s% t" @2 K! T3 U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- ]5 q- d" }+ M/ ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- Q- D. P# u1 k) D2 ^$ H d
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 N4 M6 @1 L( j8 N8 ^9 A: {" ~3 W0 Y$ c' j
2 F) W1 g% i5 a) \. h |
|