|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % W4 k- t% P4 C, I
- [code]EDMA sample test application1 W% @) }& H' B: \ X
- /*7 o4 i5 U1 |4 D) C
- * edma_test.c3 K7 G2 o6 b8 ]
- ** q5 z5 q3 j( I% U3 Y ]# Q' D0 v5 o
- * brief EDMA3 Test Application
! P( T A/ \" o/ e5 Q4 H( N - *6 F. o0 r7 i5 e/ R
- * This file contains EDMA3 Test code.& L! u2 g( \, u" i6 j' A
- *" C# W% F( U+ I5 R
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 o; t4 [! K/ y! C$ Q: f O/ i
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* `3 Q, Q, b3 ^! a, {) `9 @
- * TO CHANGE./ A- Y' \+ z3 q" t! l( W# S
- *
* E6 C: N' w7 w9 u, e. W+ y; q# e - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 n/ l z9 O5 |# ~
- *
9 `& Y" B6 G( j/ ^( [$ T( Z - * This program is free software; you can redistribute it and/or4 T5 ^$ h5 \0 |# J$ J. e
- * modify it under the terms of the GNU General Public License as
& v% L+ g/ P" Z9 I" J - * published by the Free Software Foundation version 2.& Q! d* @3 V* U* i+ u
- *
) c5 ~9 D( }3 z% U6 e; O0 e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, j) A1 h' t. f. e2 L6 Q - * kind, whether express or implied; without even the implied warranty
# N- F5 S( f0 Q0 d - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& z( d$ l8 w" ] - * GNU General Public License for more details.
5 L' t0 J7 t8 Z: }' j+ j% j5 Q - */ G* W* A7 D. Z9 ^$ V
- " }4 D( r. B t$ O
- #include <linux/module.h>
6 ^( o# y0 M. I3 N - #include <linux/init.h>* f+ ?& z+ {3 Q2 `$ |
- #include <linux/errno.h>9 e( e$ s6 ~$ O$ J1 H5 ?. W' g
- #include <linux/types.h>
$ @. t I, a5 O, C - #include <linux/interrupt.h>
, C$ N' U0 n& ~' f1 T* d1 `0 C6 ~( G. { - #include <asm/io.h>
: _: @8 B- Q: K' F J. C - #include <linux/moduleparam.h>
! W1 E( ^$ u2 ^2 R) ~ - #include <linux/sysctl.h>
1 S4 B; }+ P& n6 D+ Y1 g - #include <linux/mm.h>9 z5 ?+ M; c7 @6 S! {' ]
- #include <linux/dma-mapping.h>6 C! P1 y$ y/ G: E% R
0 y/ E! ^$ ^- X& V- #include <mach/memory.h>
, ~& U1 H( X: g; s4 { - #include <mach/hardware.h>. b3 b* T- z( N7 @1 y
- #include <mach/irqs.h>
( `& k' A' I/ \% r - #include <asm/hardware/edma.h>
i! Q9 k; f0 \* c) R' Q
! T( L2 ^5 Q' `# `0 D5 M. O' c6 }- #undef EDMA3_DEBUG
% L/ i2 j* x/ K. i3 @ - /*#define EDMA3_DEBUG*/
2 Q" Z- B& R3 W6 [! x) P - ) Z) \8 u6 R' D1 T
- #ifdef EDMA3_DEBUG: ]. O0 ^$ Q, @% }# H' y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ ~% }- W8 \ Y; C, X- u) j - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), h9 p6 ]6 h/ i0 [8 u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): E- J4 D1 S/ e( ~
- #else ~& L; h' x8 P8 ~' \) r+ \
- #define DMA_PRINTK( x... )
0 ]' L7 {! {( k9 q - #define DMA_FN_IN
% Z# _4 g: n4 s( Z* s - #define DMA_FN_OUT
! c1 P6 w/ B, T- T - #endif
7 W: p7 q" H% ]$ l' K - & [0 d' B1 }5 `% [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& U/ c5 ~2 q0 ^
- #define STATIC_SHIFT 3$ {( O3 \3 N( ]0 h
- #define TCINTEN_SHIFT 20
, [! }- a$ d1 [% t7 X - #define ITCINTEN_SHIFT 21
9 y8 e) Z/ N' p2 L - #define TCCHEN_SHIFT 22
% E$ Y7 v: K% ?) }) t - #define ITCCHEN_SHIFT 23
6 [3 e7 @% m$ Z, y& |" X/ v! {1 ^
4 |+ _' H8 X9 u; x- static volatile int irqraised1 = 0;6 M* j; T$ l9 l8 I: O# e! j; a; f3 Z
- static volatile int irqraised2 = 0;1 r. W9 s/ W! b, C
- * g- N2 a2 _ F% b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 q) u$ F7 G: x. z# O; K5 M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% S* W3 n5 g' _0 M: p$ J% _
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% x3 E8 d, v6 I& A - 3 r4 h. L9 m' w$ A/ {
- dma_addr_t dmaphyssrc1 = 0;4 y4 e( _( ?1 @7 z( i
- dma_addr_t dmaphyssrc2 = 0;
1 e6 [9 \* s# g' {* Y [7 m5 t - dma_addr_t dmaphysdest1 = 0;
) a6 M) Y5 \) [: W& }0 y - dma_addr_t dmaphysdest2 = 0;/ c8 `/ n5 A( o6 J; }2 g
8 L1 Q. |- @+ O w' U1 D- char *dmabufsrc1 = NULL;/ p) Y5 ^# j( M3 g& n
- char *dmabufsrc2 = NULL;. q& q8 f+ s( F2 {' p, H. c! A2 K1 y
- char *dmabufdest1 = NULL;
- v, f8 e( i' l5 g! j. U% [- ~ - char *dmabufdest2 = NULL;0 p6 q2 _ H$ P
% a; T2 r( U; @1 L0 k" c- static int acnt = 512;
' X4 ?5 j1 K, ^ }5 G' m - static int bcnt = 8;
. W/ i& \! T3 S: l$ G) u# @5 s - static int ccnt = 8;
. N! V( {2 s& l3 v - ) Z# _ }6 I/ R" d; S: w+ y
- module_param(acnt, int, S_IRUGO);
T2 ?1 p O- f: h% y- g - module_param(bcnt, int, S_IRUGO);
% Y& {" w; K+ ] n4 |" r6 w6 G - module_param(ccnt, int, S_IRUGO);
复制代码 ) ], O: ~" F$ X6 r4 y. P
( X6 e4 N# u9 a
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ c; |8 z- H& C+ D7 z barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 ~+ Q0 D" D( }$ x% \& N 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 z7 k% H) u* x% E
: W! Q0 ?' j% d0 A! d
; ]& ?, z$ _/ Z4 W3 U+ Z |
|