|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - ?2 s# I4 Y, O0 z4 E7 a
- [code]EDMA sample test application. g: k7 M( G0 v( Q0 B
- /*
% R9 c' h0 `, Q" K; M* a - * edma_test.c
8 u; K$ x, k2 o5 a4 C - *% _8 q4 z6 P- p5 q2 n0 t% j
- * brief EDMA3 Test Application3 C( ]% H( k( N6 i& u4 H
- *
( {, Q# [9 q5 Y% G! b U9 m4 f# l+ K - * This file contains EDMA3 Test code.
* A% B9 f7 L% Y+ V; h2 \4 N9 D - *& z7 O% E; ^2 h2 D: Y% Y' F6 H( I ^' B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 @7 d2 H; K" x$ ? - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& W: ]% L3 ~' _' Y - * TO CHANGE.
3 ?/ ]6 u, Y; X - *
7 Y8 U/ [# j0 z0 o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) b7 k* }' m0 y2 O+ f1 A2 ` - * b& e3 B$ V) J4 u
- * This program is free software; you can redistribute it and/or
9 ^0 p8 F1 I! e `! \3 e( l' }2 v - * modify it under the terms of the GNU General Public License as
% s; y9 G; A' O: ~1 W$ d - * published by the Free Software Foundation version 2.! z; y( t( j8 p5 k1 `3 x5 f7 h
- *8 f% g1 w2 [* y- Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ i+ v4 S* f) O! `/ G, u( D
- * kind, whether express or implied; without even the implied warranty
+ U% x# m, ~! P5 B, ~2 y' ?# Z) c6 u - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& z7 @6 _6 X2 D2 _7 s9 p1 y) S
- * GNU General Public License for more details.8 W2 h5 t0 }4 U. Z4 v/ S
- */
\" k" S9 i0 m2 v1 \1 Z* P
& w$ Z& ]' H# r) x' ^# I6 g- #include <linux/module.h>
/ s! }5 J6 [3 n( } - #include <linux/init.h>
! L8 P* t6 d# T9 m3 V - #include <linux/errno.h>
2 l/ g2 Z$ [, J+ ?3 E - #include <linux/types.h>
1 @% R( O9 f) W - #include <linux/interrupt.h>
0 p' X& o$ {$ n' R1 j) d6 B - #include <asm/io.h>
$ w3 j/ A( P- b2 h - #include <linux/moduleparam.h>- s4 ~- k: }/ m H- K" U- a
- #include <linux/sysctl.h>
' {1 N9 x) k7 g* D* i - #include <linux/mm.h>
2 ~1 |1 o; c3 m9 q9 P( k* H2 d# x0 k - #include <linux/dma-mapping.h>) a& {# u0 C" X" N2 ^5 B
4 N5 u; r/ X" Y$ S7 x4 o8 I( g2 i- #include <mach/memory.h>
! ]) c) l6 I0 i& u- ?5 R" d - #include <mach/hardware.h>1 D, {2 Q1 k+ E9 L) N
- #include <mach/irqs.h>
! R* g3 T$ E$ T5 f - #include <asm/hardware/edma.h>3 B, ]0 j( e) x; m& M* w
5 Z. H9 V- x" [5 X- #undef EDMA3_DEBUG
$ `8 s: P3 S7 P; }2 w6 N - /*#define EDMA3_DEBUG*/
+ o% h9 w$ M5 i! C5 @0 j - ( y0 c' G: J: p1 c
- #ifdef EDMA3_DEBUG
9 Y9 @+ v! D8 { - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" d/ Y: d/ V# B6 N - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& l$ B9 Q9 j5 p j6 s ^
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) D9 ~/ t5 f/ ^/ @1 J9 o
- #else. \2 Y9 E, O, m9 u b
- #define DMA_PRINTK( x... )
5 X5 _1 q- C$ e - #define DMA_FN_IN
) q r) j* D4 _3 @0 T- k1 x - #define DMA_FN_OUT
6 R% l% R! C. [ - #endif
% w# c, t% C$ T* F, W R% O: ~
5 H& p' G. l; ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( R k8 A4 K, J9 F( p- e3 m! O9 ?
- #define STATIC_SHIFT 30 k0 `4 W5 N; ?. F2 h" Y
- #define TCINTEN_SHIFT 20) Z' F! W/ N9 r) k
- #define ITCINTEN_SHIFT 21# C/ \/ Y$ c, e$ F9 z7 @. Y( c- ?
- #define TCCHEN_SHIFT 22# I E$ w7 _# x( r
- #define ITCCHEN_SHIFT 23/ o% @6 \/ {. X+ j
- , N( N* M0 w) G' ]: u- e- |: `" b, Y
- static volatile int irqraised1 = 0;* \4 C$ h! {# |. |2 g3 J
- static volatile int irqraised2 = 0;) y7 Q1 [% Q" z, v& X" ^
- A+ ^; A8 n4 W4 t# E, m& f+ K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 g& f8 N# M/ `, C" d8 B - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& e2 V( {$ f1 p/ A) U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% ~6 Z. T+ B8 D0 u - 1 s4 l: E* M4 z; K U0 z; i
- dma_addr_t dmaphyssrc1 = 0;) W$ k7 b9 d/ L% }- O, z; ^* X4 r
- dma_addr_t dmaphyssrc2 = 0;
& t% Z/ |' v7 g3 d' I |* {7 |/ S9 f" i - dma_addr_t dmaphysdest1 = 0;
6 ?" y( ~6 t4 q1 g2 z - dma_addr_t dmaphysdest2 = 0;
! O+ ]) q% `. z3 h: h - 7 D' ?$ q3 m' o0 M# o; v) e& ^
- char *dmabufsrc1 = NULL;
0 j) ]+ X/ f9 V! G. M$ e [ - char *dmabufsrc2 = NULL;0 c4 R! {( F# j; f/ C* l8 a
- char *dmabufdest1 = NULL;
, t4 \* E/ z3 ? - char *dmabufdest2 = NULL;1 ^* X+ l' y& T4 X. a# b% L' c' B
" o3 [& A) b2 Q' g' F7 m) A1 w- static int acnt = 512;
7 T% ^4 r/ w- c; C X- j - static int bcnt = 8;1 a/ \! n6 p( q4 L/ g( A
- static int ccnt = 8;0 a5 f4 Q+ f7 D; z% N
- " i5 S! v k& A8 b. [. g4 }/ i
- module_param(acnt, int, S_IRUGO);
- `( F. w. K9 \3 p& I - module_param(bcnt, int, S_IRUGO);
& f- G6 H5 C& q6 m/ W6 H - module_param(ccnt, int, S_IRUGO);
复制代码 5 i4 o2 z1 Q/ \
- x6 O- }6 K( E4 H& | 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; t6 v! H& l2 K& ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! e: D( V0 j( M/ i0 |3 |! p
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' j! o3 i5 {1 q- f1 _! V! f1 H# b* _$ Q2 C
6 f; q6 G& V' \/ H8 R3 V) K0 V |
|