|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! n7 C6 f; l5 J
- [code]EDMA sample test application2 V2 Q* L* K2 H' c% y( @; @
- /*
8 z. y% U% A% R/ |; \ - * edma_test.c
. O, O4 K; `3 z p) z - *
0 E4 X- I; ^- Y# y# v - * brief EDMA3 Test Application$ U _ `5 T7 i |" f( e
- ** i% t: ~1 f' |2 v9 H$ ?4 [/ k" y
- * This file contains EDMA3 Test code.
5 J5 c% Y4 p1 n$ V( P - *0 U8 K2 Y# @( d z# O
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% I+ \! t+ O0 W0 T+ ` - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; V$ Z3 b% o$ q y, z - * TO CHANGE.1 j% s' s: i+ B0 V
- *# e5 {* L5 C, g. N( F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 P) D# m' u2 e; u& r - *
8 ^4 }7 k+ f! j - * This program is free software; you can redistribute it and/or% T* I( j' w5 r( c9 C& h- X
- * modify it under the terms of the GNU General Public License as; |' }' v5 M: q9 U. A
- * published by the Free Software Foundation version 2.
+ E/ _( g4 z. l2 S9 | - *
$ k( e( F' b4 K6 c- i% G' ?1 @ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 o E! G* [* Q( b" @
- * kind, whether express or implied; without even the implied warranty
/ b4 v, i0 l0 f/ p5 V0 \9 @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! y5 J# v" ^& B% T - * GNU General Public License for more details.5 o7 o4 `5 R- U
- */# {1 [. M! h( b0 ^" g
- / H% H+ W; i% M+ E
- #include <linux/module.h>
) p3 ]1 l1 ~9 i! Z/ Q4 @ - #include <linux/init.h>% \( }( X N) U* E0 h6 Z& J# v
- #include <linux/errno.h>8 K$ V; U; a1 O0 V5 c4 D
- #include <linux/types.h>+ {7 N: E( G( g0 a/ ?* `
- #include <linux/interrupt.h>- N- m- |1 u* l
- #include <asm/io.h>% E7 g* m s4 Z' P7 J; g, g
- #include <linux/moduleparam.h>
, T3 k4 D1 ?+ R: P1 |0 k! X) w - #include <linux/sysctl.h>
& s z/ ? r w1 | - #include <linux/mm.h>; g! s$ H( ^; {; z8 G2 ]
- #include <linux/dma-mapping.h>
9 l, }5 q; P4 b: z5 V& ` - ' |7 A! M/ f4 u6 t9 g
- #include <mach/memory.h>
& A. I4 a( v0 f- n" Y - #include <mach/hardware.h>
8 _8 y1 u9 i) P - #include <mach/irqs.h>+ `1 n" u* V% Y& m" G* y
- #include <asm/hardware/edma.h>4 x g* c2 A/ d5 `
5 L3 W2 `- t' @& F( j4 {# {- #undef EDMA3_DEBUG
( T: A# d# E! @% f( e - /*#define EDMA3_DEBUG*/8 P9 f( ]3 b) v/ H8 s
- 4 h& P9 {' Q+ ]6 H7 d; _
- #ifdef EDMA3_DEBUG1 A9 B) ^, a2 r c6 x
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). m$ o2 m) V) h
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 o2 n% v* J& o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). G* m9 {# M* U3 c# O7 u. t
- #else5 H) o8 w1 E7 M! `2 w
- #define DMA_PRINTK( x... )' S1 p2 o9 E# U9 d6 ]
- #define DMA_FN_IN* {! H+ a) y1 |$ @8 R
- #define DMA_FN_OUT* a' j- L- _- Q3 H
- #endif
+ d: }0 v& x( x9 V5 Z7 R& s
, H: |6 I7 }+ p6 u, m7 P$ f- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 t5 g, z0 _1 X: A4 } - #define STATIC_SHIFT 34 n6 D/ }- q4 \- i W+ ]
- #define TCINTEN_SHIFT 20
, u* v' D# S$ \" g( T - #define ITCINTEN_SHIFT 21- U: Q7 _/ T% \* s
- #define TCCHEN_SHIFT 22; ^7 W0 V/ e$ W& q3 Z. n
- #define ITCCHEN_SHIFT 23
0 v7 K9 J; d3 a3 |* K" E
$ Q$ S3 U8 x4 \. S2 I0 U8 U- static volatile int irqraised1 = 0;
& [+ M) Y. W9 O- U# ] - static volatile int irqraised2 = 0;, e" {6 |4 `5 e. ]. R. Y S6 K
- ; x) b; w l7 I- s: D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 E+ a0 K8 G6 D5 j% T: o0 e$ q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* ~3 p O* ^6 o+ H( \$ `9 K - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: L; B/ \. Z5 j, s% i. b( {) ?
d* W) u5 C# M' X- dma_addr_t dmaphyssrc1 = 0;
) x4 }8 D( r4 g6 f& S- c - dma_addr_t dmaphyssrc2 = 0;: ~1 h: T, U7 E5 _- M9 }4 K
- dma_addr_t dmaphysdest1 = 0;
; C) Q( N2 H9 V - dma_addr_t dmaphysdest2 = 0;
9 g7 @' u& \2 s; i a" \
, f. p0 F4 X" |) O) y- char *dmabufsrc1 = NULL;
7 v" W# B% p% E1 L0 l - char *dmabufsrc2 = NULL;
9 z( d5 K( J4 m+ c - char *dmabufdest1 = NULL;
" ]/ i' r l7 D4 V; U" E0 @ - char *dmabufdest2 = NULL;
# }! {% A5 J9 Y
4 l9 n2 l _7 B( C/ c- R- static int acnt = 512;
' k) O5 g* f( Q2 h/ L7 h* D6 S - static int bcnt = 8;
0 O9 l% S7 o( \1 i. { - static int ccnt = 8;- r) W8 i0 o" _5 u
8 r# F e7 B6 B- module_param(acnt, int, S_IRUGO);5 W) y0 d$ j& X: Y6 T% J
- module_param(bcnt, int, S_IRUGO);1 Z7 a) r G) B9 d
- module_param(ccnt, int, S_IRUGO);
复制代码 + ?8 d5 K$ m7 @7 f
x( D+ E" ^4 D# a( A 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! d5 R0 s; \6 P2 L# k/ U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) S& Z1 ?0 D6 }; E6 Z- a4 F; {3 C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% W% ~( G9 W7 J/ t' e+ ?6 F. t* w3 i. ?: C
4 A- y! M2 E9 c) O+ ] |
|