|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( j7 ~# k5 ]5 D& ]) e' q# V
- [code]EDMA sample test application7 t% a3 I$ v* H6 a7 y+ V
- /*
* ~( j3 _& Q6 X3 L& _( ^2 L6 V - * edma_test.c
* ~8 N. p V# {* c: [% g - *
& ^, l& ?( s( { - * brief EDMA3 Test Application
; w e5 D% l& x2 K1 Q) y - *
; w7 J7 |* w0 w; R4 h7 P - * This file contains EDMA3 Test code.; F; M5 Y o' y( z. T
- *( K# b; Z/ \4 @' e9 }+ ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; E1 e5 m5 l2 @+ S - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; J1 M4 X% |6 D6 x% O1 M: E b
- * TO CHANGE.
# n% M# M! d0 v2 O/ W/ O, {; t - *8 L3 U3 ~% P5 F* J3 X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 ?& M! ^5 D- }5 {; m3 d0 H3 C
- *
' s7 ^4 {% H9 M$ r - * This program is free software; you can redistribute it and/or) o5 @! V2 u# M, x+ _3 O# H/ x
- * modify it under the terms of the GNU General Public License as
8 v$ l* j+ G+ v) d - * published by the Free Software Foundation version 2.5 W/ n: Q3 N2 i' H- Z7 b
- *
/ B9 B/ n; U6 O" y& j6 L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ h) i& Z0 }) k/ L3 L
- * kind, whether express or implied; without even the implied warranty; q& @' n! k ^4 S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. ?* |. `8 y9 R% `+ ^8 ?
- * GNU General Public License for more details.( i+ { a w0 p
- */
4 Z" H* m* q: _! d3 H8 g4 {( ~9 ~
( d; \/ k% E. X$ k8 q1 r- #include <linux/module.h>
; d8 x' w+ H' @: u - #include <linux/init.h>
4 p0 W+ H8 X6 Q& i' a - #include <linux/errno.h>9 b9 D/ m! @8 t) v) [+ ^6 b# x2 g* ^0 n
- #include <linux/types.h>
6 l+ u$ M% y/ x- O% t - #include <linux/interrupt.h>
( } K8 S- ~ k' `4 r9 e8 p3 a - #include <asm/io.h>+ T5 I+ K Z3 H! D# d1 w/ K. v% F2 `
- #include <linux/moduleparam.h>
6 u: H# P# n5 ~" R - #include <linux/sysctl.h>' m, R" A: z" n% L$ i: _7 i
- #include <linux/mm.h>
. R6 X3 d% F* s; ~ - #include <linux/dma-mapping.h>; u7 H% Q# Z. B0 ~
- - r8 {) A6 Z$ |$ ^* o1 Y
- #include <mach/memory.h>
) h1 N1 m) O8 c [ - #include <mach/hardware.h>
% `8 y2 g7 c/ ~ - #include <mach/irqs.h>
" a: k/ `. P* H% N5 L* ~4 ^ - #include <asm/hardware/edma.h>
: w' F7 M+ w3 }& K3 f! ~5 X - . [/ r9 S9 f" r q
- #undef EDMA3_DEBUG
' P. {- y2 _4 K k( n+ I4 g3 C - /*#define EDMA3_DEBUG*/- ?& y& a% a" E4 @8 V
& b/ G! W9 M7 K# \, D% S1 M- #ifdef EDMA3_DEBUG
8 n6 k2 j4 D; K% e) o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) g" R( `2 \( ^/ T0 A6 R r+ K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" t8 \7 I2 k c7 e2 p: c) h4 s l
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 ~! F8 Z9 E- x( @8 p# _4 y( d
- #else6 K1 V, ]/ l; G: a" |( x
- #define DMA_PRINTK( x... )! Q6 ~9 A2 b" z4 j/ ?
- #define DMA_FN_IN! ^4 V0 g7 ~1 v8 E$ M4 }: q
- #define DMA_FN_OUT
! n* H, r- Q7 G# |# h E - #endif
1 F; H$ n( x& h9 `0 [+ n; p
5 ~% [/ ?- k3 D6 I4 R4 O! H- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 d3 H, j2 V9 n2 g% {6 P
- #define STATIC_SHIFT 3' q& m+ N" A; S# j# q: A
- #define TCINTEN_SHIFT 20
; _+ n2 b2 z/ k0 S/ L2 r! Y. `; p - #define ITCINTEN_SHIFT 21% R: A6 R* _ X2 R( e: s
- #define TCCHEN_SHIFT 22
6 Z# [* B3 i* V - #define ITCCHEN_SHIFT 23
" ^3 M! m2 [" l: f3 t
% X; N4 H& B2 x+ X4 ]- static volatile int irqraised1 = 0;
9 N1 o, s' q- K; V. B - static volatile int irqraised2 = 0;4 u/ ^3 `$ \' Z" i$ |; C
* w8 R' S! V3 J. q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 H( u7 T: @% {6 n; [9 K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 C% O. w6 M" H, Q" F7 ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; ?) S6 V# N3 A/ L$ { - 9 C w2 J; Y4 \0 n2 R) E
- dma_addr_t dmaphyssrc1 = 0;
* ]7 X6 L" m& ?' p. ~8 E - dma_addr_t dmaphyssrc2 = 0;
9 K% m/ `) ^1 n - dma_addr_t dmaphysdest1 = 0;
. @( i! g. I6 F: q" V - dma_addr_t dmaphysdest2 = 0;7 D( v/ O9 ~6 o
" j5 e) X" l3 K" t3 ]9 K9 g& U: v- char *dmabufsrc1 = NULL;7 F ^6 r8 @8 V% @4 Y) @
- char *dmabufsrc2 = NULL; y$ c) i! ~7 F
- char *dmabufdest1 = NULL;
4 o6 E* v. ~- |6 L - char *dmabufdest2 = NULL;
$ g" T: W: Y9 p: \' h: n
8 b3 m. ]& d( R4 e# f- static int acnt = 512;" s/ _7 _/ A8 [8 W' K
- static int bcnt = 8;
" m1 h" o0 @9 a0 h( _2 h - static int ccnt = 8;
8 O, `: l4 O, S# [$ b
8 l: |0 F+ [* g9 U6 ]# v" }- module_param(acnt, int, S_IRUGO);
1 `" I! P' X2 @% g n1 u - module_param(bcnt, int, S_IRUGO);
4 Y1 k8 V+ x4 w0 j - module_param(ccnt, int, S_IRUGO);
复制代码 % i/ n* Z# S1 [/ n% f
/ ]2 F7 q% X5 ^5 [7 E) S( e; w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) x1 @ L* v, B# c$ X, `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 }% D. O) V! u; R+ V/ m* n. o: V+ ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 v4 D' ~- `, r d( s3 S. [; P
( y" s' x! a) @# O3 V# U
. e( N9 S2 }/ P. m3 S0 q0 e
|
|