|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 f' l s/ K. r2 M; j" Q- [code]EDMA sample test application& ?3 p, v" a" `6 M
- /*) ?8 Q% S! J. G; Z, h! `& G* t3 g
- * edma_test.c8 \; b- \9 Q4 w- u; o' n }
- *! r3 d2 _+ U& [, F, G3 U
- * brief EDMA3 Test Application0 Y% ?% o. q4 O# A* ^" l
- *& H+ E g) r6 J
- * This file contains EDMA3 Test code.
1 |! X; ~) }3 M6 V1 o6 b5 ^' A - *# A/ I7 E6 A# q g* R5 A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 `8 K* ^. E1 `8 u/ S' N( \
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( Z- ~# ]& o9 g! F) @ - * TO CHANGE.
6 L# [& Q! G( t% e. k* R9 { - *: Z5 [* J' ^$ ?( {# |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 A O% m) m5 O1 r* i t! X1 l+ m
- *
' Z; ~* r5 C7 [" X - * This program is free software; you can redistribute it and/or
, w: ?3 G" w- ^% b% L) J% B1 ]$ t - * modify it under the terms of the GNU General Public License as
_+ Z* W5 @9 B3 C- J( q- M - * published by the Free Software Foundation version 2., O& I- s/ ^6 ?- w
- *9 t! K9 _+ S' I, d! V* _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 @+ Q0 c5 I$ o5 i8 x" J! N* E- u
- * kind, whether express or implied; without even the implied warranty
5 y% v V. J8 R: ?8 z% L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 U) T0 @+ D" { - * GNU General Public License for more details.
+ E2 n2 A7 c5 _; C9 Q - */
5 f/ r: e: Y" i! y; u% F \
7 \9 f# k5 n* s- #include <linux/module.h>
' P6 e7 q. T/ ^) x$ R$ v - #include <linux/init.h>
_, G# e, g6 |8 |; z# J! g - #include <linux/errno.h>
; h8 E% e3 `7 r2 Z I - #include <linux/types.h>
1 L/ Z/ W ?7 | - #include <linux/interrupt.h>
+ {5 q. I2 d. A/ f- s3 P$ u: ] - #include <asm/io.h># |- h9 ?& `( y# q6 U T
- #include <linux/moduleparam.h>! X, P' }( X* [# ]. E+ C
- #include <linux/sysctl.h>4 s! e& P8 j5 r% S5 a" T. _
- #include <linux/mm.h>
( @, t" T% u8 y+ g8 d) N - #include <linux/dma-mapping.h>
. [& l y- Y$ v6 G+ K9 ^ - 2 `# ^6 M7 G m" s. v$ x
- #include <mach/memory.h>
$ N9 y' d7 x& F0 f) C+ ` - #include <mach/hardware.h>
; Q) T! D0 h+ H( b' _, J5 g- _, j - #include <mach/irqs.h>2 \ A$ E- Y2 ?6 }
- #include <asm/hardware/edma.h>
, L+ u) m, J2 u! Y: P* ~% j& g - - a; M0 m$ b5 @9 Z" i* t
- #undef EDMA3_DEBUG6 m+ W% ]: b w: H! I2 f! X, k- f' f
- /*#define EDMA3_DEBUG*/
8 R3 ?. e6 b! \' m4 m - ; x* e" z0 j8 B
- #ifdef EDMA3_DEBUG
' E+ g- x: x* b$ { - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- ]6 T0 E* `$ ^. @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): m9 \, c% `: J9 a- `
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 K2 X3 e1 f+ W2 d - #else$ t7 T+ j3 C2 u
- #define DMA_PRINTK( x... )
9 A/ Z# K! K9 a6 a3 ^: z - #define DMA_FN_IN
6 D2 V7 Y5 I8 N+ w9 c - #define DMA_FN_OUT- V; C( C) k! O3 E( _
- #endif
, m) B4 F6 S( I; l - 4 }" u7 S) V& w' e) V! u
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 G9 A) S& r9 B* n5 T% J - #define STATIC_SHIFT 3
! B* Y' i5 R; I' G( { - #define TCINTEN_SHIFT 201 u6 U3 N* E a( D! [
- #define ITCINTEN_SHIFT 216 f) n# h" `$ p7 P; p
- #define TCCHEN_SHIFT 22! H# I/ t( j! U* b% v7 ^2 U# q! G
- #define ITCCHEN_SHIFT 23
; e# s5 d. ?7 S; W/ A - / d, j2 m! O7 ?: g }! k
- static volatile int irqraised1 = 0;
8 P# {9 p; y- Z- ^ h+ d$ ` - static volatile int irqraised2 = 0;
, ]2 Z& t. U6 e4 [/ }
" ]: w! u$ Y u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% @- o9 i: p; N ^: f0 }
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: v( l* C: ]# V
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, m& H9 A6 ? S( }* ]
0 M/ r+ @ [. k6 T6 K$ h- dma_addr_t dmaphyssrc1 = 0;* |1 ^, @3 i5 I0 s3 c$ q
- dma_addr_t dmaphyssrc2 = 0;
% X2 X) Z# l9 o: d( R7 C+ c - dma_addr_t dmaphysdest1 = 0;
1 a2 N6 ?* q9 x+ R1 L' H. p# l - dma_addr_t dmaphysdest2 = 0;
" L$ x3 @' v Y& ]% r( J2 l/ S - + A' v ?7 N* Q, u
- char *dmabufsrc1 = NULL;
) L! x: b& L) d6 ` - char *dmabufsrc2 = NULL; r4 Y8 {/ a) y) o
- char *dmabufdest1 = NULL;
7 f# J' d/ Z2 r2 M% [% Z4 r - char *dmabufdest2 = NULL;$ v, X3 e" T* Q- ?2 e# b
- ; m' L* ^; } d/ l& G
- static int acnt = 512;! U1 Y, B9 |0 f4 i" e
- static int bcnt = 8;
+ Q; I! R9 f, q" H: \/ I+ ^ - static int ccnt = 8;
& T/ p3 M1 O, ` [: d# S" d
2 a3 b2 W. {3 E! [- module_param(acnt, int, S_IRUGO);( j5 K2 S2 ]1 t# r* [4 E: o: L4 l
- module_param(bcnt, int, S_IRUGO);! K( `3 M( C+ L3 X0 e) Q
- module_param(ccnt, int, S_IRUGO);
复制代码 1 L/ X: ?( K8 U8 h* i$ \4 t l
& Z s+ }! @3 F# n: q7 w* l: R0 m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' Z5 F; Z' F h/ }; C" V. barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ `8 p) Q8 x9 Z. G+ q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, T0 P$ O- D7 m' i6 y1 w" @0 C
9 F" ?3 V/ q! K7 b2 Z9 s! C' V2 ]# K1 i* y. J R$ W9 _
|
|