|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ y _; h. E% l2 {
- [code]EDMA sample test application4 @7 z$ a v* }, f
- /*
; [+ `0 m+ @+ l% o2 K: B" w% f( m - * edma_test.c
1 x2 N# t2 D, U B6 t - *
: c: f S# S$ B9 ] - * brief EDMA3 Test Application
4 k6 |9 \; T- b - *% w8 D' r$ A5 v \, d
- * This file contains EDMA3 Test code.( }0 f& D0 J4 y( \! q) r2 x) j$ N, v r
- *
4 n0 W% f7 C( s; N& J3 x$ D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 e$ n: t6 }1 s: m" g6 i1 P9 |( @ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 r" s8 j1 a1 j/ [ - * TO CHANGE.
7 e- @3 A5 l* L) X - *0 x6 f* N! q2 Q2 ]6 d9 i+ ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 ]2 O2 V9 O3 M( @! Z" L - *
' q" n0 r2 b0 l. @9 {; p - * This program is free software; you can redistribute it and/or
+ C7 ~& R9 L9 v: ]$ w - * modify it under the terms of the GNU General Public License as c7 Y O" X" N, m4 @
- * published by the Free Software Foundation version 2.
& y% j, p1 N1 C3 E& j - *
+ T4 U E$ `, O# M2 F5 s* m - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 h8 ~) q! ^3 D$ V- @" f - * kind, whether express or implied; without even the implied warranty2 S- g+ w) f; b ]( K% N6 u
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, O; U5 u3 i% z6 q/ t - * GNU General Public License for more details.. M: }2 A4 x" b# V
- */4 [% g( R+ b% ~+ M3 c
- 4 n. _3 p' h( y0 b/ H
- #include <linux/module.h>
9 G: E+ {7 i1 s% w7 r2 @& e - #include <linux/init.h>$ N& w. k5 d0 z% \
- #include <linux/errno.h>
1 U# c0 ^6 T- } - #include <linux/types.h>
& O7 g5 d$ a% N6 J! X- ` - #include <linux/interrupt.h>
- r3 B" N: d: n% F3 Y$ ~+ { - #include <asm/io.h>
; Q" X$ C7 W8 X' g4 n3 A+ I - #include <linux/moduleparam.h>
7 M" K- F3 u; ~1 ^0 P! X' U - #include <linux/sysctl.h>
' |' o. a9 J6 d. i% ]8 x, v - #include <linux/mm.h>* }( F3 D, p4 R; q* N l+ F! d6 Q
- #include <linux/dma-mapping.h>
5 f$ v, |, Q2 h+ {/ E5 J* V; R- D
1 T+ ~- m, L t; Z# ]( ^' ^- n2 g- #include <mach/memory.h>
$ I. g o$ s% c3 o; T' d - #include <mach/hardware.h>+ H8 ^6 a0 B6 A! [. E) x
- #include <mach/irqs.h>
|" @$ z! B/ O - #include <asm/hardware/edma.h>0 e5 t: P: `8 n2 J% H8 Z8 ~9 t, _
" C, S" Z1 e0 L+ p, o u- ?5 g2 m- #undef EDMA3_DEBUG
7 v6 F# f! e; C - /*#define EDMA3_DEBUG*/
+ x8 e, r6 S T# r; j& E
+ a, L4 d5 n. \8 {2 i* w( Z- #ifdef EDMA3_DEBUG
. ~( c# H+ |4 M# f5 n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 _5 o n6 z3 N - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" j7 u9 ^ j& n2 F& W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" m! p7 Y( K3 P* ^% E
- #else
! F* M: R* g; T: w - #define DMA_PRINTK( x... )
! O, _$ I2 k2 }+ J7 {0 ^) {# n: w4 h - #define DMA_FN_IN; ^/ |6 g3 L" @# {7 C$ m9 ]2 L
- #define DMA_FN_OUT
9 [4 e% ]# G. b! U0 ? - #endif X( b4 G- ]; Z$ V- M: @6 q) l( P
; p: T7 K, \ U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! G V0 o& M1 u; x: c - #define STATIC_SHIFT 3
) I/ x9 |' S+ `' d6 _7 J" X - #define TCINTEN_SHIFT 20
* ^0 B/ z9 L# w) s: R - #define ITCINTEN_SHIFT 21
& E+ j9 Z4 L# a& ^ - #define TCCHEN_SHIFT 22: U" m. W/ h. h* F4 d5 ]. K9 }6 w7 H& v
- #define ITCCHEN_SHIFT 23
0 F: l( u7 |3 U* T+ ] - 3 ^+ `+ ?- d1 v \4 C3 j
- static volatile int irqraised1 = 0;
8 z- r' l0 f4 H: C4 c - static volatile int irqraised2 = 0;
/ |9 S3 s4 U+ [3 @ - 5 [9 y; Q: Y6 O7 i z0 F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% m1 V- I# M4 W) {, F2 `; v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 O( C/ ^9 l$ Y4 G6 Z6 q* N6 E8 c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ J# S3 D' T5 _: U; o% z
4 K2 H3 x+ Z$ ~. G9 f% B- dma_addr_t dmaphyssrc1 = 0;+ ?) W; y! P( B. I, Y
- dma_addr_t dmaphyssrc2 = 0;1 C; F+ H, G; k# @6 w% f3 s- O
- dma_addr_t dmaphysdest1 = 0;/ I) t/ T. w# n7 s0 N
- dma_addr_t dmaphysdest2 = 0;4 W7 x5 I7 j+ F t7 y* G/ s4 q
& V$ R5 W, _' {8 M: q6 H& B2 m- char *dmabufsrc1 = NULL;
, [( _) l; w8 J. o6 ~/ S$ H - char *dmabufsrc2 = NULL;
" W: R8 E( ~+ `, q3 r - char *dmabufdest1 = NULL;
1 X: Z6 S1 _: L1 T9 h. P - char *dmabufdest2 = NULL;
/ W+ }3 Y! {; G7 y# I% R
4 ?) l7 `+ ?5 k# |- static int acnt = 512;9 W, s, e& s& o5 C+ ~( P. c, N
- static int bcnt = 8;& o- U6 }; f" _0 s3 T) `4 D
- static int ccnt = 8;2 O9 P5 d( \) w2 Z6 h/ n' B
- F. s) I, k' r" O) J7 H$ k
- module_param(acnt, int, S_IRUGO);) p/ ^, V: b+ B* j. e( v6 ]
- module_param(bcnt, int, S_IRUGO);
! |2 e: i6 z" d- ]: W; W1 o# v - module_param(ccnt, int, S_IRUGO);
复制代码
8 Z$ A: m+ f5 h6 R+ X( e% C; |% d8 b" y1 z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& S7 s8 P0 c5 F( L( W( iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 M( y! r! H* {1 F1 K9 d3 F X
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ B2 q! ?' u* L& P2 [7 z. C! S% ?3 i, r& Q; K H# h9 U* o
0 u" Z4 ?; J' d |
|