|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 D0 q. d; P% r) _5 r
- [code]EDMA sample test application
0 J9 X$ D5 i4 I - /*( X4 O" R1 b, d1 D0 B
- * edma_test.c
* P. P' [, ~ `9 z& }& C/ Z - *- N; x( m: R& ^/ V2 Y0 z8 t: q* r6 r
- * brief EDMA3 Test Application
2 `) \# {# a \* ? - *
4 x' H7 @6 R% x# c" _" l - * This file contains EDMA3 Test code.* U: G# o& E% p& O" b; s* N- F
- *- @+ v: t4 e7 D
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ B( C/ }, O% _ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 |8 M! u( q( a& Z' g. j
- * TO CHANGE.1 _5 S0 [, N, j, W# Q
- *6 @2 w( Y/ k# [/ B) r b" A$ k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" K" X, p; x+ D2 ^3 ~& n2 }' X2 n - *! I* W4 k* e3 j1 l6 T: D
- * This program is free software; you can redistribute it and/or5 J- Y* I/ T$ g& B4 H3 _
- * modify it under the terms of the GNU General Public License as$ R- D: j* y7 [
- * published by the Free Software Foundation version 2.
, s/ @3 ~3 p6 o* w8 J P* X7 z - *3 F" j" g1 Q) k" a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any# e% G; r- O4 N: e' M6 V( ]/ J; L
- * kind, whether express or implied; without even the implied warranty
6 {+ I9 G! b" A1 J5 E: A8 T+ {, H - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1 w( z* k9 |2 P - * GNU General Public License for more details.
( T& `8 c& U- F7 r5 L/ u/ H9 | - */7 s8 {2 C. E# G6 Y+ @! `
- 4 ~6 b! W% _4 [0 ` Q+ L
- #include <linux/module.h>
: ^6 W' l! K7 S' c1 W' U x - #include <linux/init.h>
3 ?# K2 {: Q/ J' |: M - #include <linux/errno.h>
* y8 X% S) `( f% g( b& U* ` - #include <linux/types.h>
0 Y1 x2 i F5 C, W; h - #include <linux/interrupt.h>2 y8 t) v9 \' r% K
- #include <asm/io.h>
; v& E3 U1 _9 H1 {- a. t - #include <linux/moduleparam.h>+ L" ^& G7 h8 O" ~
- #include <linux/sysctl.h>7 h( p2 v6 w7 r, E6 g# w9 ]& a' w
- #include <linux/mm.h>
L5 l7 b; Z- v+ ]: D - #include <linux/dma-mapping.h>" U0 a7 }! L) R3 } N3 e0 e, L
0 ]' F8 F" k7 [/ c, Y: g) h- #include <mach/memory.h>
% m: i2 b9 y5 H3 t0 p - #include <mach/hardware.h>
6 Z5 P! L9 ]& {; Y0 n | - #include <mach/irqs.h>% _! Y b0 j. f1 B, r8 \. v
- #include <asm/hardware/edma.h>; j7 c& W9 Z6 g1 f
& K1 N6 ^5 u/ i* F) p. k- #undef EDMA3_DEBUG/ V) B; L, h' j6 Y$ R& T4 l
- /*#define EDMA3_DEBUG*/
% [* a2 l% ]% X) i - - j P! Y8 {6 }0 H. A
- #ifdef EDMA3_DEBUG( M! O+ }% {! [) t6 A* d3 P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ v B* a) i' U$ e& Y$ N+ i5 S2 x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# d% s* B2 [4 N0 M0 A2 {& Q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), e* m) a- o* e5 u) P8 z8 U
- #else
* T1 ?$ o& l+ V8 ]2 h' z5 k0 [ - #define DMA_PRINTK( x... )
, S/ x) o& S8 q. s9 ^# b5 R' t - #define DMA_FN_IN4 C0 U/ j! x& w& q
- #define DMA_FN_OUT
* v* D n2 u. Z0 {8 Z3 T/ n2 h0 b; l# f - #endif3 a2 h2 p7 B! ^9 _3 W" D8 D
. @7 [4 I6 T" ~- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* G5 N# \; m& Y' p7 E6 K: J) x& m5 i
- #define STATIC_SHIFT 3
9 g- w& Y' b* Q0 e5 z - #define TCINTEN_SHIFT 20
2 x% ~' y4 X# z7 U% i: t) u1 D5 ] - #define ITCINTEN_SHIFT 21! z% u- @8 k2 K. _, X* M) V$ O6 \1 ?
- #define TCCHEN_SHIFT 22
" ~* u6 X' l) U% E% w3 Y - #define ITCCHEN_SHIFT 23
u1 S8 b, v5 Z' @+ M; X& ` - % G, b% E+ \) h5 E3 l. s
- static volatile int irqraised1 = 0;9 ]% K# U% P2 |5 d7 n
- static volatile int irqraised2 = 0;! ?8 \: q5 U7 V) n1 ?
- , H1 V% C. `$ T4 x! n+ t4 \/ c6 u
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; o+ J. [+ O! v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 \9 r6 @5 c) ?5 @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: t6 E J1 B; x! E9 m$ v
# P e9 v0 V9 t" G& N' |6 F+ x- dma_addr_t dmaphyssrc1 = 0;' j/ {# {, l% ?7 ^& C& [6 }& P
- dma_addr_t dmaphyssrc2 = 0;
- j$ s! A3 X0 c. s - dma_addr_t dmaphysdest1 = 0;
* a8 x; a6 f3 m/ `+ i; u5 G - dma_addr_t dmaphysdest2 = 0;# I! h' }- E0 c# t
- 5 X# X& U. ?5 D# W9 a
- char *dmabufsrc1 = NULL;6 F$ L4 h- G! N8 Y8 _
- char *dmabufsrc2 = NULL;
: A! ~/ X9 _7 _* s8 Y - char *dmabufdest1 = NULL;
+ E" n$ l, F$ `; t5 p0 Y" f% q- Z9 X - char *dmabufdest2 = NULL;6 E/ ?3 j! B* y& U1 }
- , s) X7 e! M" B7 Z, \9 }
- static int acnt = 512;9 }+ |; k) Y: n$ P: j9 z
- static int bcnt = 8;6 o" R' V+ d- B4 g$ U
- static int ccnt = 8;6 J/ v5 @ N3 `* E9 B
- ; w+ O/ q; f% T
- module_param(acnt, int, S_IRUGO);, O+ p) \6 a3 ?; ?2 m
- module_param(bcnt, int, S_IRUGO);; y! b& Z k: ~& @: m0 O9 W
- module_param(ccnt, int, S_IRUGO);
复制代码 0 ?' i. L7 r I+ t; Z1 C3 v
5 K- ~# Y6 x% Y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 n8 a2 R' F0 ~ t" {0 E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% m3 r6 S A' [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" f' Y5 Q1 W% f* Z
4 R5 h$ Y% ~ w* P1 T0 ~* {
( k6 a4 z; A! i- W |
|