|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 q% s; i3 D: m
- [code]EDMA sample test application
+ x& A: k2 G' [8 Z! R7 ? - /*
" {* u& l( u( [ I" Q. y - * edma_test.c( x; a- ^+ Q1 x6 M# ~( r& l
- *" s4 p- ^$ V6 z W# r1 F! k$ |
- * brief EDMA3 Test Application. H- {( ]# q4 Z7 l) {/ ]8 `
- *
, H0 L6 E% n/ e1 L - * This file contains EDMA3 Test code.
' a/ {4 v% ?7 ^ - *6 i8 g, i5 v+ C- I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% \! R+ F2 z7 H1 X$ r* y* I
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& F2 E7 k/ l+ k1 x( j
- * TO CHANGE.
/ A. M6 N, O7 B { - *
5 [3 R- ~1 a: h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; A" p! U9 r* x8 d; v: {/ H
- *- p5 B! o7 i2 ]# @( V
- * This program is free software; you can redistribute it and/or& z% d' L! ~' s# V% K# s
- * modify it under the terms of the GNU General Public License as
" I; g% J% p' d' ]* Q, I - * published by the Free Software Foundation version 2.
7 ]! |2 q0 N0 [) r2 ] - *
! ]3 c$ }, d0 x. y" G3 e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 N$ J `( Q+ ^+ f+ k u - * kind, whether express or implied; without even the implied warranty5 ~: f# L% f: K; l* {1 @6 f1 `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 x; y3 a- {" g# f% G5 W& @# Z. l
- * GNU General Public License for more details.
% k# l% h* V6 H( @% A - */
2 k/ Q0 K) s! I1 j" h
$ @* T" p4 f, c, O5 j: g- #include <linux/module.h>
! y' a: h* c: F$ [1 R% @) z - #include <linux/init.h>) s- T( a! {/ ~' v$ ]( t
- #include <linux/errno.h>
. H# p& c ]8 W* P4 N2 D - #include <linux/types.h>
! K" J' J) C' J% q - #include <linux/interrupt.h>% b2 h+ ~ f9 U$ Y# `
- #include <asm/io.h>* |) H% e( g+ l0 t& t
- #include <linux/moduleparam.h>
5 A. @; _& [+ H- i$ O( y/ y - #include <linux/sysctl.h>3 E# r, |0 c, C* r7 v8 ] O7 \8 z( `
- #include <linux/mm.h>) f2 g) u; j$ _" G
- #include <linux/dma-mapping.h>
+ ]- \6 m; E# Y% f- Q - . s! f9 |5 R" h0 |
- #include <mach/memory.h>0 W% [# R4 W5 F, ]# |# }
- #include <mach/hardware.h>
* y r G) O0 Q# f; E - #include <mach/irqs.h>1 o/ R9 E$ D/ l$ a- ~
- #include <asm/hardware/edma.h>
* q# H1 R' V4 h$ h0 j, G2 _ - # d: |1 C2 `" x0 v& Z; n
- #undef EDMA3_DEBUG
- W9 |' x X; a: S3 K: j - /*#define EDMA3_DEBUG*/
0 g* ~. J7 ?. E% {
/ m. Z$ M! N5 l: v) f1 w- #ifdef EDMA3_DEBUG
8 |- }. m5 X# c8 u) K$ D - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 B0 b* b) E; M* l' O, t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& i# I) ~0 j( N2 a( @, d* a - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( m9 w E* H2 B: f T5 N x: }9 p `
- #else4 ]9 r, T9 I, g5 h( i m' ?
- #define DMA_PRINTK( x... )" u5 | M- {: ~: j& ?
- #define DMA_FN_IN
0 D0 ?4 S6 m" b+ k+ y$ x! L" V' X+ M - #define DMA_FN_OUT- n N6 K7 d4 I4 H, V& p- S
- #endif
9 \9 J+ Y$ V) Y' x* b* G+ M0 e
; o1 f$ z( \& [! G s5 d+ a- #define MAX_DMA_TRANSFER_IN_BYTES (32768) |2 L" N2 V c0 L
- #define STATIC_SHIFT 3
% ^4 p1 a0 b: Y, N - #define TCINTEN_SHIFT 20
! S/ R. h/ p& Z% H - #define ITCINTEN_SHIFT 21
/ U/ i$ t- O( Z! K - #define TCCHEN_SHIFT 229 J) x! r3 ^. G9 {
- #define ITCCHEN_SHIFT 23
: O* [3 r) `2 h- H I6 `; e
. P: K% N2 s% ?, b4 {- Y- static volatile int irqraised1 = 0;
1 I! d; @, B8 r - static volatile int irqraised2 = 0;
8 g. t r* N" G0 ^% N/ B0 W
7 Q9 ?8 y1 j3 z% ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# v5 W) Y8 u5 \ d9 S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 g q2 m1 U5 p: n
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, p( o( Z0 B" N5 Z
- 5 D( H2 |1 W0 A9 R- x
- dma_addr_t dmaphyssrc1 = 0;1 t1 y+ j; G5 d$ w( X
- dma_addr_t dmaphyssrc2 = 0;" F6 H6 x& [& M3 z" x" q+ x, g/ A
- dma_addr_t dmaphysdest1 = 0;. k5 q& u1 m2 v8 U: }# M
- dma_addr_t dmaphysdest2 = 0;7 o4 D# W# ~# t
- 0 X! O) V1 k; a/ \! y! E a" I
- char *dmabufsrc1 = NULL;& U5 g8 R; V& z: S7 R) M
- char *dmabufsrc2 = NULL;
9 E2 P0 |: c1 ^ - char *dmabufdest1 = NULL;
* B V1 d i! a6 U2 p- M - char *dmabufdest2 = NULL;
8 Y8 X/ J( X9 e4 w# v u2 q9 U
8 W5 X8 m" Y- |) N& d! `- static int acnt = 512;
8 o# \- E( x8 ~6 [5 Y; L( j- B1 z - static int bcnt = 8;
$ H6 a6 a0 H6 D9 s! ] - static int ccnt = 8;1 H/ _3 X9 H; k1 ]: U$ v
- $ @$ l4 \, b# U% \! y% O' _8 x7 O" T
- module_param(acnt, int, S_IRUGO);
' O& b- [6 o5 H) L6 [) c% a - module_param(bcnt, int, S_IRUGO);
! U" T: @4 Z$ |0 V - module_param(ccnt, int, S_IRUGO);
复制代码
4 {0 R2 K# n+ a% |. n4 N, {8 {4 U2 X, R* P" e3 m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 `& S1 N' S; j) y) l5 Y
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, |& a& b0 k. v2 u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 t( o. R1 n" p1 I1 S
# q! ?/ d& w% `. {' p
- w3 e/ h4 `3 ^& p
|
|