|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: ~0 G' K( V5 g0 ]4 u- [code]EDMA sample test application
k- @: y. B" ^5 o$ q# _2 y+ d - /*
. x) ]3 _1 E& I! P& P/ o - * edma_test.c
+ d" Y& Y% b, v6 N, i. s) n - *
2 Q& p' L% q9 ? - * brief EDMA3 Test Application5 P, J9 l, W9 ?9 o: a% P- Y1 Q
- */ L+ n3 J( b% P, a
- * This file contains EDMA3 Test code.
7 k; I D# m' e; j - *
+ M3 E: B: R" G( ~% _4 l% | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 `0 h6 D$ ^5 Q4 I - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' S& E. Y& w# ?$ U
- * TO CHANGE." t9 `+ A4 ~9 U0 H
- *
: S; u. D( I0 y; Z! F: v6 C( Z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% ^- r* ~. Q5 o: Z/ b- Z - *
+ j; @5 i) d$ Y7 b4 G - * This program is free software; you can redistribute it and/or
, h. n! b. Y; n: h5 \ - * modify it under the terms of the GNU General Public License as
1 z+ z; Q- V/ e, W, }: U/ [ - * published by the Free Software Foundation version 2.7 {' k2 \2 d# a! p
- *
% ]" D1 ~% S1 r$ R0 p - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: t% n. O0 i, U/ p$ @" J4 u - * kind, whether express or implied; without even the implied warranty0 c8 F8 C% i x f7 `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 B4 T# I8 f! f. H, M+ \ - * GNU General Public License for more details.
) Q1 J+ o7 H$ N& A" \ - */2 k! I5 I, R, `- y( }1 k
. ^" u: p6 d$ A( `7 m) S- #include <linux/module.h>4 h5 ~9 o+ u" k7 ?# z6 w
- #include <linux/init.h>. M4 j u/ R( A: _. L
- #include <linux/errno.h>
^1 P; H# h0 H% M - #include <linux/types.h>9 I% C6 A7 l1 h6 t* o; _
- #include <linux/interrupt.h>
& E* K: r. l1 T X5 @# I8 G - #include <asm/io.h>
# R k! h/ v3 Q5 ?& K) P - #include <linux/moduleparam.h>7 d$ F e: K. N5 E3 P( ?
- #include <linux/sysctl.h>
7 D3 T1 `, B% S - #include <linux/mm.h>; m: A5 `" E" ~$ E7 |
- #include <linux/dma-mapping.h>7 A' ^: q `" T$ c% V! R
- 7 W2 q. g. n6 S- r* a: w6 E
- #include <mach/memory.h>
( B& ?6 {- b# s: f/ l$ y - #include <mach/hardware.h>
# w3 e9 a8 x% c6 m - #include <mach/irqs.h>/ n0 G8 X( i0 j2 a1 V. ^$ V1 O5 i. Z
- #include <asm/hardware/edma.h>% g; G: v/ \; m# A; W9 d) s
- ! ^3 n o! d& Y% Y
- #undef EDMA3_DEBUG
; m1 K* X* |/ a9 v! R7 H0 O j - /*#define EDMA3_DEBUG*/
5 L3 w6 z8 G6 Z, X8 P7 i& y
# n8 N$ W, E) W& Y9 X3 ]& w- #ifdef EDMA3_DEBUG
( Y. V* G7 P4 C5 L2 J9 c% J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# |0 o5 {2 t* y# h7 M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" \2 g. B3 A+ E- P4 H$ q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: Z: H7 p* j0 b5 t - #else
8 d* V) r" E9 H; _+ _4 n. t ^7 ` - #define DMA_PRINTK( x... )* K3 a, Y) Z6 T+ z# c: H7 c
- #define DMA_FN_IN( ~/ m- G( \6 b3 N- W
- #define DMA_FN_OUT
% C2 g- v" R7 O! |6 { - #endif% @3 T' a/ c! h' i, U1 \ y
( M# B) X7 s5 z- Y& s0 k" @9 Z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 A" \+ T N! B, f5 U
- #define STATIC_SHIFT 3
1 ~" Q% @ F" p3 @; r6 o - #define TCINTEN_SHIFT 20+ N \. P- c S1 Y3 h6 u
- #define ITCINTEN_SHIFT 21/ M' ?- B% _. H# B T- v
- #define TCCHEN_SHIFT 22
8 m+ T# h* h+ D+ s - #define ITCCHEN_SHIFT 234 p" S8 A! o& r4 @
c; D5 P$ G: O! M5 c- static volatile int irqraised1 = 0;; K% n( T, q+ N+ S6 k
- static volatile int irqraised2 = 0;
C, `9 X7 p: P# c" T9 _# m5 o |" T1 |
4 A# Y) y, d* H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# H' [2 z3 A4 j8 U2 [/ o8 H, `! m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! e# V) ~+ Z) u
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 Q) [) J6 c! O2 ^5 b# ] - 4 f j/ @- W x
- dma_addr_t dmaphyssrc1 = 0;" V1 g+ K( a8 b" H( y
- dma_addr_t dmaphyssrc2 = 0;: O7 s/ v6 ^( Z% r; X1 m
- dma_addr_t dmaphysdest1 = 0;+ Q7 S; B& M' X( M& z- o& c
- dma_addr_t dmaphysdest2 = 0;
2 ~# y8 C/ {" g' O* Q2 i( Y: k2 L
4 o1 C8 z- b! `: t Z- char *dmabufsrc1 = NULL;9 ?. u; t2 v* v& T0 L. T: j
- char *dmabufsrc2 = NULL;
# R: v; a, L- M$ a2 @1 I% N! U - char *dmabufdest1 = NULL;
& r8 ?0 k) R! S( V4 y3 c8 I* j; `3 z- @3 h - char *dmabufdest2 = NULL;
C y( ]' P. |# s - 2 E; Y- U6 i2 ?% \1 ^7 Y
- static int acnt = 512;6 {& ^ o K( o2 p6 X z
- static int bcnt = 8;
6 O+ R9 Z3 @6 c" }' i - static int ccnt = 8;
9 E" M# p, P- ^0 o2 P) [% a9 [
7 m4 y7 {0 }1 d: n1 o h- module_param(acnt, int, S_IRUGO);
, b3 j# Q* F- `& V- Q" e - module_param(bcnt, int, S_IRUGO);
) V% @7 G2 z7 d4 ?1 e0 O0 M) j - module_param(ccnt, int, S_IRUGO);
复制代码
( h4 A3 `8 S5 C; {9 s. G2 z7 h/ M% L
% u% O4 y0 [( V$ o6 ~8 W: A 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! Q+ l! E3 V. U6 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 Z, c. n& C) x2 k* {5 ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 w+ z& r, H8 @# k* K8 K' ?6 I! H
( v: _; e5 f1 D6 u# A! g
/ {/ _+ G4 P2 s7 l |
|