|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : Q1 y( o7 U( [! i( M* M3 X
- [code]EDMA sample test application- C- Q5 O2 x7 }0 `7 a
- /*
0 k2 z0 h+ q: U' N. c1 @, B6 v - * edma_test.c
: ^% H0 w1 w6 R& C* y4 B - *
" J0 {6 h5 U( P$ e% Z9 a - * brief EDMA3 Test Application
: O! M2 d, M d" j* R& A - *. Q8 p! l! g/ X) T- [
- * This file contains EDMA3 Test code.. E/ L! Z& f0 n1 k' J2 E# O
- *# \) y, I0 T+ B/ U, N
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) F/ P; O9 s5 J
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# c8 w. C/ }9 ?) [! D
- * TO CHANGE.4 }' b9 ? E* c" u- W
- *# ~ {! P# O8 ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 d' e6 L( O4 Y1 [' ?; Z - *
4 ^4 |! k) b! C - * This program is free software; you can redistribute it and/or5 Z; r) o# B5 X; i& B
- * modify it under the terms of the GNU General Public License as
9 I* u! o* m& S# O/ s8 G4 t - * published by the Free Software Foundation version 2.3 C a" z3 S' }9 N1 ~% X `
- *2 Z( V& t1 }/ F% \# y# s' v3 g
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, g( W9 K) i, B. g6 J9 `5 ?; R0 J - * kind, whether express or implied; without even the implied warranty
" }9 u e' b( a3 T - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' O9 U' P6 J S- m$ }
- * GNU General Public License for more details.
% z% l8 k% N A$ q1 [ - */
. s2 ?$ e. q5 f! y F - 0 T( K) e4 Z1 o1 u! _5 l( _3 Y
- #include <linux/module.h>) q s7 V& K- {5 b% Q
- #include <linux/init.h>
& C+ J z$ I" Q. T9 d% B - #include <linux/errno.h>9 C$ p, B& y: {) n9 ~6 [2 [. n7 e
- #include <linux/types.h>
6 D5 V9 ]9 a$ _ - #include <linux/interrupt.h># T0 V( S) _# I! n9 B% J
- #include <asm/io.h>! W0 G6 m3 k& A6 b
- #include <linux/moduleparam.h>. }# D0 m: }! M
- #include <linux/sysctl.h>! C% V7 d. J: y. | \ Y2 g
- #include <linux/mm.h>
& T$ l, _$ ^3 y2 }7 d* ^" R - #include <linux/dma-mapping.h>
" ?$ i' u1 Y3 D W, J6 C - 1 H; Y9 R7 \& t9 W' a6 F) J8 @% x- D
- #include <mach/memory.h>9 L( e7 J- L4 Z$ A
- #include <mach/hardware.h>4 n7 I) v" w' \9 v0 M
- #include <mach/irqs.h>3 [- [$ ~8 G. y
- #include <asm/hardware/edma.h>" h1 Q' j5 b- q$ C' ^
8 l+ K0 z7 a8 S5 j* R6 ?4 T- #undef EDMA3_DEBUG
0 R! m J! C6 m! r& j8 |. U' C - /*#define EDMA3_DEBUG*/, T5 }' k9 D2 o6 Z! b
- 2 x7 T' M. k$ H: b- k3 u! v1 t
- #ifdef EDMA3_DEBUG
" _8 z% h- n8 ]; c - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 B# A% F5 G& N& d1 f& N - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) E- N; _# |) O) `6 Y# y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# ?" r+ F& k/ {1 k
- #else
$ Q2 Y, S; l7 Z0 K! L - #define DMA_PRINTK( x... )
: l) }6 d# G% q D+ Y b9 l - #define DMA_FN_IN
. a$ [. Z: q, k! t; g - #define DMA_FN_OUT
1 A6 }3 ~/ ?% i" w% D2 O - #endif
J( Z/ ~7 k* h# I6 D5 F/ O" h - ( \5 Y+ F+ X: `5 i/ U
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, J; p+ U/ T: V1 ?" w& u - #define STATIC_SHIFT 3% D9 @ ]4 `2 W0 M$ ~0 \ \0 s
- #define TCINTEN_SHIFT 20
1 M3 e% W3 {# J7 K' p I! R% d - #define ITCINTEN_SHIFT 21
$ X2 U- j0 T. }2 Q: _# U: K - #define TCCHEN_SHIFT 22
4 x4 ]9 x( b1 K6 Z0 h* _ - #define ITCCHEN_SHIFT 23/ n/ |9 C$ e" m4 [' \
1 i. u% B" Y) q+ d( A4 ^2 u- static volatile int irqraised1 = 0;! p( S; P( M) b4 D
- static volatile int irqraised2 = 0;0 {! u2 m* I9 C
- 3 v9 E+ H4 X r( u, ]7 v4 {
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 w" M6 \5 d! r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 J, r* e. u' y) I7 x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); `: X D4 Y: C) ^. @- Z Q: `
9 I2 c, c) @* ^% ]9 m# c' v- dma_addr_t dmaphyssrc1 = 0;% h; k% Z. T; G$ t
- dma_addr_t dmaphyssrc2 = 0;
+ X( |% B# F( X% S; Z' f - dma_addr_t dmaphysdest1 = 0;
( a9 a! {: m* I4 m) a - dma_addr_t dmaphysdest2 = 0;( R( C' [. l' c3 L: f
- $ {3 X# @6 R# ?6 O$ G% {, k) x
- char *dmabufsrc1 = NULL;
3 {' T8 `/ a2 d6 @) `9 |. l - char *dmabufsrc2 = NULL;. z, k \8 Y! ]/ ^0 L8 @+ j9 x$ f
- char *dmabufdest1 = NULL;' F5 G0 p; u5 t/ R: [3 H
- char *dmabufdest2 = NULL;& T5 X9 N9 J" _6 o8 l1 i
- 1 v. q) f8 \9 k* `# x3 w0 c
- static int acnt = 512;% `3 L3 U. U. t/ g4 p* r
- static int bcnt = 8;
' n& d. z j: Q1 s( A' \& j# [ - static int ccnt = 8;
/ ^5 M0 a3 O5 a# _3 q- e: N
$ w f" V; J! Y. \ Q9 L x( Z- module_param(acnt, int, S_IRUGO);' v( V. `: e8 I# R$ Z4 j
- module_param(bcnt, int, S_IRUGO);
1 |6 C% Y- r: M* n% k9 Z4 m- q - module_param(ccnt, int, S_IRUGO);
复制代码
) C# }- U8 s3 V
& r" D; c: X8 C4 R5 w0 D3 ]3 y. Y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& h' W1 B5 ? L8 K; X2 U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 a5 W$ F( B6 | D: e1 K
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( K( L+ {* @' J! E ?) t3 `
5 l5 p( ^0 d6 w
( `$ w# w) p' q' P0 D8 r% ^ |
|