|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 i& u" H8 c# z' x8 Y: X- [code]EDMA sample test application9 {/ x2 A, M' B0 T! x" e8 W( }. R
- /*
4 t4 I! @. n8 W' d# M/ D6 _ - * edma_test.c
- X r- V; U0 f- f/ D! N, h - *
: [* M# T3 l$ D0 L$ u - * brief EDMA3 Test Application2 o, I% [% v$ d8 i) H
- *' ]: E0 e( g7 p6 z C, z% ^ n
- * This file contains EDMA3 Test code.* G1 f2 h/ S& c4 Y7 X& ]: x
- *' j3 Y& b2 A( s1 k2 t. J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* y! n7 v; X7 ~0 {% n, X. Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 k; r7 x0 \. f$ O) |$ B- p8 I - * TO CHANGE.6 B5 ?# \1 c0 D) }
- *! x' x1 U, v. `* P/ ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 l/ b5 t$ d9 g) X
- *
6 R( I5 Q2 c+ {/ J9 x; z8 R - * This program is free software; you can redistribute it and/or) i8 `1 P3 G8 n
- * modify it under the terms of the GNU General Public License as1 X( k" D, K) T, M5 Z3 w
- * published by the Free Software Foundation version 2.) J G! \5 x9 \- x/ A; y) D
- *
& {# T9 n& I/ c4 @9 P+ Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" ]! w; M$ S; Y4 N3 c0 x! K+ ] - * kind, whether express or implied; without even the implied warranty5 U! W4 T' v9 i2 F( {* E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: @. V$ b( c) |" ]8 e) q - * GNU General Public License for more details.
O! J: [" E* N- H1 k - */ \" H: A8 D* O1 |6 [
- " \1 U! _3 u2 k1 t# H$ H
- #include <linux/module.h>( x% ^( Z8 a! ~* z% P, _( k; P
- #include <linux/init.h>% c; m( @4 M2 W3 ^5 e. d
- #include <linux/errno.h>
, A5 \, u7 v4 z" x) m: `" s - #include <linux/types.h>) d+ A6 e% \7 z0 \
- #include <linux/interrupt.h>
* p* U+ |, Z7 F4 q - #include <asm/io.h>5 Z3 Y' q- H9 ^% W& U
- #include <linux/moduleparam.h>
6 o& G# s9 {6 R8 X6 p) K - #include <linux/sysctl.h>: ~- o2 U' M( l
- #include <linux/mm.h>4 c8 L4 M$ n9 y. t9 h* y# d" f
- #include <linux/dma-mapping.h>' u$ b# V3 r" f2 h
- 1 ~* u* s1 f( \8 v
- #include <mach/memory.h>( i- B& {: L7 ]
- #include <mach/hardware.h>2 R! e" ^9 l2 B' m+ e. h2 }
- #include <mach/irqs.h>6 X. H% F/ J+ l5 w4 M" p
- #include <asm/hardware/edma.h>1 e' |( J9 h* n4 `
* H. R$ C" X, J w8 S- #undef EDMA3_DEBUG( z- u% g h: n* d8 \% C8 {
- /*#define EDMA3_DEBUG*/& L( Y. X, s) j7 [& S
- ; u0 a' X) H. R4 `
- #ifdef EDMA3_DEBUG
- i8 l: D/ ]# A! c3 p' K+ w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ ]+ w( f* m% I1 S6 D1 V# q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), o6 @+ p; V8 t0 }, Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% N% z0 I! L% y! `$ ]" p: i6 g
- #else7 k. e0 v6 i8 }( l; T
- #define DMA_PRINTK( x... )& O4 \( |3 G/ D
- #define DMA_FN_IN
/ k) k6 ~! L$ K+ W+ I - #define DMA_FN_OUT
& m2 C- e) r! w: X @ - #endif# r& H. N* r5 @) H
- # ]5 L5 D. i6 X' a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# [& b& N( g6 N n
- #define STATIC_SHIFT 3* H$ E( F6 G) I: D: G/ J: v
- #define TCINTEN_SHIFT 20+ M# {% e a) O: D) R
- #define ITCINTEN_SHIFT 21 k0 m+ X8 }4 J& I
- #define TCCHEN_SHIFT 22/ e c& }1 z j' K1 y+ c7 b1 s
- #define ITCCHEN_SHIFT 234 U+ }' t/ @. q8 c
# d; a; X: S$ _/ D# D9 C8 U4 N- static volatile int irqraised1 = 0;; M1 ^4 h4 O/ S D
- static volatile int irqraised2 = 0;
# ]$ g( C9 B& t3 U
% ?! m+ k3 `: x8 F) A4 q# ~; J6 H- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' B% m C& ~" Z8 i1 w! c$ l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ W+ m/ W' l! v& _! O4 y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ Q0 e, M) a% T8 d7 N - ) C g; w3 ]& a. z. y2 v: `5 j
- dma_addr_t dmaphyssrc1 = 0;
8 g$ I0 d" h- q) H% s" ^ - dma_addr_t dmaphyssrc2 = 0;8 G; t. z7 M4 d+ k: H
- dma_addr_t dmaphysdest1 = 0;
$ C' i7 Q4 G, n - dma_addr_t dmaphysdest2 = 0;
/ I$ b& [$ j x$ u - - N; l1 ~5 ?0 R% e7 b" l+ P
- char *dmabufsrc1 = NULL;
+ {, l3 @5 k: @2 B. N1 k" O - char *dmabufsrc2 = NULL;8 X" u3 K5 q6 T% e8 n
- char *dmabufdest1 = NULL;
/ W0 D3 z1 u% X: Z2 ]: X+ f+ N. B - char *dmabufdest2 = NULL;! D v7 w3 A( p" f( B1 B
- I8 m0 n" _0 A8 L- M% O3 X& L
- static int acnt = 512;
& Q. [/ C1 V% n - static int bcnt = 8;! u/ e& o( U; [% I( R
- static int ccnt = 8;& w& S. H) W T+ p L/ D- T; Y& G
- $ U# H' _) z' E2 {
- module_param(acnt, int, S_IRUGO);6 H- h) H& N7 O" H: ]
- module_param(bcnt, int, S_IRUGO);
3 B& X1 d+ h% @) C, u! w - module_param(ccnt, int, S_IRUGO);
复制代码 0 a3 v7 S. |8 W0 a% F; {
% N0 Z# f! }( f: h
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 P( E3 _$ E0 \6 P) l& p8 j f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% |8 ^- r: h( Z! H
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ @# S7 n- y0 l8 n
/ `& L+ P& P# I6 A" E0 L. i" Q
1 [4 E3 {: T5 t! @
|
|