|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 l% ~6 P+ h& l; [# ]
- [code]EDMA sample test application0 U# i! ]- G. s2 F O
- /*: ]8 R) l" Y, ^6 Q% k
- * edma_test.c# r7 v. l$ L# \. i
- *
4 ~% d# k7 V; r! x% [8 z- u% D - * brief EDMA3 Test Application( D6 R% {1 @6 j' v4 M7 k# T+ A) ]
- *7 ?2 u0 Q2 x' R5 v
- * This file contains EDMA3 Test code.9 z5 z! o+ v' e+ l
- *
, V, `$ N" R4 g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
o- m4 j0 T3 E; i2 T( H - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# `/ y8 I9 q$ n7 F% g1 C
- * TO CHANGE. A; U5 c7 b9 m3 {5 R* s1 ?
- *
4 C9 u/ C% C- @6 d6 y) d- I - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 A( ?$ G; n& a1 U0 R; G; m
- *
4 W+ y/ U2 e3 x2 w# o5 y6 A0 {; } - * This program is free software; you can redistribute it and/or
/ `. b3 [( a, i* q2 }" E& h2 y - * modify it under the terms of the GNU General Public License as7 w& ]& o8 o5 d7 d# _9 V8 _; v
- * published by the Free Software Foundation version 2.
$ m* c' U, Y' h% I2 _) Q# ` - *
: ?( W. E7 z8 g1 c5 W4 r& x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any: Q" y3 V; v: ^% Z# N
- * kind, whether express or implied; without even the implied warranty+ y: H2 j8 \1 _
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 \6 D1 M2 J" U
- * GNU General Public License for more details.- T" H' c- K- `" C9 l
- */' b; v6 i) X6 j1 y2 b$ P$ d8 g
- / I9 F% E+ `& S- {
- #include <linux/module.h>
" {& `( l# j* N7 H4 P& N$ B - #include <linux/init.h>
+ d. w T; ~. x- L - #include <linux/errno.h>
* D" C8 E+ i- F% `* P - #include <linux/types.h>
# ~) e+ d1 M) R4 X& C( m' W - #include <linux/interrupt.h>0 f! k; r2 ], L |- [2 x
- #include <asm/io.h>
" R2 E1 i1 P) S2 S - #include <linux/moduleparam.h>6 }* B+ ?. H' e0 d) F) V }$ I, n
- #include <linux/sysctl.h>
4 d: _, n {% M% D' R: S+ G - #include <linux/mm.h>
8 i: t& ]$ Q) S% D( x0 f/ x3 s - #include <linux/dma-mapping.h>
: x$ u8 V" X/ g$ T9 Y
- u$ [# M9 W0 o( g) U9 ~- #include <mach/memory.h>
7 ]5 E+ c; [' K - #include <mach/hardware.h>& u9 D" f7 E1 c, k+ y; D
- #include <mach/irqs.h>8 \- V t$ H# W, R
- #include <asm/hardware/edma.h>% }8 s5 X- i$ Z& Z- H
- 3 [* s' I' ?! E5 A
- #undef EDMA3_DEBUG
k* _0 w, N" ]9 \+ T' K+ A7 g - /*#define EDMA3_DEBUG*/
1 i" n3 r! Z; R" c% o8 {* s - 1 N4 a7 o% E1 F% S
- #ifdef EDMA3_DEBUG7 X d8 C- g2 a; j/ A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 c7 A2 Y z+ }% L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 B( H# [3 c! a! ]( J! A. o6 Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); A1 m5 U- n( Y1 w
- #else
6 E+ S1 R3 I5 y/ Q' D0 O8 \# t - #define DMA_PRINTK( x... )7 y1 G4 O& W" S* C
- #define DMA_FN_IN. U8 Y H2 u% i, f2 z; J
- #define DMA_FN_OUT
. ?6 ]1 K: c2 R/ g/ {' a9 U - #endif6 w" e9 U0 C4 V+ V2 s2 {
- * q; l( S% g, D% B/ K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* c' G! B! Z e3 M7 A G - #define STATIC_SHIFT 3# a: e8 u9 ~* o! e9 V Q/ u1 t# T
- #define TCINTEN_SHIFT 20
3 \. X$ `, y, } - #define ITCINTEN_SHIFT 210 x: v I: j- ~* ^
- #define TCCHEN_SHIFT 22
% J) Y/ A! n K2 X - #define ITCCHEN_SHIFT 239 V& j, i" H: O* Z
& U; o2 \- e. V! W8 y. F- static volatile int irqraised1 = 0;( \- R4 P; g% B4 {
- static volatile int irqraised2 = 0;# E# Z5 T' |2 h/ U( s
. i/ o; G5 U3 n, p9 k+ I- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" {" i- W- k* n1 S
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 I8 s/ x$ a/ b, F& u+ l/ G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 E- m) F% l2 ?+ K5 m2 A, \$ U0 J
- ( M6 k5 ]" x. d% W S6 i' U2 I
- dma_addr_t dmaphyssrc1 = 0;" E% E/ }0 `! ?* Y! E6 y
- dma_addr_t dmaphyssrc2 = 0;
# x* {. a6 G5 E, \$ c6 ]8 l. V' u! Q - dma_addr_t dmaphysdest1 = 0;4 I B. t! ]5 d9 {
- dma_addr_t dmaphysdest2 = 0;
) j% y b( i' O
0 k( t1 B6 y; D% @! V- char *dmabufsrc1 = NULL;
3 o7 L" I- H8 w, N - char *dmabufsrc2 = NULL;
* a/ m. s" X; s. W* @ - char *dmabufdest1 = NULL;
: \3 N7 a6 E3 q& E, ?& L - char *dmabufdest2 = NULL;
! ]1 a" i2 E$ O+ C
( w/ s3 _* u% ^* o. Y+ y- static int acnt = 512;
. v7 L* P, c& R$ F; I8 q. V - static int bcnt = 8;! U+ A4 X& I6 E! r; W6 t: ]9 t, X/ Z
- static int ccnt = 8;: a# d+ i5 @9 m1 W! I
- % R: E4 F2 q J8 A% [) w& v
- module_param(acnt, int, S_IRUGO);3 h) ?6 e" t3 ^/ @- P" _
- module_param(bcnt, int, S_IRUGO);! ~4 ?! I: L3 y! c/ P8 D2 J
- module_param(ccnt, int, S_IRUGO);
复制代码
: j3 V' ^* D# Q, b- ?7 r
8 j) }" x2 k, t8 o! ^0 @ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: ?8 L5 {2 B% Z; ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- P7 ^1 v- u0 ~9 m9 l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 _$ l* Q9 G; X; Z; ?' `2 v
! K3 Y* \" X5 J/ F+ c; f! s' B9 P7 |3 J* w* ~5 L
|
|