|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ Y, A; y: a% z% a- [code]EDMA sample test application" z! |0 C$ s' l: F* d, u4 z
- /*8 r( D5 D' f, v1 ~, E p( H& k
- * edma_test.c
0 h; P! {' |8 T! g) z - *
5 I, p0 k% v. R - * brief EDMA3 Test Application1 _1 k! U2 ?: u0 w& @+ Q
- *
5 I B# ]$ c0 i% e+ J8 @ - * This file contains EDMA3 Test code.* M! _ |9 g4 [
- *
8 d1 T" S! M6 Q3 I& a: @2 h& U0 ] - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& H7 `+ Y/ O5 h+ E0 E! | - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 c# U( u1 g+ _5 G% }3 g# A# G
- * TO CHANGE.
1 K' E! \9 G, g - *
$ ~& r4 r$ Q' l5 i4 } U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ L( i. H! \: j* B* ^! Y - *- q: U! F' R" y; Z6 ?1 O! E# R! ~
- * This program is free software; you can redistribute it and/or
4 p- y8 Q4 L% _% M* C - * modify it under the terms of the GNU General Public License as8 x0 M. r. F( S ?6 h
- * published by the Free Software Foundation version 2.
8 H2 K. A2 }& m5 L" W - *
1 i6 w. d$ R+ ^) K7 L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- C R S4 X# }# I - * kind, whether express or implied; without even the implied warranty* @2 t p+ @5 l; u
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the e) W$ D8 g1 v
- * GNU General Public License for more details.
% L7 \! ^, h5 b; g) i - */2 L# a; B: V" H5 n& A. [
/ ?; _- U% }2 T# ?* Z% g" k- #include <linux/module.h>
7 x( k3 |0 Y0 g1 _9 H - #include <linux/init.h>9 v9 w2 l `' N. E
- #include <linux/errno.h>
, S: y+ Q; i3 U% S; G! O* G: v - #include <linux/types.h>% C' e! p. n4 I( y9 R! N) V7 p
- #include <linux/interrupt.h>
; j: \' l+ {+ Y2 z. Z - #include <asm/io.h>
9 V5 _ c& T" ~. \ - #include <linux/moduleparam.h>' D, t2 \" n; N- u
- #include <linux/sysctl.h>! G/ H3 u8 `2 a' f3 H
- #include <linux/mm.h>
* U" B' ]9 Z; D9 Y, P# K9 I - #include <linux/dma-mapping.h>" Y. D2 F* \' u- {/ ^
, ~. ^ ^2 y& c' x% y, k5 p' l& v& A5 K- #include <mach/memory.h>
, l; t" |" w2 T4 q - #include <mach/hardware.h>) Y) r, f. y/ z
- #include <mach/irqs.h>
i+ s* l) _4 S" j0 p - #include <asm/hardware/edma.h>
5 S, j1 k/ V5 [5 @+ H2 l. J
7 n* j" S& b+ R- #undef EDMA3_DEBUG
! Q, B3 C' n3 I/ e+ N t: b - /*#define EDMA3_DEBUG*/* P. n. ]6 ]* r3 C, {* E. P9 {" Q* B4 V* [* k
, W# ], Z# R; W. S- F; k4 h- #ifdef EDMA3_DEBUG; V# X& [# F* b; X+ J& q- D
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( Y5 R4 `% r2 n- C, j: @- N; J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ z- }& p+ C( b0 A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ x% @& _5 C: c! i0 G
- #else- k$ n" p& i$ G9 R; u
- #define DMA_PRINTK( x... )
. Q* u) A" m# i/ d9 D - #define DMA_FN_IN0 G4 ~% ~3 @2 a
- #define DMA_FN_OUT$ J/ {) f+ y$ h; t A+ A
- #endif
7 S: a9 { u2 d6 W1 k - 5 g& x ]8 F% T! F# I$ I
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 o* H: I, @' r/ z8 P
- #define STATIC_SHIFT 3
- c- p3 \7 N) l - #define TCINTEN_SHIFT 20
5 I2 b. W& D% X - #define ITCINTEN_SHIFT 21- L+ N$ ]- I* Z& n
- #define TCCHEN_SHIFT 22
. |+ x ]$ K k+ U( x. F2 V' N - #define ITCCHEN_SHIFT 23
& H( z9 H2 t5 v( p# E
0 L0 X4 S4 ~" w# j* ]+ h& \- static volatile int irqraised1 = 0;
) X/ Z2 ] ]( I% U# {7 |9 S" N - static volatile int irqraised2 = 0;/ f& P1 B6 a+ v8 l% b+ [
- 5 W- a/ {$ _* t+ {! J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" h, T/ n4 v4 O$ g& W7 V - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# y. ~% w5 [" G* G" l - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 a/ c g' q8 Y
- 3 v8 e% T- G5 E, U( n, s- w8 p* T# e
- dma_addr_t dmaphyssrc1 = 0;
8 X) z4 M6 y8 u! h) N - dma_addr_t dmaphyssrc2 = 0;% A0 b+ g& [7 r U+ w
- dma_addr_t dmaphysdest1 = 0;; U' r' d n4 W% J4 c l1 d$ w
- dma_addr_t dmaphysdest2 = 0;
' B/ P9 `+ t9 l
0 N' v! ` l% R& b0 `- char *dmabufsrc1 = NULL;
2 ]( s, C% c! a - char *dmabufsrc2 = NULL;' s6 C" \( w2 n5 \! V3 t- M" x
- char *dmabufdest1 = NULL;: [4 I- w" m9 V3 ~7 ~
- char *dmabufdest2 = NULL;
( G n5 l! h8 }! G
" g& {; O" e( G2 t. n( ~; R: U; k- static int acnt = 512;
1 G4 y/ U- A8 Q { ?# E - static int bcnt = 8;
" G8 H' l$ l- a* c" q& y - static int ccnt = 8;& R5 v& w8 ^2 h
% g# l. `3 U! @" R" h- module_param(acnt, int, S_IRUGO);9 M7 j8 [& d4 C1 J2 L6 d# r/ b
- module_param(bcnt, int, S_IRUGO); A" F" T' x1 m, E$ w% S
- module_param(ccnt, int, S_IRUGO);
复制代码
" E9 J `* h+ h g5 h* O0 h
) e- u& w0 `1 w8 u; D 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( R1 c8 s* R+ o+ d' f1 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 D3 D2 N4 d+ y/ w* t' J 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 n6 g# k8 b. H& S8 Q5 \ r
$ m( u+ g6 e7 A5 u0 `
1 P P# f9 u- D: |% T( X
|
|