|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 ]5 i1 k, t c+ ]. \+ R& z
- [code]EDMA sample test application, h1 l, q4 b* \; N% H; c
- /*
# @3 p8 f( q3 R0 ?0 x - * edma_test.c0 ^7 }1 @$ P; o9 a
- *
% r' i* d2 x1 r - * brief EDMA3 Test Application
$ U& c& }% Q3 e0 \5 o! U4 x5 d1 o - *
/ ~' }0 e# u$ I - * This file contains EDMA3 Test code.+ W4 m8 n. f9 i G9 C( W3 e3 v8 I
- *- @- J( z; {! V0 I2 c R2 w3 O, Q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 H' I6 P, V& C1 G& j& [0 n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" R/ \/ e; |' L7 K - * TO CHANGE.
8 [, Z7 \( f7 j7 Z% C; `9 b% s - *. V1 F. r3 I3 C0 T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( v) x/ `6 |* c. l - *. r: C( h8 t8 [" F9 N
- * This program is free software; you can redistribute it and/or
4 e$ f" k8 U, a' r: [1 l. c - * modify it under the terms of the GNU General Public License as) l7 p" J4 }' y1 W' W# L( F
- * published by the Free Software Foundation version 2.
" E8 S% T7 l* w3 l. }0 F - *
% g0 J7 E7 l2 l. o' n1 Q) f3 l - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, O7 \4 v+ P0 w4 R
- * kind, whether express or implied; without even the implied warranty
; a1 `( z; c$ N) B7 z" o - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 ~" t2 J. q6 p0 s1 M o - * GNU General Public License for more details.
7 L& i% J* V; j7 O) C' j! w - */" P- D6 P: v* L
9 D- i+ M7 }# r( @3 `$ o- #include <linux/module.h>; W6 C; I& f$ r3 ^
- #include <linux/init.h>
, f0 R% O# u& s% o+ u - #include <linux/errno.h>5 Z \3 H Z/ b+ m/ N1 @
- #include <linux/types.h>
|) L6 `; X+ \. V* _4 M; d - #include <linux/interrupt.h>+ K/ q! O# D! W3 v( ]
- #include <asm/io.h>7 s& r" p; ? O, N) ?/ `
- #include <linux/moduleparam.h>
: Z$ n0 {7 q, O- y' ]4 \ - #include <linux/sysctl.h>
7 [4 l) h$ a* w& `$ q# v. @ - #include <linux/mm.h>3 j) F7 z6 c0 m3 I: ~8 b
- #include <linux/dma-mapping.h>
+ Z! r; w- `8 ?7 M5 x9 B
4 c1 j, M; n+ _& z- #include <mach/memory.h>
/ g# W% @" X+ O$ C7 ~0 U - #include <mach/hardware.h>& H) ]0 i) o$ ^0 g- z6 P
- #include <mach/irqs.h>
0 ]3 q8 B4 ]! m - #include <asm/hardware/edma.h>. Z$ m( x4 z! u, k! v9 Y# ^8 I
( F7 k5 v+ a# q7 u# ?8 q- #undef EDMA3_DEBUG
+ d6 }7 V# Z2 B5 g: n# j - /*#define EDMA3_DEBUG*/' q" p- c; M% c9 `
1 R0 ~+ T6 Z' r( y: d; _, h% \- #ifdef EDMA3_DEBUG
, K' w# v' r' @ p( b8 P# h9 |) ]; M - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, u# r. h5 n" i# C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 N/ q+ w9 F( o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* @) w1 @6 I) I
- #else
X" `2 ?9 Q, m - #define DMA_PRINTK( x... )' y5 C4 e. C$ i+ x% [6 [2 q- g1 K
- #define DMA_FN_IN
3 a* E9 L$ Q: c) m - #define DMA_FN_OUT* J6 z" m' _ R0 v
- #endif
' ]& |0 j8 X; z0 n" p% Y
( w9 d9 p: q8 I; H0 ^1 D% M- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 w$ \( s x- D/ t: |& c2 F - #define STATIC_SHIFT 3 J C M0 v9 r7 l( g, P1 D
- #define TCINTEN_SHIFT 20
9 I9 F3 A8 m# S# J - #define ITCINTEN_SHIFT 21: c% e- f$ }' v( Q$ q. L
- #define TCCHEN_SHIFT 229 M6 _/ J0 X" k1 i$ k, K( N; W
- #define ITCCHEN_SHIFT 23
4 }0 x0 x( l5 T( w - " d% S' U8 H+ y2 r. k) h
- static volatile int irqraised1 = 0;
7 y K* W) b* _ X' a* \8 G7 _" u - static volatile int irqraised2 = 0;8 U. r; t7 t$ A# N" S: c( Z
- 3 d3 g& h# U3 G5 Y/ u
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! _7 q# ]) R0 X0 t2 E9 I) k. n - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 R/ l# E- t+ L8 Y. H# L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 F4 J* y/ ^) k
6 X( U6 c/ [0 p/ \- dma_addr_t dmaphyssrc1 = 0;
! w4 v' Z3 ~2 X! J; U+ t1 H - dma_addr_t dmaphyssrc2 = 0;6 U: T1 A( X9 Q; \! r
- dma_addr_t dmaphysdest1 = 0;7 u6 |" H/ _; [. `$ ~8 v1 D
- dma_addr_t dmaphysdest2 = 0;
# w% D/ b% q, ^% t' j' }
2 A& Z0 ~; K3 u- ^2 A- char *dmabufsrc1 = NULL;
( W5 @ }6 M+ s: P5 b0 z - char *dmabufsrc2 = NULL;
! o( s# q7 P+ B- U w2 `3 \) t - char *dmabufdest1 = NULL;' K9 [$ Y C* E7 N* M9 P& p
- char *dmabufdest2 = NULL;
% C- o# `) G$ ^, z" j
1 ]# }) l" a9 {3 C$ a" ^& T, G- static int acnt = 512;& O5 g, S; n* |7 N1 }# W: R D7 B b
- static int bcnt = 8;
1 B* C; X! G- Y; d0 l - static int ccnt = 8;
4 G' {; b+ I( ?$ }& [ - 0 x! R, m) i: |
- module_param(acnt, int, S_IRUGO);; m# e. n7 U+ i Q) r
- module_param(bcnt, int, S_IRUGO);# @* ]0 m) P/ u& S0 a
- module_param(ccnt, int, S_IRUGO);
复制代码 1 N* M- |) A; s
9 D1 c- l7 F3 `' P) Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& \4 J) ?- r8 n" M4 tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ X6 Q4 q; z; T8 e8 k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, O# ?* d$ u/ I0 Z8 `
. k' |" V* n. ?+ r
- c2 p$ H: l; i8 w" Y |
|