|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 Y3 G. l( Q/ T. I9 H, x0 {: [# \
- [code]EDMA sample test application4 F, {- x9 V% w' x0 q) g. P
- /*
# P9 o; A2 j0 K$ b3 V% @ - * edma_test.c8 w# R) q- @: s$ D( d
- *7 b7 ?; w- Z- J$ X
- * brief EDMA3 Test Application' Y2 Q! k; A6 B5 p
- *
& K. Q# L4 A" f$ E: v8 n* t% r - * This file contains EDMA3 Test code.
2 R( \1 u2 G, s1 r' ~& Q - *
9 T) m. I0 H8 f2 W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 P0 [- B& P: G9 L% A9 a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% z* g4 @% i3 k9 z9 b6 d
- * TO CHANGE.
- ?, p( s. r7 i( N - *
5 O' H( ^5 @1 n7 Y* L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" ^& J+ F( u8 r6 Y% F; R1 t
- *% i) a: [' Y3 M' ~# i2 T
- * This program is free software; you can redistribute it and/or
0 E9 b7 l3 H$ V( W. c4 Y4 Y1 w8 Y U" N - * modify it under the terms of the GNU General Public License as; N8 l) z, { q' a+ T" J
- * published by the Free Software Foundation version 2.
$ X2 V) Z4 t) ^( C% q4 d9 \ - *
) `7 H3 C- K" G& [) b7 h - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! _7 h& S/ y5 e8 @ - * kind, whether express or implied; without even the implied warranty5 ^! H) d" d5 F) N" e0 d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 I7 ~2 e7 b. b- q - * GNU General Public License for more details.
2 k) ?5 p6 y" f8 m. ? - */6 `# k# I+ l) S
% Q0 m3 p- Q" }6 w- V- #include <linux/module.h>
( o, V% K4 k6 f. P( U; Z) J( ` - #include <linux/init.h>
- |& L p t$ _ [$ f' F+ p# q" y1 r) X - #include <linux/errno.h>
! n) g: v9 l, @+ B# S - #include <linux/types.h>
& } p2 d9 z4 c/ t8 O4 s' } - #include <linux/interrupt.h>! J- b9 M6 r1 z, h
- #include <asm/io.h>
* s( C8 s2 F( y, | - #include <linux/moduleparam.h>
2 |9 X, _# m* ^! {6 P) X! n - #include <linux/sysctl.h>
$ X, N, S) l, P0 S. u9 E - #include <linux/mm.h>
( J% ^/ m1 @, a - #include <linux/dma-mapping.h>
# s% S* p, |( u2 o2 G$ P f - ( s4 t V ^7 o- ]: z! U
- #include <mach/memory.h>
! |* K4 t: `( @/ j - #include <mach/hardware.h>6 R5 n# M7 j" C$ O
- #include <mach/irqs.h>
1 }- ]( e& M" k/ i* x$ T$ B - #include <asm/hardware/edma.h>
! |1 B" O0 I V# ^: K9 x
% r! Q f2 J6 j1 ^6 M- #undef EDMA3_DEBUG" K6 r, x& b! d( Y0 ^3 Z0 \: F
- /*#define EDMA3_DEBUG*/
- B) p3 I: _( R1 ~% K: R
! M) `" }) y, X8 y' F- #ifdef EDMA3_DEBUG
, s) ^4 m$ [3 Z5 O* ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: Q0 r6 f8 ?, q& I6 |+ T2 l. f( i( } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 e+ z. f8 X# o/ [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" K( d, e! @* `& r - #else& L: M1 v. A, S2 @, x% J
- #define DMA_PRINTK( x... )
& c5 a; {- V! [ h6 _: q - #define DMA_FN_IN, A% o$ e' T1 l5 p
- #define DMA_FN_OUT: C, X0 ^. H7 V Z1 b' Z1 x, R
- #endif
( G8 ]2 k" d% x% x - $ Z* n! S3 B0 ]: F4 d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) r( a) S m' N+ n* M( i+ W - #define STATIC_SHIFT 3/ G: K6 }2 h. |
- #define TCINTEN_SHIFT 20
: K( p) a2 B6 Q; R: a9 e - #define ITCINTEN_SHIFT 21
/ h/ q% n: G, c3 y& N p - #define TCCHEN_SHIFT 22) x* `4 ^/ w0 B9 |2 |; p2 b
- #define ITCCHEN_SHIFT 23
+ ~; S) [9 _# w
3 d. T* e! Y7 Z4 W1 _& l- static volatile int irqraised1 = 0;
! d, P! J: Y5 Z6 S - static volatile int irqraised2 = 0;
u4 z& o0 R& u3 h
' v% Q7 Y* R3 e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 s0 }& B* a, ^+ P# D- f6 Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( Z) Z* `: x. b: {# X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. N7 P1 ^4 }) ^% c# Q
1 q0 t1 p, U3 w$ `. y- dma_addr_t dmaphyssrc1 = 0;8 O( p! c2 o+ B3 D) e. k! t
- dma_addr_t dmaphyssrc2 = 0;7 g7 u2 N7 ], q$ |8 q( J0 t. {
- dma_addr_t dmaphysdest1 = 0;
1 P. @7 y! I1 B5 m$ z - dma_addr_t dmaphysdest2 = 0;; s! E2 c9 N6 L5 H I7 m
5 _' ~+ g/ {/ b4 V# K2 D- char *dmabufsrc1 = NULL;) S# [; C& Q/ C" v/ [
- char *dmabufsrc2 = NULL;
( i: h" I+ p$ N8 m+ M - char *dmabufdest1 = NULL;
8 f1 L( U2 ]$ W5 ^ - char *dmabufdest2 = NULL;; v9 k$ J) V# d8 n7 L
% h( `7 h, s) ?* y g- static int acnt = 512;
) I% n; M2 N- F& v - static int bcnt = 8;: K- t$ d( m3 `
- static int ccnt = 8;! u# t) W4 T) ?
- 3 m3 w w: U) T( R+ N
- module_param(acnt, int, S_IRUGO);" j+ H' N/ {9 G0 d+ Z8 t" V/ `
- module_param(bcnt, int, S_IRUGO);
$ P% n+ m6 B1 q, J+ n, L+ w9 f - module_param(ccnt, int, S_IRUGO);
复制代码 : N0 x$ j1 @% B) u/ J3 B
. J" o. F8 r- U5 X' E/ ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 j: a6 G9 Z5 b" G, zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: l- y$ y/ e$ a: B! q0 n; F
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 L$ O+ ]+ }. X7 Q; g7 Y
0 }. q' H a1 O2 {" K1 K, F
9 f7 X" ]0 Q3 e
|
|