|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 a1 T/ a7 i3 a4 @: K- s# X" Q! q- [code]EDMA sample test application5 Q- ?1 o' i) s3 I
- /*
; a/ C/ S! D+ ?2 D1 z2 w - * edma_test.c/ Y3 N: r1 P" `( f( n9 D' k
- *
* s5 Q: [' z5 ]; Z, X+ { - * brief EDMA3 Test Application5 H8 h6 W# g# c" a. ^% l" U2 t
- *
# g- i7 U. F: T9 P) Y - * This file contains EDMA3 Test code." K& \" \: k/ l
- *2 ~7 q! p& H+ i' D6 t
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 \! k6 W q. l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 ~+ k( N* b7 B9 k
- * TO CHANGE.
" h, C, ^* h$ {' H, H- k! g - *
; j- m* r6 v* D5 s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, w9 ?- \0 S6 |1 x, W$ M - *3 A& \8 ?/ n2 z2 n; p0 ?
- * This program is free software; you can redistribute it and/or
) T7 m4 Y3 A6 h5 I% X# N - * modify it under the terms of the GNU General Public License as( e6 h) j: i0 q `" ?0 \2 j
- * published by the Free Software Foundation version 2.
! T" K( E0 N4 S7 J0 G" U - *% \- \, Q- d' v8 L3 L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 Y0 z2 t6 e& Y7 d
- * kind, whether express or implied; without even the implied warranty
0 v+ q, q# v* _# e/ i: R - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 p$ I& ]+ x! `& s - * GNU General Public License for more details.* o( o; @0 ]9 O3 v, K9 ^5 b
- */
5 n5 k0 _: I9 }
$ z( h9 I2 o( N. t4 M: P0 N$ N1 O- #include <linux/module.h>
4 m5 x5 P! b" [2 G* X: x3 K - #include <linux/init.h>: O7 {6 J; n5 m6 ^7 [. p p( ]+ g
- #include <linux/errno.h>4 w/ b: w" F! }( G
- #include <linux/types.h>/ E% Y6 @% j" f- S
- #include <linux/interrupt.h>
! c* T1 [# }" k% |$ N/ Q - #include <asm/io.h>( u. |& `3 W5 N6 j8 h
- #include <linux/moduleparam.h>3 g9 y/ l7 M4 h; g3 Q( Q$ O8 X" ~( @
- #include <linux/sysctl.h>( m. \ D2 n( H7 P# ?: `" Q
- #include <linux/mm.h>
( ]* B" ^4 S+ `, ~: G. N$ @ - #include <linux/dma-mapping.h>
' u) h6 }4 t- O/ }; j* P
' p* y2 O% i8 Z% Q- #include <mach/memory.h>
- C* h7 C& F# Y M$ a- Y - #include <mach/hardware.h>
3 t' e! Z& n T - #include <mach/irqs.h>
1 D g6 f" ?: i6 ^9 V - #include <asm/hardware/edma.h>
7 G6 I* j9 x% |+ ~7 z - 6 `3 g# ]+ p) J' R4 F* Q1 a1 ^
- #undef EDMA3_DEBUG3 r6 H5 o0 F7 i' _& X
- /*#define EDMA3_DEBUG*/
5 _- h5 k# y5 X$ d1 Z6 @& m# \ - - y& }) F7 M9 ]" p6 v9 `% V& t
- #ifdef EDMA3_DEBUG
% d, ?4 @, ^* N9 T% N$ `- e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' q' W+ V5 L Q& R
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: y2 w, H' @- J - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
]: J$ {. h! L ?( \/ e - #else* |* y$ ~2 t' `9 |
- #define DMA_PRINTK( x... )
* |& [9 E2 ]# U( X - #define DMA_FN_IN
7 B5 G% i# d, s' F - #define DMA_FN_OUT# Z/ B1 ^% V! w. z3 q5 m" G
- #endif2 Y' |% A! m7 s+ r. j
0 j# S) b1 s) \* T8 U9 r- h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: {2 x" P4 M; a% B! G4 u' r - #define STATIC_SHIFT 3
^; Y9 b; i( m" r6 l - #define TCINTEN_SHIFT 20
[: a' A% Z+ X- s/ M - #define ITCINTEN_SHIFT 21( B' n) T- U0 D( f
- #define TCCHEN_SHIFT 224 {8 d6 @, b1 v1 N4 x
- #define ITCCHEN_SHIFT 23' N8 [4 g$ Z6 e p5 a
: H7 m1 S! S) a5 O4 I% Y/ U- static volatile int irqraised1 = 0;9 U, `. ]( x f, ^
- static volatile int irqraised2 = 0;: |3 r0 V0 [, N+ w- F6 ?, Z
- ) U# o1 `# o+ J. N1 F, j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 w5 `# i3 C$ d& z% l2 q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 a: b- Z/ E1 [4 s* ?; b7 } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% K/ Q; m4 E, \. O
. `/ ~/ |: z f! D1 k$ m- dma_addr_t dmaphyssrc1 = 0;
4 O& `: F1 {; j, s: A - dma_addr_t dmaphyssrc2 = 0;
8 {" M- L. m6 H g4 M! z - dma_addr_t dmaphysdest1 = 0;
' e, D0 P2 X6 s. Z7 V! [ - dma_addr_t dmaphysdest2 = 0;2 {% r7 w' _# Z7 Q2 \
- , g6 r4 U3 L4 `* ?8 h/ _, m% ~' {; J
- char *dmabufsrc1 = NULL;
- X3 |6 x m3 \- e - char *dmabufsrc2 = NULL; N8 {1 w: L8 A4 ?8 M, @5 ]8 B, t* {
- char *dmabufdest1 = NULL;
7 W, b% H: z) T3 D$ H0 T - char *dmabufdest2 = NULL;
, e! d* ^( D' _( X: y2 E/ q - & d/ d/ [7 Q% H- W: _1 S+ X3 ~
- static int acnt = 512;
" D" w7 X0 m9 \- | - static int bcnt = 8;6 h: m* q6 b$ y$ Q) H! n$ n6 e
- static int ccnt = 8;
; d8 v5 @" n' D' t. Y4 G/ d - ! b! T1 p/ m0 k' `
- module_param(acnt, int, S_IRUGO);
- }- E8 z3 Z; G4 G( {5 o% p" ` - module_param(bcnt, int, S_IRUGO);
& i4 a: ]( v, p( M2 k/ P1 h - module_param(ccnt, int, S_IRUGO);
复制代码
3 b8 x4 m8 F2 u3 t( `' ?
# x( f2 }9 U( x5 l# R 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; V- x7 G. j2 c* R8 V b% P9 ]! {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# X: k- w6 e: l- k6 c% e$ G r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% b) Z$ Q& q) g6 [( x4 l r' E# ?7 k! u3 l1 i( u" x; P8 i3 G
, z7 w8 d3 @; G |
|