|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; b5 x+ T# C6 d4 }
- [code]EDMA sample test application# u+ t9 F9 O, w% ~
- /*
$ q( i& Q" q. D0 G" F! R! Z8 l4 } - * edma_test.c
; S1 {% Y7 i4 t) Q - *
9 D; C! R; t P6 G - * brief EDMA3 Test Application
% N* o' m$ d5 D* e2 k- T - *
0 p' X8 O' s& X4 \8 f - * This file contains EDMA3 Test code.! H* |" w( F* Y; s; i
- *
3 o% K9 q7 o, t& Y h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! z: I: E. k* {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; t* i* W* G: k. m: ` - * TO CHANGE.
. j+ q8 c1 u# p# L1 F - *
+ w3 c2 `( Y9 i5 g4 r8 G) a. h8 M s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# B) H+ v1 c1 {' @2 Z" | - *
3 S, M1 K' P6 T- K( |# ^6 M2 F: z - * This program is free software; you can redistribute it and/or
* n* l: O; r+ q5 ]" c+ W - * modify it under the terms of the GNU General Public License as
+ g4 Z" k5 z. ^7 a/ X2 j; C - * published by the Free Software Foundation version 2.
1 ^4 s2 X1 u' E+ A8 s" Z0 n - *
0 k: v- }/ w- u8 @# O9 r8 \6 L; ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! {% A2 `$ e5 O' V7 W
- * kind, whether express or implied; without even the implied warranty
6 M ^$ {9 K+ k+ ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% [& |. P1 {$ j, r - * GNU General Public License for more details.
* R+ r# w% W" Z0 ?$ j& y2 S - */
$ `' T2 z) L7 R - ; d+ T4 [4 P( h$ j( t) _
- #include <linux/module.h>
, b/ I8 e' M) ^ - #include <linux/init.h>
" {9 a" b/ e( \4 E& w; y" v - #include <linux/errno.h>
$ p3 G: S/ n, H$ n: C$ m - #include <linux/types.h>
: V# Y# o! {& |% \- x' N; a4 X - #include <linux/interrupt.h>
D! n- r4 e- n$ X% V l/ b+ ? - #include <asm/io.h>0 a. r. g7 C; v0 `2 h
- #include <linux/moduleparam.h># G7 {4 D: |2 {. P& G [ O
- #include <linux/sysctl.h>
* [" p6 b; b' G" n5 z3 G3 |) E - #include <linux/mm.h># k8 O M4 X7 C9 {5 D
- #include <linux/dma-mapping.h>
4 v* R5 g& H: {& Q" h
( T K1 I- E7 V2 `9 Z- #include <mach/memory.h>2 M: V& ] I. `' b. ]# P/ n
- #include <mach/hardware.h>
* L9 j2 a- g$ u+ m* ~ - #include <mach/irqs.h>& R. C9 W/ v7 R: y
- #include <asm/hardware/edma.h>
3 G* C4 I/ Z0 B+ @
5 y# ]4 @8 y$ S' S/ @- #undef EDMA3_DEBUG
; l* h) b V9 y- F/ V- m - /*#define EDMA3_DEBUG*/# p+ v j8 x8 m; ^
- ! s( {6 i6 q) n3 v/ ^4 Y2 f& R4 l
- #ifdef EDMA3_DEBUG' i5 g+ \: I% W0 o7 F. M
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); E9 z% }4 Z7 n* }4 W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 r, \+ }- L# e7 n6 o: R1 w3 t# H( Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- O# F3 q8 ^$ V3 k- t
- #else
; c$ W; W8 M4 c. W3 \* y& B - #define DMA_PRINTK( x... )
( o/ \" w% d2 M% d/ i" |& N - #define DMA_FN_IN
4 v; N. v& U6 g& B1 K - #define DMA_FN_OUT. }0 }! v( O& L( R4 c0 v% G; }: A
- #endif
, \1 D5 d5 T0 b. w
( z. F& L$ c! |! w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ Z; e, ]6 B% T- f4 S - #define STATIC_SHIFT 3
' E" E8 m1 ~+ s$ [# P8 z( a( u* ~1 Q - #define TCINTEN_SHIFT 20+ X4 t) ^- n$ |. J9 p7 m+ U
- #define ITCINTEN_SHIFT 213 \; H! Y- t5 F; K% Z& r
- #define TCCHEN_SHIFT 229 U" g" ^+ B1 f- m5 F
- #define ITCCHEN_SHIFT 23
* ]% x1 J4 ] a2 u1 a% [6 j - , P; y8 u9 _& B% E
- static volatile int irqraised1 = 0;* R& ~: n: @& h9 c& p9 w W
- static volatile int irqraised2 = 0;4 L" p. J+ s* O- r% B, n" W* y- k
- 3 ]$ Q" U+ M' o5 ]8 W# Q3 u; H
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 a* l* x7 f5 u2 H1 Q7 M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 s4 X( u4 P! ~; W+ J& W/ W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 J2 k& o' m& a3 }8 a8 j/ d: J
& P* A H9 ?8 d- dma_addr_t dmaphyssrc1 = 0;
% n0 J9 A/ @. G6 z! o# x& | - dma_addr_t dmaphyssrc2 = 0;; f; ~) O8 a- I ?) P" q. q2 }
- dma_addr_t dmaphysdest1 = 0;5 R0 a2 M4 N7 R: s! V3 w7 X
- dma_addr_t dmaphysdest2 = 0;; U: d, ^, l/ b f+ Z2 \
- }& N% Q' i ?8 L4 H
- char *dmabufsrc1 = NULL;
* H# K( d2 f0 Z - char *dmabufsrc2 = NULL;$ o+ b: u. _1 i* B7 X0 K' H# ~
- char *dmabufdest1 = NULL;
: p. J& b. ?( ?" q1 G% s+ x - char *dmabufdest2 = NULL;; V, S4 Q5 n: E; G, L
- 8 R7 }; w7 O) u# ]$ S
- static int acnt = 512;
! w* M/ I8 X' n i$ J' h2 B - static int bcnt = 8;
- u$ v3 J q+ d5 }- D! d6 H" ~ - static int ccnt = 8;
( ]& u, m' D& T' T
# X6 I% l% C' z; I+ z3 A- module_param(acnt, int, S_IRUGO);
0 z$ U# n3 ~1 @8 y3 P+ _3 ] - module_param(bcnt, int, S_IRUGO);$ _% m8 x/ w9 _' W+ {# X7 B
- module_param(ccnt, int, S_IRUGO);
复制代码
0 w8 Z/ @3 b; y8 L; D: |
. F. _& `/ V+ s 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, G# k) E' n- z, w p6 I; [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; b0 m. l q% M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& c# q! O8 d4 _9 E. I# K( U: C8 ?/ z
' p/ g8 F2 z2 g6 _
& K" y* O2 S/ O) A9 H: O |
|