|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; g, }# u: D, Q# x% }/ e2 {
- [code]EDMA sample test application
3 t4 c( ]: _0 g& \; h0 O - /*2 o1 ?& R1 U% _
- * edma_test.c
/ ^; s2 a+ R* m5 w) { - *
6 D( n! H2 ~8 m/ X7 @+ T - * brief EDMA3 Test Application% ]3 b0 E+ l2 {7 f6 r
- *. Y" `$ S7 ^7 e% D, w+ }& X+ W
- * This file contains EDMA3 Test code.
8 r b$ z' A% Q4 ~) G: l - *+ A& L6 K7 c0 K% Q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# H' G; I! U/ d' `- B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! S/ H2 K$ S6 N2 V - * TO CHANGE.1 ]9 ^8 j/ `! `. H: ?
- *
2 e/ s' X0 I- {8 J - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
1 a) s( r9 {# g* F6 d% W" l5 D - *% G: N! ` _! M" [4 p+ C
- * This program is free software; you can redistribute it and/or4 z' q7 x% X M" o2 N
- * modify it under the terms of the GNU General Public License as9 t. L& l1 G, L% i- t3 c) l% h
- * published by the Free Software Foundation version 2.3 a% V0 {. L9 i% b& z2 t
- *
: ~# z8 D/ B9 K& [ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 r- H9 m% j% M, _* z6 J; g! _9 o - * kind, whether express or implied; without even the implied warranty
; Y$ ~$ r5 W6 F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- E9 U {0 V% ]% K
- * GNU General Public License for more details.- [! s; m) F _: W& Z. m, j) {
- */
4 x1 R5 G& u) Q; c5 V - 2 ]; O B( X( g
- #include <linux/module.h>
2 E+ D: p' }8 i9 G - #include <linux/init.h>
7 c. A8 A9 _4 @" M+ _6 M - #include <linux/errno.h>
, P9 q; J' t0 B5 T6 e - #include <linux/types.h>2 r6 A! v$ e3 W: A3 B+ y
- #include <linux/interrupt.h>" S8 n6 r- G5 r# l3 o1 o1 v* F
- #include <asm/io.h>; Z+ T$ u3 g% F Q
- #include <linux/moduleparam.h>
) `9 c# b/ a: J" G/ Z' e. K4 q1 _ | - #include <linux/sysctl.h>, u! n) z, s4 W7 I( I: h |& g7 ^
- #include <linux/mm.h># T! B/ ^, D' Y" |9 A
- #include <linux/dma-mapping.h>" `$ v" z6 s' Q2 {% E" y3 _2 N( ?$ ~
- $ q% [* F& n9 |- g6 g8 U
- #include <mach/memory.h>
T0 K' p% B+ g0 O3 V5 n' r - #include <mach/hardware.h>
$ r+ o+ o9 o% T7 ~( G" e - #include <mach/irqs.h>. S3 P* [& Q _ [% F2 p
- #include <asm/hardware/edma.h>/ r3 m$ k6 A* m$ Z( F
" I) Q* q7 \/ h4 v* ~% C) b- #undef EDMA3_DEBUG, ~% W1 ~9 b( ]% r, `' t- y
- /*#define EDMA3_DEBUG*/
1 I# o+ y, C; [2 \# t. f6 |0 S. l
; n- u8 s; h: v. t+ }" L- #ifdef EDMA3_DEBUG& I2 {; m+ k: T+ l, B
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 Z. U/ N+ ?4 @/ C+ G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 h9 Y8 o5 S6 u6 H' ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 H/ m% Q. ]: Y+ M5 e - #else
6 V' r. c7 C/ p" _% M' X3 i' J - #define DMA_PRINTK( x... )% l m; p0 C- f$ Z
- #define DMA_FN_IN
4 _: L2 o8 G. _) T p- V- ]. S' j - #define DMA_FN_OUT
7 _4 i* G& T# W+ U - #endif
* |, @. U: k$ |6 Y; p# N
8 k8 C# b0 H$ c/ I' I& N$ g/ B- Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 C I u3 w: i$ K1 z7 o - #define STATIC_SHIFT 36 Y0 F, l" U% ~& C7 L
- #define TCINTEN_SHIFT 20
% }' s# ]2 i0 y7 d - #define ITCINTEN_SHIFT 21+ T" t9 T% u6 U0 A% l
- #define TCCHEN_SHIFT 22
; O! `+ a& B; w( P( {0 f - #define ITCCHEN_SHIFT 23
" K3 t. q! _- {9 ~1 u
# A/ ^: O1 g5 F/ p0 c7 o5 s7 X- static volatile int irqraised1 = 0;2 n7 r, p4 T) }% x* L9 O2 v
- static volatile int irqraised2 = 0;
9 a$ @! ~$ l5 U3 `/ h - 5 [3 @0 I5 M* A p+ L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ F+ \% Q! e+ K5 u! T5 s# z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- k/ M3 `8 K, l- I6 D% v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); `+ m% V9 U+ l. r2 G9 B1 [
- * B& k! {- m# \2 p
- dma_addr_t dmaphyssrc1 = 0;+ Z3 s- q. [* |2 P8 L
- dma_addr_t dmaphyssrc2 = 0;5 `* Y% p5 S9 ]* |( j4 F( s% d' M1 p5 q
- dma_addr_t dmaphysdest1 = 0;
" ]6 K) h% }2 K1 U. j) T3 g1 F - dma_addr_t dmaphysdest2 = 0;
7 r/ R q- j* H! ~3 f& L& _ - + m# S1 K9 T4 _2 p
- char *dmabufsrc1 = NULL;# k# w4 |' ?9 R: R. o2 Q3 A6 x* d$ c
- char *dmabufsrc2 = NULL;
* I& q) ]. ]/ l! K2 k - char *dmabufdest1 = NULL;
5 \; A2 q: p3 _& a2 u - char *dmabufdest2 = NULL;* l: D2 y! w# _1 V, V$ @
- ) s' P9 ^# B5 ^" ^% S+ c- e
- static int acnt = 512;
% W; z1 S0 V2 b - static int bcnt = 8;! p' D" l/ Y' w& A7 z6 Y
- static int ccnt = 8;
1 N# P* ~) |$ W: ^
" h; ~0 a, }, C1 W! ^ m- module_param(acnt, int, S_IRUGO);
' O$ M. a# t1 H% M, [ - module_param(bcnt, int, S_IRUGO);& O: ~, V- P1 \
- module_param(ccnt, int, S_IRUGO);
复制代码
[+ u% O5 F) _! h; l" T; e- @4 v
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! {6 c$ p) L7 H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 [ y: p% e6 x) S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( c0 i! X( X# m/ `3 O
& m2 M' d7 N! k! e& T1 y: V0 z
, ?4 m: ?$ J& v% q6 r$ R: o |
|