|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) G9 o# _' U# a6 o5 X0 Y- d
- [code]EDMA sample test application/ R( G9 R$ y! Q Y, E i
- /*
& Z8 U9 h' E+ K3 G8 n; o - * edma_test.c! ^. n9 ~# G3 T7 x' d
- *2 x! z+ z8 ~5 x
- * brief EDMA3 Test Application
) P; X+ w1 G) c2 P6 t6 u - *
: v" [% F( P ~) F7 v" m/ b7 W - * This file contains EDMA3 Test code.
0 Y- a* g W! q1 h6 b$ j - *! p4 L& o' G) O) X4 J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* D1 A# i% A1 N- N# ?) G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 T6 ~7 {4 b9 n* k' Z+ J! A+ i
- * TO CHANGE.
% b' U; h, ~( \ - *
! S5 N5 m+ y$ A; \' b3 | - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 d$ X0 h8 Z% q+ \
- *0 i8 _8 a0 l3 W/ }" A( u
- * This program is free software; you can redistribute it and/or1 h/ O3 D* m( R% d9 V! H+ X
- * modify it under the terms of the GNU General Public License as7 |1 \, {* v9 U" I
- * published by the Free Software Foundation version 2.( ]! n) Q/ s! f2 C" s2 r
- ** L9 F5 b/ N+ |- u! [
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, V3 z# |" C7 A8 c: G4 m, x% t - * kind, whether express or implied; without even the implied warranty
! X3 X4 e6 K3 `4 D$ G - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 H( x2 t; A4 z# _
- * GNU General Public License for more details.
# C4 C# v9 a% w/ n$ E s5 f - */. e% b+ g5 I; R/ c5 z! b( l2 g
' I7 k) C6 Q9 w3 W' s4 f- #include <linux/module.h>! g+ D& o/ V% l! X' B
- #include <linux/init.h>' R0 Y7 O/ Z! M8 _% V( T n* w
- #include <linux/errno.h># x. h6 Z# I& n2 ?
- #include <linux/types.h>3 b, N! l; Y ^
- #include <linux/interrupt.h>
9 |3 p6 y7 v' P6 R - #include <asm/io.h>
' B0 H( C- u! ]- Y& p. P1 X) G - #include <linux/moduleparam.h>: d! p! D2 r" I. z
- #include <linux/sysctl.h>
% a5 p A$ x) s$ X" p - #include <linux/mm.h>
0 D$ O G; e6 f. M" h4 g2 W - #include <linux/dma-mapping.h>
+ A+ |+ W. ~* Z. \5 h2 P) I5 f - & g* X. P s' n7 A, A/ S4 v
- #include <mach/memory.h>
* X s! M7 n3 P" x - #include <mach/hardware.h>0 O4 k2 l& ^2 f+ ]6 t! j" G
- #include <mach/irqs.h>' U1 X9 K1 k5 g% C% `
- #include <asm/hardware/edma.h>1 R5 J# a7 o x8 ^2 D+ E4 C1 j
o/ H9 T# m2 s0 N1 T) a$ o- #undef EDMA3_DEBUG) d' ?- W. W3 x9 Q2 V+ i* `7 d
- /*#define EDMA3_DEBUG*/( Y8 y2 [0 w5 m2 c7 J! B+ o
: c) S3 O' V' M8 `, Z- V( {- #ifdef EDMA3_DEBUG
7 ?/ \& b! P& [7 V1 t2 L7 k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). P# Z5 o4 Q6 a2 _8 L8 _
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 B4 s; M4 U6 R. v# Z& `* e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) N& t1 M1 n3 r* @ - #else
0 ~, M' M! f2 n9 ^ - #define DMA_PRINTK( x... )
" I# o* f1 N5 b! o0 ~: Z. V2 M - #define DMA_FN_IN
8 o7 B+ |1 |0 ]- \7 \ - #define DMA_FN_OUT
7 v$ X* D- ?+ B1 A, e" R8 \1 t - #endif
; ? ]8 X' F/ A/ t7 M0 u# _. J
& l: f+ Z* j9 w: F( b- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 C" M' W9 J3 L - #define STATIC_SHIFT 3) a; o3 Y) F+ _$ l) T: B( z* v$ H
- #define TCINTEN_SHIFT 20% j; R. | E3 c7 _. B9 Z! M
- #define ITCINTEN_SHIFT 21. |7 S% F h8 ], @7 [( r8 o
- #define TCCHEN_SHIFT 22
- j7 e7 n6 Y: Z- t' S' n; e3 \& V - #define ITCCHEN_SHIFT 23
* Q6 ^0 u# A# W* U! J - * L4 v; l% A3 X/ E
- static volatile int irqraised1 = 0;
( b' Z& I% {: X9 N$ ~3 k - static volatile int irqraised2 = 0;
% H- i; B# F' U* f: F9 o5 k- u - ! J2 `& k1 x. l) x6 f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- w& k; F8 f! Y! Y$ m. T; { - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 C2 K8 z2 Z! o. k7 ^
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ A5 r9 w; J0 v: {% }& O
4 e8 Q0 A6 Z) }1 d- dma_addr_t dmaphyssrc1 = 0;# ~7 ~+ u) k/ D7 m
- dma_addr_t dmaphyssrc2 = 0;
1 d$ F) Z+ n- h2 H/ a: F8 e - dma_addr_t dmaphysdest1 = 0;8 [( }2 j6 z) [2 R, b$ R
- dma_addr_t dmaphysdest2 = 0;
* C! {0 _4 {/ h ?
2 E" p$ ]) U0 d" l- _' N- char *dmabufsrc1 = NULL;& t9 o) Y3 k: v- k8 x. ^* A- p2 s
- char *dmabufsrc2 = NULL;* n; G/ [: f; y; I% a( I* {) D- h
- char *dmabufdest1 = NULL;! w9 I O% O; J( R
- char *dmabufdest2 = NULL;- j$ M9 s V& _& s6 A" s- X
- + u5 e y7 v0 z: s W) q
- static int acnt = 512;$ n6 r. O: p( c7 p6 _
- static int bcnt = 8;8 }1 X9 J/ g2 w/ J k7 o+ B
- static int ccnt = 8;
. r& k5 k( |4 g3 d' ^ - 2 @7 u' }* F/ t" l& {2 m) d
- module_param(acnt, int, S_IRUGO);
' J1 ]7 s% I4 \0 G: y$ y, y3 ^) e7 w - module_param(bcnt, int, S_IRUGO);( O$ N, Q% |4 |# L4 U, Z' l" x5 Z& S
- module_param(ccnt, int, S_IRUGO);
复制代码 & i2 X1 I' [8 {2 k2 N9 a& F% D( _' v
; ~* J) Q# o0 z) ^/ w 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ a8 H- m0 t6 ]" L" L7 Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" g1 K: s8 Q% F4 B1 h0 k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. I! C9 V. X$ Q$ m/ l, ~2 q+ S: r: R& C1 O, g, S) y5 k
! L* L' w$ ^: F4 j% R' M
|
|