|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 p% F; |: O# e7 H- [code]EDMA sample test application
z6 J) R3 X. x1 C4 X - /** i* D. d. K8 B
- * edma_test.c/ ^0 p' A7 F% P+ M3 k, n6 M
- *
! I N) N) C3 Q6 V8 v - * brief EDMA3 Test Application7 L8 w5 O- v8 D
- *
. r3 v2 R" f# K* [% ` - * This file contains EDMA3 Test code.
: j3 c" |& v m+ T2 K* R- h - *
$ T& @. a# Z* d0 m, z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ S) f6 v0 Q0 A& I Q. P2 _& C+ n1 C
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& c" V7 B+ c Y6 z$ C& \) F - * TO CHANGE.
: p! B. C+ F$ j# l7 _ - *- i" X& g7 k- I/ p8 n- x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 n& z: E7 W0 I
- *
1 Q" f, } q- H9 f$ ] - * This program is free software; you can redistribute it and/or% y1 r% \1 Q; B l. v e( L
- * modify it under the terms of the GNU General Public License as
% [. ?: y) p, h- S3 g5 c' h" j - * published by the Free Software Foundation version 2.4 E2 ~. C% {- H D" {$ B8 o
- *
" {% `$ k* y# t0 F x' ? - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 E$ }0 A- g) e( H
- * kind, whether express or implied; without even the implied warranty
5 E3 z+ X9 U! x6 T7 v1 e7 Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 P8 s2 b$ N. E) i4 @$ s% C - * GNU General Public License for more details.
! K5 L0 n- N% b! S" Q. b, y - */
! R" n& c [3 U
b& f7 x" m- Y; q& s8 W- #include <linux/module.h>1 u# v! ^* I, @: c B- n/ x+ w5 `2 k
- #include <linux/init.h>0 |. J# z, V' K# Z+ I/ X1 S
- #include <linux/errno.h>3 \& Z+ H8 s$ g4 t1 T- x- I- J: a
- #include <linux/types.h>
' c% [; r7 c) M5 z - #include <linux/interrupt.h>8 y7 z" _2 N" x
- #include <asm/io.h>/ u8 ^: h$ b" v" W+ r# |
- #include <linux/moduleparam.h>
! C/ L9 l; {( I9 ~' w$ j6 o - #include <linux/sysctl.h>
2 R' o3 V, F$ \2 }9 h+ ?% \2 G# ` - #include <linux/mm.h>, o- n$ R; J4 V C" k# c, J& H
- #include <linux/dma-mapping.h> a8 b% Z* [" G9 K" f( }
' i9 ? S. `* u- #include <mach/memory.h>
' F* `+ M5 C% T5 J - #include <mach/hardware.h>2 p! F2 V+ U3 S) s* }2 V% w- n
- #include <mach/irqs.h>" O4 I' U5 P) }$ q5 `9 H7 R
- #include <asm/hardware/edma.h>
+ B- Y, P2 P, f! ` - . c/ R+ d# |; e8 m
- #undef EDMA3_DEBUG9 l2 A& B2 S, P1 p0 y( J& }0 {
- /*#define EDMA3_DEBUG*/
8 Q9 }* Y; `% d4 ` n, q
z- ]% G' t4 j- #ifdef EDMA3_DEBUG
5 z5 Z! i) C2 j' V! O - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ \3 c* t4 ?4 Y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( e% ]4 W* s% a - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 v/ W2 a d! T& k9 f$ o0 L
- #else% ~, |6 j: m: g
- #define DMA_PRINTK( x... )3 R# V# k- P5 q; J- e W% Z
- #define DMA_FN_IN: b4 ?; E3 s/ ]$ s! ~
- #define DMA_FN_OUT
6 P+ J0 C- z7 g8 A7 j - #endif
; q; V/ h) ^" ?3 B! V8 ~( N - , g- o$ H* T5 Q2 s( j: e' n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); x: N' [( H$ f0 o. R
- #define STATIC_SHIFT 3
9 H7 p& O1 A4 P0 m. k6 c6 N - #define TCINTEN_SHIFT 20
! [; w/ r7 u9 ?1 Q - #define ITCINTEN_SHIFT 21- W% ^8 {. w% \' u
- #define TCCHEN_SHIFT 22: \ x' {! d; e' v9 f
- #define ITCCHEN_SHIFT 23: F: w6 p$ \+ S2 V
- % U2 B1 S+ t( W
- static volatile int irqraised1 = 0;) q" [+ [1 m( w3 q' u/ C+ e$ E
- static volatile int irqraised2 = 0;
$ ^) y% w2 D+ G( D6 a# P4 I
S5 b" c8 N7 D+ @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" Q$ m( r+ E y0 u5 b
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. p0 L4 ~! `4 [5 n% e - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 A- R1 ~( P& U4 e4 n - 8 d. R; d) ?1 o6 J
- dma_addr_t dmaphyssrc1 = 0;
" j4 |' k h" ^+ o: V* G - dma_addr_t dmaphyssrc2 = 0;, D; r+ ? I- _; X' J( n! D' l- l
- dma_addr_t dmaphysdest1 = 0;- w ]( H4 i/ l& [5 P
- dma_addr_t dmaphysdest2 = 0;
* c. w2 \ B* B) D2 D5 }8 ?
+ P' b. c ~3 N8 \- char *dmabufsrc1 = NULL;
% A3 D! i, j* q* T6 s2 J - char *dmabufsrc2 = NULL;
, K8 N6 a6 _0 u9 E, n. p; ? - char *dmabufdest1 = NULL;/ l# w, p, I9 E1 K( O; ?+ Q5 {
- char *dmabufdest2 = NULL;- m! ~1 C# C0 x% G
- + Q) M8 x2 L0 k) f9 |
- static int acnt = 512;2 D- _/ }- @9 O* u) `0 @( E
- static int bcnt = 8;$ H3 X' u7 Y9 s0 W, i6 U
- static int ccnt = 8;7 N3 H1 d( g, r5 F1 w: D) ?
3 B' U3 ^4 b1 d4 K8 t( b2 ^4 n8 a- module_param(acnt, int, S_IRUGO);) N9 W4 Y" o- _ E' H
- module_param(bcnt, int, S_IRUGO);
% b1 k8 T5 l+ y: N: `: _ - module_param(ccnt, int, S_IRUGO);
复制代码 ; d& E9 o1 f" G2 K C0 }* Y1 _. f( m
! p8 \, w) `6 f( ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: c, A2 B$ Y9 S" b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 h; W! y2 K" Y3 [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. j @' M# @/ w: }3 q& I3 ]
! m' p( P5 i: H$ S E& V: ~4 @4 S# k, _
|
|