|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
{3 Y0 f/ z9 o# ], _6 {; C3 i) f- [code]EDMA sample test application
5 F! h; L( H: s6 x! D - /*
3 s7 b: A" ?0 ]0 [* a5 g$ z - * edma_test.c
1 ], y3 J- c- Q: ]; X6 Q) _$ h: u - *
3 f7 V- y; K4 W9 d - * brief EDMA3 Test Application
2 y& t5 H9 A! x) K7 ^8 x2 r+ w2 \ - *2 `6 I# y* a# H* [
- * This file contains EDMA3 Test code.
2 b7 F) m% w9 y& l1 h1 o( r - *
- k0 h! p0 n+ `) ^9 r& A - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 t' ~* M7 j( ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ e+ | W$ ^, ^" z, w- @
- * TO CHANGE.
. w+ T0 i0 H/ Y7 d - *
# f S, f; U/ P- S6 u8 H) } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 ^& S- D! e0 O' R) L! M8 Q - *: R( u' \. q" S; A0 U* I
- * This program is free software; you can redistribute it and/or4 p0 Y* O) b3 R6 W. T) G1 j
- * modify it under the terms of the GNU General Public License as
0 c8 u# G4 `9 n6 w( u9 V - * published by the Free Software Foundation version 2.
/ X: ^% n Q' u9 z1 i - *0 O$ }; v3 V) \ Y/ Y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 n" f/ h, I, l: L+ ?! x
- * kind, whether express or implied; without even the implied warranty1 p6 X+ l0 p: ]1 O
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* r1 M5 }( m- s7 L' S! j5 a5 F
- * GNU General Public License for more details.
9 n2 f& s* w! B0 | - */
: g% a! ` B& d# k/ v0 [ - & Y/ i+ z6 } s( p) S' x5 y6 X2 _8 H
- #include <linux/module.h>+ V/ d @" s0 v& N( E" }# @3 @
- #include <linux/init.h>5 d( U+ S0 C+ V
- #include <linux/errno.h>7 s/ n9 S' o/ ~" |
- #include <linux/types.h>
s) q5 S. S) M& ?! ?' }/ _ - #include <linux/interrupt.h>" r/ j9 J M- n& F
- #include <asm/io.h>6 k' j- Y' }0 @" i# j- }
- #include <linux/moduleparam.h>2 ^* I# h7 _& f$ j5 \3 {: t
- #include <linux/sysctl.h>
6 H8 v$ D* [; t3 T, i - #include <linux/mm.h>
3 p7 N- u7 p) U5 W0 k - #include <linux/dma-mapping.h>; m$ x, _: |$ t0 \
* o( c* e: s, n- #include <mach/memory.h> W. T1 g4 ?3 S- f7 {4 v
- #include <mach/hardware.h>
( j! I0 j" X; y9 g9 l5 Q - #include <mach/irqs.h>, s0 G6 ~5 e- Q- n! z
- #include <asm/hardware/edma.h>
/ D" H: ^9 t) _+ p
6 [% d) ~5 F4 T1 t- #undef EDMA3_DEBUG
/ v7 Z5 v# C/ |7 q" q0 ` - /*#define EDMA3_DEBUG*/
, _6 ~- \1 g+ ?9 K4 B8 L - - G' |) H8 E9 C7 a0 a9 ^
- #ifdef EDMA3_DEBUG% V U' s! N# S& a7 p1 n* x
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: K/ @; m) R3 I! o! _7 n' { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' \5 u. K+ L. n4 | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: F' R. B$ k- ?3 D8 } - #else
# u7 ~ m: f% X0 m) c- J% i6 B- l - #define DMA_PRINTK( x... )
- }* r2 i: u1 R( N4 ~; A, b5 ?( \ - #define DMA_FN_IN
) @) T. P& f/ \% q6 u# f - #define DMA_FN_OUT
/ e' y/ M- B& ?4 [$ @$ {- z5 p$ P - #endif
& o+ W4 R$ h8 v. v4 N
! U5 I2 @, n5 |7 ^& \2 l% S, t- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; ?: l0 S& k9 G9 ^0 F6 } - #define STATIC_SHIFT 3
* M1 |! C& r4 j' ~* h - #define TCINTEN_SHIFT 20
F: w; n1 w" P" C+ t - #define ITCINTEN_SHIFT 21/ f: y0 l: X; {1 ]
- #define TCCHEN_SHIFT 225 q2 B. t& w2 K7 o9 G- o- B |$ |! _
- #define ITCCHEN_SHIFT 23
# f4 _0 f/ N* j; N; c+ l" T# V - - ~4 |, G% ]% l6 ~, B% K. y% N
- static volatile int irqraised1 = 0;+ v3 M" J2 j: b% x5 V5 F* }) g
- static volatile int irqraised2 = 0;
7 ~: I+ T3 I) r- G* ~ - - a8 x2 E' g6 {& k6 d
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 }5 E+ j3 S% I/ A1 t) m3 b - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 i5 F# J; @- |* o r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 I8 b- m, s( b% A% b3 B3 k, O
( `) d4 E% \- T8 v% t3 z! j! U6 n3 g- dma_addr_t dmaphyssrc1 = 0;. ]9 m( R& T) w* u$ J1 r
- dma_addr_t dmaphyssrc2 = 0;
$ D# o1 ]$ j( A3 R# _4 S - dma_addr_t dmaphysdest1 = 0;
8 w3 r& C3 E0 l4 j/ y( Z/ { - dma_addr_t dmaphysdest2 = 0;
/ Y* b1 w* ^! E
! Y. Z8 @/ i9 t+ S: d- char *dmabufsrc1 = NULL;
: S, T9 G4 F2 V. X% T o - char *dmabufsrc2 = NULL;
7 X- y f% K! h/ I( X - char *dmabufdest1 = NULL;
" p% t8 x" j' a - char *dmabufdest2 = NULL;" ^; x6 T& `6 T% C$ {5 ^# w1 m) v
$ G% y* b- b- N! X- static int acnt = 512;
* d7 Z1 Y: x* M' G& j - static int bcnt = 8;$ e4 Y+ b. U& P( _+ s# p+ r
- static int ccnt = 8;0 \$ `, H7 R+ Y# M& I0 P
& J8 r) a! k/ z, L% e- module_param(acnt, int, S_IRUGO);# M% o' O% s4 O' o% `
- module_param(bcnt, int, S_IRUGO);* b" _; Y X& o. w2 W
- module_param(ccnt, int, S_IRUGO);
复制代码
. Q3 ~% o! V3 R& l1 w# `) i7 P
0 z2 M+ x' X' A! F/ p, W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 l. q2 v8 z$ X5 t3 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; T/ T0 l2 y' A, T1 q0 u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ Z# C# u, p0 h* n- J
- T) N, Q. h; L. @" s( r1 t0 t8 ^- Q; k
- F$ V2 ^) Z/ O% o! ?
|
|