|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 o$ R. v# w+ b4 k" R, v- [code]EDMA sample test application
! A0 q3 P$ x- K& c8 F% F - /*
* ~; [; [9 J: s6 z% R, |# T - * edma_test.c* r( @' Y: Q& q& K$ w; h* [) i
- *
& W. O o/ E4 u* I6 I, } - * brief EDMA3 Test Application- f o5 ~' z* f7 M
- *
! c" f% h; F8 [% N' \. L. G9 b$ j - * This file contains EDMA3 Test code.
/ W e. {6 h0 `8 d - *
+ i/ ?4 l0 l+ \# P: A' G - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 K( {; W: U3 E3 Q& j' X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( z5 p" N' r0 }0 H+ S7 c2 j- E. R5 o - * TO CHANGE.
. e; j: _1 N* g9 B. r' v" ^ - *
' A# e2 d) ?+ X' }! @ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' W. |! I3 a4 F' X p
- *
" _1 t* S [: A, s8 ^1 B - * This program is free software; you can redistribute it and/or0 Y: I# N# {7 _6 e
- * modify it under the terms of the GNU General Public License as
6 e" v/ ~0 t- v' t% z - * published by the Free Software Foundation version 2.7 G! B- f" I9 w5 B9 k
- *$ v0 ?$ P0 I; _1 `+ @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" p9 L: P$ n# \ - * kind, whether express or implied; without even the implied warranty
& J: A. f" c% h5 Z) w - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; E# }. x$ Z' f) T8 n8 v4 a - * GNU General Public License for more details.
5 i% n. r! v% o5 y - */4 q2 m+ z$ H& _! _4 Y& C1 {
- / O, c3 S* R: k% g" _! K3 i
- #include <linux/module.h>/ h4 p, t3 y/ W3 u
- #include <linux/init.h>! u, |1 Q% u7 k8 K0 Q8 q5 \
- #include <linux/errno.h> A( A5 d0 _& {# `) F" _
- #include <linux/types.h>
6 z* x5 F' ?, Z. |0 g) F" q - #include <linux/interrupt.h>
5 \4 ~ E2 V: W/ A5 F$ i - #include <asm/io.h>
8 }6 U8 Q7 y$ w3 j7 v: F - #include <linux/moduleparam.h>1 c( P& w* x U @% F9 ]8 E5 \/ k+ Z
- #include <linux/sysctl.h>- D, Y( ?& {) L& `2 H
- #include <linux/mm.h>
5 |! m }! G' g - #include <linux/dma-mapping.h>
3 M1 U2 j% z2 u/ Y5 n ?0 [
% @2 ]1 W( r9 a' B8 x" W& d- #include <mach/memory.h>" N0 T0 @5 K7 n& p f
- #include <mach/hardware.h>6 F; x! z* f) T X' S7 H) p( F9 u
- #include <mach/irqs.h>
1 O$ O6 n9 I& {7 E4 c+ k- Y - #include <asm/hardware/edma.h>
1 [/ K* Q& K8 ?2 M. v6 l - 6 U7 e" q! X4 Y1 p
- #undef EDMA3_DEBUG
] G& s z$ g- d8 X2 X' B - /*#define EDMA3_DEBUG*/" X0 _5 p) t) V1 C' _0 t/ o+ _6 b
( y+ Z; b! C* S- i3 R0 ?4 Z$ j! n- #ifdef EDMA3_DEBUG
* x6 b' D) w7 A3 Y/ W2 {) W - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, r5 s/ v$ K5 c9 P0 N% l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& J5 L+ E* ]: K1 w# G6 n6 [" ?
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 x: I3 s& y8 X) Q8 \
- #else
/ B3 ~& D0 T1 X2 v: H - #define DMA_PRINTK( x... )
. V$ a# o6 E& k8 G7 O$ T$ x9 R" a5 W - #define DMA_FN_IN* G, F$ ~% U& Y0 D% w- p9 j1 K
- #define DMA_FN_OUT
6 L8 B% f( w; T! `4 b+ M5 g - #endif) l8 f0 m1 U0 `3 A! f' Z
- * k; {* |* n J$ S5 Q4 z( x0 L( y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 c& b& V1 l! |
- #define STATIC_SHIFT 3! h, Q3 G% f9 j. ^9 m* i+ z
- #define TCINTEN_SHIFT 20/ K; b( B% y& L: m9 i6 ]
- #define ITCINTEN_SHIFT 21- D' n8 M5 t9 ]7 ]& v/ `% V
- #define TCCHEN_SHIFT 22+ @" @7 }$ y! F
- #define ITCCHEN_SHIFT 23
' V$ C, m- F% F; o7 k - ( @" T* {4 T2 ~5 q d
- static volatile int irqraised1 = 0;
5 B7 ^! P7 R/ f! U5 \ - static volatile int irqraised2 = 0;
* W' @% V! n# d( y9 c% b& c
5 _" b) ?" y6 i% s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 N0 [, y% i- V3 p, t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( Z! k3 J3 ?+ `" d+ ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 r# T! n6 N5 ~7 a7 H
3 M% i7 O( v: O+ w4 s) j" R: r- dma_addr_t dmaphyssrc1 = 0;* x! I h) J4 C) u6 }
- dma_addr_t dmaphyssrc2 = 0;) k* L( N1 v) u) g- V+ y5 Y
- dma_addr_t dmaphysdest1 = 0;, w1 i1 o) D* x: k, m( q8 V. k, [
- dma_addr_t dmaphysdest2 = 0;
# t8 g6 z2 f# B+ m H$ q
% @5 q: ~" b* F1 C- char *dmabufsrc1 = NULL;
' {+ |$ G3 p8 o, R% H" R, @ b - char *dmabufsrc2 = NULL;
. W0 X3 |' r1 z/ q1 T2 l. F+ H - char *dmabufdest1 = NULL;
: l) ~* C8 S* f5 `3 b$ J3 j - char *dmabufdest2 = NULL;( ?1 d( j: j6 U3 G3 I
8 `1 e' u- F/ o3 ?6 v( l- static int acnt = 512;1 A# q2 e: W1 }
- static int bcnt = 8;
5 c o# W9 G6 O6 X) H0 i' } - static int ccnt = 8;% C2 N) \" x- [5 |. {& P: Q
- 6 ~, h% d! y. X
- module_param(acnt, int, S_IRUGO);; ?) d3 V7 x# @5 d3 C: P6 i5 ^
- module_param(bcnt, int, S_IRUGO);6 C2 G9 x7 r1 s' {8 Y9 g* D, @
- module_param(ccnt, int, S_IRUGO);
复制代码
2 e% i% f4 Z% O+ L9 }4 {: B6 U; ]7 k' U4 H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ Q- Z/ L' D* w1 ?( K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% {: e# C' P2 n! ^2 U! x; d 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 s9 ]) T0 q/ E# K# ^0 s4 ^$ L
7 M& O: j9 Z6 H) S7 Z
( K- _) C* a" m |
|