|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ m# D" D w/ i- [code]EDMA sample test application
$ C# B" O" r# T" V; E% L - /*; F0 I) c- R7 f. I, K
- * edma_test.c
M* p& |! t; i5 ~) Z- J - *
$ p }5 B# J! A7 C. m, J+ U2 F: I - * brief EDMA3 Test Application
8 V8 D c5 A2 i, J4 [& D - *
' T1 N/ l' j% I$ @, P - * This file contains EDMA3 Test code.
5 s( J# w1 F; i# C$ b - *
0 W9 F) a+ t, ~0 m7 J8 C - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. `5 ^+ K! i1 N+ q+ | - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* y$ |2 P O1 A' x5 }! m
- * TO CHANGE.
. Z# [1 B* \# A0 {9 }3 z$ D - *' v. }% l4 k" w1 z7 x. t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) c' g+ Q, y0 c7 H c - *
5 F4 l+ B- o4 L* C( M. p' p - * This program is free software; you can redistribute it and/or. ]% T! ~6 u$ X
- * modify it under the terms of the GNU General Public License as1 @ M2 Y/ b* b3 q- G3 i6 `7 w
- * published by the Free Software Foundation version 2.
( ? S7 g8 o8 ~! k - *6 t/ R/ S- C2 E. e( q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 z6 u8 c) Q9 V, g! i$ s# Z8 v% q. N
- * kind, whether express or implied; without even the implied warranty) T) a% } r( a1 V- P7 k
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 z7 U x+ S( ~4 W - * GNU General Public License for more details.* e) T9 W# f& K, C0 q9 ~$ r+ U1 {& M
- */
+ Z) B: o( E/ N - * u% d' ^: H! G6 q
- #include <linux/module.h>! o& X& w# F8 \* r$ z- M+ N
- #include <linux/init.h>
6 |4 M7 R: K& a1 y/ R - #include <linux/errno.h>* i+ ^/ T. \" _* ]& ]* y( N; ] d4 G8 U
- #include <linux/types.h>
_! r. t6 e. X* B - #include <linux/interrupt.h>
5 s) ?6 G, h2 A2 h: t - #include <asm/io.h>
{. |! R* @. a* t6 [ P' n - #include <linux/moduleparam.h>
3 B6 d- c: K% Z1 t) s - #include <linux/sysctl.h>
- {4 d* @; ]# a6 p# G, e - #include <linux/mm.h>
3 [2 N; c( G+ z% g" ~0 q - #include <linux/dma-mapping.h>5 r) F; I6 k t& S: h/ X+ [5 _
& ^$ J8 ], p! l) H- #include <mach/memory.h>
: [ u: j3 ]' s2 V9 K! k Y - #include <mach/hardware.h>5 N& k: \/ B% @3 |& Y3 @
- #include <mach/irqs.h>+ Y5 V# C5 J. p; o7 H
- #include <asm/hardware/edma.h>
/ y' N0 g$ T) ]% d! A! U - 2 A# v# p; L# t* W! M' D. f
- #undef EDMA3_DEBUG& O6 l) g9 e t0 y# b/ z
- /*#define EDMA3_DEBUG*/
4 u# f4 c& l& m' D1 T - ' `8 ^6 J' P4 d( }! Q5 b9 d$ O
- #ifdef EDMA3_DEBUG
1 K2 W2 a( u2 `) x# m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( ?+ u7 a G; y; [3 Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 U5 s- k% g, W2 W7 S0 G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( ]* N" J: x' _* s. C: W2 Z& b - #else- \3 w5 ^# `" n) z" a) z
- #define DMA_PRINTK( x... ) C1 s0 l: g: {& r& q; h9 s
- #define DMA_FN_IN6 ` Y4 c0 F* D2 U
- #define DMA_FN_OUT+ m" o' p$ F# ^' i9 z% ?! e! M' t1 ^
- #endif
( V) H: d5 `: E: n - ' A& ~# e+ |8 U5 ^- F
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& h; e D( `. J: k+ D; @ - #define STATIC_SHIFT 3
( X. O- ?. J# ` - #define TCINTEN_SHIFT 20/ ]0 c: g& `: ^$ p/ [* l1 L/ C
- #define ITCINTEN_SHIFT 21" i' x; h2 ~" A# f" ?# }' a' b3 U0 M
- #define TCCHEN_SHIFT 22* x& N7 ]" ^- [8 Y) E; X8 v
- #define ITCCHEN_SHIFT 23
1 j7 u, s+ |0 N - # o; K! R' \; D/ s
- static volatile int irqraised1 = 0;
$ |, r9 M9 m7 {+ A - static volatile int irqraised2 = 0;9 l9 |' p1 Y; @9 S# H; Q! N- u
. k6 x% Z; B( X% a2 P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 D. z7 ]& M6 N3 [( r0 t8 D. v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 v4 f& ^- `8 \* ] - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 H8 F1 [2 a+ G+ j
- * \4 h! X$ l- z: v
- dma_addr_t dmaphyssrc1 = 0;7 f& @3 {6 H, o. L
- dma_addr_t dmaphyssrc2 = 0;
0 c+ k* i; a( }# X' G9 F- q - dma_addr_t dmaphysdest1 = 0;
& \3 [$ u% k" t) g1 h5 B - dma_addr_t dmaphysdest2 = 0;
9 ?" V; a1 ?' V7 Z5 L* o: g - ; s! f5 }* q L. s8 t8 {
- char *dmabufsrc1 = NULL;
4 d: k U1 U3 C; V( a - char *dmabufsrc2 = NULL;
9 J9 N' q& \! b - char *dmabufdest1 = NULL;6 x( D# P- `2 A* I0 e) K
- char *dmabufdest2 = NULL;
# V7 @8 ]: @7 ~+ A6 P/ u - , y* p: j, n. K& i& S
- static int acnt = 512;
- M: E* h; w) P! m3 e7 v - static int bcnt = 8;
# v& A3 \% v4 `9 c3 m - static int ccnt = 8;
1 A) F! o5 B, t& j - . y4 F% m$ d ^6 j& @+ |
- module_param(acnt, int, S_IRUGO);
7 Y# T, W7 k5 l# M0 L% g8 f - module_param(bcnt, int, S_IRUGO); J0 ?. R: S" s: `( J
- module_param(ccnt, int, S_IRUGO);
复制代码
! H5 [- _5 K3 y0 {+ a: G1 _2 P% V M$ z0 l: q! a; w8 M3 e- E8 J
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: ~+ Z4 _# w# [& i5 E6 `7 v+ z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 }0 F# v& s* X3 F+ B x 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 v( u+ r( l1 ]/ Q5 J% _1 f
7 `! R- Q! \% N# d1 W+ J+ B. J' d9 K+ E6 j) U
|
|