|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . K) _3 w7 r7 C3 w7 B$ w
- [code]EDMA sample test application3 l8 s. X# Z6 S; f) J
- /*2 A% n+ `) T0 z5 T- c8 m
- * edma_test.c9 p& ~4 m% P3 a( C9 I# o6 h2 n
- *
% s# v1 g5 {: A+ R$ N$ [" n - * brief EDMA3 Test Application& e0 t3 } j& R9 N' J
- *# x1 `& p8 U1 Y5 H( O7 z
- * This file contains EDMA3 Test code.
: \8 A, F4 j% x - *
# g+ ]; D) r8 }9 Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; l# W2 C% x8 T# Y7 z% y( y' a" R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 J, Y$ U( z: T% k
- * TO CHANGE.0 n* b2 N; D- l" @
- *+ }7 b; r/ H7 B& f+ E
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# r5 ?( D( R, r5 w - *
" V3 U0 l) X% Q' z) \6 f - * This program is free software; you can redistribute it and/or
9 r% x8 l4 r& T, D4 T [/ [ - * modify it under the terms of the GNU General Public License as0 n9 f; W6 r! P
- * published by the Free Software Foundation version 2.
$ z5 I- b1 v8 i9 R - *4 n) Q" ~3 U* q. _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* I% a/ [ T1 R4 g8 x- E
- * kind, whether express or implied; without even the implied warranty: Y# \ O7 p# G% t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 Y2 W' h8 l. M: Z9 w - * GNU General Public License for more details.2 ?7 I9 D4 A3 I
- */$ C/ w# \4 y$ S; B
- ! [9 q- \- T8 ~0 i _5 Z3 P
- #include <linux/module.h>
( K# k" g* e: h5 M, L( C1 w - #include <linux/init.h>, _# @. t# ^6 M4 l9 z% n- I
- #include <linux/errno.h>; ?: k' m+ t6 F& x% D6 m6 q2 }4 r
- #include <linux/types.h>
" y6 |! [7 O9 R' F/ C - #include <linux/interrupt.h> {- Y- R& F% s, D
- #include <asm/io.h>/ j" \$ Q8 r. E( |/ N, I8 P
- #include <linux/moduleparam.h>
+ N$ }% L7 b% {. L - #include <linux/sysctl.h>, k) r( e5 ^ Y7 `( K; d) `* ^
- #include <linux/mm.h>" ^0 R( S/ s. ]
- #include <linux/dma-mapping.h>7 V" U e, p& k
3 U/ E+ O: T) u, r: J- #include <mach/memory.h>
9 P( b& n; H5 R# `2 Z* X+ C# W - #include <mach/hardware.h>
" K- l7 `' H" {5 m3 G - #include <mach/irqs.h>
/ @( C- i% C7 \# ^; |3 @* {+ O' _ - #include <asm/hardware/edma.h>/ O. g( s! X, j, y7 g# C- U
- . k% W7 K: R9 u1 ?& ?! b
- #undef EDMA3_DEBUG5 E% h2 g( I+ H' o! ]) c
- /*#define EDMA3_DEBUG*/6 \6 n& _8 J5 a
- 8 r5 ?7 a3 n# q- s5 ~2 m
- #ifdef EDMA3_DEBUG& t5 n7 L1 o' ?* x/ U* M5 m* k
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 O3 x: H' k) ]+ \0 ?' x5 C( |
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
~& v$ R$ v% l# ?3 w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* z/ u9 M) }3 [( O - #else: H( \1 ~0 n% X' j' `& h
- #define DMA_PRINTK( x... )3 F5 F# Q/ M, R4 I2 Y5 B1 X# ^
- #define DMA_FN_IN
3 W( Z: l! A% j3 s3 N9 d m4 X - #define DMA_FN_OUT N" B% E+ o; u$ f
- #endif
! O8 Z; H. n% e7 I0 F" p+ U
8 i& q# b( V! H% X) {9 T- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; A$ c8 n* M0 x& T - #define STATIC_SHIFT 32 |/ L. x' a6 D
- #define TCINTEN_SHIFT 20: \: r, F9 b2 Q+ [0 [9 ]2 o; q
- #define ITCINTEN_SHIFT 21% K0 ^% w& F. |: }0 l8 x( P
- #define TCCHEN_SHIFT 225 }$ K" l& Y) ~- U
- #define ITCCHEN_SHIFT 23 x7 m7 r/ B" S# _& L1 c, R
* O. F& ^* D) e- A. S2 J* }- static volatile int irqraised1 = 0;0 e4 y! k3 ~0 i
- static volatile int irqraised2 = 0;& @: M3 K5 h" a" @* ~+ ?7 P
5 \$ i1 ^9 Z( ^& o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) k6 j0 a! x V& `7 { - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ I7 P/ z8 H6 r' W1 c/ s - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# }* |& d" k% P, M1 {4 u: [ - # p4 W% ?# ~/ }4 l" s
- dma_addr_t dmaphyssrc1 = 0;5 P7 z; X- U, v9 C: o4 r# R
- dma_addr_t dmaphyssrc2 = 0;) {# u& I" q( M3 M8 r$ @
- dma_addr_t dmaphysdest1 = 0;
2 o( ?9 d/ ?, G% ~" R - dma_addr_t dmaphysdest2 = 0;
1 H: A6 |$ O( H1 n4 c" o) R& H2 | - / W4 B$ T+ J& J( Y) U
- char *dmabufsrc1 = NULL;
4 h* `9 W% }& d- \& {! X, b5 F - char *dmabufsrc2 = NULL;
8 p; B# F [; c8 I/ Z5 c0 c9 t a2 s - char *dmabufdest1 = NULL;$ \5 ~6 s3 T3 c
- char *dmabufdest2 = NULL;
2 B% N( U; j- b! I" I; e( @* V - * o0 N, b$ k8 u+ Z* _0 C9 r* E
- static int acnt = 512;! {: Q3 ]: j, Q r% K
- static int bcnt = 8;
0 p1 W) h; F2 P5 N - static int ccnt = 8;
1 }" q2 }, I1 J - + @$ O' h4 f% T, ^$ r' J. B# m
- module_param(acnt, int, S_IRUGO);
3 r5 c' ?4 l2 {0 v8 I. c3 z - module_param(bcnt, int, S_IRUGO);
0 r. E6 @7 n% A( X8 D - module_param(ccnt, int, S_IRUGO);
复制代码
; m# b1 i3 U* a5 \. m: m
4 O2 p3 f, T' ]( i8 m3 P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ c3 A V( u. P; {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ d* W: ~3 p; c6 S& T- m 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 Z8 l1 L. K; K* Q; ~
% z& H0 e s' C& W; v P& Y5 V# i
2 l; X& o% g' I |
|