|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" w/ j- a& C+ Y, G- [code]EDMA sample test application
& S/ s) d+ q7 |% k* l3 {( P7 C+ `! j - /*
; H5 i3 j8 q8 C# u - * edma_test.c
' r: ?4 c% M# }9 g - *( X/ x4 `. h$ F4 N0 _8 m: R
- * brief EDMA3 Test Application
+ Q7 S8 D# g2 p) ?9 V# {6 Z8 g - *. q `) O3 @4 }
- * This file contains EDMA3 Test code.
3 P Z7 i$ n* f1 Y - *0 Z8 M: }2 A3 v2 x: z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% I* T( N! g5 m+ }1 S
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 S, `9 H9 |$ _( ` - * TO CHANGE.+ O9 w4 B& W# b1 Z
- *( ?( z6 t }* v# [! @- x, e
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" o: r. a( i' `3 h
- *5 L: G$ O8 `6 c% ]' _
- * This program is free software; you can redistribute it and/or
1 V; _' M+ y; Y/ Z+ q - * modify it under the terms of the GNU General Public License as9 p1 Q/ k; W* D4 g& v
- * published by the Free Software Foundation version 2.
2 ]* [5 k6 Z% O - *( g( [& d" L+ W# A0 I
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 n# W( [1 p5 x) o* ~# B/ w - * kind, whether express or implied; without even the implied warranty
# \) k. j4 n! f0 ^ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 v9 t( B: V/ K) s( c) P" ~ - * GNU General Public License for more details.3 M: D! ]4 ]1 t9 O& F- _2 c
- */
' s% x3 |: m) {4 g - : E$ e0 L2 N( L# t, V% [, @
- #include <linux/module.h>1 I0 r6 R4 {4 f4 _: O; R8 v3 t. }
- #include <linux/init.h>
* D# m& N, L) ^' r. W z- _ - #include <linux/errno.h>6 o: T B( c+ V
- #include <linux/types.h>. W& w P0 ]% w
- #include <linux/interrupt.h>& W; T" U4 a) @
- #include <asm/io.h>
7 i' C: m' R, `7 `0 S+ E* k - #include <linux/moduleparam.h>5 e& z0 ^& A1 W+ }
- #include <linux/sysctl.h>. G$ M8 B& ^& _( B
- #include <linux/mm.h>
# O+ n2 c$ r b& b - #include <linux/dma-mapping.h>
& R4 p( J1 a/ ^2 X
- H5 C* p* Q: d- #include <mach/memory.h>+ w8 M9 V4 V- U/ A- w
- #include <mach/hardware.h>1 N/ x2 f! G3 P0 M) s, Z6 Q- _3 y
- #include <mach/irqs.h>
& c C" u9 v @" W3 N - #include <asm/hardware/edma.h>0 ]" I1 r4 d9 [! L
1 l" u- \- ]' y$ ^! }" C4 F0 g2 a- #undef EDMA3_DEBUG
5 C/ C, j& Q" j: {0 S - /*#define EDMA3_DEBUG*/
, U4 R; W: w. L+ J1 d: ?$ @
) k; Q" K. ^' G2 s1 s3 D4 W- #ifdef EDMA3_DEBUG
# L. {* D6 f0 _, B - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 g9 H, a) S9 I3 ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 W& L8 {7 t+ g& l* Y+ R" ~8 Y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* S5 U, q* S- E2 a. } I - #else
/ s& F, c! J" T' X( W4 G - #define DMA_PRINTK( x... )9 v. M) Z/ S F0 [! [- [
- #define DMA_FN_IN
. c& {' F0 P# q% z* b9 z. m - #define DMA_FN_OUT1 ~5 z3 e% n8 C# }/ {6 _
- #endif
; f, V x* c1 h9 o/ M
3 k7 |3 }8 L2 A. F5 P* M* g" e1 ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 V6 u0 \. x1 ^( r - #define STATIC_SHIFT 3
. T! f" z* `( Q7 S) [. H - #define TCINTEN_SHIFT 20
* u4 |" F& _' |+ G- f# }/ I - #define ITCINTEN_SHIFT 21" s: ]7 w& h8 y0 Y' z; u. p: ?
- #define TCCHEN_SHIFT 22
% k- k% x2 C4 F7 s - #define ITCCHEN_SHIFT 238 ?9 b9 ~; z+ N# @$ M4 Z
- - G6 g$ o7 P# X* F8 M2 X
- static volatile int irqraised1 = 0;5 z) b [$ T$ Y* }/ {/ }8 B
- static volatile int irqraised2 = 0;1 k* {8 Y6 ? |4 y- {, ]( z
- ' z- }) x2 m1 V1 j% y# b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); S# _4 `* O3 n- e. L5 F
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ X. v5 E3 \, U2 A7 z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) v/ Q6 i0 P4 ?. Z* t( l; ~: g; _
* P4 V$ v& H5 t7 x/ m, u! h- dma_addr_t dmaphyssrc1 = 0;: @8 \# J/ X3 I; b1 ^( G1 S/ [
- dma_addr_t dmaphyssrc2 = 0;
, f6 m. M9 u7 t - dma_addr_t dmaphysdest1 = 0;9 g' u( }0 Y( N
- dma_addr_t dmaphysdest2 = 0;. f! v5 I( _ s3 L
& I" g- S' I2 h8 D7 g) I- char *dmabufsrc1 = NULL;, O: W( B C# f3 V
- char *dmabufsrc2 = NULL;
* A W* `$ Y( x/ _, l1 f - char *dmabufdest1 = NULL;# P0 T& @, i$ G9 U9 [
- char *dmabufdest2 = NULL;8 g, o% J+ P: {8 o
# f$ C2 U* N j2 `- static int acnt = 512;/ z& S1 j: c# o; F/ p0 n8 U1 z5 z2 j
- static int bcnt = 8;
; U/ k0 K1 a* n8 ]1 j# h: F3 c2 X/ u- W - static int ccnt = 8;0 D# H; f, _: C) ^/ [: R
- 5 s( Q. D% S9 `5 y
- module_param(acnt, int, S_IRUGO);( }1 {6 l4 M/ y* G/ [
- module_param(bcnt, int, S_IRUGO);
( J: V' x& E2 [4 G! x - module_param(ccnt, int, S_IRUGO);
复制代码 % d4 N. p' A$ G: X8 W/ u
+ \$ @4 g) n1 X* Q6 k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 i; I+ X4 q0 L% barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& B, X% B: I4 ?' q+ l" a" ?5 h 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. x3 q. _0 F; Z1 U2 Q; p
n, y; }- b2 _" P3 s5 f' n; u: \9 m; o( p2 S) N& \* v9 r+ X
|
|