|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 u" _" O8 S, J- [code]EDMA sample test application
$ W& ?1 X. l, `7 l' ^/ x/ E: X! Y - /*
' L$ M8 q5 Y* a& R - * edma_test.c
+ D0 y/ S) \+ k$ I - *4 a# o0 m( M1 r4 G8 F. H& Q
- * brief EDMA3 Test Application
1 z, X1 @( l2 b6 L - *0 ^7 _- z; J" `- w6 u- V
- * This file contains EDMA3 Test code.+ v1 a8 L& u1 k
- *& |( t9 e# B( c
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 L Q- @& P+ }; x - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 ~1 _% M" m, H9 w - * TO CHANGE.; v" f" _; r' T8 h! W3 O. j+ u6 p
- *' s' Z8 F9 E6 P3 j6 r$ {
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ Q0 k8 w6 f' l/ }2 I& N; r a& G5 ` - *
% I h1 {& w$ x! v3 g9 s - * This program is free software; you can redistribute it and/or" U7 S9 I$ h6 D* {1 z1 S
- * modify it under the terms of the GNU General Public License as' b+ ]8 }3 n+ F) U" n4 X0 ]
- * published by the Free Software Foundation version 2.1 z) b" j0 [5 l0 Q
- *
" `: e3 w, n) |' G# q1 I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* N9 g5 t. F5 E, ?5 e - * kind, whether express or implied; without even the implied warranty
m+ C3 u$ B+ s - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% p% D9 |+ ?: z% E: i- O( {, j - * GNU General Public License for more details.
) z$ ?4 C6 l& @- u9 O# u- M - */
4 }# C3 c+ x8 B, M3 |- H - : J$ v, `+ g* }* O/ a) O
- #include <linux/module.h>
% Y1 [5 z% r: g: [8 S - #include <linux/init.h>4 R3 T4 w$ n( j( V* Y! x4 J
- #include <linux/errno.h>6 @+ g q, ^& T( N/ y. N' Q
- #include <linux/types.h>
) {! B$ U6 ^! p" f4 X - #include <linux/interrupt.h>
! N, ~6 o6 M: [& R3 P# ` - #include <asm/io.h>
' p+ v/ e$ s2 R) H0 x - #include <linux/moduleparam.h>
9 G9 {" p1 f8 E( v9 q% t - #include <linux/sysctl.h>
! E3 U0 ]7 K8 R! J1 k- r - #include <linux/mm.h>
) @( d8 a3 _7 i" Z6 x - #include <linux/dma-mapping.h>; v/ {; q6 ~$ \: O$ D7 x
8 i7 g" ?. {8 @8 s& E$ M* N- #include <mach/memory.h>4 y6 h5 E8 K3 Y1 j6 F( u8 s" w
- #include <mach/hardware.h>
4 H( P" [% f8 X- I+ ] - #include <mach/irqs.h>2 h7 |/ e4 {, w9 {+ j# t5 l' A1 T) c/ s
- #include <asm/hardware/edma.h>- n7 b! S. s3 E' s
- - r( k1 f; p( ]6 j' c
- #undef EDMA3_DEBUG
+ V5 a/ ]- G5 C; k. o - /*#define EDMA3_DEBUG*/
2 _7 \6 n4 i1 G. A - 1 H& R! ~6 {! y2 e
- #ifdef EDMA3_DEBUG1 ?, a2 I5 o0 `* W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( a, e! R0 M$ b - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) O+ A! z1 Z* B! R
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ r, \% b, E5 }4 F. u - #else
9 s! T9 q7 [+ F6 |$ b+ A - #define DMA_PRINTK( x... )
7 U! a! x+ C. z. f: U' n( P - #define DMA_FN_IN& Z$ B; }: m+ }: b0 a. R
- #define DMA_FN_OUT/ k+ [ l3 N3 @1 A+ S% M
- #endif
: e+ n3 W m: _6 e- K
" ]1 |8 u7 ?* M9 d: P) E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- B4 e4 x O( ^: x - #define STATIC_SHIFT 3
& q5 t" I4 A: ^; B _' I9 b - #define TCINTEN_SHIFT 20
8 W; m$ g2 e6 o; |4 M - #define ITCINTEN_SHIFT 215 v1 o' q9 L4 T$ D/ j) L
- #define TCCHEN_SHIFT 22
! I. ]+ X6 [+ Y/ N E0 T+ j6 _ - #define ITCCHEN_SHIFT 23
4 D" |! h& Z! p' N. J" ^& ]$ S - 6 d: K8 `# P4 {& x) U
- static volatile int irqraised1 = 0;
7 {+ ^( V, k% o5 t- X% X - static volatile int irqraised2 = 0;
! \# f% m' K+ w/ H3 _" W& U - ; h( z! g# n M1 o. H# t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. g2 p+ `( N2 ~' {& s: h
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 L9 b( H8 L! B& E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 l7 V: A% t5 [. n5 R7 E: \
9 n; ?' A3 u( s x, k9 c+ ?$ E- dma_addr_t dmaphyssrc1 = 0;
: }4 J( M9 w7 S - dma_addr_t dmaphyssrc2 = 0;1 ?& }7 T3 g" R g
- dma_addr_t dmaphysdest1 = 0;
3 v+ B- ]; W& z- M8 W8 r - dma_addr_t dmaphysdest2 = 0;- @4 ~0 v, I! U+ u4 X$ ?& {+ [' o
- 5 P2 b' s; U8 x
- char *dmabufsrc1 = NULL;( B" _( [5 E# M- |0 r( I: d- m* @
- char *dmabufsrc2 = NULL;( \8 E- }# c. v- L; u1 {2 C* Q# ]
- char *dmabufdest1 = NULL;! \; f% \. Z" E; ~( }, P
- char *dmabufdest2 = NULL;- q( b, q/ E& ?* I& o1 Z/ O6 J
& Y: P% K, `6 H1 \- static int acnt = 512;
3 o( g& l/ `" W1 E. o/ B, G& Y6 a2 Y9 l - static int bcnt = 8;
5 e( S# f; s& l2 D' ` - static int ccnt = 8;
8 @3 M1 w: M# X" v# x
f$ \" ~0 K C2 q) j- module_param(acnt, int, S_IRUGO);
/ p! e) \ V! V0 P - module_param(bcnt, int, S_IRUGO);2 x7 r; Y/ K( P$ D" _* [
- module_param(ccnt, int, S_IRUGO);
复制代码 $ N+ N, h% d, ^( I! R: r) r$ o0 _
4 q: V8 b* T9 Q* ]& ]9 j" x7 d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ r' ^( M. m3 Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 z; A4 s! R: i/ b, P. _( n1 N 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: g( r- h; y* T: h' q; i
; U0 U. H% H1 c M' _$ ]9 [( [0 U- c) U+ N. E3 ]8 I, Z. W) R* R
|
|