|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ j- ^$ c9 x9 [. i8 u3 d- r0 k- [code]EDMA sample test application
; f/ [ f! S3 f4 P; K- k% Y9 z; e - /*
3 u6 O. F. W V7 i$ l - * edma_test.c' o4 [. y9 o a: a/ d
- *+ B \8 T% l% d7 Z: X" I
- * brief EDMA3 Test Application. z" k; n6 V+ S2 j8 F
- *3 X! k% K- \6 O
- * This file contains EDMA3 Test code.
$ _$ b* B9 w! e2 ?, U - *; ]* }, f# |: m& E7 f6 x
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- X2 ~! B) ~7 K, P. ]5 f7 B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% |; r3 f' }, X! b' c; K - * TO CHANGE.
A5 s/ U. \. n8 r5 k7 t V - *. v3 C. M( A) n
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ D3 L5 C6 e' F- F
- *
8 N$ ]4 J' t" c" L8 H9 f - * This program is free software; you can redistribute it and/or: o% h: ~# l( L; W! ]8 z M
- * modify it under the terms of the GNU General Public License as: H) ^7 Z2 Y% O( i# ]& S L
- * published by the Free Software Foundation version 2.
9 }7 F! W! J4 s$ [& C$ p! ?6 V* z - *# }8 ~, \1 K$ G; r& j6 c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" ^6 O% W. s6 R' m F) {) L1 W
- * kind, whether express or implied; without even the implied warranty$ @; i8 [* u$ h
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 z/ L. W/ f" _0 n& K" ~7 E: [
- * GNU General Public License for more details.
% i6 [$ a! T# ~1 o - */
; {# I$ |, _3 F& A% g5 G- F
* c' U8 j$ j% l* @0 Y% O2 p# }% w- #include <linux/module.h>
* }8 `# g d" j. }, m, l% j: P - #include <linux/init.h>
! q/ j J7 }0 E' K4 @$ @/ J4 r - #include <linux/errno.h>% E$ }) R/ F+ o7 N4 [
- #include <linux/types.h># z8 G( b3 h8 z2 g
- #include <linux/interrupt.h>
: z& H3 v& y' D6 ~5 ^5 R5 i - #include <asm/io.h>
# i) }+ e. V% @5 P2 E - #include <linux/moduleparam.h>$ b0 n4 L4 J: Z0 m
- #include <linux/sysctl.h>0 ^1 A5 R4 q$ N3 G: o
- #include <linux/mm.h>
0 D/ W3 ]( U8 h) j$ Y - #include <linux/dma-mapping.h>
: E3 E' J. q# I4 K- l S - / b% ]# K0 ~' G; {' }
- #include <mach/memory.h>
$ f6 C2 D2 Z. Y - #include <mach/hardware.h># w5 B- r; b; i/ t
- #include <mach/irqs.h>. q: C! n& T' u: z9 T3 \9 t
- #include <asm/hardware/edma.h>
0 ]$ f% M! g6 ^: j/ V2 S% ?
. Z! J7 k6 U1 b' }. W1 N- #undef EDMA3_DEBUG
6 }* q \1 c7 \ - /*#define EDMA3_DEBUG*/
8 ?1 X g6 n) [
$ S) `5 `. l! O5 ?; D! ]$ W- #ifdef EDMA3_DEBUG
1 d; ^( y- h4 H: w6 l* V! j - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) r0 c: e W# a) c# m8 }/ C/ x; l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 G( M& r8 j6 K, i3 W8 k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# ^- e+ ~. k6 {1 E - #else; _! Y5 R2 `8 P
- #define DMA_PRINTK( x... )
# T7 ]; u1 W6 m - #define DMA_FN_IN
& _; v+ P" c q: [! y( m4 D - #define DMA_FN_OUT3 Q# \2 \& [# b ^; q* i$ B# V- u
- #endif
! f9 ]7 k) ~ e; _1 S. T9 | - : f. R/ K1 d. o) J# w& J
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( o% `& h3 k4 d# M3 u4 G$ B
- #define STATIC_SHIFT 3- v# ]) c! h- ?& B( _& A
- #define TCINTEN_SHIFT 20
L0 b* |0 v7 X1 d - #define ITCINTEN_SHIFT 21
E! ]8 c6 N1 ^+ v& t1 x1 {: M/ N - #define TCCHEN_SHIFT 22
, i6 M3 d( b3 _ - #define ITCCHEN_SHIFT 23# ^7 f9 E! ?0 A5 _
- # A5 D, J' p6 ~1 W
- static volatile int irqraised1 = 0;8 p: D& M! q5 W% F
- static volatile int irqraised2 = 0;( @6 _# ?% z! E7 h4 s1 [* F
' w, N! c; D# r# V% B' g- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 `- A# r1 E- m4 h- M Y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% p9 Z* ]* W0 D, F - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& b! @9 O$ t. O0 f& f - % _; x U( M# v! G7 e+ i2 P
- dma_addr_t dmaphyssrc1 = 0;
0 I+ X3 o# _2 c! w& y# Z& Z; I - dma_addr_t dmaphyssrc2 = 0;1 ^7 r' z7 \; w4 ?
- dma_addr_t dmaphysdest1 = 0;
4 {8 l3 D6 H- L1 L6 | - dma_addr_t dmaphysdest2 = 0;" }5 s% ~3 R {, a6 D r
- 3 I2 C7 |( D$ i! U
- char *dmabufsrc1 = NULL;
4 W+ n7 e9 k% }7 {% {' {. k - char *dmabufsrc2 = NULL;0 \& h, H" i1 n6 C/ \7 t. k% G, L
- char *dmabufdest1 = NULL;2 p4 `; p |! n% i& Y9 w! K4 j( a( R8 }
- char *dmabufdest2 = NULL;
1 E- G) r8 y+ t9 h - ) I6 T$ l: l6 Y: C# J6 p( K
- static int acnt = 512;
& ~# ~8 {4 ]4 H- j3 x0 @' o - static int bcnt = 8;! C, T9 N& t! h- ]
- static int ccnt = 8;; G, z, H! D, ~" y: ?& m j d
* s. @/ r' l6 {, V- module_param(acnt, int, S_IRUGO);
# |4 n0 A/ P. F% s' s" o4 v - module_param(bcnt, int, S_IRUGO);
1 d* r, d4 {" ?& ~: m - module_param(ccnt, int, S_IRUGO);
复制代码
7 h o( r. @' {7 Q6 \6 b# q$ m1 j% C _& c; H! Z. y3 ]
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* H5 D1 Q; N" a) D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 P$ g" U) s" l5 ]. J- o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 N6 ]7 l. u% r! b+ v, D3 ^
6 w- O% j+ z- v+ ?8 B. \
1 W, t" F/ n( v1 l9 k& J |
|