|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: ]. r! v! a+ j# ^8 c' f; O- [code]EDMA sample test application
+ h8 A. p# K7 e$ ` - /*
- b! `- d* B, R$ e/ c - * edma_test.c
' G2 Q4 I0 I4 D* y4 ~2 w - *
6 l$ m$ ^. }8 x1 q - * brief EDMA3 Test Application \9 A5 z& _* z8 S) K
- *5 z7 j z0 G# g1 V4 P" N! |. V! E
- * This file contains EDMA3 Test code.
0 m8 c5 O# ~$ U5 T6 D - *' x! R# o. F! C/ o' Z! E0 `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' r1 t; b$ R6 o+ W5 Y7 Q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& H4 b1 R( j! M; s* l
- * TO CHANGE.% `1 `, q6 H8 v* U! N9 w$ X/ h
- *
4 t1 ^2 s; A2 K* f/ I$ ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// Y( \! C2 v* W4 |) g0 L7 q
- *5 N0 ?4 y& E2 H. X3 E; |, q
- * This program is free software; you can redistribute it and/or
3 a+ _ ~7 o6 P9 J( s1 _ - * modify it under the terms of the GNU General Public License as
5 h7 W$ F0 Z8 w& g' p" M( t6 Z& p - * published by the Free Software Foundation version 2.4 _) M: {* y' P9 @& z& X! y
- *' F* H, q$ _ d: v5 j4 d
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ `/ G, f% G' @3 C
- * kind, whether express or implied; without even the implied warranty) t; a+ O# ^4 D7 }/ [& N5 V; c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' q, Q- d+ P6 u: e1 Y, }
- * GNU General Public License for more details.
( ?, d/ A/ ], ~8 |1 ~7 p4 j - */
$ ]5 S+ q" n* A& c5 ?! g - : B5 x) [9 \" s: o n
- #include <linux/module.h>9 w, a5 h/ r; s" g1 m- p9 D8 d
- #include <linux/init.h>
% V% w$ X4 n$ l! d2 p5 Q - #include <linux/errno.h>3 ]- h! p" m0 H) z, k. W/ }
- #include <linux/types.h>
$ ~- |. Z W) T5 E. Z; Y, R, |( [ - #include <linux/interrupt.h>
6 {! r( U- m6 Y- N4 T( k% r - #include <asm/io.h>+ ^1 n+ \% K; N
- #include <linux/moduleparam.h>
! {/ z8 U' c- z( y8 u - #include <linux/sysctl.h>$ b: ?: P6 I) g; _4 y
- #include <linux/mm.h>- _# f5 E& M& W
- #include <linux/dma-mapping.h>
7 K+ g" I. g8 e3 |- ` - % v' e: P. |/ K3 a) i
- #include <mach/memory.h>
, y# Z \1 T# z& ]& k - #include <mach/hardware.h>0 A8 e1 k! y" A6 o, Q
- #include <mach/irqs.h>
* I8 P, j# N. K. | - #include <asm/hardware/edma.h>
8 l4 y% L! y, `! R$ B E
0 }$ D* ~) T% P h& }+ |( N, y- #undef EDMA3_DEBUG
$ U& w! v( X4 B4 E b/ w - /*#define EDMA3_DEBUG*/. h4 H0 f7 P5 n$ `+ L* i7 { r
& Z% w ?. c- i: x! G1 R0 ]- #ifdef EDMA3_DEBUG
4 g- R: @. w! ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 R. P- J; V4 o/ T. E
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 E+ G+ c( M& m3 m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ ?. U: h+ v- z1 v
- #else
1 T7 _- g. {; Z: n6 L - #define DMA_PRINTK( x... )3 A8 W. q! W+ F3 \' c
- #define DMA_FN_IN
( {* ?; y" b3 G5 c; v5 b( s - #define DMA_FN_OUT! [/ M7 S" C" s& P
- #endif
* L( K! L$ x' @# } - / C! z5 I5 f/ [5 s! n4 ~% T
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; G# O3 _% Q* O# z7 d4 R$ p& ] - #define STATIC_SHIFT 3
+ g$ b8 G H1 t- [: R% t - #define TCINTEN_SHIFT 205 b! x H# Y& Y: K
- #define ITCINTEN_SHIFT 21
5 m7 j/ D/ k7 U2 n! f - #define TCCHEN_SHIFT 221 P. {, [! E2 u; }8 q* z1 b r
- #define ITCCHEN_SHIFT 23
+ G8 o" q7 ?, B# d0 u
! ~' x; W1 f7 v5 E5 S- static volatile int irqraised1 = 0;: \) V; m( z3 x& I
- static volatile int irqraised2 = 0;
4 p! _) r; Y5 A$ { U- u
2 P+ a* ~! ^# P5 _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- n. e a. K w9 \5 b+ j
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' I5 t4 }: J9 z8 S
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); d8 D6 O; q! Q1 ]
; O+ q7 p) c( b F' ^- dma_addr_t dmaphyssrc1 = 0;
. E8 E2 j0 G( i! Z% i6 A) l( _, m( v - dma_addr_t dmaphyssrc2 = 0;
; R7 \% _( p$ t# D - dma_addr_t dmaphysdest1 = 0;& W5 s' I8 J5 H @) V: a
- dma_addr_t dmaphysdest2 = 0;
p9 r( x- {. }/ m8 d* ~7 Q8 c- n
$ B: @2 Y; U7 B, |. R- char *dmabufsrc1 = NULL;$ {: v, Q) z. T3 ^. O9 u
- char *dmabufsrc2 = NULL;5 Y2 S2 E: B7 t0 a6 ]
- char *dmabufdest1 = NULL;
0 T6 Q4 {- f! v8 C! T! a - char *dmabufdest2 = NULL;
8 w$ d+ Y- H$ B( Q }0 ` - 4 [) q8 K. P6 a
- static int acnt = 512;
9 r" }8 L8 l& ~! ?9 e/ C u - static int bcnt = 8;
" K. O) \& q N! y, J( t - static int ccnt = 8;% w3 }7 E9 T, A# o
- 8 d. g6 k. x- I
- module_param(acnt, int, S_IRUGO);# B0 r" ^6 n" j
- module_param(bcnt, int, S_IRUGO);* f" D. J3 I+ x, P
- module_param(ccnt, int, S_IRUGO);
复制代码
$ h+ W+ r! U; }0 L P, L. W# ]5 s% J/ R( @# r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 U9 ` G1 ^0 s9 y$ n3 karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" q7 p, }, i3 r! v: S) j 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) P: I; {# E* X; o
: `" l: g* r" g# R: f+ p+ t0 A0 I4 l/ Z5 V/ g, V0 C S
|
|