|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 r u2 x; l9 ]9 A [
- [code]EDMA sample test application6 J, \" j G1 ]2 Y
- /*, o5 Y3 @/ U. ]2 @' q4 o5 Z
- * edma_test.c
8 w: g" ^$ |3 e; b0 r1 {9 S* ~ - *
0 X/ \9 Q# V U' c' {1 c: t9 z - * brief EDMA3 Test Application% d# Y9 M8 g+ @+ j; \
- *# B" N) T5 {* u0 m. Q! \+ W( ?
- * This file contains EDMA3 Test code.
1 x& c, [+ ]- H! K2 D7 M - */ S1 a+ f) A: D5 s) C) a, I0 y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& h5 Q. X0 k+ E1 T; R& X' y' {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 h# y: `( p4 x - * TO CHANGE." r6 ^$ S. M$ E1 W# v
- *+ M" Q5 V1 P1 n
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 y, [5 k* E! _' S# M+ ^% B- Z
- *8 K- V! u* ~- ^* p/ i' U
- * This program is free software; you can redistribute it and/or5 @$ h% B- p3 @) g3 J, ?, |: E) _
- * modify it under the terms of the GNU General Public License as
8 m ~- m( R# b" w' k) O' ^( ?: Z - * published by the Free Software Foundation version 2.
; L m" L" q( h7 f' G' w! y - *" F3 s- P9 s7 m( n: M/ z8 f
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 ~) k1 [$ N7 ]* \9 L' p
- * kind, whether express or implied; without even the implied warranty' ?. |9 N: \; s1 v% n. u+ N
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 x) ~( V2 ?& S1 \2 J" o - * GNU General Public License for more details.9 B0 U' L& |" ~& s0 B# U
- */, A8 @ k: ]9 H5 C0 X! u- A
" G. ?' u0 i& ~( r/ E% A- #include <linux/module.h>
" L9 T: ?/ I8 d @5 a) v) r/ A - #include <linux/init.h>
' ?2 Z8 y4 l0 B% A) L8 i+ S - #include <linux/errno.h>
8 A% Y$ |6 i8 _4 r w t5 }7 J - #include <linux/types.h>
3 i" D8 n' ]$ u& m* p& ~ - #include <linux/interrupt.h>( G- D6 G3 { c% E
- #include <asm/io.h>: {% z* j" \( C7 S, ?
- #include <linux/moduleparam.h>
, t, i5 ]1 @( B# s6 W w - #include <linux/sysctl.h>
. a% ], E: l7 ]3 h2 H - #include <linux/mm.h>. \2 W. \- u' R: ^, r9 z
- #include <linux/dma-mapping.h>
& R/ N0 {! S' U1 W4 M - 2 ~( x, X k- N1 s9 I1 H
- #include <mach/memory.h>- O0 m. c9 W |7 {8 l0 l
- #include <mach/hardware.h>
8 h8 Y! r+ p3 N+ y$ u( d/ \# I - #include <mach/irqs.h>3 }. k" ]* v- E" ~
- #include <asm/hardware/edma.h>
9 Z+ H0 c/ x r5 h& F
$ ?) P9 Y6 Y. T, V# ]" H! c1 y- #undef EDMA3_DEBUG
# l$ o2 X1 M! F1 _- I - /*#define EDMA3_DEBUG*/2 V; S8 J; Y! Y0 d- t
3 V6 a' R* z: D4 m+ N- #ifdef EDMA3_DEBUG
1 X6 J, j& p5 ~' g7 t2 e+ i% ?! W0 ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ ~/ e: L# T6 C; j9 ~: [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" H! ?: G4 I5 @$ b1 v! L - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 n1 P/ D8 y0 K/ L9 g% z
- #else
7 j% S1 d7 ~- }: Z4 f0 V - #define DMA_PRINTK( x... )
# |( P% B# s3 }& ?- r - #define DMA_FN_IN/ C5 @9 c% ]" l2 S/ h( d6 }7 s
- #define DMA_FN_OUT
3 J. z9 e1 W4 R+ \ - #endif
: J9 e! H0 g: ~
7 l- ?6 S! Q( _8 G. r- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 [7 x0 j: v s# o4 Q3 x& c7 ^& k
- #define STATIC_SHIFT 3
0 g3 S3 A) x" I8 ~* B - #define TCINTEN_SHIFT 202 Y$ l$ e* \& ~/ Y6 C: R! O
- #define ITCINTEN_SHIFT 214 Q) O7 o& N. J. u4 |! T
- #define TCCHEN_SHIFT 22 I& O7 y8 z8 ]+ S- `/ o! ^
- #define ITCCHEN_SHIFT 231 F' X0 A2 u3 O; K! u2 H2 T; a
2 s! ~/ L# [9 R3 P: f% a- static volatile int irqraised1 = 0;- X# d W( t! L
- static volatile int irqraised2 = 0;. Z( L" U0 ?# s; ]
- 0 b4 ^0 ]6 E1 i" v! v) q" Y3 f! b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 ~' @) h' h# L1 g - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ }% V+ e" v- e4 b. E/ Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ E% R% \+ |$ T t+ j
- 5 b4 k0 M! d. y5 C. T3 w
- dma_addr_t dmaphyssrc1 = 0;+ H& W5 c$ v+ Z* V3 Q
- dma_addr_t dmaphyssrc2 = 0;9 }) I9 }% n5 n3 f( ?
- dma_addr_t dmaphysdest1 = 0;
* i' E6 u) @8 [+ d5 s# D - dma_addr_t dmaphysdest2 = 0;
' u! w# x4 A S( ^9 Z5 ]7 H! z0 T4 d
5 y2 m7 A4 i9 n1 j# q. ~: H5 C4 g- char *dmabufsrc1 = NULL;. j+ P, g* K, D3 @7 T; L% N
- char *dmabufsrc2 = NULL;! g" w( |' b& f2 |- l: Q5 F
- char *dmabufdest1 = NULL;( n) P4 n) }7 [2 ?
- char *dmabufdest2 = NULL;' [. I* `* ~, @4 i3 X9 S4 d/ i7 j
* A; A: ?, t; V: ^- static int acnt = 512;
S% g: q" \* X4 ~7 s - static int bcnt = 8;* t7 Y! k2 V1 p5 c% j
- static int ccnt = 8;, `0 P* F" i1 ]- Q
- - E1 s: o/ Q6 h( e" Y
- module_param(acnt, int, S_IRUGO);5 B) l/ |2 N0 B: Z
- module_param(bcnt, int, S_IRUGO);
4 A& X- L7 W& ? - module_param(ccnt, int, S_IRUGO);
复制代码 $ \3 c9 q& H- B3 E
* q# e" k z! S: c% L! Y. U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 Q8 r9 g+ Q+ J9 r' M0 larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& Q9 t2 g4 T" L5 ]: D5 x& z( V
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ g; g# u( F R
5 s5 e" w0 O, R' r1 k* K3 c' ?6 v9 o- d" l* e4 X
|
|