|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 C+ }0 z7 _5 s' }- [code]EDMA sample test application
# p7 s' T7 g3 ]) A - /*
1 N2 f/ B' ?- ^ - * edma_test.c/ O) e/ T- [6 Y0 Z! a" F
- *
. c: i( c" e* t3 S1 x, | - * brief EDMA3 Test Application/ J6 O6 L' p. R+ h5 s- ?4 d) x* {
- *
! i3 ~ B1 v6 e5 x# G* F9 J - * This file contains EDMA3 Test code.
0 k5 k }9 q2 ~. I+ C7 f - *
4 l k" U6 H: @4 l5 Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 G \* o; U8 I/ B6 G+ R; @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& W7 A+ C6 z( m' s( `$ h w
- * TO CHANGE.
7 L$ b# F! j) ^( K3 e& h7 ^! y1 N4 L - *
* i, i: E" c, C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' U3 d4 \; X" O$ I3 J& i
- *, h2 i5 ?2 I6 E, W$ H
- * This program is free software; you can redistribute it and/or
: s& X5 z0 W9 {, F0 ^ - * modify it under the terms of the GNU General Public License as8 h* K/ K9 r. z& ]; I
- * published by the Free Software Foundation version 2.
( y! r8 x+ w1 B* ~9 L4 A4 V - *
8 F5 s/ J! Y0 j# } - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; y7 K& O1 o, v" ?$ P. W6 q - * kind, whether express or implied; without even the implied warranty2 M1 Y. H& u6 C* X8 }" L) k
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 h* \* v: D; X( U8 R3 K - * GNU General Public License for more details., @- f# m4 x$ _# a8 \
- */8 t5 b. C! ^/ e3 c# U, m
- 8 a6 m: S2 x& f! I3 }
- #include <linux/module.h>- i7 j2 W: s. }- t4 K+ P; w
- #include <linux/init.h>7 f/ T1 p; j6 l: Z5 [
- #include <linux/errno.h>
- G. Q# }" {6 P7 ] - #include <linux/types.h>: ^# i+ K* c. N$ b
- #include <linux/interrupt.h>
# R$ T1 e+ l/ |( ?. T7 @1 n7 R( i - #include <asm/io.h>
! o, M V+ D% \ p* R) a8 I - #include <linux/moduleparam.h># S: Y3 t) X' |' b1 ~7 e2 I
- #include <linux/sysctl.h>
* V# Z0 p+ [2 w+ W - #include <linux/mm.h>
9 @+ |' v4 Y0 w& V - #include <linux/dma-mapping.h>
7 E! ?( {/ M7 P& O - : u% i f8 Q* x: {
- #include <mach/memory.h>
. f/ z( v" Z) X- G- B$ n - #include <mach/hardware.h>- l f' H9 @& j) H5 J! \# O/ w
- #include <mach/irqs.h>
! s1 o) Y& K2 ?0 \$ }: c+ ]2 ~ - #include <asm/hardware/edma.h>
$ N* z/ ~' R6 n. d8 g - 1 t9 T# S' E# F$ Q& o5 H
- #undef EDMA3_DEBUG. N8 ^$ T. p' j& W, ~
- /*#define EDMA3_DEBUG*/, N$ x2 J+ z' g# F" Y5 D
- 3 y4 b" R0 H- F
- #ifdef EDMA3_DEBUG0 M: P2 I4 Z" ]: J5 y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ Y! h# E2 x3 ]1 P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 q) L# J0 R3 D" m/ p
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* D( ^& v) g* X6 p- }/ w+ a1 e' M
- #else) k) q% R d5 m% z
- #define DMA_PRINTK( x... )
. [1 E$ y* t. Z4 y& P- G - #define DMA_FN_IN
+ T! j- U& Q; \1 K" y6 Z - #define DMA_FN_OUT8 G* y+ }. A% x+ M( b0 p
- #endif
% j8 D, C3 I0 P' | - ! O, T3 P: I7 H; y4 C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& y/ M; b! c J# z* h5 t
- #define STATIC_SHIFT 3 p+ y7 D# T5 j5 R
- #define TCINTEN_SHIFT 20: {% J1 x; X5 ^1 I" m
- #define ITCINTEN_SHIFT 21/ w5 r% b0 |4 m: O
- #define TCCHEN_SHIFT 22% c* G6 n6 A0 f" l) \+ ]1 e
- #define ITCCHEN_SHIFT 23
8 A% w4 G i& ~! `( U% z! Z
1 @- w) U1 c( ` N: _- static volatile int irqraised1 = 0;
4 O z0 o5 l! [( q; }' Z - static volatile int irqraised2 = 0;
2 C* a# n' _5 q( l% x' q& b& o7 M4 D
) ?6 @- v- u8 q: C, ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 I/ D0 K4 e& Z$ E
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! s) ]; X$ \ J5 I+ ~( H
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) m) A3 V% i+ m+ v
* \$ ?9 [0 p3 l& E2 c: z- dma_addr_t dmaphyssrc1 = 0;& h) R3 A- V5 r& w- O( h$ o. K" n- l
- dma_addr_t dmaphyssrc2 = 0;
/ B+ P) Q$ y/ d- {5 L# B# K1 p; X9 I% ~ - dma_addr_t dmaphysdest1 = 0;1 ^" }8 I& |* C; A' g' M
- dma_addr_t dmaphysdest2 = 0;8 a5 n- j* Q5 \
- - v- M( ]' S& Y W8 Y
- char *dmabufsrc1 = NULL;
. L2 p" z* X2 N4 K - char *dmabufsrc2 = NULL;+ k. V$ V. \+ b0 g) z% _
- char *dmabufdest1 = NULL;2 w& G# \) F- T7 y# G
- char *dmabufdest2 = NULL;, W# A3 _, H. u: c5 C( A6 J7 D$ v0 S
- & i' v# c4 R/ G! m' h
- static int acnt = 512;
# m* }3 {8 |$ { - static int bcnt = 8;( S2 n4 x, l, Q1 b$ m$ {
- static int ccnt = 8;
# {. v1 m" m6 @% t5 i; P5 h( n - % @' |$ m2 l5 Q5 x! V. s
- module_param(acnt, int, S_IRUGO);
/ G9 K1 n$ ^% d5 Z - module_param(bcnt, int, S_IRUGO);
Q0 O' M: k! w `1 b% G. w - module_param(ccnt, int, S_IRUGO);
复制代码
; M8 ?" `8 `- c4 `1 |
7 S( L# o3 i: L! y* x( L; i } 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ t2 j6 t! r9 w) O x. @! Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 n% l' S2 z1 j) r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 I0 H1 N' N( b
, y. U9 b% k, }8 U6 w( o' \4 Y
4 n1 _, \, R3 M+ M# V
|
|