|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ O5 u5 a3 b8 p: g$ ^
- [code]EDMA sample test application
8 N6 ?6 a- h3 S% D - /*
2 u: n' p2 M' X2 N1 b$ Z% ~2 \ ?3 d - * edma_test.c) m3 R0 X9 x1 i2 h2 N( g7 |$ @ o
- *! P U' F2 y" c4 e5 Q9 V! ] Z# n
- * brief EDMA3 Test Application% C4 U8 l6 t! `& Z7 ~
- *" k$ j, e: G; U- d, q. Z0 l
- * This file contains EDMA3 Test code.% u) _! R/ P9 z. q) K
- *
2 z! g+ m e# Y. v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. \4 ?' `- ]; i6 G. j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! X& `: K" V V - * TO CHANGE.8 [9 {4 H( [8 F3 `1 ^* J2 j* [; A5 U9 [
- *4 {/ p" \ D) H, G% z' @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 S6 W S( [1 X5 [) a, Q7 |" t6 P
- *
: [; X2 n' d1 R, s$ F - * This program is free software; you can redistribute it and/or
" T- W- {" ]' k/ ?2 z - * modify it under the terms of the GNU General Public License as9 n$ V8 t [( W9 u
- * published by the Free Software Foundation version 2.
( R+ G; e( `2 R5 A0 k - *, i7 P; H @6 [3 ] _9 r6 d. F/ E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 N' _' h. b& h" \, g - * kind, whether express or implied; without even the implied warranty
# H* d/ Z& i# Z3 f - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: L6 L$ f1 G- P - * GNU General Public License for more details.
6 e! q' g" D2 r; ], F - */% T2 x7 {" O% s* B9 e" B
- + C. o* {/ ?! h" W U0 k- R
- #include <linux/module.h>
' q, m* H* t7 d. ] - #include <linux/init.h>- w1 {% C0 B/ z$ Z; U' g
- #include <linux/errno.h>( G1 X( [3 E r, y( A
- #include <linux/types.h>
6 J% ]! ?" ?5 Q/ } u8 Y+ k4 D - #include <linux/interrupt.h>
% t9 L4 R- u( C D3 Q - #include <asm/io.h>0 r5 c1 P/ n& M! C/ ]% [
- #include <linux/moduleparam.h>- g5 I; U& P, s4 s3 ~2 [& E: J; H
- #include <linux/sysctl.h>
& j. L9 ?' k: V1 F$ K - #include <linux/mm.h>/ t( x! Q/ n8 i7 Z
- #include <linux/dma-mapping.h>
- h) E7 C9 [" X3 h
6 m. N: H3 ]! o- I- #include <mach/memory.h>) e( @' P! n8 h d, P# T
- #include <mach/hardware.h>
2 p7 n2 V/ o- | p. L - #include <mach/irqs.h>4 ?* G, y1 V( D+ k! [& j
- #include <asm/hardware/edma.h>+ T$ u% x8 P" l. A2 V$ l
- 0 g* V: e8 e* [0 j. {- N$ }
- #undef EDMA3_DEBUG
/ ~ b1 O4 z# T- w# f" s - /*#define EDMA3_DEBUG*/
7 V4 y! }# r( x! G* D! e) L - ! Z0 C" c) b J# b' y
- #ifdef EDMA3_DEBUG& P" B: s0 ^) Y( g4 d; R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 `: P' o g6 J' c% F1 z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 ^% s, h3 L+ S; J* | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ B+ s; Z2 J. p1 i - #else- S' a9 \7 s/ ^$ f! U* F" M) P
- #define DMA_PRINTK( x... ): I& }8 K' U8 h' k- m! F9 o% U5 o
- #define DMA_FN_IN
5 L! X6 y0 Z! E5 O- F' e& { - #define DMA_FN_OUT' _0 }. P( ~0 Z! G, P# m/ J) |) N
- #endif
2 u/ q: D9 u% T( v: \; p x; n - " c4 G* Z+ X+ }* `' {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 E8 |) W# I3 G6 O/ b; P3 B8 z - #define STATIC_SHIFT 3" o! F3 s _" @1 H K& \1 Q
- #define TCINTEN_SHIFT 20
+ y' W7 ]5 \, P( B% s - #define ITCINTEN_SHIFT 21" d# k0 K" G; U/ q+ o' Q( S4 Q
- #define TCCHEN_SHIFT 22
/ x3 {+ o! I% _6 W& U1 M. E - #define ITCCHEN_SHIFT 23( R( T2 G) D4 z& L
- - Z6 H3 P' t2 _8 z0 i
- static volatile int irqraised1 = 0;& p9 V' q) Q1 E8 n, R
- static volatile int irqraised2 = 0;: E* O" W1 I3 U; }+ o
3 m7 w" P6 j/ \, w2 K- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# y! T' m, l$ d3 X' r5 x - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; b x. D1 h9 k/ t - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
D; ~4 D; c- {, ? W" B - 8 b9 z) u M% ^: C5 V8 [
- dma_addr_t dmaphyssrc1 = 0;& K$ S! J0 e& c3 |- K
- dma_addr_t dmaphyssrc2 = 0;
- m9 P5 B" p/ y& h/ p$ D a7 j# j E - dma_addr_t dmaphysdest1 = 0;
: L& Z. ~9 N T* f - dma_addr_t dmaphysdest2 = 0;
. l8 E1 p3 J7 i3 J0 q* W* I0 E2 l
6 z$ [& X$ l6 o0 r# Z H4 a- char *dmabufsrc1 = NULL;
7 ^0 g6 v; x* Q6 J - char *dmabufsrc2 = NULL;- }" n7 h; w/ ^! Z5 o4 P
- char *dmabufdest1 = NULL;: a2 W1 A; l+ C% i" V! M
- char *dmabufdest2 = NULL;+ C' m: j7 M: q# |& c# D
5 N: N/ m; t }" o- static int acnt = 512;) ^$ ]) J' i# w2 s" E" @
- static int bcnt = 8;& S7 Q3 c7 K+ {; S
- static int ccnt = 8;- d# H/ t! N9 c2 {( R
! S$ S1 L# Y! X( x5 B/ B. B- module_param(acnt, int, S_IRUGO);
7 A7 `& r5 Y6 R/ w6 _2 _3 y - module_param(bcnt, int, S_IRUGO);4 O* S6 T9 H9 k* z; y
- module_param(ccnt, int, S_IRUGO);
复制代码 9 q* n& a& [; q( w$ S& [
- S7 z1 s- v+ W; B x; P9 A7 m. x
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& e$ }/ D* [ M7 `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! A% {( R+ w% f1 _1 S. \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ }1 _0 `$ w5 }! S7 V2 \6 Y6 R
; i" n- [, E8 {2 T- l6 N& Q- C1 \1 F& U* b
|
|