|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / V2 z, a, g7 Y* U+ y
- [code]EDMA sample test application* q" l, B1 h, m. u& I" p2 w
- /* t8 j, A' ^; R
- * edma_test.c% F) H% Y; t6 t' \
- *
5 K" z l) R/ b+ ?2 Q - * brief EDMA3 Test Application
+ p1 R% Y( N; ^9 H! T) L1 t+ D - *
7 x8 ]9 {8 s) Q$ u) n+ O* v' s. g - * This file contains EDMA3 Test code.
0 i u. G$ C( n- I - *
" u9 P2 {/ ?$ j' h3 @- } - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ N- ?# V5 s8 i% V7 z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 F; ^) k9 F# F$ _ - * TO CHANGE.8 [8 @: c% v9 ~: V# P+ g8 N
- *( u! F" L. k5 j+ z- y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 q6 u) G3 r2 J - *# P9 _& m% e: m+ [* T
- * This program is free software; you can redistribute it and/or
4 Z; ^/ p- j+ R0 P% i9 [" H - * modify it under the terms of the GNU General Public License as
8 I/ E- d4 X% b1 Z5 t, Z4 t - * published by the Free Software Foundation version 2.
, T5 W9 _' h! c' d1 e/ H8 R - *
( F2 U f: H0 b, _ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. [) @+ f5 C- n/ u* o; e - * kind, whether express or implied; without even the implied warranty
+ L X% K' d6 s% `8 N - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 x8 C; |1 G# t1 w7 K# W b
- * GNU General Public License for more details.
1 t) r- z( a" b( E1 M - */
( m) n$ Z+ l7 }& c8 o3 t
. F2 v3 l( m c2 ^% |7 U9 s- #include <linux/module.h>
2 p4 ]: y0 [; Q; ] - #include <linux/init.h>
- C+ l/ F! s/ u9 I J - #include <linux/errno.h>
3 L4 c1 i( w+ W" ^ - #include <linux/types.h>* t4 g4 o4 k' v! e
- #include <linux/interrupt.h>/ c Z3 r; _ E. K1 V
- #include <asm/io.h>
2 R# P" e; N# B - #include <linux/moduleparam.h>- @# K7 f. F- [, @: N4 a
- #include <linux/sysctl.h>
s- ~. A, z( ]) i9 H- L - #include <linux/mm.h>) w1 B" g* d; a$ i# k
- #include <linux/dma-mapping.h>
1 Q1 Z1 ]& I" o6 n/ }) j
) K; v$ C6 S0 o4 P- #include <mach/memory.h>3 {, w5 c+ I9 c' t
- #include <mach/hardware.h>. F% X1 d; [) q; i
- #include <mach/irqs.h>
6 x, s6 h$ n$ w6 w) S h - #include <asm/hardware/edma.h>6 }( V0 n( v6 O" E
& G5 k9 T$ p9 t" ~" T- #undef EDMA3_DEBUG
# e1 z7 w3 A0 l5 m - /*#define EDMA3_DEBUG*/# p6 Q2 H; u( l' w) A H
6 O& H% H3 w& _, q9 F- #ifdef EDMA3_DEBUG
9 |5 Z' E8 [* _4 m& u# { - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 p8 U# s# t6 Q* a; ]) S7 g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, T3 o' k7 F7 k* w" | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! R1 u4 u$ T- Z6 R! o - #else, b$ i9 _9 L% j6 l: g0 e: `) m* i% u
- #define DMA_PRINTK( x... )7 ^% T0 m0 v, S. R$ K
- #define DMA_FN_IN
: i' }" K7 M7 A2 z1 h% Q - #define DMA_FN_OUT7 n) D+ r2 c' n
- #endif5 Q$ d3 W! p0 m9 R% g; P: r8 l/ |
1 r2 R5 n S" ~+ Z, ~6 S4 B- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 g$ \; D' \ o; ?- d
- #define STATIC_SHIFT 3: a6 I3 n U, h3 [' \' W5 E
- #define TCINTEN_SHIFT 20& d( _+ B4 } @+ ^! {
- #define ITCINTEN_SHIFT 21( w! a5 ]- h V( y
- #define TCCHEN_SHIFT 22
; m1 y" r, X/ ^) A M - #define ITCCHEN_SHIFT 234 X0 R* G$ `0 ] G+ k3 u7 ^
4 K7 b) f5 g* I! ~5 P0 M- static volatile int irqraised1 = 0;
( F, K5 Z* B5 i2 r8 Z - static volatile int irqraised2 = 0;: M2 o; Z& ?) p
8 B( H( q4 I+ x, s. g1 ]6 _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* G$ I1 a% A+ z B( e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" V8 L, V0 ^: c% w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, }/ l" l1 ~% i3 g
- $ A. u- z3 x' D5 n
- dma_addr_t dmaphyssrc1 = 0;( y. l/ k3 y# C- j' \8 [
- dma_addr_t dmaphyssrc2 = 0;
* V6 x D6 X/ ?1 S5 F - dma_addr_t dmaphysdest1 = 0;
" f; W( |& H" C% X' ] - dma_addr_t dmaphysdest2 = 0;9 U5 [2 w# T0 I8 b, N! q% _
- + [4 u% W5 p0 q7 y" {
- char *dmabufsrc1 = NULL;& Q0 `+ U2 r4 n( `( z, A
- char *dmabufsrc2 = NULL;1 x. V' S$ ^( f1 p9 D
- char *dmabufdest1 = NULL;1 Z# Y" ]( `* C1 s# ~' L4 x; o
- char *dmabufdest2 = NULL;
4 _- c' [) D p0 y+ E& K* S% T - 6 q& L& q# l) D( F9 f6 T7 I) M
- static int acnt = 512;* Q2 l1 P$ E. H2 Z
- static int bcnt = 8;
. l5 b7 K3 D0 O - static int ccnt = 8;
: ]7 Y, D6 V2 c' O9 P) i/ _
& w# R' C8 E8 n! [1 k% x& V8 D; K- module_param(acnt, int, S_IRUGO);8 Y- O( u6 [" V. v, }% Y8 g
- module_param(bcnt, int, S_IRUGO);
9 `9 @/ g1 c# j& l! @ - module_param(ccnt, int, S_IRUGO);
复制代码
1 X. V3 ^. v8 m% Z
/ ]7 e, `+ v& P6 }1 A% D5 o3 j _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ \7 `. \# k1 W/ Y. uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 ^2 q' c" A! m/ g6 W, G4 v9 J. Y: J 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ u X! s% m6 p* c+ X# ]
5 `' D5 l) X g8 }1 A: B u
$ b O; | t4 P' R1 r
|
|