|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * a) H* y3 b: \# t+ F
- [code]EDMA sample test application
8 H. P+ k7 I% U# | - /*; a% j0 Y& N, e9 X7 _
- * edma_test.c! B4 I# k( F6 N4 w. d( m' Q1 E
- *# @3 p# n( p% M
- * brief EDMA3 Test Application2 Q: }+ O* T2 [% R
- *! M# t& V* F6 P: R, u
- * This file contains EDMA3 Test code.
) W+ {! r4 y2 x8 z7 a& O - *
" ?8 o$ q& j8 T% \% d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ |8 {2 s# c q6 D4 ?, | - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% P9 ? r+ Y' L$ Q* T7 d
- * TO CHANGE.& y- X, `7 H! X8 b
- *
3 d7 B. L) x5 _" o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
P3 N: C# y3 h B3 R; d7 ~ D - *
$ ~9 W9 ~; H/ d+ z' E - * This program is free software; you can redistribute it and/or* |% D; j+ d1 S# ?( V
- * modify it under the terms of the GNU General Public License as
2 X+ \# c9 A1 ]: O - * published by the Free Software Foundation version 2.
& l' B. W6 p ]% J& \8 m - *& E& S/ q7 Q0 v! l k; P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 ?9 }+ l7 l7 ]) l, ?: f - * kind, whether express or implied; without even the implied warranty4 b) ~$ P8 q' u* V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 u4 s4 Y1 b- t
- * GNU General Public License for more details.8 ?6 k P. c1 ]/ Y, ]
- *// ~* X% R3 W5 M+ D: e, \% b
7 |* J% ^, l/ Y% k* H o- #include <linux/module.h>
) l) O4 v; z( R( I' H c - #include <linux/init.h>) |1 s/ h' I: ?! R5 N
- #include <linux/errno.h>( Y9 S2 y0 j9 }: L
- #include <linux/types.h>
# S) ]8 Y% o9 H0 m h( M - #include <linux/interrupt.h>
7 {1 ~2 G6 m: M, f0 b. Q" m - #include <asm/io.h>, [7 V9 D3 B6 P( q8 ?- N6 t# S
- #include <linux/moduleparam.h>& a v) z! n) }1 I
- #include <linux/sysctl.h>
8 d# q7 |) u+ q - #include <linux/mm.h>
7 G4 T C$ X- w* U$ C - #include <linux/dma-mapping.h>$ | U3 N. w+ l
- 8 C- h) d. Y* ?5 ?" j9 Q5 A& n
- #include <mach/memory.h>
$ x0 E1 Y6 L: r: ^2 w# B - #include <mach/hardware.h>
. y4 G* d6 V0 o0 }; G' k - #include <mach/irqs.h>) q* R& @1 S- ~7 G
- #include <asm/hardware/edma.h>
$ f. M) |* p/ b3 A; K
( {3 l% n1 u0 k; p* _# I1 E- #undef EDMA3_DEBUG
7 w3 M2 ?. K. k# H+ O0 Z/ \ - /*#define EDMA3_DEBUG*/
/ V |6 `- p* _! [" a2 ^' T
6 {+ e2 v4 f2 }" g4 }- #ifdef EDMA3_DEBUG
. Z x7 `2 d9 B- C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" w; X/ U+ |" e) ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 D8 m4 c7 q" `! }
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# R$ k) X9 x+ J
- #else
8 `" N2 k+ H0 d8 g - #define DMA_PRINTK( x... )
# V# t+ h: w+ k L2 ~, w" ]5 t - #define DMA_FN_IN( ?7 W7 q! E0 ^
- #define DMA_FN_OUT
9 E- R- e A7 c G6 X9 T - #endif4 P3 ]- Y+ N: x( j9 B" B- ]) ~
. h8 Q! \/ |4 w0 H, |: d8 u, \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# `8 f A0 [, l - #define STATIC_SHIFT 3
z" j% M# T6 k. { - #define TCINTEN_SHIFT 206 A% n2 V+ n2 D
- #define ITCINTEN_SHIFT 21' t: z: K8 q0 I0 B, F
- #define TCCHEN_SHIFT 22
7 P: y0 d! M7 u* Y* p) Q - #define ITCCHEN_SHIFT 23
# }: Q% L. y" w; _' L; y( P8 B
' v* J* r6 y( w" ?8 R) c- static volatile int irqraised1 = 0;
, e! a. o, a* m8 i - static volatile int irqraised2 = 0;) t6 N K* H# U" L
) M; r8 Z$ i% E- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, T' h ?' K& O5 {0 F9 } - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 \; g5 J- A' Q! J2 ?/ r9 u7 u' q. u) U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# b+ e+ ]8 ~) c* o- J$ O' V0 f
: g! R% w! C3 b) Z- f4 _; z- dma_addr_t dmaphyssrc1 = 0;
4 \! S1 s/ g8 V) ] C1 h: ^1 N2 @% k - dma_addr_t dmaphyssrc2 = 0;3 q6 [: r) H4 G" I/ |. a
- dma_addr_t dmaphysdest1 = 0;) q" r _! P( b: P% w0 q" Q+ e
- dma_addr_t dmaphysdest2 = 0;
" |' \4 H) f# V$ i' G3 K% U
) V1 v b f& U- char *dmabufsrc1 = NULL;
& U( T3 F2 V7 ^4 p' m2 x; A r - char *dmabufsrc2 = NULL;$ B1 Z/ O" \! e- n3 q
- char *dmabufdest1 = NULL;, K" x# @2 y, a' D) w/ E. |
- char *dmabufdest2 = NULL;
4 e |7 Q9 Y1 T( Q
3 }# S' x* X: m$ q* o- static int acnt = 512;& q! M( Y& q2 \) x+ k- x; x4 B
- static int bcnt = 8;
/ w+ ~* K$ E8 i7 O8 [+ b - static int ccnt = 8;
, Z* O) i4 z& M
# [2 R& v: \; Q8 o2 O6 J- module_param(acnt, int, S_IRUGO);' ^) f! t2 O+ N3 q8 O
- module_param(bcnt, int, S_IRUGO);
( e) e% `& z% k! M4 h8 Q& @3 l4 u, Z* T - module_param(ccnt, int, S_IRUGO);
复制代码
; N9 W" o" W, i% _) p5 T( m) d u; K
: a- D8 X. R( v X/ Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% X0 Z M$ F& C' ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% T9 u, s+ N7 U0 k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 S7 Z2 ]& i! j9 n" E0 {7 {$ d& M) a
- h+ Z3 K: N8 N2 k+ I |
|