|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( p1 ~( U! Y2 t5 u$ O; ~
- [code]EDMA sample test application" I. [* G* P$ [( O6 |* v
- /*$ U$ u X: U; p6 H6 k
- * edma_test.c& j" u) N3 i" X% H
- *
' G9 f1 E4 P! S: L! m% |! n - * brief EDMA3 Test Application
$ P( Z2 R& b& J0 T$ H+ j* ~ - *
: F7 X3 h$ }; @$ y, C9 q+ a4 l" ] - * This file contains EDMA3 Test code.
_ M( u1 s+ J, D3 J - *: A, p; d! j( \7 \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 Z! X$ J8 W. `: Z% Q4 P3 r. {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ _ X6 ]0 n. l1 \* P; r! c1 g
- * TO CHANGE. U/ V; Z) Q( `7 M5 A. w% t
- *
2 `1 C, E- }2 y7 s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% o; h' b- [6 e! h - *
$ P8 h8 q) R" H7 u" u3 d& x; G' B- l - * This program is free software; you can redistribute it and/or
# J; l2 b' m& N8 S - * modify it under the terms of the GNU General Public License as- b4 y, v h. s$ j* v9 H; b
- * published by the Free Software Foundation version 2.$ j: }% A1 S: W3 t" ]8 G" \
- *1 O/ Y% Q3 T# Q0 J* t2 H+ H' y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" {0 e2 M" ~' U) r0 X - * kind, whether express or implied; without even the implied warranty) Z6 D4 {, P. m1 ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 u" U) a, b9 L9 `8 S9 R
- * GNU General Public License for more details.1 v# E* e5 n$ |
- *// l D% F- k: j1 ]$ Q$ z
- 4 x6 Z. h1 M. F
- #include <linux/module.h>
1 e4 f4 c( s3 r/ d q - #include <linux/init.h>
% X3 N$ S% S2 P4 o4 ] - #include <linux/errno.h>' H9 _5 A; S- k) d. P v0 G) L
- #include <linux/types.h>5 d: o/ R3 k5 U9 O3 J( S2 @' [3 H
- #include <linux/interrupt.h>6 L& G- `# S$ @1 [7 e# Y v- e
- #include <asm/io.h>, N- n& I2 L7 N4 c. \! [+ I
- #include <linux/moduleparam.h>
# m% p: K" ~4 U& q- @, i j - #include <linux/sysctl.h>/ ]) a& `; ?. ]! |( Q
- #include <linux/mm.h>
" A1 B4 T5 Y; O" b3 d - #include <linux/dma-mapping.h>7 n% r, A! s0 U' H- @( N6 A
- % ^9 m# |9 N, U" z ], C
- #include <mach/memory.h>
% w, |" {- E% t1 l6 P& c) y1 R - #include <mach/hardware.h>
; E$ W& ?. p( k - #include <mach/irqs.h>4 A y5 n& ` R2 O
- #include <asm/hardware/edma.h>& a+ X$ n2 \ y0 G0 f& K
- ; E$ i N; p |, o% J8 T
- #undef EDMA3_DEBUG
+ J+ \4 r9 K Z0 t' q+ @ - /*#define EDMA3_DEBUG*/
, x/ c1 }: X7 w - ; }3 ]! ]9 ^) d ]# s C
- #ifdef EDMA3_DEBUG* P& i3 n8 g8 k
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ k$ I: y* o. ^% r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). t" H0 L( t& |2 V/ g' U
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) E' T, t4 c% }* m
- #else
3 P( s1 }( C. m" |) E" J0 n - #define DMA_PRINTK( x... )! `" J, J% v$ e: l
- #define DMA_FN_IN
. ]% s) v$ R+ L( v - #define DMA_FN_OUT; w3 n* n! n. d) Z( K* T( ?
- #endif
! K5 z+ i, c- |7 \8 p8 r; | - $ ?5 y, K; T8 U4 R0 v' W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 a$ L; K2 J* }7 S2 c- [ - #define STATIC_SHIFT 3- s0 Y- y; q3 t5 l. C- M8 q) _
- #define TCINTEN_SHIFT 206 V1 S* w' k7 u7 ?/ q X# H
- #define ITCINTEN_SHIFT 219 V4 h, c1 |! e, F: t: x" Q# Y
- #define TCCHEN_SHIFT 22
0 E7 L5 ]! D, _7 x( e - #define ITCCHEN_SHIFT 23
4 m5 H* ]9 ^2 i3 ~9 C7 j$ G. z
& d" W1 M$ x' `$ H9 d" G: x9 T- static volatile int irqraised1 = 0;
( t" `: v5 {" X - static volatile int irqraised2 = 0;
, k$ J3 M) {# F, x. u5 ~
& B) D' d y4 Q1 N0 e& s8 h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ?2 O4 H" D1 z" o* G# ^. h
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 {; o9 M4 c; O. L - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
{2 A3 b* A7 }, l# t o+ o
2 ?. x7 \4 K2 T" A1 I( x& }1 x- dma_addr_t dmaphyssrc1 = 0;# E% A, ^8 M. d
- dma_addr_t dmaphyssrc2 = 0;
4 o3 c4 Y! S9 W' ^0 D0 P, U$ b - dma_addr_t dmaphysdest1 = 0;* ~- E! m6 A. H0 K5 S6 t
- dma_addr_t dmaphysdest2 = 0;
: a2 x a! e1 f. ]2 H2 W! Y- \
. w! L7 Q( u& K* q- char *dmabufsrc1 = NULL;
3 y. }7 r- F4 z. J9 j" Z - char *dmabufsrc2 = NULL;
: R1 {4 A8 x* T1 @ - char *dmabufdest1 = NULL;: Z+ j2 Q5 x$ Y6 z
- char *dmabufdest2 = NULL;, }0 O5 w2 f: V9 M+ J
- 1 ~# x7 G6 s0 E# c( z3 b
- static int acnt = 512;
1 |: M; U* G0 m# K, E - static int bcnt = 8;
) [ ]) H4 ~& a: W1 D - static int ccnt = 8;. d8 o7 v2 N: R2 P
- ' p s" S d: V( Y
- module_param(acnt, int, S_IRUGO);; t! t; i# l& {) G" c
- module_param(bcnt, int, S_IRUGO);
$ t( q; q% \: e/ `) L - module_param(ccnt, int, S_IRUGO);
复制代码
% {1 [9 k; Z5 _ c& | z5 N) V; y' Q2 r! J' m, C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& ?3 P# ?' S* z" P6 S" y, e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 A, L3 G+ G: {2 Y G/ v+ _" x
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 e( w" K$ o. \( J
& @& Y' I, G9 X! a6 F
' W+ A( p# S! Q% L' X+ S |
|