|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 `; V% V- O- w( z( Q( u
- [code]EDMA sample test application" R0 U+ E. i6 x5 I# T
- /*
0 b( u$ | g7 |) ^ - * edma_test.c
* S% V" j; b; m1 P - * x/ Z+ h# ?7 W. B3 e
- * brief EDMA3 Test Application+ z& p; d; j( {' e$ ]% R w
- *5 s" D3 H u1 r: u0 E1 @
- * This file contains EDMA3 Test code.
6 u5 X! i1 W: w8 X2 t - *5 r' @/ r* O% Y% j( d0 {
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( m5 a7 `- s" n3 \2 _! V$ Z/ K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 ^9 T: v6 A$ o& n5 V+ g+ P& o
- * TO CHANGE.
( D8 B9 X# d* p) }' u; Z3 p6 ] - *
3 r V+ a( t, V* V/ F2 T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
& H- ~! W; z4 D a, A. Y, Q# \ - *
( G( p9 B" L9 ~3 P0 \ - * This program is free software; you can redistribute it and/or' D" e! q( g! |: z' s$ D# u
- * modify it under the terms of the GNU General Public License as2 X5 }8 h6 g) C& T2 I9 U
- * published by the Free Software Foundation version 2.
$ m w3 n# |- \& L6 m% M! ?' ^ - *
2 O4 y2 l9 f. C4 u' _6 @- J - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% I% h& ?7 D$ k$ f$ G - * kind, whether express or implied; without even the implied warranty
7 P: P) V& N3 _. o; K+ b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 k2 j A1 E4 }# v. T/ M
- * GNU General Public License for more details.% e) L0 R" K- O( `
- */
. E* K1 h% y4 E; P( N - 8 n1 U( N6 z, F8 M8 P# d- o; i% x
- #include <linux/module.h>: W& t# q( P7 O( c. c# V
- #include <linux/init.h>
: B: q! w( A# Z$ A: _% j& | - #include <linux/errno.h>
6 d3 }) U: c P) r8 \: @ - #include <linux/types.h>
5 Z7 _ _( B" f* Z! [0 ? - #include <linux/interrupt.h>8 ~* b: Y1 `+ o/ y
- #include <asm/io.h>8 v8 P5 f8 _8 F& _# }3 m
- #include <linux/moduleparam.h>
5 s, S, @5 Q' w1 ^% w5 U. w - #include <linux/sysctl.h>
$ U, r! U! s: B - #include <linux/mm.h>$ h4 M, }$ y( A+ {0 O
- #include <linux/dma-mapping.h>
$ c; }8 a, D, `2 n) x$ B# v- b3 P - ' \, V. Q' c8 [* |, U
- #include <mach/memory.h>
, w1 {, N" V; N9 ?$ {2 i - #include <mach/hardware.h>
2 E$ j7 i+ M' j% V* a) H+ l. Z/ y - #include <mach/irqs.h>( |! R# W5 U9 [& h2 f/ \
- #include <asm/hardware/edma.h>, @5 w- Q9 [- f$ Q
- 5 u: {* r3 D2 f& m3 m+ J
- #undef EDMA3_DEBUG
1 _! u9 D+ x7 ~! E6 E* W) `" { - /*#define EDMA3_DEBUG*/
: f; q% O6 c' ~* m% m3 i - 1 U. N3 w, z0 G% B/ B
- #ifdef EDMA3_DEBUG( v( Y; D- h: M6 M/ H
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: }' x, O+ @' V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 t5 \4 \/ E8 ~- {$ }1 ? - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ M7 ~- s# b: H( D6 f - #else
( D- V: L; i2 ^' ?2 N - #define DMA_PRINTK( x... )2 A1 y) i, T. K' @' R
- #define DMA_FN_IN8 b& d( `9 x% c( W5 v8 B
- #define DMA_FN_OUT
2 Y0 _) t& q8 \" H - #endif
; c5 }8 J/ B, N. n - + I J5 q/ N: R# f2 t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& T8 B$ L {% I. n, k2 g- G; u - #define STATIC_SHIFT 3+ V9 c: W2 H& F6 T( D' W% U
- #define TCINTEN_SHIFT 20
- e/ S2 u5 n [6 n; P4 V W - #define ITCINTEN_SHIFT 21; ]$ z% k5 _5 I- m
- #define TCCHEN_SHIFT 22 o/ S: ]4 u. ~( J0 M9 L
- #define ITCCHEN_SHIFT 23# E2 f8 k e1 d7 [1 _
- $ I; D$ A3 ~. P M$ N5 X. B# J
- static volatile int irqraised1 = 0;0 n, L' Y( I/ U! K$ T% ]8 C
- static volatile int irqraised2 = 0;
S" i$ ^# o1 Q4 @2 o0 \5 `
2 M% ~* ]: G5 S c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 X% S0 u b6 S0 o' v( A - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ O; R+ ^+ j0 Z% h, r4 j
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ |+ i' z. H- q$ F% b4 \$ T3 m
+ d& [! Q; b& k* W- dma_addr_t dmaphyssrc1 = 0;, R* g% j# D) ?$ }' B
- dma_addr_t dmaphyssrc2 = 0;
# Z$ j3 M. f) d6 j1 @7 o - dma_addr_t dmaphysdest1 = 0;
# d: A2 P! i& r* m$ A) h: Q" k - dma_addr_t dmaphysdest2 = 0;
1 P' f9 Q* i3 w5 L: d# _" A
2 `) Y( J, [- ]! h ^- char *dmabufsrc1 = NULL;4 }7 T+ x8 t, O8 h. M' S
- char *dmabufsrc2 = NULL;5 Y( R2 W" m8 k; J7 M2 q
- char *dmabufdest1 = NULL; p4 F5 t, C8 M: h
- char *dmabufdest2 = NULL;- T7 y+ f/ ?" @& F- r/ |: F6 r
- 6 P! X) ?0 [/ X" c
- static int acnt = 512;
: t( Y7 ~& d; P7 S& Q4 R - static int bcnt = 8;" D+ V* Q ^* i8 u G
- static int ccnt = 8;
7 H3 {- x+ G- B: B& X8 c
7 [- y' d- D3 p" s3 \ T% |. _- module_param(acnt, int, S_IRUGO);
9 [( H) y/ }5 A8 y% r" D - module_param(bcnt, int, S_IRUGO);
% Z! Y* v5 A4 U0 _& h& ]! p - module_param(ccnt, int, S_IRUGO);
复制代码
% j2 r7 W4 T1 s* J, s0 I
" q# s9 }# d$ ~( p/ b9 @7 o4 ]' s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 v' G0 S. r# v0 Y D* V/ Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 E, O r0 M2 [8 _0 b' Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& x" q* x$ L/ ~
7 Q* H! |5 ?7 |2 U9 p+ t$ X+ M4 b& I
|
|