|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
a% n* X% V2 _- [code]EDMA sample test application
% f$ p( j, p' ]* Z8 a - /*# a( ~0 s! R |6 v0 Y+ D/ T& B$ c% {( m
- * edma_test.c
/ e" ~! p) d5 n/ I - *( t/ h0 ^+ H E
- * brief EDMA3 Test Application; J3 `( v& | ?* }# R
- *
1 l0 p" m9 j3 x - * This file contains EDMA3 Test code.
3 f2 |8 A7 X+ g - *0 C0 B# n# y6 h) R2 S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" s" H/ W5 U' j* o" s; e( R- X
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT N4 t4 m2 t: @- E0 `6 e
- * TO CHANGE.
6 N8 l9 g3 z: i2 v! i% u/ ]* a - *5 P) U) ?. f0 \9 Q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' Y. i2 G. Y5 Y. p- ]( O
- *
, k; Y# \6 [1 P9 M) [4 {2 Z7 k - * This program is free software; you can redistribute it and/or$ O1 |- V+ ]3 P# E7 N
- * modify it under the terms of the GNU General Public License as
! Y6 g. s8 _# V" z/ X - * published by the Free Software Foundation version 2.' Z. W1 @! Y( D2 f7 Y, p
- *3 n" f7 Q4 d) t+ g( \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& ^6 y( _. a/ L! d$ o @9 @
- * kind, whether express or implied; without even the implied warranty7 z! B& n, h* Z7 Y" T+ o- n( l, e
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 W) A) X) q0 p) K; R
- * GNU General Public License for more details.4 }# R6 e) _. M; g. i! N0 R
- */
+ i, w0 [4 w1 Z: b - & _% o8 n3 [" x: ~' p
- #include <linux/module.h># x, N6 p: u- @- q, |" X: W
- #include <linux/init.h>8 U H% C* d h, l& i% F. n$ c
- #include <linux/errno.h>8 i) k! ]7 W' a/ H0 J3 L4 N
- #include <linux/types.h>
1 L5 h' E, r+ ^. K* A - #include <linux/interrupt.h>* ]. v, D* d& C, ]" H5 ~
- #include <asm/io.h>4 ~* \, r( s7 L; B, i; X4 \& X/ q7 p
- #include <linux/moduleparam.h>
r7 D# S5 U$ Q0 j4 j7 C - #include <linux/sysctl.h>( D6 u/ c9 t; X6 a
- #include <linux/mm.h>
/ B# I1 ~' a, q4 Z - #include <linux/dma-mapping.h>
: y/ r. h! \: S
0 T9 A( b' L2 u# ~6 j- #include <mach/memory.h>
. |6 n% \. J2 Q5 Y9 A - #include <mach/hardware.h>: I, b! T: `) v! C
- #include <mach/irqs.h>
5 O/ m% t P" m - #include <asm/hardware/edma.h>
' B& O. a8 j: h6 o( v - 4 i; ?+ R7 O/ H4 T0 X' K3 P
- #undef EDMA3_DEBUG- b* J/ b& b5 \2 m4 n/ o7 t' ^
- /*#define EDMA3_DEBUG*/* ^8 f! L# q ?$ |
- {- F+ I: G. D; ~7 }- #ifdef EDMA3_DEBUG
1 ?1 s: I9 j) z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 Y# Q2 }7 i$ z( }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; m6 O8 k/ P0 j. w# M- D - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" B" b2 b; H+ p; W5 G) J6 Z4 {
- #else- p9 u4 k$ }; W: ?
- #define DMA_PRINTK( x... )
& O) ]6 n# Q( ~1 X - #define DMA_FN_IN
0 z5 t( B2 B. Z) L - #define DMA_FN_OUT) B0 F/ ^" p* p0 N( E' Q0 J8 c
- #endif
6 Y: D9 F* V% S# j5 E/ k
5 L$ G5 l. N8 P* v7 _. C- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- p/ ~ L+ U6 U& H - #define STATIC_SHIFT 3
- p$ p: U* D1 C k" b. r - #define TCINTEN_SHIFT 20
+ K. X7 S. I8 G7 m ^ - #define ITCINTEN_SHIFT 21) a) F! S# B& W, `, z# N# X
- #define TCCHEN_SHIFT 22
. u# Z5 }1 Y) U5 L - #define ITCCHEN_SHIFT 23
1 x, V( t5 ]' ?5 t; U$ @, {/ ]
8 v2 A! }( g# {. a- static volatile int irqraised1 = 0;
# m( f/ \, a! v/ O* z7 } - static volatile int irqraised2 = 0;
' i y5 A6 K; H. v - 7 H3 B8 w2 ?8 I+ p: e5 T$ ?
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* A( I5 P+ d1 ?1 o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 N; `# t! R1 L% c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 Q7 O- _' Y* F4 e i4 }1 f# \
- 1 m. `' E2 }7 r
- dma_addr_t dmaphyssrc1 = 0;! r) u; s- S' l8 g5 c
- dma_addr_t dmaphyssrc2 = 0;( I4 ^1 }! }5 ]/ K( J: G) D
- dma_addr_t dmaphysdest1 = 0;
% S/ {( {8 L. v r/ ~) { - dma_addr_t dmaphysdest2 = 0;: U3 }2 P9 o1 o+ z
- : _+ E2 q' |, S5 p
- char *dmabufsrc1 = NULL;
9 y" [6 g9 r n3 X8 j - char *dmabufsrc2 = NULL;) j4 O j+ f, A$ E
- char *dmabufdest1 = NULL;, z4 T& ~" q4 I" G2 R
- char *dmabufdest2 = NULL;
! M3 P. l, L( S _+ K( {
# I' e" q- Q6 p8 c+ L5 I! j- static int acnt = 512;
! v& \' N8 z+ Y, W% _ - static int bcnt = 8;
" w2 r8 ]" M- }! D4 N/ z! S - static int ccnt = 8;
" n/ V8 w+ a; j - [4 E8 i0 Y5 ]* s
- module_param(acnt, int, S_IRUGO);
/ p* r: ^ N! G - module_param(bcnt, int, S_IRUGO);7 U6 X# h8 e# y5 F r
- module_param(ccnt, int, S_IRUGO);
复制代码
: t, G0 d% x% U8 ]; M/ {$ |' F6 `9 M: Q0 M* {$ j
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" ^" [. t1 [& `* H" {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 l5 c3 x4 F1 d( u% S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 W! m* c" g7 h( q- [! A
4 x% I, j7 ^4 T! ]" B" x5 f& r6 H" H$ q: d; O, K6 t4 }" B
|
|