|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ z6 b6 G* A) l- ~- [code]EDMA sample test application7 h5 t. D& q6 u2 L, m% J
- /*+ r# _' i; W/ Q0 b6 W2 v f4 I
- * edma_test.c7 F: q: [7 P% c5 X2 c
- *
+ t$ C! n) c8 i; v: I6 Q - * brief EDMA3 Test Application
! _% U$ \5 h/ m& K' U g1 ?2 O- O4 v - *
# l9 x5 V' [+ v - * This file contains EDMA3 Test code.0 b& P( _. d0 p* e7 F
- *
) ~! w9 I' y' x* k7 W9 V+ T - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ ^1 ^6 B3 k) s( S/ P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' g9 |! w6 u$ Y4 H; C) ^9 R, R% ~
- * TO CHANGE.
- {' b/ T# `! ^/ W: ~/ g - *: i* H: X. i+ _, t. |$ }* T8 C
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 F8 c8 Y" t$ g3 s
- *
, q& w( {* W" z8 B7 i z d$ A - * This program is free software; you can redistribute it and/or: E9 F' I2 v$ C% V. j$ P7 z
- * modify it under the terms of the GNU General Public License as
% R; P& |5 X- K; Q) w8 X - * published by the Free Software Foundation version 2.
4 {* B8 B1 W2 c. B1 @% ^7 b3 [) Y" O - */ O/ @& H) K# U0 ?+ a& T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 x4 @+ ~ u; ^* c - * kind, whether express or implied; without even the implied warranty9 L% i& [7 ?' m# F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 M) c, V4 y8 a - * GNU General Public License for more details.+ m: l4 w0 P, D9 z& L, E4 i
- */) @& `8 X7 ] e" f A
! [/ ^) q4 |) G; \5 Q( M7 P- #include <linux/module.h>0 Y) a; N A) S: r' e
- #include <linux/init.h>( c5 V; G9 o6 }2 E1 R9 f. ~, @
- #include <linux/errno.h>/ f7 }% D! H- k& p: m- H- e
- #include <linux/types.h>
) `8 F6 G3 f% A$ ~/ l& l+ D, g - #include <linux/interrupt.h>' w6 a4 f W( }
- #include <asm/io.h>( C4 J( B \7 \: {* b9 B. ^, e
- #include <linux/moduleparam.h>' V3 f- [- @) ]; d V1 n# \9 y
- #include <linux/sysctl.h>) H8 R2 o8 k, h" `
- #include <linux/mm.h>' _- w. U" @6 o# u! D- J
- #include <linux/dma-mapping.h>
; c) C: p( U+ J' y
+ j b* z3 Z0 C$ o% q- #include <mach/memory.h>
# {- B' I2 K0 F# o3 J+ | - #include <mach/hardware.h>
( l) D l9 B% S3 H5 C - #include <mach/irqs.h>$ I; C f! z" l1 `
- #include <asm/hardware/edma.h>. P/ ^( ^; D- @% ~! _& t; o
2 b( O5 f& ~& s8 E8 r6 B3 g- #undef EDMA3_DEBUG9 F# u5 ?1 S! Y, f$ Q. q
- /*#define EDMA3_DEBUG*/9 D+ Y l3 i0 |& A
- : H; W0 X) _* ?2 a7 G
- #ifdef EDMA3_DEBUG3 Z; R5 N6 g0 Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 }& \0 ?7 M- [* ]+ F3 _- H: L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). g% n5 J+ g w9 }& B. i8 ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ G8 k ^ m ?- N5 l
- #else- r6 o9 c h, G* J
- #define DMA_PRINTK( x... )
1 z9 C( B# @ \' s: [" w$ n - #define DMA_FN_IN+ h( q l/ t$ z3 }, E; U* ^
- #define DMA_FN_OUT* b0 b; u, {3 q1 `; D
- #endif
5 n* L5 W" g& q5 g
. }0 F2 }" U+ z* m# n" B0 @6 V- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* z7 z' A, \1 l; F3 }9 W) Q - #define STATIC_SHIFT 3
. y- r5 q1 E4 ^# B) K, n - #define TCINTEN_SHIFT 209 h& Y. T. [ {' W4 u# L S
- #define ITCINTEN_SHIFT 21
* t% t8 V6 s% _) H2 h4 b" H g - #define TCCHEN_SHIFT 22
! f9 u* M4 c/ G0 U+ k' L - #define ITCCHEN_SHIFT 236 P7 _+ Y/ q9 n
" @; z( c& F4 B; p2 _- static volatile int irqraised1 = 0;3 i# g$ K! @! f. k1 i
- static volatile int irqraised2 = 0;& _% k" q: q1 Z" k3 ~' z
; |& N8 N0 A" D+ |# A- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 F* I' _6 v& q, M; M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% n8 l6 q4 D7 S$ A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* }) d, E( w) J, u- }
) ]+ j( ^* p$ A# ^0 D- dma_addr_t dmaphyssrc1 = 0;# `. M J' ^) Q2 r. B# S
- dma_addr_t dmaphyssrc2 = 0;& D5 b" X5 X: u1 O9 V- r9 Y
- dma_addr_t dmaphysdest1 = 0;3 _' r5 n1 b6 C6 h9 |, g
- dma_addr_t dmaphysdest2 = 0;
6 D& n# d& S# ]& G. t. z1 Z - & } x/ F r' u$ k1 `1 j
- char *dmabufsrc1 = NULL;! l) B$ u, |# O6 F
- char *dmabufsrc2 = NULL; X+ D# g5 X' Z, Z; }
- char *dmabufdest1 = NULL;+ j7 M! g0 g h% h; `' E, B
- char *dmabufdest2 = NULL;/ E# k. `* V8 u
- ' z) \+ u/ _# T1 Y) U/ X7 m
- static int acnt = 512;
0 ~: ?1 N$ p3 _- H - static int bcnt = 8;, |2 p) G2 d' V! q6 c
- static int ccnt = 8;
8 v! v" ~& A, j9 u# D - $ D) Y4 w/ C. Q" B& W2 L
- module_param(acnt, int, S_IRUGO);
3 O0 X! X) b9 E# U& S- k - module_param(bcnt, int, S_IRUGO);
2 s' Y S9 V0 T H - module_param(ccnt, int, S_IRUGO);
复制代码 ; n# o8 A5 n( b
! l Y$ `# i/ |- w! q. g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& t0 ^' {7 W* h# L6 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ z! ?& O+ o2 ^7 V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" b; \/ q E. s5 \1 N# K$ A( @6 h5 l% ?- \
* u' l3 O% O# \. x |
|