|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' x" A& b0 O( _8 u* x) }: z" O A
- [code]EDMA sample test application
5 V; W7 o6 {' x i+ Y' O7 M* _3 d - /*
* R5 i& q% ~% ^3 s7 { - * edma_test.c
% C2 b+ y* B' d1 E - *
3 n; d& M$ _+ Z* c% _ - * brief EDMA3 Test Application
0 \! h' P$ h9 ~+ o4 k4 L - ** q9 ?$ S, W2 C
- * This file contains EDMA3 Test code.* l( l4 t% z/ R* ]
- * ]: A& ~" A) N! V$ w2 |6 q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: ?0 p5 g! ~( `* V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: W1 o, \# w X* |. M0 X% `7 z
- * TO CHANGE.* u1 F( j: A6 m5 N
- *' l0 C7 _" B3 g' ~
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: @9 ?6 b6 c; j, x
- */ p( a! ~. G( F* G2 b2 }+ B' B% w- M
- * This program is free software; you can redistribute it and/or! K* S+ R3 H( O
- * modify it under the terms of the GNU General Public License as! |1 L4 n0 ?9 m( W& e
- * published by the Free Software Foundation version 2.
$ H) N) J+ i- O1 T( n; R# x - *2 w& q/ d% i* Q) p, p' f& B+ `; `# b
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any# i# j# T9 X! |' r! r$ O- n
- * kind, whether express or implied; without even the implied warranty
4 y* O' Q. r9 k$ S' Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 {1 W; B) q* f - * GNU General Public License for more details.. h& n" Q6 Y! x+ H8 O8 G
- */
6 T" o: b) V! H0 T5 k - % w0 a3 k! R. L- W/ _& t
- #include <linux/module.h>
7 L3 \: s( k4 p B - #include <linux/init.h>8 t8 F9 L. r; b! u( n0 Z0 b+ h2 f, N
- #include <linux/errno.h>* e" J U9 i/ _, J+ |- y3 L$ p
- #include <linux/types.h>
1 l, M; ]: L) E; L. X( j( V - #include <linux/interrupt.h>
. p# J: z* G7 h7 p - #include <asm/io.h>
. a, f, B6 F1 d j: p6 q; [; F - #include <linux/moduleparam.h>
0 D& t4 I' ?& Z! m" L8 n - #include <linux/sysctl.h>/ Q5 o' a% B6 |( a# ~8 M3 W3 L( V1 Z
- #include <linux/mm.h>1 U9 j5 a' w9 V5 K2 o( w- G
- #include <linux/dma-mapping.h>% @: v( L$ g" e$ c0 i9 R
( R; ]5 G( o! k7 G- #include <mach/memory.h>
. z6 c3 V e/ M6 G - #include <mach/hardware.h>9 j' H# }$ Z R2 z+ S
- #include <mach/irqs.h>5 n2 F2 y+ S& H" N. O6 h# @
- #include <asm/hardware/edma.h>2 |: T' [, B K/ Y3 }$ {8 `, {, W# L
- " s7 Y) L1 f, ^. Q) u
- #undef EDMA3_DEBUG( v6 _5 k$ Y& @9 m% D
- /*#define EDMA3_DEBUG*/
1 @9 A; Q' _( Y - $ V% _6 \( `# n! U, r2 U; o1 }
- #ifdef EDMA3_DEBUG
: W# Z; g# a# `: H5 c; t - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: N9 N2 }3 f+ j3 A - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- l1 M# k4 V+ m r- L* U! R - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), N. j9 B% e4 \4 \4 P; K
- #else5 D* M) G% q/ H M4 C* J/ J
- #define DMA_PRINTK( x... )
5 o" v6 r% S# z( K' ^ - #define DMA_FN_IN
7 B8 |: C+ Q5 \# r1 w - #define DMA_FN_OUT: V% u( h1 c; b/ b
- #endif+ F& y! E9 \( g% X' p
7 R* W6 v0 ?/ y& a4 U! M8 D- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, ]# V3 G* A: P6 |6 Q" ~ - #define STATIC_SHIFT 3- Q* T: f! b% |, P7 C
- #define TCINTEN_SHIFT 20 v9 }- n6 t+ G$ H( `
- #define ITCINTEN_SHIFT 21
9 k" M" c) e& S) y1 D& ?& a% s' F - #define TCCHEN_SHIFT 22
5 x3 n& u0 U6 L! L' s - #define ITCCHEN_SHIFT 23+ b4 }+ O9 H. `) O
- 4 V* m8 b2 h: Q3 |. M0 l6 N
- static volatile int irqraised1 = 0;
- T& z1 d B0 l; d - static volatile int irqraised2 = 0;
1 r- D- h/ t7 N: K
2 e: V1 M' k% D0 m4 i2 J7 s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 g) q) r$ [/ P v; l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% u2 Q7 U' B \5 q6 Z2 b3 ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 K" p, j3 d" C
- " U2 I8 j/ R. _0 W/ S& B$ v2 N; P
- dma_addr_t dmaphyssrc1 = 0;: S! z' ]+ w# C
- dma_addr_t dmaphyssrc2 = 0;7 t, g8 P5 `: Q4 {, z, A
- dma_addr_t dmaphysdest1 = 0;
! D: U3 y: c, P& @# f - dma_addr_t dmaphysdest2 = 0;$ X, `8 U9 n) e; U. }" j1 f# q
" p& t2 R9 t* I* \- char *dmabufsrc1 = NULL;
) B) g3 j' ~- ~+ M" r4 f - char *dmabufsrc2 = NULL;( p6 b5 E# z( |5 T
- char *dmabufdest1 = NULL;
1 E5 w8 W F# N - char *dmabufdest2 = NULL;6 i1 {" n/ S7 ~% v6 f: R
- . L; C3 Q1 a+ O: c
- static int acnt = 512;
' _- P r; q( k7 c - static int bcnt = 8;2 x$ s" b0 D) `& V! S, l3 W- x# }
- static int ccnt = 8;% P) s+ z* p9 x! j# L3 {
4 R9 S8 @5 Y O; d: ]* m2 T- module_param(acnt, int, S_IRUGO);
2 O: ~$ A5 P/ Q/ V - module_param(bcnt, int, S_IRUGO);( ^% k$ g7 X& E3 c. {. W- C6 K0 d* i
- module_param(ccnt, int, S_IRUGO);
复制代码 % Z% q& d. c o2 ]
, b4 K: p& v4 r2 g8 X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 R6 f- n; \; K( ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 G$ Z# ^ k( ]9 q" m4 w+ |" ?! t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 u' C+ E5 Z1 y; v9 }7 `% m/ X
) a7 b o, \4 z' f; a, C* P8 \* c. s Y$ N6 c8 g" W3 |
|
|