|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( g0 J4 ]2 t& y8 `. y- [code]EDMA sample test application! \! X% Z3 d! _# ]
- /*5 S& P1 M" ^) a
- * edma_test.c% a7 A7 M- z y, C t- q
- *" I2 K+ p- f6 m) F+ M
- * brief EDMA3 Test Application
2 i9 K4 s8 M: y0 M. U4 y - *' j) J7 w- A ^ v
- * This file contains EDMA3 Test code.5 N2 e( P; I# ?9 o: ^9 Z0 g+ v
- *
7 Q& I: R, l% f' f: D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- a; R2 A* ~( A9 V { M6 l6 ] - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- r" F ^3 R/ t. N, d - * TO CHANGE.
% N Q8 G- G- X# e - *
# W* t; W! h% h6 X3 F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! U; y q; S S4 ~8 e; [/ ]% }% j
- *6 l% k# Y" P4 f4 c4 a: c
- * This program is free software; you can redistribute it and/or/ P( n$ C$ [1 ?5 }" d; Z p0 [
- * modify it under the terms of the GNU General Public License as
: Q1 H: t: Q u* k* B( H( c* u; l$ H - * published by the Free Software Foundation version 2.
! G# j( X1 E4 j: h - *
' F/ R! z5 a" `9 Q5 \/ f - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 ]* F% h V3 ?% R. k - * kind, whether express or implied; without even the implied warranty4 {3 l. f$ h1 m& N
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- E0 i# \0 p% o- h6 ^1 z4 b' E - * GNU General Public License for more details.. T& k( H- \+ h# R
- */9 }1 _- W( d( n$ ^- f
9 a" E; J& W. K+ z5 T; r- \9 X- #include <linux/module.h>
5 d7 t, k2 Y4 w/ K( ~ - #include <linux/init.h>
- E# h1 m# ~7 v+ ? W1 k - #include <linux/errno.h>
' q$ D J+ s& n1 d - #include <linux/types.h>
) \. I% N5 |2 `5 m2 [3 M - #include <linux/interrupt.h>* g, u! r3 ^# x: ~
- #include <asm/io.h>
2 N* J: q. L# z6 {" r' F$ f) Y - #include <linux/moduleparam.h>. e6 T# e G' h
- #include <linux/sysctl.h>. J) C, B' {$ o k: ~- D4 G
- #include <linux/mm.h>: e3 o- |8 G. t
- #include <linux/dma-mapping.h>
' [/ s: k! j% f - ! s x p! R3 X8 [: o
- #include <mach/memory.h>
' Y1 r1 n$ F( K* O3 m1 c3 k; Y4 w - #include <mach/hardware.h>
- ^* @& o' q/ V1 X( @ - #include <mach/irqs.h>
6 M, u* Q' w- ]5 _+ y0 Y" e - #include <asm/hardware/edma.h>
6 I$ T2 w0 O4 q9 R5 d y9 c7 O - : t: q0 \/ b, u( v9 u2 d8 S
- #undef EDMA3_DEBUG
$ f- g2 S9 g% o1 Y6 {* M5 I2 M - /*#define EDMA3_DEBUG*/
, M& |: H% {, A( A0 V! \: r* A/ Y4 H - % z( L9 l, V! ]% I5 Z
- #ifdef EDMA3_DEBUG
( M" i0 K9 ]% `. ~ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 ]) o$ T4 R% ~* n; c, ?
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" C0 j+ B$ w5 [7 j - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) {5 e, l/ d; y( g8 G
- #else
8 G( Y0 F7 h# Q# N# K" c' H( |" ^ - #define DMA_PRINTK( x... )( L1 E1 r" l6 @( `& M# H9 K
- #define DMA_FN_IN p* v% h6 X; p3 Q8 w3 U
- #define DMA_FN_OUT
. Z" A/ \1 b/ ^. Z* P - #endif, `) i- A, t6 e6 M0 [
- 3 O- d9 ]6 e* n% h& F( S# C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; U: E& u- J- H/ `, Q9 d - #define STATIC_SHIFT 3( W/ D" K$ U( X+ [9 M8 y
- #define TCINTEN_SHIFT 20: I9 \9 A* b1 i; t. }+ n+ o
- #define ITCINTEN_SHIFT 21( q/ ?7 a0 z& n' Z5 @2 g, Y
- #define TCCHEN_SHIFT 22
& U8 d; {, E4 E" R - #define ITCCHEN_SHIFT 23
+ B3 l: G) ]. S T# s3 e8 f - . G" r( z4 G) k- n* C9 L
- static volatile int irqraised1 = 0;
$ }) ^: Y. r1 x u - static volatile int irqraised2 = 0;
0 h! u7 k# T w - 8 C& w4 ~$ Q, m L! [3 r* {* r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( l9 v8 X3 \/ l! X% S" Q9 v
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: ?4 h# H; ?" u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 l8 G5 f9 v4 R% O- e4 |1 V
- & t$ ]" Z; {- n4 j) J; d( V
- dma_addr_t dmaphyssrc1 = 0;6 H4 p7 ^3 ^; ?7 G1 Z
- dma_addr_t dmaphyssrc2 = 0;! E7 F2 d. I: V
- dma_addr_t dmaphysdest1 = 0;( N6 D; b$ r" Z5 C
- dma_addr_t dmaphysdest2 = 0;
6 `' [6 ]3 |" b' U' i* V r2 F - 6 E, f3 q; u, w. `- C, P% O8 x
- char *dmabufsrc1 = NULL;6 t# {5 A5 ^+ _* F8 i8 _, b. t
- char *dmabufsrc2 = NULL;2 T; M+ b8 ~8 O' @
- char *dmabufdest1 = NULL;
7 U8 n0 c- R; U - char *dmabufdest2 = NULL;
5 }8 a% C" Y6 F# K/ G9 I
+ w2 ~1 o a/ t: J2 l2 m" u# i- static int acnt = 512;( \1 p' q3 r2 o a9 G# n$ }/ V
- static int bcnt = 8;- v& }+ r3 \ G
- static int ccnt = 8; z3 z& T/ z) N( B( B0 S. S
* I! ~* P. C5 ?0 N1 G( J8 M- module_param(acnt, int, S_IRUGO);
8 X! H+ y% X6 |2 \! K - module_param(bcnt, int, S_IRUGO);6 P! u% {: p5 P3 R( @$ L
- module_param(ccnt, int, S_IRUGO);
复制代码 2 R0 B7 U' y& b4 [; x* o, d+ \
6 p( w, n) @% S: a 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 P0 E: N4 A P0 W& 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 }' f7 @8 y( l1 t& ?7 k6 \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ G# S4 }# T( i5 R, N% ~1 k
& m. c8 Q5 l8 a( k6 D& ^8 B4 M/ N
|
|