|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ \/ f& v2 v# _; `5 V9 Q; _
- [code]EDMA sample test application
1 J0 n) |2 T/ U+ B( H3 }6 b - /*
5 s U8 K, t* g0 U' H5 X( ` - * edma_test.c
) D5 n3 w- Z7 l' E1 b/ T; g - *- V* ]" f. k4 H" m) F
- * brief EDMA3 Test Application
6 Q! q6 o8 S# T+ L5 r0 L - *# h3 S% C; v9 ]1 w" j2 |, ?
- * This file contains EDMA3 Test code.6 Q1 f! D) Z# [' z& y4 Y/ x% j
- *
' H; O6 n+ n1 m& G6 e - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* l I# X& i0 L3 i$ R: e; Y3 a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. t) A& Z$ z# a! G) [
- * TO CHANGE.. Q8 Q' L% W( a& M/ d R
- *
+ p. s! e6 U3 t$ C - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 Y2 b# j" b: G - */ W: v& x4 b2 s& k, @; G# Z8 m
- * This program is free software; you can redistribute it and/or
3 |6 K: X: n3 y& ]; h - * modify it under the terms of the GNU General Public License as9 y1 i" R* B3 _( |% y! c
- * published by the Free Software Foundation version 2.4 ^, j3 Q0 ?- U, ~3 C4 `: o# h
- ** ^1 J: U8 t+ l" |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, P* V, Q/ ?& ?+ q6 f
- * kind, whether express or implied; without even the implied warranty4 f1 J% C+ ?$ c# z! U
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% Q! `: b4 x2 c: P8 A - * GNU General Public License for more details.
/ @: h/ K0 F }" |7 o0 T - */' a5 \% c( O+ _+ a0 N7 u2 E) f v. J& g
- ' L0 c6 I ^) L/ j$ Z5 X# d. d
- #include <linux/module.h>
( S' G Y/ s8 J7 [" I+ v% s/ K - #include <linux/init.h>( t. ?5 q" V- s% O7 }: }: d l# G: g( C
- #include <linux/errno.h> R* `; { B' n2 P3 C
- #include <linux/types.h>6 N" C/ f5 ]1 E3 d; M
- #include <linux/interrupt.h> q+ |* p4 |( ~: \) Z' K
- #include <asm/io.h>! ^% D$ K& t2 }# l, x/ D8 ^
- #include <linux/moduleparam.h>* G" w+ z0 ~# }4 _. A" Q
- #include <linux/sysctl.h>4 |0 H+ l9 j/ [
- #include <linux/mm.h>, O/ {0 T! x7 J# W ~' q
- #include <linux/dma-mapping.h>6 X" h2 r; z- A/ k0 u$ _' N- d1 A
- 7 D" i$ }7 _0 u4 ~* p
- #include <mach/memory.h># q5 g- d9 v. e
- #include <mach/hardware.h>5 e% h0 M! _8 T r
- #include <mach/irqs.h>7 @) u- j) Q5 o/ A+ o+ A. r( q
- #include <asm/hardware/edma.h>
1 N9 X' v# o0 B. O( U/ q& N6 t - & y+ O- p/ B9 H9 i$ j' W
- #undef EDMA3_DEBUG
# m# o. _* m6 e( \ - /*#define EDMA3_DEBUG*/# {8 Y$ {* r3 I+ d
5 J/ o8 [3 G2 m- H- #ifdef EDMA3_DEBUG* g" ?7 x |8 F0 a: k
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) L/ {' Y6 {( ~
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) w0 [: }! A0 K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* h. v' a: Z# j. U% D5 _ - #else
6 w# A* q( d5 k3 z - #define DMA_PRINTK( x... )( n2 A# o6 H S* [4 |
- #define DMA_FN_IN" B# q) }# Q; A
- #define DMA_FN_OUT
! i8 {- W9 j" t2 S - #endif
" g. n! a- C( { y8 D) _ - * o# \( O$ n% t+ S6 \/ ?; g. u4 v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 J5 P B' I( J1 Z, z% [2 k6 A - #define STATIC_SHIFT 3
4 h6 y1 ]' h y3 ~" V - #define TCINTEN_SHIFT 20
7 A2 w. h6 j8 Q* x8 G$ _; M/ Y - #define ITCINTEN_SHIFT 21
( G1 R3 w7 `1 z z* H+ ^ - #define TCCHEN_SHIFT 222 Z b' o. ?6 v% |& f7 M
- #define ITCCHEN_SHIFT 23- q% u6 F/ J, |4 a# o% r+ v
- 5 N- N5 Y2 e* J8 I) J
- static volatile int irqraised1 = 0;" t A; Q1 x& D, r: A
- static volatile int irqraised2 = 0;' @2 S: H4 F* c
+ J) w2 k0 T+ h* G' C3 T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% x4 S7 \2 r0 }" w
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 |$ B4 s# ~( B0 g3 ~, x9 l - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. m# d m+ ?! G5 l
% T5 q5 q7 I9 h- dma_addr_t dmaphyssrc1 = 0;
$ Q0 V& r! ^7 ?/ g - dma_addr_t dmaphyssrc2 = 0;! y' _5 O9 _& o; g# i
- dma_addr_t dmaphysdest1 = 0;
- o" Q& [; w6 a" V - dma_addr_t dmaphysdest2 = 0;8 m! s r: @$ f- O7 x
3 t: x3 I! }3 C i- X Q- char *dmabufsrc1 = NULL;3 q2 _6 O) y5 f1 C6 F9 V
- char *dmabufsrc2 = NULL;
" v. N' v5 N8 {( ` - char *dmabufdest1 = NULL;) X) H0 P4 o; n4 I
- char *dmabufdest2 = NULL;
- |' W8 Q; L$ v# P, o( Z7 C) k - + E! q ~1 Q( ^0 R5 Y6 \. k# }5 h2 z
- static int acnt = 512; z7 Y& A4 w/ ^' ?
- static int bcnt = 8;" \7 c3 h! b# t) X: Y
- static int ccnt = 8;% x# [6 e: i4 O" q5 |! \2 H
- * g1 K' t9 b& k7 A1 O
- module_param(acnt, int, S_IRUGO);; H3 r! _: f, }& e5 f5 Y) w
- module_param(bcnt, int, S_IRUGO);. |) E T, `" l1 i/ U7 z" J
- module_param(ccnt, int, S_IRUGO);
复制代码 9 |7 l. N, b. @7 m* X& Q) n, }
" S9 p5 S7 W; d( w; p0 ^- U3 L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 a2 J0 ]+ f# t. k/ u& yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; v# m8 H$ y a 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& A& u9 B* {' c+ F- L' D
4 r* X0 D7 B6 J. I% x+ Z z" R/ O1 T7 C! K# c: o
|
|