|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* v2 ?) S5 [. h" M! c3 @7 j9 U- [code]EDMA sample test application
. I4 m! F, L6 K& ~( U - /*& H9 S2 V% d. _$ F T- K9 [9 _
- * edma_test.c! G; _( M9 Q. }6 O2 m) s
- ** P) w1 o- ?& l
- * brief EDMA3 Test Application
7 g3 z6 }' W' \3 G - *$ Z. ^6 i: f6 K# }2 O: c5 |+ g) N
- * This file contains EDMA3 Test code.% h0 d+ c3 e' G& H" l/ ~
- *% l+ l! D, K( W, |8 n( P% h N
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 @) _5 t" M! o, @5 f; y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) w' R N$ j3 w# O! H- G. A - * TO CHANGE.
: T! }4 y ?. a4 a - *& |* ~. H6 o1 D5 f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) y2 T7 t8 i& o. V# q: ?* ]$ k$ d - *3 j( } ~. [3 g9 Y
- * This program is free software; you can redistribute it and/or& m0 O$ H4 ]* l3 h8 B
- * modify it under the terms of the GNU General Public License as
. e# u/ q7 p+ j* U1 s; J" ~ - * published by the Free Software Foundation version 2.
8 M( L: ]: r- |; z. I5 p4 s - *( W6 o2 A, Z n7 |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* K% h6 x* e. i# C8 @. \
- * kind, whether express or implied; without even the implied warranty
3 R, C2 A% W4 u; w+ t4 ?9 z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 C5 t5 |, `1 B" ?# o) s- b6 Z
- * GNU General Public License for more details.
" ]* ]1 R& d( C `, G F0 J - */* Y: B5 r! b/ c3 b5 H/ y
. Z6 L9 d( P( j E/ ]6 e3 t- #include <linux/module.h>
9 {$ Y5 s# |$ [1 y0 r6 M5 Y - #include <linux/init.h>
0 ?. F) M9 p' a2 s$ x: P3 ]. ? - #include <linux/errno.h>2 m1 H# c# u$ x- L1 @
- #include <linux/types.h>
% d3 M2 y4 f$ ^& k5 s2 E! h, d5 u - #include <linux/interrupt.h>
) n1 C, L5 v. G7 O: A - #include <asm/io.h>2 ]. M* s& Z4 j3 M8 q
- #include <linux/moduleparam.h>0 @# A1 U3 H( c# s6 l8 a* E
- #include <linux/sysctl.h>
4 n! v" A' I1 y6 q u$ ~ - #include <linux/mm.h>- C( |8 f0 T& E( X
- #include <linux/dma-mapping.h>
G9 b' ?( W* k$ K/ m
: W% f6 o( A( f+ V ~. S. A- #include <mach/memory.h>
3 A' y. @2 n0 b7 n - #include <mach/hardware.h>
( ?" d* {2 E+ L8 V2 t6 Q - #include <mach/irqs.h>* J% ]4 v4 T2 J! G! ], r
- #include <asm/hardware/edma.h>' ~8 e, h* ?3 Q9 T5 v0 K
( D0 V, o4 ~% b1 o# @- #undef EDMA3_DEBUG
" l! l2 J/ ^5 L8 i( d( d1 S - /*#define EDMA3_DEBUG*/
: Q5 H5 o! U* K3 T0 _$ s7 r - % z7 w* k4 g5 P' ~' p* C
- #ifdef EDMA3_DEBUG8 W& l2 _! ?- V& d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& Q7 m1 L: d* \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- O8 @$ t8 p- l$ e+ u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- J+ _+ Y( i; S; c - #else* N3 b9 [3 D' ]; o* ^
- #define DMA_PRINTK( x... )
; i* V% ]% `1 C - #define DMA_FN_IN
3 `) m. [. y r - #define DMA_FN_OUT* {- c$ N3 C8 g5 r
- #endif: ?" _. {6 o; w7 W
- . f! u% ?$ k9 c% g1 |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 w( ?) k1 ?4 L5 }0 T8 b1 s4 i
- #define STATIC_SHIFT 3( y. Y+ _' V0 V$ \5 H2 @* c- ~
- #define TCINTEN_SHIFT 20
% v2 [( E4 G& P( U - #define ITCINTEN_SHIFT 21
4 L U8 m) n* B8 G; K! {: G - #define TCCHEN_SHIFT 22
1 W- F; U' w: R! |1 K. P3 X - #define ITCCHEN_SHIFT 23
, l+ L3 y& c: | a* W. b - : A/ G1 s# p. N7 A2 ]7 K; C
- static volatile int irqraised1 = 0;
" @* m( f3 I% v2 w+ j! \7 m) k5 Z2 L3 }8 C - static volatile int irqraised2 = 0;. n7 t- W3 ]3 w a' E
- ) S0 b, z8 k6 V) k1 e$ G# J. A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ J2 @& J% h }
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 q L* ]6 l c# P
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: ?8 v7 O! N' y% W- b6 _, B
* q8 t. A1 x0 c: l L" ^- dma_addr_t dmaphyssrc1 = 0;3 p. u) E7 q+ W. }; r h
- dma_addr_t dmaphyssrc2 = 0;' ~ I& @* L& \) [
- dma_addr_t dmaphysdest1 = 0;
/ E4 j# j% |! S* t3 G0 J/ Z- z - dma_addr_t dmaphysdest2 = 0;- n. K; c8 _* g9 u
- - Z3 l+ Q, [. |' ?6 }) [
- char *dmabufsrc1 = NULL;
, d0 q# e% j P* {) U7 b - char *dmabufsrc2 = NULL;
6 Q: {' [, }+ a5 ^+ b - char *dmabufdest1 = NULL;3 x6 ?5 L. o% K$ S! a$ J
- char *dmabufdest2 = NULL;$ l' `4 a: T! \) t7 F
- - l4 Y7 \7 v3 T
- static int acnt = 512;! ^- J1 W" x3 N( L5 b/ Y( V/ b
- static int bcnt = 8;
3 L/ K) Q( ~. F( w - static int ccnt = 8;
" y" m. f- G# Z
, `/ b% J/ R4 ^( A& V- module_param(acnt, int, S_IRUGO);
# ?; Q) k' P- D: `0 ^ - module_param(bcnt, int, S_IRUGO);5 G& v1 W4 ?/ e8 d
- module_param(ccnt, int, S_IRUGO);
复制代码 # W, }9 O" q2 @# q4 V, K/ `
/ f5 T9 K. {* B* Y& X+ L; B3 z9 N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. S' V9 i0 c0 l/ ^
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 P0 I0 W- \! ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' d' ^+ Y& n8 I! R
: E! N4 r' f8 q
' n& o3 a0 ~3 }# D |
|