|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , V0 t$ j' G1 m7 g5 v" {3 Q
- [code]EDMA sample test application
I! {0 r/ D3 b9 G/ E8 |$ j- W" g2 d; p - /*
5 k" H2 E3 c; H7 B. }! ^- ] - * edma_test.c, N# [: {( j0 r8 \3 _! {
- ** \( s+ A4 c# \& i6 y& S$ |2 a
- * brief EDMA3 Test Application b* B4 H" t1 m# z! o
- *
' H7 b0 L2 l3 k- N - * This file contains EDMA3 Test code.) j3 F, }" o3 J9 q/ U
- *! B" d# y X1 f5 g3 m8 N* p9 Y+ B) r) `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' c! W* `9 g7 A3 C0 g. y; u - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT B' O8 y- W2 k4 `" g( t9 ^( F
- * TO CHANGE.8 d0 W! ~5 A$ s7 \% `2 L, Z
- *9 y9 y+ [% x5 H9 t3 \! {5 s6 \8 R
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ Y8 R3 R, N9 |9 w( U
- *
# U. n5 P$ A& i [( _ - * This program is free software; you can redistribute it and/or
* J5 J# a" q/ G: O8 c - * modify it under the terms of the GNU General Public License as+ E) D- X) E7 H. T" r, n3 y2 L i
- * published by the Free Software Foundation version 2.. C0 {% _5 I9 q
- *
; W# k5 A0 v& }. I0 R4 O+ u - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 y: Y( V' u" y8 `$ y! c! Z - * kind, whether express or implied; without even the implied warranty" d4 f+ y7 _% v. V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! d! @# L5 m- k) X
- * GNU General Public License for more details.
6 i7 D% n+ i( T) y4 ~1 g V5 |' a - */
* K+ M. b. x1 w. |
8 M) p7 @# A3 `- #include <linux/module.h>
" `5 b* u- Y7 |' v5 t - #include <linux/init.h>6 |* d& _; `" z
- #include <linux/errno.h>. H# J7 L* _: x) |
- #include <linux/types.h>
" k6 Y$ ~5 A+ l5 ?& S - #include <linux/interrupt.h>5 J& \( u. u! P
- #include <asm/io.h>
. Y6 }6 |- F5 {) Y2 g/ N% Y, x - #include <linux/moduleparam.h>8 Q( l- T0 R) h# e/ O0 D
- #include <linux/sysctl.h>1 }: V- w6 V6 J( Z) V7 C
- #include <linux/mm.h>
( @0 z$ I& l% V& ?0 \$ G: H" q - #include <linux/dma-mapping.h>
( w3 Q) j! y \. x2 D" W8 w* k
2 i, A! M0 U% I7 W# ]) J2 e# @- #include <mach/memory.h>
! e5 M, `$ d% m3 L" @ - #include <mach/hardware.h>5 k; N, J3 @4 z0 D2 q2 q
- #include <mach/irqs.h>
5 m y6 e; c' S( p+ C6 }9 e - #include <asm/hardware/edma.h>
& f% S- G( \- z' T - 2 A" ]/ S1 `& i, z# |5 I& r
- #undef EDMA3_DEBUG: c' D7 Z% w' a% Z1 W
- /*#define EDMA3_DEBUG*/
8 K1 I- g' c) P/ P
, I$ d- X; ]# p- Z! f& n- q- #ifdef EDMA3_DEBUG
0 |1 O& ^/ d% L' r0 X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 c# i- b& T+ ^# M9 }6 b
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- m7 X$ D5 X; V0 F2 p4 b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ I) n0 F+ q; ]+ K
- #else
9 `+ k7 O' t2 j6 a/ q( i1 K! C - #define DMA_PRINTK( x... )/ G5 d1 T' f% g J; Z
- #define DMA_FN_IN4 Y7 Z6 \" \# T& _
- #define DMA_FN_OUT
r- Q) J4 ?5 s! n9 ~ - #endif
0 L- | I& N( S8 x- `# R+ b
! A2 [$ i% G, N8 @5 u- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' f; J* Q: O! X2 {. M$ v - #define STATIC_SHIFT 3
1 [4 I5 s0 D8 R+ S; p' H( r - #define TCINTEN_SHIFT 20! P9 l- p- n3 a+ U! r- t
- #define ITCINTEN_SHIFT 21
% T6 O; C' [" \ \4 j, \* X1 i - #define TCCHEN_SHIFT 229 V, f: d6 a% W
- #define ITCCHEN_SHIFT 23
n# `- {) d' B, w2 r
, J8 {5 M% a8 _/ m- static volatile int irqraised1 = 0;. l% |# i9 l- J% {
- static volatile int irqraised2 = 0;3 f8 ?, M: I- A2 @3 |, J/ h7 e2 ~) a
- ; H" ?. q* L) ]) [
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 E4 ~, b, I) o) C: W+ G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 b: ~! x5 i, A8 s3 B$ O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ ~" W8 e3 {1 y9 C7 h
- 5 ?& g$ J2 {5 t4 z! x1 J2 ?+ R
- dma_addr_t dmaphyssrc1 = 0;
, |' Q) [: P$ J: H. y) W& L, |+ J - dma_addr_t dmaphyssrc2 = 0;. T/ p9 Q. \4 }/ ?
- dma_addr_t dmaphysdest1 = 0;3 @% @" L1 e; {
- dma_addr_t dmaphysdest2 = 0;: m# @, V5 {5 N0 ]- K( ~8 K) e" ^
P3 v' F( }6 B: B }/ D- char *dmabufsrc1 = NULL;
3 L: z$ F' v3 m1 T - char *dmabufsrc2 = NULL;
1 ?/ z( I# k$ E5 o% \ - char *dmabufdest1 = NULL;$ y# N5 f2 I3 s
- char *dmabufdest2 = NULL;: Z h' q, |. T: }' J
6 l5 r* o& L% [8 O# u6 L) X! V- static int acnt = 512;! ^0 Y3 C# A- i
- static int bcnt = 8;
- ^2 i! Y( `4 I8 t4 V. F* P' G" B - static int ccnt = 8;
9 m1 x; n, W. _* g/ w6 V( @0 u
2 ^3 r, d6 J" R0 o! l- N. f3 C- module_param(acnt, int, S_IRUGO); U/ }0 W& E1 d: u' U2 v6 g
- module_param(bcnt, int, S_IRUGO);
2 O$ P! W0 j: I5 A. T& W/ n8 c; L - module_param(ccnt, int, S_IRUGO);
复制代码
: M: R* @9 P7 A$ [, J# t# a J5 q V" F. e$ d2 `8 S
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) y5 r: o0 G5 X9 t3 P( ?6 R% e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* j5 p5 u" v6 r5 Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& ?- X4 R* w' M, ?' ]8 Y% M) Q9 V1 P/ Q/ D# E
. V; M2 G' Y) ?; H+ C8 n3 N
|
|