|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% X* e8 o$ {2 K2 ~9 b. C8 u- C- [code]EDMA sample test application' K1 S+ H2 x O) q
- /*! s. W4 }. b& y' ^1 k7 d9 m
- * edma_test.c( S* V" S( m- x W" q
- *; L q& E- V0 P) l5 n
- * brief EDMA3 Test Application
7 {3 m4 }# B+ L* j( b) ? - *
0 _ e0 ?9 ^& e+ D - * This file contains EDMA3 Test code.! Q: s0 m/ v' N: ?+ @* E% p2 O$ Z4 X
- *( Y' |4 Y1 w+ y0 p0 s
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; o+ w+ B+ _- i4 a; F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# B% R: f% O3 L: E/ L0 i
- * TO CHANGE.9 X7 o) [1 r0 \% C/ U
- *& p- {* o( d9 c* z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; d/ u+ R4 w# [8 ~1 N$ w1 z - *. r3 E8 A3 Q, S; L6 Y
- * This program is free software; you can redistribute it and/or8 T4 o7 Z* ?/ w9 y$ v
- * modify it under the terms of the GNU General Public License as# v2 L4 r! N. H3 c# a R
- * published by the Free Software Foundation version 2.
: U2 ?% A) S# ] - *
3 o$ v, Y- a2 F' |5 k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 P2 A& E0 x( r' {1 c& Z" \% ~8 j - * kind, whether express or implied; without even the implied warranty1 P# {. i1 F& S% T$ i; F- t R! d |
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% V" j* ]6 d2 [: I, t0 r
- * GNU General Public License for more details.( h% i. q) C6 {5 o. V
- */
1 u* L1 U5 r9 I% v/ M% `# H
: _) @1 e _2 \1 o- #include <linux/module.h>
" L. \# v! f6 [5 Z - #include <linux/init.h>
3 [& L7 F C% B, B' L1 | - #include <linux/errno.h>8 t2 O- g% {6 {0 ]* a0 z
- #include <linux/types.h>
/ H9 ?. Y2 D! Q2 v - #include <linux/interrupt.h># q# X M% l3 Y6 A
- #include <asm/io.h>
! |3 P& X6 w/ D; b! F - #include <linux/moduleparam.h>& o5 y8 N: l: A# n
- #include <linux/sysctl.h>* Y1 v8 X! B2 r% O$ L
- #include <linux/mm.h>
3 o+ E. H- X) |: n3 Y1 _ - #include <linux/dma-mapping.h>
, F5 s# w* f( \& b3 @
4 [7 k% ^# x2 }4 m- P- #include <mach/memory.h>( v [- L$ x- L' L
- #include <mach/hardware.h>
. c1 Q% V4 k+ z2 b# c; G7 L, G) r - #include <mach/irqs.h>
: |+ Y9 v/ Z5 M' ?4 v; l - #include <asm/hardware/edma.h>
W8 z$ _. }5 W2 I7 A - 9 i J7 {; c( F& V" b
- #undef EDMA3_DEBUG7 u6 {4 F& _4 X, _7 N7 S- w2 p, J
- /*#define EDMA3_DEBUG*/! P# Z) \, C a* D$ p1 J4 f2 ~. |
6 Z1 H l/ H+ R2 p- #ifdef EDMA3_DEBUG
n7 ]! q2 e, s9 G - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: ]- k: E/ B( `6 i' j" { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" K* w: q0 _1 W+ {3 ] - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 Z' h" g/ l. T5 R - #else' n! N5 Z) e% T- _' t
- #define DMA_PRINTK( x... )7 e9 s# w1 [% ~- @) @
- #define DMA_FN_IN
1 _, g7 Z) C, `" s, v - #define DMA_FN_OUT
7 ~, M* r! `+ ?' h% k% N8 f - #endif
5 _ t, H/ Y* O- N: _7 H
8 m1 O( [, \" h8 s; W6 @: `7 V5 s5 p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" i% k' I1 y6 Q+ C* D
- #define STATIC_SHIFT 3. l! e" K6 s: {+ R9 U$ C+ z1 D
- #define TCINTEN_SHIFT 20: S4 E) c+ e% d3 k
- #define ITCINTEN_SHIFT 212 t* {( z2 Y& K5 K$ _9 T
- #define TCCHEN_SHIFT 22+ K0 v: P& X' v) g
- #define ITCCHEN_SHIFT 23
. w% F! I/ F6 G. }& i9 f" i% ^9 c
- a- O: j& ?) _- static volatile int irqraised1 = 0;
0 t N& k' `& ~4 \ - static volatile int irqraised2 = 0;" r) K3 L: a: @6 t0 e6 l
- & I9 y! W- |0 i" s" L5 C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 r7 r' \5 W# \$ z0 B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& S. D$ \9 {5 i6 O0 ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. r( |0 P- W" G2 f
* z% g. _/ Y7 u" v+ G8 q* K- dma_addr_t dmaphyssrc1 = 0;' u! M3 o! }, F$ R* H' y1 y( e
- dma_addr_t dmaphyssrc2 = 0;: ^" ~) C. ~) m& D
- dma_addr_t dmaphysdest1 = 0;
5 \$ a+ p Y) {5 v! N4 l - dma_addr_t dmaphysdest2 = 0;5 r' a% ~) O6 l# o$ r
h# X7 G7 U; }# p! ~1 r' e- char *dmabufsrc1 = NULL;
7 U# o& I8 C1 `- z - char *dmabufsrc2 = NULL;6 o6 M a7 o. A
- char *dmabufdest1 = NULL;
3 c Q' S0 \1 L" v8 e - char *dmabufdest2 = NULL;3 Y0 U1 |) }0 ]) D$ [, N0 w1 V
. N. p: C8 O/ C6 S% l- static int acnt = 512;
' ]9 ~: h$ e+ e! F& m$ V - static int bcnt = 8;
- L0 q L x/ o) i) {, |) T - static int ccnt = 8;
6 @" o% o! H8 V+ U* Q- J2 q
# u3 |" T! H& O; z- k+ a4 a- module_param(acnt, int, S_IRUGO);' w3 R' {9 J s6 K2 |' C; K. P: x( f' K
- module_param(bcnt, int, S_IRUGO);& O e+ v& B/ b+ A9 M% K" c. t5 Z
- module_param(ccnt, int, S_IRUGO);
复制代码
5 ~6 v4 p% I$ v1 m2 v6 I7 S& W6 c6 E$ r+ p: u7 U, e* L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 n5 C% _2 f% L5 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ v- q7 X/ _9 }- R& X
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 G- w7 W* D: V. R, e
3 G+ x$ S ~) w
. R5 q g/ d3 B, \7 w |
|