|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( v' C1 _ R( s; _6 n5 Q; p4 n
- [code]EDMA sample test application
' T2 R5 k9 r% n8 ]6 W - /*
/ y; W+ q; y% R" e' d* V - * edma_test.c+ B7 G! B: F+ B3 }+ b
- *4 V3 C9 F+ G$ v& D& U$ i) \, I
- * brief EDMA3 Test Application
" C' V+ W( |4 l- g! z - *
/ V* C. k! k* I% L - * This file contains EDMA3 Test code.6 D1 G2 f7 n3 a1 r; j
- */ N" P, S! O9 I# X) x
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' n+ q8 [3 U' q: c. v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* K( ]3 `& e. ]6 H
- * TO CHANGE.7 B6 a1 o" [/ W/ X0 `
- *8 u4 `. t, T* _" o1 z& d4 z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 p' d& b4 l2 C0 l" t: d) ] - *. l( Q4 a* }, c. v- w7 t
- * This program is free software; you can redistribute it and/or
% p2 C. d$ k7 a! C: ~! O# F - * modify it under the terms of the GNU General Public License as6 U1 G) n3 [9 I) b
- * published by the Free Software Foundation version 2.; p. U/ ^7 L. e
- *1 L; l% ~( w; [* i* d" k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. l v- Z9 P2 B+ a
- * kind, whether express or implied; without even the implied warranty. K; V2 y! l/ }+ Q& V+ Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 p! U: S% C# n" M' D
- * GNU General Public License for more details.( R. P5 m1 D/ p
- */
/ A/ Y- s2 T, x - / y3 _9 Y( J& `2 U; [
- #include <linux/module.h> t4 i7 B, W4 D7 B5 N, l, I- p
- #include <linux/init.h>
/ K- j) n% t( E! J8 m0 i2 x' W Y - #include <linux/errno.h>6 j9 c, _- J/ l, G/ b; y! ~+ X
- #include <linux/types.h>! p' j. j0 w; }8 ^2 s2 p
- #include <linux/interrupt.h>, e& W' B: ?. E% B5 J
- #include <asm/io.h>
2 y' @. \4 Y6 d o - #include <linux/moduleparam.h>
6 @$ L8 L7 A) q+ |" \7 L3 s - #include <linux/sysctl.h>& Q# ^+ B4 l) [2 f5 Z, c
- #include <linux/mm.h>
! C$ B2 u3 H4 }% E9 P8 f- Q - #include <linux/dma-mapping.h>
) ?: A# \8 o. g/ T! u; c0 J4 k
& S1 s7 ^* g {& k- #include <mach/memory.h>
0 r" o1 q, B/ U- k - #include <mach/hardware.h>
5 g5 s* M7 ~: ^9 S$ a- k! F+ W - #include <mach/irqs.h>
' ]6 s# e6 O- A7 r8 }$ X - #include <asm/hardware/edma.h>6 F: q/ \5 K* @' b5 ]4 {% Q6 g9 r
5 M8 u- [6 m7 ^: u9 X3 t u- #undef EDMA3_DEBUG
5 E- p0 g1 e6 x' W6 \) p" j9 w - /*#define EDMA3_DEBUG*/
; D1 G: x* e, E2 c% K; R0 P - / T \" ?& l+ K/ g6 p
- #ifdef EDMA3_DEBUG- D) D! A9 K; P8 S+ S) @% V
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& S1 b T$ f2 u1 g& u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
P0 ?+ o" m! `4 V - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 u! Y" I) Z) w# s - #else) R4 e' i9 T5 m0 E; c) o
- #define DMA_PRINTK( x... )1 [, n* Y( e- X! _" V: ?
- #define DMA_FN_IN
' I. \) \0 v- w9 s& N/ s - #define DMA_FN_OUT' o$ |) m9 A' o! i# _$ D
- #endif, i- a) w# D* ` A2 H
- % F, R' z4 k% W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( B& a& m+ X3 S5 T/ t - #define STATIC_SHIFT 3 c0 [% P# H2 C7 l8 P! l
- #define TCINTEN_SHIFT 20( I$ P. f- c9 e$ p" P5 Z
- #define ITCINTEN_SHIFT 21
! f, z, C; B/ i/ l$ x, I - #define TCCHEN_SHIFT 22
+ g5 Z0 H- Y% ^0 U - #define ITCCHEN_SHIFT 23' `- Y) `) u% u- a
+ \" T x2 X! D# q% R- static volatile int irqraised1 = 0;
5 t: }2 T4 J; |1 }0 U - static volatile int irqraised2 = 0;
u8 n" n. y& M( u& s0 a0 h - 2 V0 e9 D: I s3 d7 y2 C; V3 B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' |: q- r, e. L$ D; e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 Q8 J+ e) `; [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- [8 W2 B! Y! b( U! i# S0 q
5 c4 V* Y! K2 N$ N. R4 n+ Q- dma_addr_t dmaphyssrc1 = 0;
, W$ F+ b! c/ I3 i5 I+ ? - dma_addr_t dmaphyssrc2 = 0;
$ l6 ~, n% D* Y6 q- ^ - dma_addr_t dmaphysdest1 = 0;% i4 C% E: M0 l* [4 K
- dma_addr_t dmaphysdest2 = 0;7 G9 y/ ^1 z1 W! H% ^9 V+ x, G
- i3 R' N$ {5 W! O' Q, C( ]- char *dmabufsrc1 = NULL;
# V2 B- p) s) l1 D: H" o& Z3 Z - char *dmabufsrc2 = NULL;
4 S9 Z \+ j$ H& u) D% ^: a" A. \ - char *dmabufdest1 = NULL;
' E5 \! r B" A - char *dmabufdest2 = NULL;: B- X5 i+ R0 [0 x
- : [/ i0 T) D1 `/ i2 S) u( S
- static int acnt = 512;) `8 b. H8 O8 h! m
- static int bcnt = 8;
( b2 ?- }0 ^/ z' B/ y - static int ccnt = 8;
% }' ?8 x8 B/ G) Q' u7 x3 `/ Q - , @/ d( v; K! |, x6 A
- module_param(acnt, int, S_IRUGO);
5 `( ]; e! x, N" e - module_param(bcnt, int, S_IRUGO);4 b1 d n5 n& m
- module_param(ccnt, int, S_IRUGO);
复制代码 ' N+ `/ I& K! v. Y! @- }) V7 i6 Q
( ^3 V% z7 n( E+ U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% t& j# m# n. Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. b( G1 z0 E. `8 x/ p' u
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 N& m7 K5 q( C3 y
" _- V$ [1 b5 h! i$ E# a' f: f, Y
6 _; S' a, R/ {: Z# A |
|