|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # v4 W" S1 @' @! z! H
- [code]EDMA sample test application& b: n' M6 `8 {, q. d
- /*
4 d4 ^* V! b& J8 W& G - * edma_test.c4 p: Q/ M' P- }
- *
% t0 A4 E; J8 |7 f( W- Q: ~ - * brief EDMA3 Test Application* D( k# m& H2 D& R
- *! h3 z8 p/ h( C8 e: {8 k
- * This file contains EDMA3 Test code.4 R9 ]6 o! U* W6 Z
- */ W* n( [+ d8 I: U) I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ p8 G; X/ i5 \3 k a' ?8 Y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* }& |+ r! r+ k/ S) [ - * TO CHANGE." v6 j! j) H5 X$ N# n
- *
, W/ c* \2 F; N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: ~) f7 [, g2 e/ p) y: v - *
, }& w% N" D/ _" A: Z+ P! Z - * This program is free software; you can redistribute it and/or
' m7 ^1 }+ f( j. H6 }$ e& E2 F; |, J - * modify it under the terms of the GNU General Public License as
4 R; V& h: n6 `: ]* b. f2 c - * published by the Free Software Foundation version 2.
6 M7 p' S- y h0 S9 p - *
7 i3 x9 t5 {! j8 Y7 a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' v( j0 Z$ H' z+ Y% v7 b - * kind, whether express or implied; without even the implied warranty- z+ L% c9 m, h0 c9 d l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 ^# w; \) i h
- * GNU General Public License for more details.# g. j% Y) [) \' J) ]9 z" Z7 Z
- */
9 B8 l" h W, _/ B0 Y, A" {
; b/ p0 U6 C% b. @ V3 a: J- #include <linux/module.h>
8 k4 Z5 K- X8 U6 L2 ]0 ]& R7 m& o+ } - #include <linux/init.h>
5 n% m, l9 v8 Q* A - #include <linux/errno.h>
" Y/ H* v) V1 P; A - #include <linux/types.h>
" l6 Q8 z3 a. W5 c - #include <linux/interrupt.h>0 x2 M: r0 d2 `3 G' X% h
- #include <asm/io.h>
% f4 T: U/ C! Q" k$ A - #include <linux/moduleparam.h>
$ C3 k. S5 X+ c; o; U - #include <linux/sysctl.h>
+ k- k9 ^+ y/ C, Z+ _& W - #include <linux/mm.h>
" N/ ]0 b+ E7 Q% i# Z: p* U - #include <linux/dma-mapping.h>
2 a+ D% g( a2 ?' j, b - " [4 F1 Z/ K$ R9 u
- #include <mach/memory.h>
6 D' q Y) O# i* h, Q C - #include <mach/hardware.h>5 J9 h6 _' s1 z/ s' p; J: s
- #include <mach/irqs.h>
4 a* F. l+ e7 b1 l( R( h% v( H5 c) A u0 ` - #include <asm/hardware/edma.h>2 r* H8 J. {/ G7 `
- ) }/ u$ |( l, f. C0 \
- #undef EDMA3_DEBUG; P: w( e4 A; x6 x; R. t
- /*#define EDMA3_DEBUG*/
; g3 `, J! Z1 _. y - - W4 `2 F5 S. X. B# s! p4 D; J
- #ifdef EDMA3_DEBUG
* N) l% }7 ~9 D' k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), G( {* p* L" w! ~$ a
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 k7 _! U$ g$ F' ?8 _: J1 X) f - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" e6 B$ U7 Q+ Q+ C1 b - #else- b0 M$ k( k: \) G( D
- #define DMA_PRINTK( x... )
( [3 _$ L/ p: Y" S* Q" F+ V - #define DMA_FN_IN
1 `( O% h6 Y9 Z6 c - #define DMA_FN_OUT( @8 q3 m+ C0 P
- #endif
p0 W4 x0 S9 I- ~5 o5 k - 6 ? M3 }/ }7 P1 g( N% H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, ~1 ~) |3 s. @8 a7 g - #define STATIC_SHIFT 3
( D" B2 B0 a( r - #define TCINTEN_SHIFT 20
( Q0 x; I7 I% W" U - #define ITCINTEN_SHIFT 21
$ l, M; C. ~9 B0 \3 R* N# Q - #define TCCHEN_SHIFT 22
* ?! j+ n4 ?5 Z+ V9 S! `& w; N4 k - #define ITCCHEN_SHIFT 23 E7 z, V) K7 a& \% s
- ' j l% j$ v& m! P9 [
- static volatile int irqraised1 = 0;* ?9 ^8 x6 f( U# T+ u+ c) d
- static volatile int irqraised2 = 0;
/ S" @- |' r' {( l - 3 p& y" h0 w2 u) x; f J% P
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ U$ q# Z+ y J( c" Y9 X# D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( s6 P4 a* s: ~+ b; ? F" g' h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 O) y) M1 `2 F7 B' f3 G
- : R, W2 j+ y/ H& Q4 h9 v
- dma_addr_t dmaphyssrc1 = 0;
% Y# o" y1 I9 f. j - dma_addr_t dmaphyssrc2 = 0;
# n& @7 `+ ^9 p, t5 g - dma_addr_t dmaphysdest1 = 0;
" E6 ]# H# X* m) [8 S( X - dma_addr_t dmaphysdest2 = 0;
8 _$ T ? \' Q2 u$ {1 ^ - 8 w8 }9 Q1 H, a
- char *dmabufsrc1 = NULL;
9 z3 j& ~, X. j( \1 j' G1 {7 L! s - char *dmabufsrc2 = NULL;
( A Q5 D9 v! ?: l9 s - char *dmabufdest1 = NULL;
1 F; j$ v% i" p8 o) \ - char *dmabufdest2 = NULL;3 n- z o9 F5 F4 P& G
- : ?0 ?+ U2 O* W
- static int acnt = 512;4 W& V+ a' q9 Z* B
- static int bcnt = 8;/ k2 t y2 t& z% R% \
- static int ccnt = 8;) w" i9 U" E) ^7 A2 j. T9 ~
. t9 H( G+ w9 G& B! j* C- module_param(acnt, int, S_IRUGO);" P1 Q9 F) n9 p6 Y
- module_param(bcnt, int, S_IRUGO);! j+ S$ I+ \. O+ L
- module_param(ccnt, int, S_IRUGO);
复制代码
; b) w) V0 d i
& `) J6 |/ @$ a S" S4 s" l" m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' R' r$ I6 t6 i) z3 O* Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* u. o% g" Y# j4 C. n, @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ w, d/ V8 b8 d3 w% `+ F
3 _/ |+ W. x" ]1 s3 M+ y2 f; _
' y: @6 [$ L/ z' V! s5 H% X2 m
|
|