|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : L$ V1 k* |# E$ G
- [code]EDMA sample test application
/ b. U+ ^2 W( [3 o2 F - /*
: `% }+ R( N1 M! } - * edma_test.c6 i9 I; i" ]& A3 \7 T$ b
- *! v* L, ?3 T; j# s0 T
- * brief EDMA3 Test Application! M7 z) D9 C- c+ w: I
- *3 @8 Y. }! @7 Y5 J! M7 `0 E# V
- * This file contains EDMA3 Test code.
% h0 [' J# y* c+ o. K0 q - *) v; {8 M( ^3 W( D. ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. i5 z' G% }9 n( Y& v4 O
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! N- b2 e& V$ h- H( E6 } - * TO CHANGE.
0 [1 {( W# h4 ? T0 f; ^& q- W - ** w2 P/ q( a) M0 N" Y$ g. z2 u
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" q* F' @$ i$ {" J+ D( L* a r) o5 ?( ^
- *4 g. [" |2 g9 v Q
- * This program is free software; you can redistribute it and/or
& t1 ^; n1 e" n: S% P# y - * modify it under the terms of the GNU General Public License as& C v z; f0 K& u: {
- * published by the Free Software Foundation version 2.
! g( I6 ]/ ~) i$ \5 M - *
1 s% B0 W) ^& P2 E. M3 M# \8 N' p - * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 C, R1 X; J+ J3 e+ \+ Y" J
- * kind, whether express or implied; without even the implied warranty) _4 S' }* a0 S* ^* A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) h$ w" Y5 O9 ?7 f: S# ^ - * GNU General Public License for more details.2 }1 K. B% a4 e( G
- */
8 i8 W! `7 y( Y3 G$ ]6 F7 c - " ]- t- l# @, K- c, V$ e4 S
- #include <linux/module.h>
2 k9 n! c! I+ o3 ^ - #include <linux/init.h>
6 N! x7 z' i6 ] - #include <linux/errno.h>5 I+ } s3 d, |/ t7 J+ P e! [
- #include <linux/types.h>) S& h- x) X! A2 j
- #include <linux/interrupt.h>
0 U. k! k4 V: o% }: ?% j - #include <asm/io.h>' `# H4 ]! d( u
- #include <linux/moduleparam.h>
8 i) ^& p; O$ ?2 | - #include <linux/sysctl.h>
3 p, z$ Y/ g7 Z0 B9 Q - #include <linux/mm.h>+ ?: F: N3 J3 @* a3 \
- #include <linux/dma-mapping.h>- E( P/ C% R! G7 U- g' }; f5 `; Z
- 2 D T* a3 a. L L' ^
- #include <mach/memory.h># i" i3 I% Q* M, ]# _ Q& ?5 ]
- #include <mach/hardware.h>7 d- ^0 R8 _8 H- A5 y8 }0 t
- #include <mach/irqs.h>' z( s7 t) i( W) A
- #include <asm/hardware/edma.h> @) M% R* B6 N. G/ `5 A; b
- _8 y: C T/ t- }- #undef EDMA3_DEBUG8 ~9 v( Q2 n- y, S' u0 ^
- /*#define EDMA3_DEBUG*/0 o6 ]. m9 s: S) q0 C6 c$ ]3 f
6 d8 a( Q: l A* g/ T' U H- #ifdef EDMA3_DEBUG
* J& M% ]' h/ R2 s' F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 g! N. u% M9 q, }+ Z" K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! F& O- j6 S \
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), t: p% v1 J5 X; M
- #else( V2 L6 J9 U( E; l0 g: W2 [
- #define DMA_PRINTK( x... )
) z8 }' w3 P9 n) U( @& M - #define DMA_FN_IN3 v0 l; M7 I: D" z- L' @! G' B
- #define DMA_FN_OUT
) B' A* C! t! I2 t - #endif8 p) F$ n, ~3 P4 s. j) }' I
- : y& H; e% H$ S1 c. F3 E$ E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 O( m8 |: I' D: W: U( n" \
- #define STATIC_SHIFT 3
' E% Q b% o$ ]' ~3 Q - #define TCINTEN_SHIFT 20; U1 U# ?# K$ n0 `
- #define ITCINTEN_SHIFT 211 J, E9 p0 Z, Z. \2 H$ `# i0 M" X
- #define TCCHEN_SHIFT 22( E$ T* L, Q8 F1 [
- #define ITCCHEN_SHIFT 23: g/ V; i9 T) L3 u2 f
; @/ ]$ a7 P# [+ N- l1 f- static volatile int irqraised1 = 0;5 [) o2 ]3 g; V6 H; A/ k( q& \
- static volatile int irqraised2 = 0;. S6 B; }8 ^% H# B `' |
- ' o# u ^. h9 x6 I
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 o" ^! u6 q6 K2 _8 g( W" P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 D$ \4 n9 q' t- j7 Z: X7 `9 H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; I5 {& o8 [4 h
( k. `4 O2 A6 C- dma_addr_t dmaphyssrc1 = 0;
" N$ Y* V5 q9 p' o$ A - dma_addr_t dmaphyssrc2 = 0;
3 }2 j: ~" p1 H8 w: X - dma_addr_t dmaphysdest1 = 0;% ^# W$ h' d3 D& y& @& n
- dma_addr_t dmaphysdest2 = 0;
+ A! c' E0 M* s5 q D0 X+ y) L
- [0 p- o- l* c+ v- char *dmabufsrc1 = NULL;$ e- G; J$ q$ ^' f. v5 Q
- char *dmabufsrc2 = NULL;. I3 C" h$ x4 n4 ]/ g
- char *dmabufdest1 = NULL;
1 G8 ]5 c! `2 i; D3 Y; B - char *dmabufdest2 = NULL;
0 [$ }+ H; x" _+ z1 R6 s" s
6 a* X& a% w9 y- K9 j0 d0 W# }* j. ~. l/ G- static int acnt = 512;. w- P4 r2 O+ |: p2 ?- ]+ ?& ?. x
- static int bcnt = 8;4 t/ N3 u- [( z a+ S7 { o
- static int ccnt = 8;
4 q" x- C2 }7 }/ ?* r - $ P f! Y' P; r1 n! n. S/ z
- module_param(acnt, int, S_IRUGO);
+ B% ~8 u& Y3 B0 V) w8 V! ` - module_param(bcnt, int, S_IRUGO);
; Q6 J/ V! R3 I% t2 Q - module_param(ccnt, int, S_IRUGO);
复制代码
) x g) x) d4 X/ F# j" X
+ L& z2 h2 l' r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& B% |: Q% ], ?+ `4 K. earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; D2 E( f* A7 S6 p3 T$ ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ _& L$ \/ Z' n* N; l
; [8 g. z6 l S$ l7 j$ i6 A8 n
0 X& ]% v/ F2 Y2 j3 W" C- K |
|