|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; L2 G& a6 p4 K4 d$ \5 r- [code]EDMA sample test application
9 F' W; i5 \' P4 I2 ^ - /*6 w a8 ^% a# R9 z$ v$ {. z8 L
- * edma_test.c
+ P) O- X& \2 e( j$ | - *
5 m& E1 S* C( P5 y; o$ F8 B4 y) f' y - * brief EDMA3 Test Application
2 p) E4 E) m" [0 t! }% i; Q - *
5 w- Z& p% h8 A7 l% | - * This file contains EDMA3 Test code.% j; W! i& U9 V* L7 d0 H
- *
0 W9 `* s' F+ u" E- \3 x/ H - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. B4 T6 h, e- `3 i g8 @7 M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, k% d0 ^9 j/ }, g3 K - * TO CHANGE.
( R3 D( E% _1 o: [$ f - *
5 C- H& M1 _5 d/ n- q5 }! a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' p- d7 a) @" o' K& v/ i
- *
$ X3 d- C; C7 c4 u* V3 B - * This program is free software; you can redistribute it and/or: l8 z+ d" t$ T* _8 o' t
- * modify it under the terms of the GNU General Public License as+ e Q5 n7 H; L7 Z/ J
- * published by the Free Software Foundation version 2.
) ?5 Y, o! L8 q7 a - *4 ]7 W0 M V* X x- J: J6 P- h F( @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, z0 ^* @# f( F# N
- * kind, whether express or implied; without even the implied warranty
2 ]6 c3 @6 d" _; w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" N1 V% H0 q' [( l# H8 a, a
- * GNU General Public License for more details.
1 _. c9 d/ }3 [3 N" @& e( a2 s - */( `- h* D$ y1 y* p1 X: ?* _
- # V6 @ N9 l% \) A" h3 S
- #include <linux/module.h>( T- x9 ]# K; o9 {# x
- #include <linux/init.h>; ^- ]3 ^3 O: r" i. |( D
- #include <linux/errno.h>+ o3 u; d( g1 T4 u6 S$ y
- #include <linux/types.h>
+ b" P N8 X2 Z) @ - #include <linux/interrupt.h>
% C5 U. A X! V1 i& c; [. d - #include <asm/io.h># D9 k: D- @/ p& O! }
- #include <linux/moduleparam.h># n2 W' g8 R F4 V7 Y% a# x
- #include <linux/sysctl.h>- X% H/ `( ?2 l3 @+ \9 d
- #include <linux/mm.h>
3 a% Z: V) U; { D- F - #include <linux/dma-mapping.h>
l8 h% R( E! ^4 m" d b - - A' V4 w# V. X3 ~% s- F! Z
- #include <mach/memory.h>. i1 P8 E) V. T% z2 M/ Z& d U
- #include <mach/hardware.h>
+ _5 q* x: O6 a: d8 p1 e3 t' V# g - #include <mach/irqs.h>
& I h$ ~5 K/ t" j, d( z7 H& m s - #include <asm/hardware/edma.h>
7 h3 ^' J' S9 ~ - 6 E% G5 n/ y7 O
- #undef EDMA3_DEBUG
: ?8 w, t) h+ J% U) D/ @% X - /*#define EDMA3_DEBUG*/! n; p! {: M6 k7 X: [
- 2 u) f- W2 h9 h( k; T* \- \
- #ifdef EDMA3_DEBUG6 z% E+ V! M8 k; Q8 D4 D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( B) z; t F0 M: [ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ v' S& W: j, E8 k% B, m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' \3 @- n f, B - #else
3 J+ |& o7 W+ i, ]' g - #define DMA_PRINTK( x... )
, q& Y& B& J3 ^- f& l+ `( T- j! P9 c - #define DMA_FN_IN1 S0 O- l5 @* W. E% f/ V2 X
- #define DMA_FN_OUT$ t$ b. E) Z: H9 T! ?0 ]+ ^
- #endif. M( G( b. e9 v8 h0 I
- " |7 u8 W# Z( M3 n! M# x B9 f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), g: W3 y8 I9 b& H# [
- #define STATIC_SHIFT 3; r) }, R( d0 T7 [8 u4 a' F
- #define TCINTEN_SHIFT 208 J( r7 n8 A% C5 X; `
- #define ITCINTEN_SHIFT 21
9 ^% d6 d* h0 t( ]4 H0 R0 v# V - #define TCCHEN_SHIFT 22" b' o/ M4 S. x) x/ `5 M: a3 I4 s
- #define ITCCHEN_SHIFT 23- U# `: S* J" Q: z; x
/ n% [. j# V3 k- static volatile int irqraised1 = 0;
2 ]2 E* H* D; e& P+ w9 R - static volatile int irqraised2 = 0;1 q6 O6 W: v) T) l1 d' @
- 1 S1 n4 r' e9 l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; \6 [! c( J* U. W) r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ K+ N' c/ S5 j: U' T7 \* d- q2 M) {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 p: F3 l t6 b D3 X
$ H* i; a5 Z5 S- [9 m- dma_addr_t dmaphyssrc1 = 0;, v4 }5 r& X! D& ? }* E
- dma_addr_t dmaphyssrc2 = 0;/ Y0 w) t" k/ E/ D i. F1 E% @
- dma_addr_t dmaphysdest1 = 0; \8 J& i6 T, i8 n
- dma_addr_t dmaphysdest2 = 0;' V6 U* n U) f- @8 m) v" t. j- r' m
( B4 b0 u* t6 p$ I) O7 W l/ l! N2 E- char *dmabufsrc1 = NULL;
, W3 A3 Y6 k6 x - char *dmabufsrc2 = NULL;8 ^1 Z) m0 Z$ C$ n/ a( S, {
- char *dmabufdest1 = NULL;1 o6 x. w3 D1 [/ N4 ]/ r7 ?9 y
- char *dmabufdest2 = NULL;
/ u! Y$ I6 h0 {- c1 P* {
' D, c9 O- ^5 p. C3 [ C- static int acnt = 512;
- y/ d9 b$ D0 I- Z! J$ G0 S - static int bcnt = 8;
) m, L% O) [3 T+ { - static int ccnt = 8;) {. N& w' w) O+ x) F' ]+ b$ }! X
- & Y- g1 X6 N4 C2 m( A. l
- module_param(acnt, int, S_IRUGO);* G! q) f8 d7 n( [& v
- module_param(bcnt, int, S_IRUGO);% E8 f p" s5 k# F; J, b
- module_param(ccnt, int, S_IRUGO);
复制代码 : O7 O, d0 \: g; H
* @5 I4 x4 _* f
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 N* f4 M- X: j) M3 n. \, z/ m' s z8 j! ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ d9 |! @: {4 ], ^+ _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. z8 ~& Z6 @% n
$ Z4 W3 n: P2 I3 I
5 c0 u2 | e2 M6 E |
|