|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + S& s2 x/ a& g1 }% i
- [code]EDMA sample test application
3 [5 |) g, W9 H/ [ - /*
4 g" c @/ Q7 A* ~ - * edma_test.c' [6 |8 }/ H& r5 E ~
- *
3 g1 c: ?. f! O - * brief EDMA3 Test Application+ x* F( j2 b2 k+ `5 A( t) y& p) Z3 v8 V
- *4 p# U5 Z/ ~5 D8 @, ~8 l. w) H3 @
- * This file contains EDMA3 Test code.
! b' |/ e% K9 ]9 i7 C6 m Z: b, {$ D - *
* O& o1 D0 m+ z& u6 p8 j/ T - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 O$ Q. E$ Z' I2 _) Z" @$ [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 J+ ?) J0 J" {8 j - * TO CHANGE.& O; k, W l' d8 h% m
- *
I, K, O5 X: L8 ^! R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) A4 f/ @ r0 [ - *$ ]4 S1 A1 r" G3 ~- o z, g) M
- * This program is free software; you can redistribute it and/or
' N' M* ~9 l. Q - * modify it under the terms of the GNU General Public License as
% b: _8 q2 E3 P! w9 T! m9 m - * published by the Free Software Foundation version 2.
. J( P3 R! N- h/ X- ^ - *
$ B9 W/ L; j4 J/ E" x - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: u- L) _4 [, R( T w - * kind, whether express or implied; without even the implied warranty! s% k) X! L) D- i F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- V# Q) j7 _) }$ U! q& ?% R
- * GNU General Public License for more details.
; p8 o8 x9 l; X - */$ m ^, Q1 t$ j$ B, c( v* y
- 1 k P) _; ?# U7 b
- #include <linux/module.h>- m ^- `$ X% C P ?* u n: H
- #include <linux/init.h>7 F/ |) h) \8 l
- #include <linux/errno.h>5 E, S# A3 h4 Y' c7 h! U/ A. ~. |
- #include <linux/types.h>
( {2 _( ^* [% z) Q: ]& ?, |, y% \ - #include <linux/interrupt.h>0 V8 Z+ @6 Z9 @! b
- #include <asm/io.h>
+ A1 `3 A6 m8 M$ F - #include <linux/moduleparam.h>
Z( r( k) r. E+ C! i# A - #include <linux/sysctl.h>
% k0 B$ a* c% t5 ] - #include <linux/mm.h>$ b' `: @' q* l+ h, |$ M
- #include <linux/dma-mapping.h>
# F7 I( B' z0 k& U; Z& O/ ~ - 1 j1 _0 S; V) S) G* M
- #include <mach/memory.h>
% n7 F" d) `/ _6 S9 X' c - #include <mach/hardware.h>" H5 a$ A/ B5 S/ i, l
- #include <mach/irqs.h>
! D4 b8 N |. ]* h - #include <asm/hardware/edma.h>
9 E1 q4 A$ Z9 G% |0 j- O% \; a
; u% Y4 H/ ^8 o+ q+ o( i- #undef EDMA3_DEBUG1 J# C* ~8 p( C' t$ o. x* x5 C
- /*#define EDMA3_DEBUG*/
; @6 k0 \* M9 X8 X+ Z$ X+ w* o - * d( e8 h4 ] R3 O6 T: S
- #ifdef EDMA3_DEBUG
( f0 q! V. b# B7 e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- V& Z7 _/ n) V3 X; L4 i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ A2 ~) V! y2 d% z$ p8 s6 v - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) r- e9 _$ T. a8 f% M+ ^* _7 S. X: O
- #else' |* u6 r2 C5 q4 u
- #define DMA_PRINTK( x... )
7 n. h# h9 W9 i4 G0 y. g - #define DMA_FN_IN
7 i4 m4 m' u) I% A - #define DMA_FN_OUT- C' }& b4 `7 }+ P6 ]
- #endif
% V1 J& ~/ y3 V
8 r- X+ P4 O1 E* w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" X8 `3 v5 q) c. ]! |7 \8 ~
- #define STATIC_SHIFT 33 w, `0 ~% m5 }: _
- #define TCINTEN_SHIFT 20
" F, G; t, c; r) M$ t - #define ITCINTEN_SHIFT 21
, Q2 Y3 W' {! ]( `0 `: @ - #define TCCHEN_SHIFT 22
: n* F- x; _/ ?2 @' j - #define ITCCHEN_SHIFT 23* ]3 _' y: F. X4 T5 i
- ) T2 a+ v. F7 k3 D# H- G
- static volatile int irqraised1 = 0;- \6 `5 A" t% G. a9 x9 E
- static volatile int irqraised2 = 0;# ?0 z: r" ?" C# {
' h) b* ~$ R( @* U, j- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& V4 H4 }* T4 I+ x2 `/ p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 c1 n5 z. j$ P7 z1 G6 W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 [: g; r' v% o- G
- $ F* h. M7 U5 p" F2 o2 a
- dma_addr_t dmaphyssrc1 = 0;
7 R f5 x$ R- N4 N+ X4 |% r - dma_addr_t dmaphyssrc2 = 0;, D V7 {7 F6 a8 P
- dma_addr_t dmaphysdest1 = 0;8 ]! d9 R6 @$ F; W
- dma_addr_t dmaphysdest2 = 0;
# h2 \& p( E1 c) Y
" A1 j, K3 ]) H# `% E9 p- char *dmabufsrc1 = NULL;; P% P/ O3 b0 \) _. @: B- n" M
- char *dmabufsrc2 = NULL;5 k0 V( p( K" S
- char *dmabufdest1 = NULL;& _: k+ u' o4 {. p, s2 b* Z
- char *dmabufdest2 = NULL;. A% P$ P: j4 D& `: x
3 L: K1 U+ F! `0 L5 x' A- static int acnt = 512;
& Q1 }9 C7 o% e7 H. p' ~& i - static int bcnt = 8;
8 L1 f& n$ B; A4 R! ~2 W6 A - static int ccnt = 8;
' w4 z, i: G* ~, q( T - ( q: r6 A7 ]$ } e3 @% F
- module_param(acnt, int, S_IRUGO);
4 e# v! z4 c; r6 n* o - module_param(bcnt, int, S_IRUGO);) _5 r9 [: q! B7 K
- module_param(ccnt, int, S_IRUGO);
复制代码 1 c+ j7 d/ G- S# r" d" n
- R$ r- I) M2 Y) B- ~0 {2 e: c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 m. C* U2 f+ s) |; x4 M- N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ S4 r* {, B# d- {, i J* R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; U7 u7 d; ^+ F0 P' B
$ J; d9 m4 |- g( k. D
" y7 `1 Y/ J; I8 f( ]$ ~- \ |
|