|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - y1 t K2 f: L4 G' E) |
- [code]EDMA sample test application5 X0 l# L5 D' q6 [8 U( T2 c/ p5 h
- /*
$ |# E& I2 Y% C) U7 H& P# T - * edma_test.c. u3 i0 y0 ^1 o
- *
5 ^6 N9 c6 e3 t" i o& B - * brief EDMA3 Test Application
; D& O" `2 p( x' O% D, { - *
; f. X* t- j( v( r+ C# ^ - * This file contains EDMA3 Test code.
) }9 C1 E Y ?1 b - *: ]2 d- f" D2 W2 _! k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ w% |" L3 P h8 b" U: ?1 W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 z n2 x# k: M4 S# ? - * TO CHANGE.
& m D6 C z, y - *
, x2 e; G" Z. z7 o o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. R. ~: t4 B& l/ P( F2 ?& A - */ n2 j9 Z, R" _/ A8 W6 L
- * This program is free software; you can redistribute it and/or& F) N5 c2 I( e# x
- * modify it under the terms of the GNU General Public License as( ]9 _( } [! N0 A B0 D, Z7 Z' v
- * published by the Free Software Foundation version 2.5 h. P2 r d, l3 ?. w6 a
- *4 N. I1 ?: m$ z3 v& U$ t1 I! h; ^% T" N
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 B/ P& W+ ?+ k _, y
- * kind, whether express or implied; without even the implied warranty
/ o/ h9 I2 i% k O8 ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& ~2 l; {* Z2 Y: p4 U5 e - * GNU General Public License for more details.
& x/ o* s4 ] i; I/ x# C, i - */% d! Z V4 r3 P, W n# ~. E( w
- / ]1 I; J9 M- w& P* `. q
- #include <linux/module.h>6 H# m7 \. W% c7 |( V1 H$ S
- #include <linux/init.h>% H6 P7 Z7 b8 h, b
- #include <linux/errno.h>
1 M' C( A( |/ v) N" T! X - #include <linux/types.h>
( C/ G* l$ p; A$ A' m2 X - #include <linux/interrupt.h>: W1 _2 @" }6 k- o4 I5 X7 }9 [8 c
- #include <asm/io.h>8 T! o+ w7 B6 T' N$ _+ P6 t' Q
- #include <linux/moduleparam.h>( E- v; M: a7 J5 m1 {
- #include <linux/sysctl.h>; y; O! s5 G$ C/ F# m
- #include <linux/mm.h>3 S# x9 y; g! \. M1 V
- #include <linux/dma-mapping.h>! G* M+ `0 {3 Z) W5 L1 f) h% s$ e
M4 @ `; p" P; I. T; S' ]- #include <mach/memory.h>
3 n6 E3 \' S' a! u; z: O8 ` - #include <mach/hardware.h>5 Q9 F7 U, c2 k( o6 o
- #include <mach/irqs.h>
. x7 B& k. T% k: J - #include <asm/hardware/edma.h>/ X. ]% e# Y6 v& B: ]) a
6 D/ M* _: Y; A& O- #undef EDMA3_DEBUG
, \6 y8 b1 [ ^ - /*#define EDMA3_DEBUG*/1 ^& S1 Z8 ]+ J$ Q
6 o& i8 ^) o1 B: q- #ifdef EDMA3_DEBUG
( B3 L; ~. @3 E# Q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- V; s5 M+ B. i9 C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) r/ K9 H4 v2 F4 d - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
r0 \3 L' |7 P) U8 z, ]4 Q# l6 i - #else: G3 k9 z. K' l8 ?2 T
- #define DMA_PRINTK( x... )4 S8 L, o' G- k7 D6 n
- #define DMA_FN_IN: O4 g0 _3 C( ?6 [
- #define DMA_FN_OUT
2 d w$ z& l7 H0 J" Y, L" p - #endif
2 B4 x" P7 l$ r2 s( t! @. @
' ?0 E, Q# z+ G% v* z. t3 b- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 C# l7 \( r! S [4 ?# h - #define STATIC_SHIFT 3+ B' Z3 J0 t- o6 k
- #define TCINTEN_SHIFT 20
3 c0 x. T$ ]4 O- I' a9 a4 Q; |4 C5 E - #define ITCINTEN_SHIFT 213 C* n% K" N$ o& J3 S/ ?
- #define TCCHEN_SHIFT 22; Z' C8 h) f8 ]& Y/ h( r
- #define ITCCHEN_SHIFT 238 B# x, H- e. W: p# l' Q5 b
- U- V- t2 Q3 X* I G- static volatile int irqraised1 = 0;3 L! p- y2 ]( W8 i
- static volatile int irqraised2 = 0;$ Y7 `# A# y$ Z. u3 o
- : @- q1 ~: ~7 q7 t5 b+ M6 e. P: W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& J& @/ R2 K% z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 C9 ]3 v" z6 A) b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 u0 @% N6 U! W$ U2 H3 m" ]5 Q - " D8 }- e" Y7 I; R; o# h6 Q1 T
- dma_addr_t dmaphyssrc1 = 0;
; c( u s a/ ~6 m - dma_addr_t dmaphyssrc2 = 0;
) X' r Q: P. v: Z$ Q - dma_addr_t dmaphysdest1 = 0;
( o/ Y5 E$ v( M* I. ` - dma_addr_t dmaphysdest2 = 0;
6 m' [& `3 i$ D; y - # i8 X9 I! v+ [2 B2 S6 Y6 X
- char *dmabufsrc1 = NULL;
! Q! w6 i( S- a- `" k - char *dmabufsrc2 = NULL;" o4 D+ f6 Q6 E! m! P1 _5 @) n
- char *dmabufdest1 = NULL;
' t# a: Q9 _* T& d - char *dmabufdest2 = NULL; e& ]8 I: g- f- q0 F7 [: d) v3 G6 F
9 B. w5 O; R. c5 b" }# E- static int acnt = 512;
* S" |! x; v. s N% D. E: o1 F2 d - static int bcnt = 8;
- a* i5 t: j% [- q( h" d1 y - static int ccnt = 8;
" ]9 t2 W" ~; C+ N4 t) W, i - : K" E$ S, X1 w) B5 A! ^0 }& y, ^9 t
- module_param(acnt, int, S_IRUGO); T6 F! \" h1 A! l/ s
- module_param(bcnt, int, S_IRUGO);7 Z$ |4 F+ t r; v' M
- module_param(ccnt, int, S_IRUGO);
复制代码
/ i+ @: m C( ]2 v) y m* n- O( @! u4 ^) T
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& d# M, u9 a! D: V. `) ^9 [1 darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. c$ L" A. y0 N$ l& _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 y+ |( f. O9 V. I
3 N& X s) x6 K* O; L5 m
# F7 V- j& @, V* N |
|