|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 w! R. C8 a2 G1 e! Z, m
- [code]EDMA sample test application
* U f7 ]5 y8 U8 H - /*! y S" Z3 l6 ?5 h* @- I
- * edma_test.c) V4 j( O$ h# [% X' F) m
- *
1 Q2 i$ L; \9 ]: C d9 \ - * brief EDMA3 Test Application
6 _( a6 K) {; W6 f0 \/ [ - *( i. ?9 x) v4 U7 P7 R! j9 u
- * This file contains EDMA3 Test code.
2 u1 F4 v/ h. {1 E5 L - *
% d7 Z& u8 Z( v. n - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 D2 r+ u, v) E8 d& {8 O
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; `% m! v+ W: g, g. ], t) _
- * TO CHANGE.
3 y, y- |( m7 ?' i7 b D! j! a - *
; M" F, h% }- z& `5 j - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 u& i: A) T/ j
- *9 ^* F1 o, ^7 B2 d" n
- * This program is free software; you can redistribute it and/or
( C2 f) `* s- f. C4 R7 T4 ^, }8 I - * modify it under the terms of the GNU General Public License as
9 A P6 b8 \7 O( Z& p# G" O; L8 X - * published by the Free Software Foundation version 2.
/ t: y) E6 A; P9 i6 B( _- G - *
) s+ r0 b6 i9 a8 Q3 A( }% g, I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ x$ g) @+ B0 o0 ?- e9 k - * kind, whether express or implied; without even the implied warranty
( U4 m: ?* R* l3 @1 q% @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ ?# L% C. h; W- w9 d4 F. M
- * GNU General Public License for more details.
+ D* T" C, {2 `' x- w2 h v5 A - */8 E1 v: Z; `7 g# B
- ; ]& z, q7 J0 ^4 S" _
- #include <linux/module.h>
* |! {* X4 y. Q" m- L1 g' m - #include <linux/init.h>
' g! u+ L$ @7 k! U6 Y - #include <linux/errno.h>
4 O4 q+ e1 d5 n% f/ B! t - #include <linux/types.h>3 W' O) G6 ^' {5 Z) W5 n9 b
- #include <linux/interrupt.h>. e6 s2 j8 `/ ? m% _$ K
- #include <asm/io.h>
2 z* K; y z3 }. E; G - #include <linux/moduleparam.h>
6 S' q. G! l+ k; D - #include <linux/sysctl.h>
4 Q" x5 x+ F# a5 ^0 q - #include <linux/mm.h>
9 O1 x5 F" S* Q5 {7 }2 w - #include <linux/dma-mapping.h># S& ]( {' B3 w- @3 b5 Z1 l# Q
4 h" p7 h+ f" H$ S3 l! P- #include <mach/memory.h>! q* f* i& r7 a- n0 L5 R; C
- #include <mach/hardware.h>" C: ?% {1 ^ K# A& C% S b
- #include <mach/irqs.h>
( J' \2 D: D3 K, o: W - #include <asm/hardware/edma.h>
) |. G) b- M* X% { - & ?' |, f! S1 s& P3 a# O( B
- #undef EDMA3_DEBUG9 \% q( X' i+ D Z) ]: {
- /*#define EDMA3_DEBUG*/1 D9 Z6 n2 H9 u7 F2 S8 M! ]
- $ a2 G) ?4 Q- h; W$ r* H
- #ifdef EDMA3_DEBUG
4 R2 _: K# f: Y2 ~2 i) |# S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
$ o6 f4 }! J8 I! C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' a5 x# w' }2 m) L2 ^* c- A6 e
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ W" r1 N7 C Y0 F7 u% C4 O, P
- #else
2 v8 u, q. u8 P& u% l0 Q1 W - #define DMA_PRINTK( x... )1 ]2 H1 X' X0 ~. |
- #define DMA_FN_IN
" ^. p4 E1 i( v4 z - #define DMA_FN_OUT
* A9 e, C4 E1 M/ m3 M+ d {1 C; W0 C - #endif
) b9 B1 V! p$ @* }+ X
( ^3 q, e5 ~' _% j; S- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 z. [7 I) l- X
- #define STATIC_SHIFT 3
8 l. i6 F$ I2 z* M% H - #define TCINTEN_SHIFT 20
3 h+ E& q# h, K3 F: j - #define ITCINTEN_SHIFT 21
) v0 b! H6 V( u7 w+ w' I - #define TCCHEN_SHIFT 22/ k1 x1 O0 Z8 z6 |
- #define ITCCHEN_SHIFT 23
0 a I* H( U! }- g9 C8 |2 J - - a* E7 ^8 ?& Y ]# J0 c! n( u
- static volatile int irqraised1 = 0;
' r: r; A/ ^6 C2 D9 c6 i' F - static volatile int irqraised2 = 0;
3 j' \4 c* @( K; {) Z5 ~& W1 J. w - 5 Y# P$ K" w; e, R
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ u. L4 e+ S# h4 ~
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' ], y g& b. X. F( E! A5 U2 k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 k2 e" P N/ w8 I# M) N
- % J' J5 i+ I7 Z! k7 U! V* q9 Q8 q
- dma_addr_t dmaphyssrc1 = 0;
. z4 a$ K) {8 i - dma_addr_t dmaphyssrc2 = 0;
! P: f# L; W0 [, A2 q( G# ]* J/ V - dma_addr_t dmaphysdest1 = 0;8 [* X6 E# K: r& p$ @
- dma_addr_t dmaphysdest2 = 0;+ l5 _( Q$ Y6 d' M5 i
- / g5 |. |6 X* {' r( d/ b Y# u3 r) m
- char *dmabufsrc1 = NULL;
& W- [( r9 o; g0 N3 c - char *dmabufsrc2 = NULL;
% D) \" q7 Z0 L3 Y$ u - char *dmabufdest1 = NULL;
/ K' o/ j9 s* f( N* C - char *dmabufdest2 = NULL;1 L( X7 |5 [& n' y
$ i5 R8 h6 p2 D0 x7 c5 Z& P# k( i- static int acnt = 512;
- L& Q! U3 w6 Z2 }# b - static int bcnt = 8;8 [' Y# {. _9 [! {6 q. p0 f
- static int ccnt = 8;& y2 v7 p- M( n" ], |* i3 i
- % u3 W. Z) h; G( Y; d* s7 r( o
- module_param(acnt, int, S_IRUGO);
# v. d% @8 _1 Y3 S7 G& x - module_param(bcnt, int, S_IRUGO);, A. I0 n) F7 x0 x$ s7 T
- module_param(ccnt, int, S_IRUGO);
复制代码 # Y& w( g) Q6 k. m+ R
3 H# q- X. I3 q" J' @) R* X
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, T5 C+ h ~5 E7 L8 u9 Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 n8 b1 c8 Q7 t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 K$ F1 J5 Q$ |8 C/ p
+ G* t6 w" T( K9 D5 C9 w' v' a/ l( E& H0 m* e: l
|
|