|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ o% E: J" {7 n1 ]4 {
- [code]EDMA sample test application# }9 d H, F5 U2 V' P
- /*
, O. _: h, H" H4 g, f, q3 A& } - * edma_test.c
4 G$ X5 u' s% p - *8 E, R, x1 y! S6 d( G- z/ J5 T H- p
- * brief EDMA3 Test Application" v u/ Y) z1 G( K5 {8 S0 c# {
- *0 z9 ^8 [6 Z, F4 b7 J# g
- * This file contains EDMA3 Test code.
2 c; b* ?/ K2 G - *" t5 Q" J* ~" D1 p; Y( f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; |1 q& B: m9 f) n; K" u" u& q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 ~ [' p" s, W. L
- * TO CHANGE.
3 V# W7 B1 a0 x8 a - *; `* i# G7 r% C! ~! l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ t- |/ j8 l8 v2 ?" M% o - *
1 L9 t# {) f& W& c* j- ^ - * This program is free software; you can redistribute it and/or& X) h3 k( g$ ^+ ~: o) b6 O( s' e: b
- * modify it under the terms of the GNU General Public License as
& f6 F3 `! y( k4 j - * published by the Free Software Foundation version 2.
& O1 w- `1 U3 P - *1 T& c1 V0 X- H; c$ c* o; L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; A, @+ X% X: C$ C( m# t& i
- * kind, whether express or implied; without even the implied warranty. N- C) J' ] L$ X4 G
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 j7 w- b/ t2 u) d' b% J: k2 a - * GNU General Public License for more details.
r7 r: A1 g- `2 v* t6 a3 d; z - */0 W, \' H( t$ t! h
- H' |% W4 i( C& a9 b& F. A' _) m" a9 u
- #include <linux/module.h>
" J$ \" F- e. l# ]/ o" D2 L/ Z/ A - #include <linux/init.h>1 R, T3 {! v) N& c. f
- #include <linux/errno.h>
4 y4 d) K$ u% N! J; [ - #include <linux/types.h>
6 D: m# J7 A2 g) c5 \ - #include <linux/interrupt.h>
% K7 j5 ~2 @6 m% N2 Y! v - #include <asm/io.h>
: d9 S( t* ]' [ - #include <linux/moduleparam.h>' U/ w, D4 @ A. s
- #include <linux/sysctl.h>
2 T$ J$ ]0 G- y - #include <linux/mm.h>+ k% H5 o/ M! H) u* o7 U
- #include <linux/dma-mapping.h>
3 \$ V8 N/ k( w6 w, N W - 1 z2 f+ q- M* I, d8 k; k* Z$ g! }
- #include <mach/memory.h>' Q, x5 o- u5 N6 ^* e' q4 `
- #include <mach/hardware.h>
h7 K+ q: m( A( C" _- |2 L# h - #include <mach/irqs.h># ^8 w( w+ a5 N8 L; w
- #include <asm/hardware/edma.h>+ c2 l4 z+ K1 D8 m& N- E
1 J2 H- a. r+ M( `* m5 |4 d @- #undef EDMA3_DEBUG- A! s, A R8 o1 n
- /*#define EDMA3_DEBUG*/" y4 p2 ~ r& v' H! ?+ f
- $ m* Y: ]* v6 P/ S- n1 l0 _
- #ifdef EDMA3_DEBUG
% k" F& k7 X9 G) W - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' s3 h o+ |5 Z+ T1 o5 n7 a
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 @3 a1 ~- [- r/ q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 o D4 M: n k' k' O
- #else; R- D& k7 u' U* n$ y
- #define DMA_PRINTK( x... )
) D1 |1 U0 K( _" J W9 {; y: u - #define DMA_FN_IN' v' y% u/ y4 ~$ t) s- |! R) q8 K1 y
- #define DMA_FN_OUT
" k8 ?5 j+ [( s - #endif
7 G0 i! E# L7 k3 w! B% U/ J, K
; H' E- ^% J( r( ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% D$ J5 e8 m# o7 r4 M5 x
- #define STATIC_SHIFT 3
+ H8 P5 E; ~8 A0 Y - #define TCINTEN_SHIFT 20
8 `' F/ Y H9 I! p - #define ITCINTEN_SHIFT 21
% v9 e. L! q1 E9 P! T - #define TCCHEN_SHIFT 22
0 ^! v. E& }- F3 o1 d - #define ITCCHEN_SHIFT 23
2 _( \# G3 h x% w8 s" h
3 I' t A, m# l- [5 ~- static volatile int irqraised1 = 0;% N6 C- }4 ~! f: c4 Y' r) T
- static volatile int irqraised2 = 0;/ V% d0 \. q& S @
8 a1 X4 B. U0 {$ m- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 N! h% G* k p2 Z! r, e5 ? - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 c0 w5 [5 E, F4 U5 T
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( I4 N* t; J# p - + K# Z& K R5 r! G
- dma_addr_t dmaphyssrc1 = 0;3 I/ S+ M) Z! }
- dma_addr_t dmaphyssrc2 = 0;/ A- o( j4 u r- N
- dma_addr_t dmaphysdest1 = 0;% Z- Z1 {. A3 ^# p
- dma_addr_t dmaphysdest2 = 0;
4 e: ?' `) A7 B - & F8 w+ ]9 `" o& K0 I
- char *dmabufsrc1 = NULL;) g) J# e% @8 | r
- char *dmabufsrc2 = NULL;
. e- r8 b+ ^: t5 g8 M( k - char *dmabufdest1 = NULL;
) ? C0 F |* p - char *dmabufdest2 = NULL;
" Q! z2 }3 [4 N' A u5 t% [9 a
/ ^ m* j: C! r; P3 `- static int acnt = 512;4 c# c' g- T& @" \) o5 f# u
- static int bcnt = 8;6 \% d9 Q$ E2 ~* [
- static int ccnt = 8;
. ~6 k( B( n4 v8 s# {8 s) T6 V - $ i! P+ a# F: Y- _) T+ t
- module_param(acnt, int, S_IRUGO);
" I- Y! C3 ]6 u0 G. o - module_param(bcnt, int, S_IRUGO);
[6 I- j- X- K8 U; P - module_param(ccnt, int, S_IRUGO);
复制代码
; T& d4 @* R' W q: R3 \9 v/ Z& N( c$ @7 M2 U9 u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 V* k' K( B0 G0 k9 harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! i! l8 f2 _8 O0 c9 n" N& o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ g5 I* ~, F2 O& S" i8 w% _/ V" N) E$ Q
3 ~0 @9 m% Y9 o( _7 j& k( Z o |
|