|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 k; I3 w5 ?) k
- [code]EDMA sample test application
5 t, X9 d' v: A1 T - /*
: _& B, _2 g) w8 Z, H - * edma_test.c
8 `' r* Q S* C! { - *+ h5 d' T/ G* X
- * brief EDMA3 Test Application
, m( ^& o# Y0 {0 s5 Q2 ?" | - *
5 z1 G8 N' m: t6 i4 B1 ] - * This file contains EDMA3 Test code.
/ z* ~7 Z4 P/ g. D1 K5 Z - *
' x; e8 ]% w0 {4 O- w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 E* X. u* J2 U% D/ M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 A& A. m2 ~; J: @1 a" X( s - * TO CHANGE.
$ D8 R$ _2 K: ^: i, T - *: ]% V/ \% P: [& v& J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( I/ p& h8 Z) \ - *
! A+ L1 }5 p: W; }' ^2 s0 |$ t - * This program is free software; you can redistribute it and/or
# E4 b. x$ A9 e5 [' G) o" T7 W& k - * modify it under the terms of the GNU General Public License as" H5 S% }! w8 c% D# u3 o1 c
- * published by the Free Software Foundation version 2.
# G+ [: V, F; I* F - *# v" F7 X- }+ T: E% ?! e! w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% L% D" Z* ?$ L. z1 B; q6 i/ Y - * kind, whether express or implied; without even the implied warranty
& v; A7 @' S! {6 N6 s7 F' z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! V v0 ^3 K. L$ K1 A8 s
- * GNU General Public License for more details.( e1 j6 _2 u- d1 ]# C; ?
- */
% P) o! L/ M4 q) H1 A# v - 7 {( R, N% v) b* i
- #include <linux/module.h>
6 n# ^/ }6 k7 K D7 w - #include <linux/init.h>
1 P t0 `- ]: H; T - #include <linux/errno.h>
1 h( w4 q2 u3 n* E# M" ~. u/ r# F) X - #include <linux/types.h>
- `2 u) c6 s! o+ d - #include <linux/interrupt.h>
: ~: F( R t; X/ s. m3 @ - #include <asm/io.h>
. |) N" O& T2 z. J/ m0 Q - #include <linux/moduleparam.h>( q5 k6 I3 X; ^
- #include <linux/sysctl.h>
, h6 Z& N" k& e" B' L$ @ - #include <linux/mm.h>
2 V' _7 v- q A ~! t - #include <linux/dma-mapping.h>8 ^! M7 O+ J+ N8 C
4 T% s8 z" `5 K& O- #include <mach/memory.h>
; V X1 k: r+ p9 P - #include <mach/hardware.h>
+ I) A" ~: H; M - #include <mach/irqs.h>9 s' S' b& l* w0 h3 D" u
- #include <asm/hardware/edma.h>
% K' u2 F3 r' ?6 c) a - 4 L# C" G9 y, _) F2 A; a& J8 L
- #undef EDMA3_DEBUG0 H; e5 l& K7 M( G
- /*#define EDMA3_DEBUG*/( L% I5 Z7 `2 r4 x
8 h$ R$ ~/ R( k& G( l" j- #ifdef EDMA3_DEBUG
" {' }& b0 ~2 H$ [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 @" C' @5 ^6 ]% s: a0 u. q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
h: A% z$ Q5 K9 c - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' y* [* j( _8 j- _# E- _$ ?
- #else
]9 f7 S! ~ i) u4 F - #define DMA_PRINTK( x... )/ h0 W+ j, ^4 H0 g+ s+ V
- #define DMA_FN_IN
. H" D1 y1 P$ D - #define DMA_FN_OUT8 R5 B0 m6 e1 Z3 `3 o
- #endif
; ~/ F. e/ \- p: G" I; N - 7 c3 t0 T# q: y9 f' E+ u
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! ?, u- o3 b" H1 k1 @. `/ |/ \1 F7 Z, f - #define STATIC_SHIFT 3
7 V9 I8 F, R. | - #define TCINTEN_SHIFT 20
& X3 A: c# Q( g6 S3 c. r4 |# | - #define ITCINTEN_SHIFT 21/ p$ v7 f1 d9 N Q* K7 r, \: h+ |
- #define TCCHEN_SHIFT 22! h# r6 B3 x& f2 I' W
- #define ITCCHEN_SHIFT 23: a8 i; g3 |$ W0 W4 J5 E
$ I! t5 ?* d6 @# }, Y- static volatile int irqraised1 = 0;' q( a# r1 y. x9 x* i) V8 H
- static volatile int irqraised2 = 0;( o# Z3 l: [1 c" X7 a0 i4 y: G
# M9 o' J4 h( Z' o6 r: A- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 s6 }" C# W* ?. C: ] - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. {- D# T& E2 [! B/ t - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* o( x; V* |4 |/ _
7 X- P$ t) X2 ^/ s& Y3 U- dma_addr_t dmaphyssrc1 = 0;) f( s, C5 h: E2 z9 i
- dma_addr_t dmaphyssrc2 = 0;; D, B4 m2 d8 ^
- dma_addr_t dmaphysdest1 = 0;* B" k% X8 l0 k0 Q& P
- dma_addr_t dmaphysdest2 = 0;) U0 t) b+ R* t2 Z* }3 T
2 n p8 _4 K- }4 Q; Y6 o" o, I- char *dmabufsrc1 = NULL;2 s! d% E+ U: V5 ?
- char *dmabufsrc2 = NULL;5 B8 U1 I6 F( E; b5 a7 L
- char *dmabufdest1 = NULL;+ W: d: A+ @) ?1 ?
- char *dmabufdest2 = NULL;# t) Y# F/ @: q+ G
- ( W+ i' [3 A- X! Y9 K6 s9 H1 Y0 r
- static int acnt = 512;
! s$ }- S `7 s. U9 z - static int bcnt = 8;
5 j h4 H: N4 i, T8 [2 k/ S - static int ccnt = 8;
9 k/ n8 c: K, a0 S/ D - 7 r/ c4 c) r0 p* A. ]' }
- module_param(acnt, int, S_IRUGO);6 M2 i9 Y8 d7 c
- module_param(bcnt, int, S_IRUGO); w( W- g( S: r- d G' k$ w
- module_param(ccnt, int, S_IRUGO);
复制代码 ' |" ?4 [+ y) G7 n
8 Q' x" G M, D, L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 P4 ^/ a4 m5 s% W/ n; harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 w( ^; `0 m5 `2 _# p4 g" k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. g& n: J- b. a7 U* Q! ]
; V7 ~* t w: [* a# C1 I- C! j7 m! m& s/ u; v5 `
|
|