|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, ~" H3 t8 _7 z/ m- [code]EDMA sample test application
' |4 D3 D2 ~/ z$ V7 R- h) @ - /*
! U4 L, ~/ A `. u5 { - * edma_test.c% W6 [. o0 t3 i+ M. c, w
- *
% X: O& |7 a: o- L4 [ - * brief EDMA3 Test Application
0 z4 w+ \* V5 S6 F' _" Q - *
3 ?; ]& W' Z% L; V - * This file contains EDMA3 Test code.
$ V8 P7 a0 H: W( X - *+ m4 n; ]6 t, D, y$ ]/ Q# n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* Z! M. i: K2 i' B; I" p - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( I8 Q' b) o" _* T) A1 S
- * TO CHANGE.) V/ h7 ~# I2 L8 u' h& I
- *
+ W6 Q3 h: S; b$ X G) S8 P - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- e3 W" T* b# u6 u - *1 ]! g5 p0 G, Q- V$ q7 J2 t8 h
- * This program is free software; you can redistribute it and/or% @5 @ x! S1 L" P& ?0 d
- * modify it under the terms of the GNU General Public License as
/ T2 O* c! A2 ?' V' N - * published by the Free Software Foundation version 2./ I M1 I/ e. V4 b& l
- *, _- ]. V& U8 q P) ~4 E% D
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( \/ ^$ \: x4 L9 h, X4 R s - * kind, whether express or implied; without even the implied warranty/ z1 q# h0 _7 p2 v7 U+ i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 @7 |4 y Y$ |- R5 B3 Y' {
- * GNU General Public License for more details.0 `3 B' I! I3 D2 w7 L+ A
- */5 u8 d$ d% b4 g \% p) U
5 }( R3 ~- r) w1 Q3 @2 k r- #include <linux/module.h>
5 p2 h. x4 R7 w& s7 f - #include <linux/init.h>/ N7 U0 I& w8 M- h, O q c
- #include <linux/errno.h>
2 h9 ?: Z# m0 r _/ ?8 a7 m - #include <linux/types.h>
: f: d! M+ w, G, ?: M) w - #include <linux/interrupt.h>
& g; p9 ?$ }2 l - #include <asm/io.h>
% t3 x, G8 ^4 ^* P* M - #include <linux/moduleparam.h>
( G' b& Z. [# ^2 N; ~$ U) W - #include <linux/sysctl.h>' X2 j. l5 }8 a/ V4 g% A+ Q
- #include <linux/mm.h>
6 p7 p7 S9 J/ b3 A+ s2 v - #include <linux/dma-mapping.h>& ?; ~0 w4 C' U; V! m1 a1 `
( t/ o" S: V5 S9 d# n- #include <mach/memory.h>; S; N8 {# r0 m
- #include <mach/hardware.h>: H" _9 {1 f" K- m9 U9 n
- #include <mach/irqs.h>
) t. c+ j, h; Q% l3 O" B& O5 E - #include <asm/hardware/edma.h>" \) @5 t) H# p
- : l6 ?2 b4 t; `2 V# j4 B
- #undef EDMA3_DEBUG
/ v9 ]6 q" u M! F; C" G* Z - /*#define EDMA3_DEBUG*/
+ L/ X- }' S6 e
) P7 g N5 z- h3 B+ ^9 {- #ifdef EDMA3_DEBUG
% ?9 t$ }9 A2 p - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! z2 o; B+ V* q ]9 `" r( F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) |1 q+ [8 ~7 I. Q5 q6 C5 \' n - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 G$ K3 V: l r! W9 Y. y' B3 b
- #else) C2 B; y1 d( [ F3 Z
- #define DMA_PRINTK( x... ), Z+ R+ G! Z- ?. B# u# c* X5 t& ^
- #define DMA_FN_IN
v( f: ^+ x5 B - #define DMA_FN_OUT8 z5 Y! M m& C' |% p/ c
- #endif
1 _' { A& S) B - 6 [7 w6 d1 b$ @- E; w% x, [: {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 T* p, d6 q( I# h2 d, E
- #define STATIC_SHIFT 3% T& O; N$ ~2 ^) z$ R& J
- #define TCINTEN_SHIFT 200 C! a$ ]% ^, ?# H+ r) F% T
- #define ITCINTEN_SHIFT 215 X; Y. A0 F8 {: Z0 e
- #define TCCHEN_SHIFT 22
- U1 r; {' n% G. e3 N$ N# g6 n - #define ITCCHEN_SHIFT 233 @7 f; P) q1 [; c
- , N/ t# t0 c: n7 r
- static volatile int irqraised1 = 0;( T) Z# o' r$ d7 O6 e$ v
- static volatile int irqraised2 = 0;
* ?, I/ Q6 R/ ?- u$ k2 a - ' @9 r3 P: i: d
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ~" r- Z/ n$ Q/ w+ a0 M( z" U+ D
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ V% l0 Y7 C' K+ Q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, \9 I" B* J) r2 _
- * w$ u; ^* Z8 c0 n: V; L
- dma_addr_t dmaphyssrc1 = 0;* ?) f3 L( |: f0 e h, c
- dma_addr_t dmaphyssrc2 = 0;* ]9 u' q; ~( y5 b
- dma_addr_t dmaphysdest1 = 0;
( T) \* j4 X( s: D# s- Y# L# |: c - dma_addr_t dmaphysdest2 = 0;
. ~6 ~( h, [. ^$ ~6 u4 i - : K/ w, u- p4 [, O' C& S
- char *dmabufsrc1 = NULL;! |; C, p3 M( M
- char *dmabufsrc2 = NULL;' I+ y/ Q) x8 U2 y. N5 Z
- char *dmabufdest1 = NULL;: A% X8 F! E4 l- Y' N( {
- char *dmabufdest2 = NULL;
; P+ C- Z$ A+ h: ~. h - . M( l! q; A& l
- static int acnt = 512;
/ ?( U3 ~# L$ R# E3 _- j - static int bcnt = 8;
/ V; Z/ M! {1 f& ^ - static int ccnt = 8;
8 z4 `* O( D, ]5 |) Z4 {7 ^
8 x& o# T* a4 r( s/ m% g- module_param(acnt, int, S_IRUGO);, |! z1 i* s( V; [
- module_param(bcnt, int, S_IRUGO);2 Y* X Z: J3 x3 g% L# ]# X( `& v
- module_param(ccnt, int, S_IRUGO);
复制代码 ! @# Y1 \5 _! R5 T2 K3 A( a0 b
* i* X$ U0 \8 s' D' U! u' `! O4 E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 t; \+ H4 }. Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( j3 X8 {; A& ~2 ~2 W 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) _0 f5 ]" ^4 k/ k
# S/ d: E, R$ P; Y2 _' o5 t7 G# ^; D
|
|