|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ _" b0 A' D* c8 ~
- [code]EDMA sample test application& f/ W. B/ Z- r7 p4 ?9 v- Z' g' f3 b
- /*! g, t/ C4 ^/ `/ [
- * edma_test.c
/ i4 g; X; |% Z# o - *
1 E& n2 b% ^+ d& W5 l, Q6 m3 u, _8 F K - * brief EDMA3 Test Application1 V1 l- i0 _" B
- *3 |4 A2 }; f/ W- d' G& @ h
- * This file contains EDMA3 Test code.2 U2 k; i( l$ @; k, Q
- *
; s# l* s5 M0 S - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
0 W6 @: w3 ]' \! c; D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& M5 X" |/ g) d# q& `8 W3 M - * TO CHANGE.
/ B" r7 X; S8 M1 K - *1 X: }% k5 g( ]" y! B" _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( l4 f! i3 z; Z( D" j3 o
- *
% {/ j" S% O, l' s& } - * This program is free software; you can redistribute it and/or* _1 o: o9 ~+ ]3 Q
- * modify it under the terms of the GNU General Public License as
! s# U$ C, v6 C5 T( k8 Z: }0 K8 r - * published by the Free Software Foundation version 2.. W8 t. X* } a( L' S- x3 m- m- Q, D
- *$ H' F3 b/ o( N) l% z- E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ ~8 G+ ?7 e d* P) \; n: ]2 N7 V
- * kind, whether express or implied; without even the implied warranty) a; R \! f- ]( G0 p4 C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ s/ I" x# P; e$ Q - * GNU General Public License for more details.
' O1 y l. A7 z8 X* K - */( I- l2 {2 ^: I. U; q5 `
2 t, Q4 k0 m0 \( F; B- @- #include <linux/module.h>
4 o4 Y7 V# t5 a5 b) R: m j( _ - #include <linux/init.h> J4 R& o) N' f- t3 _% p j4 [# C
- #include <linux/errno.h>
1 Q0 U- }2 A+ _- \ - #include <linux/types.h>
' Z, I3 \4 f+ K# R( R - #include <linux/interrupt.h>
+ }# t' N; e9 C* j - #include <asm/io.h>' } X% q3 u3 J9 K8 b
- #include <linux/moduleparam.h>8 s( I; `8 I7 @ M) v* h
- #include <linux/sysctl.h>
8 E, Q1 O# e+ ]7 d7 D - #include <linux/mm.h>! w8 W& b0 V, C$ e/ P( j4 v
- #include <linux/dma-mapping.h>
) R' |8 h: K+ W5 W0 p
$ B* \" @ s0 Y( Q# A% m! B- #include <mach/memory.h>0 I! T0 J4 E) J, L7 e4 ]& n5 V
- #include <mach/hardware.h>
g2 C% l( c1 c - #include <mach/irqs.h>* ~2 N% ?* S4 L1 v
- #include <asm/hardware/edma.h>
1 r' w. X; h+ E
9 z' S9 z5 Z7 P. u- #undef EDMA3_DEBUG
1 O- E1 g+ f. s8 C - /*#define EDMA3_DEBUG*/9 P0 f2 }/ p" l. @ B+ d$ {
- + `- Y8 b: U! D2 `: H; j
- #ifdef EDMA3_DEBUG; d8 u1 g- b- Z+ f7 U+ y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
J: S; {0 P! r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 K. C# p) v, Z- R$ O! S, U6 l8 } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 d7 Y) u) Z1 V: M- @1 |
- #else" o$ G" |1 U* G, A7 w1 A
- #define DMA_PRINTK( x... )
/ z! O" w1 r, `1 o% b& U; E - #define DMA_FN_IN2 L$ h" g$ }, K( g( S( w
- #define DMA_FN_OUT
% Y: ?" m4 U2 }3 h6 E - #endif% X! Z; Y" l, B- f1 `9 ~ I
$ ?6 v. a# a) y$ [: y, O' X$ C4 p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
^! b" J/ q1 h% o - #define STATIC_SHIFT 3
8 v7 M! A: w' e! b/ H! b# v - #define TCINTEN_SHIFT 20
. V2 q( ]* C3 j0 r1 s. } - #define ITCINTEN_SHIFT 212 ^# Y. ?) |4 C& v( t3 T0 l8 i0 a' Q4 B
- #define TCCHEN_SHIFT 22' t2 Q* N3 \6 @3 V) F2 V# y
- #define ITCCHEN_SHIFT 23! q, L' Q a, R Z8 |9 ~) \7 s
- 0 @1 c2 Y( j8 W
- static volatile int irqraised1 = 0;3 x) ?$ j% m5 G2 H L! W# k
- static volatile int irqraised2 = 0;# u0 T1 T# }% K1 y9 L, e8 k1 M4 ?
- 1 H3 C7 m4 X9 w$ n- x2 P! F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& }: z% t3 N: e+ f; k7 N: O' B# u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, l& U* F9 H& X) Y" Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 K4 _8 S5 s5 I4 w' L& r
4 t3 U- [+ n+ e( v) N* T& j1 _- dma_addr_t dmaphyssrc1 = 0;- @2 ?( Y/ m, Q( \6 {9 V' i9 m+ Q+ n
- dma_addr_t dmaphyssrc2 = 0;, x% E, i3 V# E# x3 r* s2 {
- dma_addr_t dmaphysdest1 = 0;
* y: v' Z8 [- w5 q - dma_addr_t dmaphysdest2 = 0;0 |+ Y4 H% I$ p/ [
- 1 f0 b, {2 k/ F, I( A
- char *dmabufsrc1 = NULL;8 a2 w* G" L% J# [# ?& v b
- char *dmabufsrc2 = NULL;
% R& s; @. y3 z3 ?- V9 K. E9 N - char *dmabufdest1 = NULL;( |; r7 v5 T1 C Z9 u6 o- l3 e0 ?
- char *dmabufdest2 = NULL;
5 @* q; ]3 C1 F6 m) i6 {6 [. C
5 V9 \. H/ R' K+ D: y- ~/ h- static int acnt = 512;
9 \& R1 `8 |* |/ i4 ^ i# w6 h - static int bcnt = 8;
8 Z$ h; g. E% ?$ A/ u1 W+ r( N2 f - static int ccnt = 8;
0 r2 v9 b# u$ M M2 G% }* X* P - . K" m f% C; _& ]# G- P b' B
- module_param(acnt, int, S_IRUGO);
8 Q* ]" `% r8 W0 D4 w - module_param(bcnt, int, S_IRUGO);
: k1 y& q! n# z5 f5 w8 `- H - module_param(ccnt, int, S_IRUGO);
复制代码 2 a6 t% B% _& j3 H( R
7 f. r8 n5 L- u. z& `- C5 t8 N9 f
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; ?' Y1 n/ i% D+ Y+ T2 Z% s/ \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 q- Z: `; j; c# u9 F! O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ d- n/ g) B. B# ^9 B& x3 S% r8 C6 e
/ ?) o- \/ v8 t
|
|