|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 b u9 H" Z! X2 f% O
- [code]EDMA sample test application; g+ z0 F" X. A6 ?7 E
- /*
5 }/ s9 s! P* G) u - * edma_test.c
1 l; C7 r. g* y; R9 U - *
6 @" E! Z5 q0 i/ j- L$ y - * brief EDMA3 Test Application
! `8 c! T5 A$ ^+ Y - *) ^- m% J# S% k1 A% X4 Z
- * This file contains EDMA3 Test code.
, n8 O, r R7 R4 @" A9 B - *# f, b& ^8 U1 w( E6 s
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; s8 m" J) [ a# ?& T0 i) J# M0 q) P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ L) X* y2 s# j6 V/ l$ i' ^, |, t
- * TO CHANGE.
4 @0 T7 O4 j8 X5 P) m Q8 c# g - *( u, M8 l+ }; E' a9 D1 ?: L
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ Q7 K( @( l' ~4 ~ - *
i# D9 k$ Z' A# y) M( f - * This program is free software; you can redistribute it and/or: |! R# u2 `6 x- v
- * modify it under the terms of the GNU General Public License as, W% O$ S. U q6 T9 J7 h
- * published by the Free Software Foundation version 2.
6 i% B2 e. L: ]1 t9 p - *& N: n- V$ F. f! L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 E |: F( R! |7 f* ^, w9 [ - * kind, whether express or implied; without even the implied warranty: R* I9 V- m. J2 R9 R \
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) ?# P8 _* c( |' `$ c# f3 |, n
- * GNU General Public License for more details.
) h Y7 j8 ?3 a* t. d - */
& Y" l- a3 F9 X - $ M# k8 T7 ?+ v
- #include <linux/module.h>
, p) b, H }' W9 O5 ` - #include <linux/init.h>2 D% ], w) V+ _5 d) x
- #include <linux/errno.h>
3 \, D$ c' E9 ^$ w: j% a - #include <linux/types.h>
- n! W& I, N* e1 x7 O - #include <linux/interrupt.h>
) w1 }, V$ i0 k. S6 ~% h" Z: p - #include <asm/io.h>0 j, d r! M+ c" F7 [( ~
- #include <linux/moduleparam.h>. K( F9 @3 i, K
- #include <linux/sysctl.h>' G1 C3 s9 k" Q0 X+ S
- #include <linux/mm.h>
3 j! u6 |- f- A6 p: v9 G - #include <linux/dma-mapping.h>% \. t" P: s: m
- ) ~0 m* j2 W7 F2 n" C* z
- #include <mach/memory.h>" W4 z$ V; s$ Y/ L6 l6 g. u
- #include <mach/hardware.h>
: V' `- c# u H [ W4 ` - #include <mach/irqs.h>( V. {; H; s% y& u! X/ u, `
- #include <asm/hardware/edma.h>2 h: H2 u @2 ?) Y) `- L) `
* ~% F* q/ J+ @. G- #undef EDMA3_DEBUG
: @- t0 M+ K/ ]6 } - /*#define EDMA3_DEBUG*/' @* ?0 Y4 q" ^6 v, D9 b( E" x; ]
3 ~9 Z: U( {: X( ]. D- #ifdef EDMA3_DEBUG
& E( C s; Z1 W# G - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 V* N2 `5 Y/ [9 B% ~4 g$ @
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) A4 m- Y8 n: E) K* V - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& i# ^ Y- H/ D& r
- #else
3 y! X4 c$ c; N( B; ^ - #define DMA_PRINTK( x... )
( O1 b& Z& j5 q# k, J - #define DMA_FN_IN) N3 ~3 f6 e" f3 ]8 f7 d8 Q; a
- #define DMA_FN_OUT
, z5 f7 a& A7 \9 N8 c$ I/ v: q) A - #endif' m- `3 M; v. H8 p6 _' z( a9 f2 K5 K
- : `: O6 I0 I4 B; n* U+ @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 b3 F- O/ ^& b4 o
- #define STATIC_SHIFT 36 N0 b5 c5 w! |) s: a
- #define TCINTEN_SHIFT 204 D: J4 f0 K5 D& w
- #define ITCINTEN_SHIFT 21
' v( `# {' X7 ^8 j7 _% [ - #define TCCHEN_SHIFT 22
( l/ B# M6 j3 g, C+ Z$ t0 n$ c - #define ITCCHEN_SHIFT 23
0 q5 v6 {: A( |9 b2 {6 Z
5 u B! X; |, R7 M- static volatile int irqraised1 = 0;
1 c0 r' O O$ W; q+ I+ J% p( r - static volatile int irqraised2 = 0;! b+ Y5 p" ?5 L! U5 L7 ^
- & a/ Q) a3 `. Q& {7 ~4 o3 i& B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); O# p- v9 m7 z& p) [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 J* K3 H6 b# j J* J" `# \# L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( u& b- p! F! ^' j! a
; m& j0 F4 C* r9 |& Z- dma_addr_t dmaphyssrc1 = 0;2 [& `- P$ U4 E2 D7 X
- dma_addr_t dmaphyssrc2 = 0;
4 f4 B, p, z( V% Q" a3 u - dma_addr_t dmaphysdest1 = 0;
0 V* U- S' o/ H' q9 y# o0 B - dma_addr_t dmaphysdest2 = 0;
1 H' _+ D3 E( w+ q4 c: n8 f - . B2 s4 X$ k. R# t' f
- char *dmabufsrc1 = NULL;1 e: C; G6 S& o" k# r
- char *dmabufsrc2 = NULL;
# A4 b# M& w, |' q - char *dmabufdest1 = NULL;! L$ I0 j" \) b% ]. H4 Z
- char *dmabufdest2 = NULL;$ M3 ~2 P. c/ X
2 P5 u4 s$ a7 c5 I! Z- static int acnt = 512;) J9 R/ w% K3 L
- static int bcnt = 8;9 h# F; \& B) O0 n
- static int ccnt = 8;
7 [4 w: o/ e# c0 G2 p
) E/ C% Q0 N* x7 I( p- module_param(acnt, int, S_IRUGO);% S1 g( B% q6 m" I' \
- module_param(bcnt, int, S_IRUGO);
1 n, L6 H0 ]7 X5 P - module_param(ccnt, int, S_IRUGO);
复制代码
$ t3 A% \6 ]+ x6 ^+ `
, I# C% F+ U1 N6 O r' F 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, R3 `, ]: O9 y0 Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 ^) \" ~4 T9 s e0 ?+ R {, I
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ B" ^1 x: Z" v; Q8 \9 k9 z! _( I8 z6 x. c$ e4 P K) O
( s" N' V/ u) e2 z, W. \* a
|
|