|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 D" u i- G7 G; P
- [code]EDMA sample test application* ?& Z9 X H: O8 B9 k
- /*6 Z* T1 h+ ^3 ?, p! v* H
- * edma_test.c( @2 {9 h, B) e' d; H
- *
1 ]& O/ f+ R, k& o8 K - * brief EDMA3 Test Application
+ R" r+ ^: Y y- e. k. N - *, V4 a4 b# D' n9 ^8 u( ?" j
- * This file contains EDMA3 Test code.
' T' T+ u. W2 c8 H" M& H- P - *8 ?5 ^ O I( ^ R, r+ F: R
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 c9 o Q; U, j+ ] - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 R) E- R. m# O2 T* R: v6 M' o+ o - * TO CHANGE.
& r e7 X) [& d% |& n% `* g - *5 I3 `1 T# F8 z9 B0 g+ H! D4 N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 k. L: l+ F0 r# h- m4 z$ Q
- *( h8 B/ Z: x! {. {' _ z' W# \
- * This program is free software; you can redistribute it and/or# v6 b1 v( b( L6 F9 `
- * modify it under the terms of the GNU General Public License as, F* |8 E! B# j/ p6 w h
- * published by the Free Software Foundation version 2.0 e) K/ d+ j5 S# r4 k0 u
- *( E# d7 O% \( l) U
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 i2 Q2 e$ ?# e+ f - * kind, whether express or implied; without even the implied warranty
; v4 T: E, i/ |* S. F6 r5 _# v - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" ~1 o5 n9 I' `% O3 |* T- b - * GNU General Public License for more details.
8 ~" Z' u# _$ a8 H - */
1 Y% X) }& \0 ^( ~3 A - , K, D3 g" U+ T! G% W/ {% K8 t
- #include <linux/module.h>
* Q# v) V- v: O7 H9 A V - #include <linux/init.h>* ^: k' s) K; W! B. Z: b
- #include <linux/errno.h>; i+ G- k; i3 K" [' {
- #include <linux/types.h>, H1 A! b0 f: U( f
- #include <linux/interrupt.h>7 c9 Q* u9 j! Q8 {
- #include <asm/io.h>, u2 B$ D0 U6 a e- c# R
- #include <linux/moduleparam.h>& V: M# u, X$ q8 ~% V' c# H
- #include <linux/sysctl.h>
* D( r) I3 a7 D% l+ m7 @1 ` - #include <linux/mm.h>- z& E$ |; Q3 N, y$ y) [& k4 W
- #include <linux/dma-mapping.h>
- D% e) i b- H- }
6 Q0 c; \! s" J- #include <mach/memory.h>
+ l! M# Z6 ~9 U' z! s# |, z - #include <mach/hardware.h>
+ c0 j4 J( ?* o3 Z" I7 m - #include <mach/irqs.h>) C2 I5 w: y0 p' I) ?
- #include <asm/hardware/edma.h>
, p" o8 q8 [- `4 e7 m/ e
# |# q a% J! @- #undef EDMA3_DEBUG
1 |7 v8 o% T4 P4 x- D7 { - /*#define EDMA3_DEBUG*/
- p, R4 p8 ?$ s- J5 C
3 g9 ~- Y1 f% S- #ifdef EDMA3_DEBUG
# Y8 X7 v, S8 k - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! U. k3 q! C! Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 t1 ~& |8 _, d* ~, W& M; k - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" m. K- w1 W/ G0 f5 J0 D
- #else9 P0 L) P8 v9 u( D1 ~* T# S
- #define DMA_PRINTK( x... )
3 X6 f/ h5 a# j2 ] - #define DMA_FN_IN g! q J: }+ @
- #define DMA_FN_OUT
0 q" Q( t7 p o; k g* M: c9 _ - #endif2 J2 ^" _0 h- U8 Q3 {; [: }# ^
- . X' w4 L. g6 d4 v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). `- S3 P- C$ ~8 M+ [7 s! d& Z) u
- #define STATIC_SHIFT 3) a* ~* d# M' r R8 M
- #define TCINTEN_SHIFT 20
$ B* s! M( C, A3 B& R7 E2 ? - #define ITCINTEN_SHIFT 21
( @: `# C! x/ I - #define TCCHEN_SHIFT 22/ O% M$ y6 n/ e! c& k7 r. k
- #define ITCCHEN_SHIFT 234 ~ d1 c# e' U/ f
- ; {7 B7 C T4 t1 J8 b
- static volatile int irqraised1 = 0;, |6 V( v E6 L; r* m' z* H
- static volatile int irqraised2 = 0;9 W# p6 D0 |' O& ?5 ~/ Q
! ~( m2 j) A9 P( [5 p( R% K7 b- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- F+ \7 e6 E2 a! f# _. L# \, f - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 g) Q' K) x& Q' d8 [4 L$ j
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# v1 j4 B, V, Z* M
- % M( c5 R9 D, q7 K+ G
- dma_addr_t dmaphyssrc1 = 0;2 [$ _% t! E, L! h. M
- dma_addr_t dmaphyssrc2 = 0;
. h2 n& y) O" X s4 F - dma_addr_t dmaphysdest1 = 0;, W E! R; o' G* I
- dma_addr_t dmaphysdest2 = 0;
" G4 u* i' f; [/ Q! _( J2 ]7 } - 6 T0 R$ S) O$ j4 Z5 Y& P
- char *dmabufsrc1 = NULL;7 W3 M: i5 V, N+ _
- char *dmabufsrc2 = NULL;: a, ?& K5 ^1 F: G9 `9 M/ b- d
- char *dmabufdest1 = NULL;
2 J8 }# f( j" q! w4 `6 f! C4 T5 Z - char *dmabufdest2 = NULL;
; m V% ^5 j) ?; q
/ l. y7 |! b4 ?- static int acnt = 512;# h z5 K+ ~# A; b# D0 f
- static int bcnt = 8;
4 \- `) S( p0 k! K' P) O" P1 U - static int ccnt = 8;% H% e; n9 G+ p" n$ G
- " Q8 ~# S% U1 d) S) {0 a* w
- module_param(acnt, int, S_IRUGO);+ J. d% Q3 R. p5 T6 T( }
- module_param(bcnt, int, S_IRUGO);
- c& L4 _5 k4 J5 t - module_param(ccnt, int, S_IRUGO);
复制代码 : ~6 i6 |6 S1 n' { E2 _; B
% |4 x( Q" b6 z, { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 y9 H2 Z/ ^: @
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 Y5 c+ l6 d5 {9 C% ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, L4 [1 f9 T3 N& q
2 |! x# D* \1 R# s0 u3 h
6 d- |7 L- c* q5 R3 @: N7 w |
|