|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, W3 c6 e8 J8 \) i9 d/ }$ H# I) C- [code]EDMA sample test application
$ n) j% O6 @4 l' `3 g. r - /*. A: a# [% E1 |( f) k" s3 H
- * edma_test.c
# f% O6 e7 w4 }8 b! F1 p+ ? - *5 l5 } H" q* _$ Q1 N# E3 Z- b$ H
- * brief EDMA3 Test Application# O" l, Z- c5 {% L5 Q
- *
( H F6 L$ H" _ K - * This file contains EDMA3 Test code.# c: b& i$ W: [ r4 Q# \3 O& |8 l
- *& ^4 S- t) p6 {5 B% Y" Z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 F! z7 F5 N9 G3 K$ f$ M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; A- C" j/ H1 o6 Q( F7 l8 { - * TO CHANGE.
- U5 z- U+ h) S: G - *7 v3 }' _ `1 d. A
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 e7 [: C4 Q. t3 M, Q - *" k5 P0 r* p4 I6 t: b1 S
- * This program is free software; you can redistribute it and/or; L8 W! l3 E6 [$ L- r% |
- * modify it under the terms of the GNU General Public License as/ e6 B7 X5 ^" U4 `; q) x6 K
- * published by the Free Software Foundation version 2.2 ~4 S. w" v1 ?$ m# G
- *
. D! F& V7 m: d0 {; x, u ] - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. |% E8 j/ H# o5 z# k - * kind, whether express or implied; without even the implied warranty6 U: W" H$ g) F( v" h4 ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ w) o, d5 K' c. P" \ - * GNU General Public License for more details.& u9 P: G, L# S. h/ h0 l
- */
# S+ I r l$ {% `, U1 w - 6 f$ d# J& n" e
- #include <linux/module.h>
. s0 L8 j7 \# S - #include <linux/init.h>
7 z2 [6 ^+ g, i* C# e$ y( E7 k - #include <linux/errno.h>& h U1 w6 B) f4 I% j$ ^8 H4 S
- #include <linux/types.h>2 ]* ~' ]0 F! S' [& d7 i
- #include <linux/interrupt.h>
0 S+ @" ]& w6 U! F7 h - #include <asm/io.h>
) m/ v" f6 e$ i, w4 L - #include <linux/moduleparam.h>
% f3 w/ p% b1 t1 {/ k" u) _ n - #include <linux/sysctl.h>
( t/ B2 t8 P8 o/ F$ X+ l - #include <linux/mm.h>6 {# d3 d: U) F2 E
- #include <linux/dma-mapping.h>
+ o L9 I/ M4 y6 g0 ^ - " q2 X, Y- R, j+ b, b9 v8 {
- #include <mach/memory.h>* L" k$ w$ }6 ?7 k8 Z
- #include <mach/hardware.h>" E' |& U: ^: P& {
- #include <mach/irqs.h>
" h) S( a, i1 X% J - #include <asm/hardware/edma.h>
2 x0 Y, c' Z; n6 z+ P. }* X- y9 |
; A2 _$ m i6 ?4 L# c2 P- U- #undef EDMA3_DEBUG
) a" k9 R1 v7 X+ i - /*#define EDMA3_DEBUG*/
/ C% i3 d* f2 o* a - 7 T* C" q$ T% v' F( |0 x9 @
- #ifdef EDMA3_DEBUG
6 E4 V: e4 L+ ~ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 S9 i: [, \- N$ R - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 N- ` c7 j: \ Z4 L, k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" z) q! c- y. X/ L; X
- #else* L9 M4 d: H3 m! V
- #define DMA_PRINTK( x... )/ i& Z3 B$ x0 o, ?: e$ g
- #define DMA_FN_IN3 g4 V, Z9 s$ t. o6 a1 g
- #define DMA_FN_OUT
) J+ V W+ q* {3 u$ \+ Y: A% z - #endif* p/ m1 u# I6 k# q5 C4 B
- ( |, W% ?) z& l! \. [8 T: t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 }( h ]: M8 N! T3 o
- #define STATIC_SHIFT 3
% R) e1 R" ~5 e: Z - #define TCINTEN_SHIFT 20
0 e' Y/ K" D9 a7 C' a - #define ITCINTEN_SHIFT 21
: }5 ~3 v1 H$ t$ g9 ? - #define TCCHEN_SHIFT 22) S Z) K: {4 L; z
- #define ITCCHEN_SHIFT 23) w1 O3 X: U5 T' m
( i9 t9 }' ^; Q6 |3 k/ s- static volatile int irqraised1 = 0;& X- r3 ~9 V' |9 h |! \6 V
- static volatile int irqraised2 = 0;4 S- F4 Q9 {2 c- W
( |2 k8 ^% M- N1 o) k- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# j i5 D5 U# |2 N
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& a; u* D ~0 E/ q3 \
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( H6 c; ?$ D1 l' u# o5 T
6 U+ E, @- Z% \. N- dma_addr_t dmaphyssrc1 = 0;+ `* K! c" a8 G
- dma_addr_t dmaphyssrc2 = 0;& K, \# ~; X* D) S' l4 C
- dma_addr_t dmaphysdest1 = 0;0 ?$ V- B# y$ |$ ]
- dma_addr_t dmaphysdest2 = 0;6 q4 b6 z. p5 F% @& W
& d3 _: L# ^+ N! A: Q- char *dmabufsrc1 = NULL;: z3 T4 }! e9 j
- char *dmabufsrc2 = NULL;
& M6 T7 o8 O% B4 B+ X& N - char *dmabufdest1 = NULL;
+ v8 g7 C7 q1 b |9 I& p - char *dmabufdest2 = NULL;& b9 Y2 U5 j2 Y$ U+ w+ H4 l
) _) {+ o# x+ b* \- static int acnt = 512;6 n9 K6 g9 T/ |( Y
- static int bcnt = 8;
2 V7 _9 r: u* v k+ B - static int ccnt = 8;: E; X& ]( d, L0 D# H& G% v
- - L) X* Y" ?" W0 Y7 P
- module_param(acnt, int, S_IRUGO);3 r- }- Q! ~9 x- i2 r6 n3 m( K
- module_param(bcnt, int, S_IRUGO);
4 B( N; g# g% r5 L4 D. [ - module_param(ccnt, int, S_IRUGO);
复制代码
; T! c1 r) R4 r5 W
( x, X! ~% F, f! h9 y5 D+ { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 L: o" c7 j& 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ o6 A% L1 |& f& I4 q( h
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" w1 ~# m3 R% z) {) _8 s
5 n* m7 d) S/ Y0 s9 ?
# q3 h i' x/ G
|
|