|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% V, z, d) N% P5 I, h( v* o4 {- [code]EDMA sample test application) _; b/ A8 X* J
- /*
. n: ~* Y' c y. u+ A4 T - * edma_test.c
) N# F8 O; P* Q. z* _4 L - ** [2 u/ j: R+ n) e( z0 b; {; N) B
- * brief EDMA3 Test Application8 h# ^/ w+ d% h: D3 P1 [
- *
. q$ z4 Z* P f6 d( x: q) V1 B - * This file contains EDMA3 Test code.
/ n2 D E' f% ?) @; i Q - *. o3 a4 b+ l+ Q0 B/ J2 o
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 E# y1 @' J i7 B
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 c5 x& E" ]1 r
- * TO CHANGE.
8 }+ V5 d2 Q+ B - *
" r* A4 @% M* U, i, N - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 y5 x/ u9 b! W! m: ?- ]3 h/ D
- *& ^- I2 N' |% G* A8 F: i! q
- * This program is free software; you can redistribute it and/or
+ v% o- E6 D% | V- x3 V - * modify it under the terms of the GNU General Public License as. ^* j+ C! i' p& W; J" w3 n0 {
- * published by the Free Software Foundation version 2., h/ U5 s5 f. S5 g' ]1 n4 {) _* \
- *9 ~( B, K6 c. M4 s% |1 m- K! l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 D8 r1 r" n% G; A s: ]9 \ - * kind, whether express or implied; without even the implied warranty' n+ a) ~+ \# X2 G7 T ?
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# D/ a+ R* }) l+ F8 W7 @
- * GNU General Public License for more details.5 _3 W4 ], S8 f; m
- */" b4 N! J. Q `
- $ h7 e( u( r( F a8 a. H; O; R
- #include <linux/module.h>
* c* z. y5 i. z X - #include <linux/init.h>& |9 y; q0 N- A) O4 [! e, o
- #include <linux/errno.h> f$ `5 _* K% S4 u$ V
- #include <linux/types.h>3 Q5 p, w% S9 z& C4 P) Z
- #include <linux/interrupt.h>7 U) q1 q3 F( I7 ~
- #include <asm/io.h>3 r8 [& Z: I E# u& J
- #include <linux/moduleparam.h>
! ?/ F* z- l6 m5 V/ _ - #include <linux/sysctl.h>
4 B& G2 H" R# V" m$ c- S k3 C - #include <linux/mm.h>
2 J( |" @; b q% p4 T8 ] - #include <linux/dma-mapping.h>
- @0 s4 x2 T/ f( o. ?( G/ t1 T - " v) y8 w- }3 l$ V' N& w2 L# \
- #include <mach/memory.h>/ w8 p3 b6 f7 \6 D" ^- E
- #include <mach/hardware.h>
! g, T9 @, U: O8 _3 }8 y - #include <mach/irqs.h>
& _& N" ^0 f$ y4 D - #include <asm/hardware/edma.h>
9 V5 ~- U& ^4 ]" H) V; K# r - - |- }/ I0 p# {7 z/ A S% n
- #undef EDMA3_DEBUG, A, ?0 \% C# K# T: c" v( n4 M
- /*#define EDMA3_DEBUG*/
9 \; C- Q& ]! n) Q% Q
& T! _9 o+ w4 t1 u, _1 H. p- #ifdef EDMA3_DEBUG* s {4 j P) O% [4 O, `: p, P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 M$ `0 g8 w* ]0 K+ B$ Q0 i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& D1 i' G/ u4 z8 J+ ?- O! U7 i
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 o# e5 P3 B# B - #else
( _- \, r) S$ Q, l& h4 k+ c - #define DMA_PRINTK( x... ); Y( ~ v z6 a1 L
- #define DMA_FN_IN
l0 n- L5 D8 q8 [8 F9 o9 i# D - #define DMA_FN_OUT
* I: p- |6 q; C/ s. z' p+ f# b5 D - #endif4 Z( E$ J9 y) R; o" Q
& \$ u3 x3 o4 I- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& o) u3 P+ I2 B- u - #define STATIC_SHIFT 3
- [7 ]: Z$ E) D/ l+ Q. W& ^7 `% b - #define TCINTEN_SHIFT 20 A- b1 n" K A2 g4 n$ S* [ ]
- #define ITCINTEN_SHIFT 215 t/ H% n" i9 s. d8 R6 V
- #define TCCHEN_SHIFT 22
# @' Z( o) x9 ], E - #define ITCCHEN_SHIFT 23
$ t/ }+ |; W& l* a; e% `
* A4 Z# l/ T. x0 o5 _- static volatile int irqraised1 = 0;8 R: G1 m7 ~: M1 r, E
- static volatile int irqraised2 = 0;% x7 K/ I' j7 C2 Q ~
* x7 q/ Z, u! G$ J# |- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 S# F# M4 p* U U7 l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% S5 O2 N5 R7 H- F$ L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% ~& n. G4 u% @$ a* T* x
- ; v+ T. H- ]% E
- dma_addr_t dmaphyssrc1 = 0;
# X0 i! ?1 z% y' r8 w - dma_addr_t dmaphyssrc2 = 0;
' c7 }) `' Y: ~. y: k - dma_addr_t dmaphysdest1 = 0;
0 K- ~" V! O+ x. Q) V% |' R9 [ - dma_addr_t dmaphysdest2 = 0;9 y! j7 g/ _4 ]& r- l( N. }
& r/ i" @, M! E- char *dmabufsrc1 = NULL;
+ A5 m8 C/ ~+ Q: n; K( ^, S - char *dmabufsrc2 = NULL;
( Q2 s) G+ j+ c: Z - char *dmabufdest1 = NULL; y! ^7 @! ^) o0 D
- char *dmabufdest2 = NULL;
# O8 h, y* h" M' \5 Z0 A' W - & e% z! `8 n+ I+ M6 E* G# m9 O
- static int acnt = 512;
+ A( z2 p ?3 H9 s* q6 E - static int bcnt = 8;: [0 O# Q) n) S9 D' }$ S( X* p l
- static int ccnt = 8;4 U, W* p* m3 j; c/ U( ?. O. M
4 s' T3 z0 [( c* S" z# c0 i- module_param(acnt, int, S_IRUGO);. A" `6 p4 W; ~2 Z
- module_param(bcnt, int, S_IRUGO);
8 v& ?/ f1 f5 X4 }$ z - module_param(ccnt, int, S_IRUGO);
复制代码
4 i) L8 Y4 m6 g( w7 O' n" l7 Q' K. a5 m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# R3 X W' h, X6 X
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 m3 d; k% @/ m6 c* ?) M# {% S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ ^, Z2 X2 w* f6 \$ e& y6 |# u
* }/ s# \+ F# h$ ~! w
9 C+ ]) p; X% g6 }8 [ _+ j |
|