|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# I+ p6 J/ p) j6 t2 d. I- [code]EDMA sample test application4 ~5 y# p, {7 W' d% @' k
- /*
1 V6 p5 T5 ~: s7 O& J$ p1 T - * edma_test.c. i9 ^" M+ ^' Q( D3 g$ \, M
- *
6 Q6 R, v; {; f, z; a$ Y, X - * brief EDMA3 Test Application
5 P0 h% k* t1 n. l7 Y h% [ - *
% A2 o x3 a# T7 j/ S - * This file contains EDMA3 Test code./ v: J5 ^ {- ?+ G2 l' z6 `# k5 w8 r
- *
, v* }8 T1 I6 F% u, i, z) D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 D! m8 Z0 f4 z% R+ s6 i& y0 i - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# g" L; B" C7 A - * TO CHANGE.* U! A3 O& i; `8 n8 }% {
- *+ U6 ^1 K6 `, g# x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& e0 a! i$ j6 H8 I+ W! T4 ~
- *% ?$ r D8 x" K% H
- * This program is free software; you can redistribute it and/or
, d5 _4 l" W3 o9 p' O - * modify it under the terms of the GNU General Public License as
- K3 s) g' i: M1 |% e - * published by the Free Software Foundation version 2.
" E1 r( j( r+ p& M - *
{0 V$ T" K: `6 c- W9 A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 E* J* U ?4 L+ L# i
- * kind, whether express or implied; without even the implied warranty* Q" c% y0 E2 }$ K6 O
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& @) y6 u, E0 m' u2 [
- * GNU General Public License for more details.* v' ?) @; U' w" K- Y9 x
- */
( K. z' h8 Y: c
3 `, l z: [3 j) e- #include <linux/module.h>
. q, g) `* [- s" z( [5 E, | - #include <linux/init.h>
( e. V0 @. D# e - #include <linux/errno.h>
0 l( k3 i. |2 k: x. d! j - #include <linux/types.h>
' q* |5 L+ g0 z4 g% Y - #include <linux/interrupt.h>$ w" D0 t, j, r( v4 \
- #include <asm/io.h>
! `/ q: k. n# h6 S0 g" @ - #include <linux/moduleparam.h>
8 l) `0 {& ^0 S5 M! R - #include <linux/sysctl.h>
9 c% @$ r2 D. _ - #include <linux/mm.h>1 I# x- n7 v, {7 t% j! b# V
- #include <linux/dma-mapping.h>- _$ m' I3 P/ b8 n6 q* G
- : C8 a. [* F9 J% J# d
- #include <mach/memory.h>
! v7 E s& s9 g; _9 y - #include <mach/hardware.h>
- @( Z; k* `& [, p, L* _ k) ] - #include <mach/irqs.h>
; `6 t3 L8 E+ Q0 J& n" b, T - #include <asm/hardware/edma.h>9 s9 a6 l7 Q0 J$ r! a+ j6 s
! b* @9 y; D* z9 `, K: h( {- v- #undef EDMA3_DEBUG' W2 W( D5 H# z0 ]
- /*#define EDMA3_DEBUG*/8 W. s7 @/ e! ]% X
* G* u9 M, m/ v: u, ~- #ifdef EDMA3_DEBUG1 U/ F; m2 Q3 t8 g, [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ i* `2 t% a" m, ]- i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 z4 h7 z1 Z$ H2 y7 j
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 u* @1 K& c5 d6 C- P$ b
- #else5 X8 {% B8 |& }+ Y v& A
- #define DMA_PRINTK( x... )
# a0 ~1 W+ {5 w. R# N0 M2 {; @ y4 Q - #define DMA_FN_IN2 B: ~# a, O1 F: d' x* @& N) C
- #define DMA_FN_OUT
! B( H m2 s0 w, K; j# @5 t: I - #endif
8 J( v9 T: p: o2 o8 ^7 [# [ - 2 P j, |( [+ }5 \: H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ X5 j. U/ J, U& e8 f
- #define STATIC_SHIFT 3
" e& g7 U& S# @; \( f' O. X5 T( d - #define TCINTEN_SHIFT 20) D9 E- I8 _( M$ T7 z `8 [
- #define ITCINTEN_SHIFT 214 w" d, |) R$ N6 g4 ^% W0 j C" `
- #define TCCHEN_SHIFT 220 I) T$ V8 @" ]8 M% R' H1 a+ z
- #define ITCCHEN_SHIFT 236 J8 `8 I6 ~& l& z" L+ X/ v% {7 x
0 y0 `7 @$ ]: a0 g8 o- static volatile int irqraised1 = 0;
9 Y# Q2 m U7 ?' S: s; K - static volatile int irqraised2 = 0;
' _% L( E: X' z. l
% F: s$ ^1 D( A6 i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: l5 |( Y% {& _! F4 [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 T; [/ v7 H. E7 f0 D - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 L0 e) M4 R6 n8 f- z
; n4 @) k9 x! Y) t- dma_addr_t dmaphyssrc1 = 0;
; k2 k' h- s5 J3 t& H - dma_addr_t dmaphyssrc2 = 0;
2 V- F) s7 q& Y) J' A$ t - dma_addr_t dmaphysdest1 = 0;
' c; b0 {( j! k+ D5 c - dma_addr_t dmaphysdest2 = 0;
( e6 C3 }: K9 n0 g0 C0 r - : M7 H4 R) i4 A4 u8 O5 u# \
- char *dmabufsrc1 = NULL;& T6 i; R, D, c, R" B$ m
- char *dmabufsrc2 = NULL;
8 c j! d, `6 k% Z6 o" U - char *dmabufdest1 = NULL;
k( u* k0 } M& t& _: Q- x6 u - char *dmabufdest2 = NULL;* P, h( \/ {( q! _0 C0 U
5 u8 s0 D- [5 F( \6 k8 ~+ y6 x- static int acnt = 512;
2 R; d" r1 h% ~! {9 f( w - static int bcnt = 8;
* O7 v) \8 D0 E, y1 v7 f. s3 ? - static int ccnt = 8;6 g/ v, u( t6 {4 W' g
0 E! e" i# }+ x) L- module_param(acnt, int, S_IRUGO);9 I+ p, j Z. j8 z @
- module_param(bcnt, int, S_IRUGO);
7 C' D, S- P. ~ - module_param(ccnt, int, S_IRUGO);
复制代码 0 ]% b% `% l0 y) H+ f4 @
9 b2 h5 K( w0 h9 Q6 ~/ J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 }, R, `% f( @& p& R4 k8 Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( d( J. F8 V% }& C0 ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. Y( C8 R, h1 M& q; i& f' h2 F: s, p" b
3 @: x/ ?8 P- b. \3 r9 N$ ?3 ` |
|