|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ c8 Q$ m2 C. e) \; [- o4 F0 y0 b
- [code]EDMA sample test application
% c# K' N1 h% B: Y- V' K+ w - /*/ Z" @" W& ]9 Y! b
- * edma_test.c
; J, M8 d* [8 r7 M q0 k - *
( n4 X2 j' }+ U9 Q - * brief EDMA3 Test Application
& I" A3 b+ M- ?& r# X$ d1 b3 @8 c0 l - *
/ c9 h- R* ~" g& h1 { - * This file contains EDMA3 Test code.9 A8 L: M" y+ S, D
- ** j$ q2 K/ ?1 v' {, u
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 t5 O2 G3 B" a& r, V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 Y2 {0 \4 A$ Z; |2 G: ]# @, b
- * TO CHANGE.' ?2 k: l5 V# W. }! {" w
- *
: a- Z3 H3 ]0 d - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 P4 H* c; T3 f1 o: |. }: f7 ~ - *0 s& p; ?1 N+ H# P
- * This program is free software; you can redistribute it and/or, E' `0 C/ g7 M' W
- * modify it under the terms of the GNU General Public License as1 v( X, J) [4 Z2 O7 S+ q
- * published by the Free Software Foundation version 2.+ ]( \! h* Q: V: e Y7 w: l
- *
" U- g6 c1 o% _2 g0 E8 } - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; Q# H" C0 K0 m1 g. k" w$ O
- * kind, whether express or implied; without even the implied warranty
9 w$ u1 X" e; t9 ]$ P, u" P( P2 @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 K) }5 `0 }; W$ q( g, k2 q- `
- * GNU General Public License for more details.: w4 q7 x+ I: X: q
- */: |: K2 G9 w) l% f: }
- 4 e% Y$ d& \! C2 ~! z" J. d X
- #include <linux/module.h>2 A- n6 `5 }" W/ m( \
- #include <linux/init.h>$ E3 B; x3 w1 t" j& u5 F
- #include <linux/errno.h>4 v8 [ y- i1 d0 w5 U$ K$ B
- #include <linux/types.h>8 E) L8 C2 [/ _3 ~ X+ w
- #include <linux/interrupt.h>
: z2 a7 V$ F& P/ e1 | - #include <asm/io.h>
0 K: s2 h" j9 S7 r- `2 K* f8 ` - #include <linux/moduleparam.h>
+ X4 O3 S4 p) Y - #include <linux/sysctl.h>
. C, H: W* g' n& ]- W7 x0 o% j% c - #include <linux/mm.h>4 V% I, Y& h1 M% H
- #include <linux/dma-mapping.h>9 L9 d' a: y1 t& _$ g$ L
- I: `& X) Q8 ^- S6 b# H
- #include <mach/memory.h>& K" @8 G& a s4 h3 S0 V; B9 D
- #include <mach/hardware.h>
) L5 f+ y" Z/ m - #include <mach/irqs.h>
; n+ B' I7 J- U9 r3 R. k2 m - #include <asm/hardware/edma.h>9 w* ]# a8 m- V1 x: ]' y
2 J. A0 M* o) s+ A% {7 C6 X- #undef EDMA3_DEBUG
$ ?& g; s2 D+ ^* F - /*#define EDMA3_DEBUG*// @4 r9 _' i7 M
, F( n6 ^, A7 ?' M/ U n- #ifdef EDMA3_DEBUG3 l1 R \5 i& x3 Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: s6 D4 e) s6 c5 d - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' v/ z& A$ y# [5 Y* ~5 d7 C! N - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ O0 ^# |- I, Y h2 B2 c - #else
4 h1 R7 M+ b, b, Y5 ~ - #define DMA_PRINTK( x... )
- i" c# I/ d5 k% d% h/ g+ y% w - #define DMA_FN_IN
4 O/ Q$ ~# \$ w1 O% j - #define DMA_FN_OUT
4 O# u! c* E) a/ k7 X - #endif) o; L9 [$ Y. {
. o% x5 ?( y3 w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 l2 g) V8 W8 F" B
- #define STATIC_SHIFT 3
6 d+ ?# J6 L- @! V& \ - #define TCINTEN_SHIFT 20
+ K0 _/ B* ]/ i+ w. a - #define ITCINTEN_SHIFT 21' s$ }- s1 M3 R% R$ e( w$ _
- #define TCCHEN_SHIFT 22
( X5 ^% _( ~+ k' Q% ]) X2 J - #define ITCCHEN_SHIFT 23) K% d" a. i$ U+ @. u8 D
0 C9 |' p& _% w4 A, s0 K- static volatile int irqraised1 = 0;
- k: V7 S& m) [7 ]* A4 R - static volatile int irqraised2 = 0;. E: c2 O2 r# m8 k. q& w1 E& |1 x+ o7 v
( C$ F9 A7 t$ ]! S8 w0 ^ J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ?' R2 }/ _* E% A; V/ n0 y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 p4 ^) M* h, E- X A- h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 k2 W6 t' e/ P( _, g4 w - : s9 i4 N, x' h4 L! |% a
- dma_addr_t dmaphyssrc1 = 0;1 U3 [7 C1 w2 G& i+ l7 u
- dma_addr_t dmaphyssrc2 = 0;* Z, B, ]: S4 ]& r$ \: A% O0 z
- dma_addr_t dmaphysdest1 = 0;
9 S$ \! D+ s3 m; M' Q) ?+ b - dma_addr_t dmaphysdest2 = 0;6 U" Y4 H+ w* e- y- _
- % V/ `! p0 _9 z9 k% j
- char *dmabufsrc1 = NULL;
; \: A/ y6 C3 K7 M3 Z4 w - char *dmabufsrc2 = NULL;
* I* g" c! Z. b - char *dmabufdest1 = NULL;
, C) ]- T. f, e* M - char *dmabufdest2 = NULL;$ @: M6 w& @) M: J
- $ t+ ^0 W/ A/ i8 G8 e9 x5 Q
- static int acnt = 512;! o9 l8 j. H( y, R
- static int bcnt = 8;4 o' `4 H F- }! x+ n* X# t# k
- static int ccnt = 8;' U* [/ V9 Z; y
) F4 `: X1 V$ y- module_param(acnt, int, S_IRUGO);
. Y& N4 M' r* Q: u - module_param(bcnt, int, S_IRUGO);2 x) d5 B' H2 ^" f: c
- module_param(ccnt, int, S_IRUGO);
复制代码 & H* k$ M% @. G3 z, D
3 t) k9 z/ j+ x8 i: e
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( e5 t1 U* L- B A e) Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 ?5 K& S; `9 E& r, Z( L6 C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 _" e- w) P) g9 t9 m
3 g* H4 J. u! N# |3 y! n3 ] P/ F
7 O1 C! l: V& N9 w0 S |
|