|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- z a: J2 ~+ o6 v: b- [code]EDMA sample test application. K, ?5 m& _3 \; Z6 h3 Z$ o! {
- /*# z" t, E1 Q3 d# H& P
- * edma_test.c8 [- G. T5 v; y" q
- *
! {3 V- T; N& T. } - * brief EDMA3 Test Application. d! A2 s q& B' R. Z. n
- *- d7 Z! b W& p, Z$ q' g
- * This file contains EDMA3 Test code.
1 b! R6 @( z. v: Z. ^ - *
8 J: e$ m7 |2 H/ E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! A! i1 v( j0 [7 }: n$ O$ m
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! ?. S. f( d: K5 r$ v3 Z - * TO CHANGE.
. E- `3 C6 l& L1 o. D6 ~ - *0 [+ H2 `/ w5 C" ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% n8 O6 A/ [: L# \) |$ T/ n - *
# z3 U, R5 a3 X: x - * This program is free software; you can redistribute it and/or; |8 E( U; V0 D3 Z
- * modify it under the terms of the GNU General Public License as
: k8 S+ E; g6 I8 @/ z - * published by the Free Software Foundation version 2.
+ K3 [# W1 E, | ]! q - *
7 {8 r9 {$ ]7 Z# I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 ^/ U4 R9 q; o. e0 P; b
- * kind, whether express or implied; without even the implied warranty
$ @, R$ n& |. ]' _3 _& p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# o6 i: ^5 c$ g" _ K/ d7 v+ D* O- O - * GNU General Public License for more details.+ R! @3 L |- A! M) l* P' D
- */7 \ @3 t7 U, ?4 i% c
$ s+ Q# u/ o; |; N+ ~- #include <linux/module.h>1 z5 _$ f: m6 _& N
- #include <linux/init.h>: o6 D. h' C- ]8 O5 s8 J0 v
- #include <linux/errno.h>
% m% s, q+ H6 z0 A% M - #include <linux/types.h>* _* g) F: G1 Z* h9 v
- #include <linux/interrupt.h>
6 e7 r8 j7 w0 {" A+ I - #include <asm/io.h>( \3 b6 G4 i. a! {' n
- #include <linux/moduleparam.h>, V6 d. D! k. p6 n
- #include <linux/sysctl.h> H$ {" m8 R$ p+ w* y, h
- #include <linux/mm.h>
5 Z! ^5 Y5 h- S: z9 j - #include <linux/dma-mapping.h>' D" l7 P. Q# n# S
- $ m7 d3 w. x- O: w6 z
- #include <mach/memory.h>, W( c. h# T$ m g% x
- #include <mach/hardware.h>4 O1 R* B R: }& I5 E0 w) [" C
- #include <mach/irqs.h>
) O4 I* Q ?* `; A# n - #include <asm/hardware/edma.h>% X* U/ j4 N; C; E0 c/ Y+ `) B
- 3 n P; R# O& B
- #undef EDMA3_DEBUG5 ~. w* c& h! [) G9 z3 g* O
- /*#define EDMA3_DEBUG*/& ^) w: i: v/ q& t
- 5 l2 T9 @2 [' a, A& a6 F" m0 X
- #ifdef EDMA3_DEBUG
0 ?+ N* \% `# E$ Q. @' ~0 O+ N - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* b3 R4 t: G8 R2 q' f5 ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& j2 E6 q5 z1 X- j1 j: v6 ?' k
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* @* C$ a. P: p% g
- #else
7 K, J& {1 g# a! p( Q4 Z- [7 k - #define DMA_PRINTK( x... )* Z( F h3 d. n# X+ G
- #define DMA_FN_IN
6 F7 c1 t. X; O+ D4 Y - #define DMA_FN_OUT/ n: ^: c- _2 q8 X2 g
- #endif+ U6 l8 @& ]3 F
- 1 ?" ^: c3 K# U" A
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). d* r: N- B1 M8 K6 C) F
- #define STATIC_SHIFT 3+ D: w5 J* X8 K+ s/ w3 E. O
- #define TCINTEN_SHIFT 20
3 g. S, y! W0 a - #define ITCINTEN_SHIFT 21: k2 P% }0 J7 v
- #define TCCHEN_SHIFT 22% X$ i7 o( Y( n
- #define ITCCHEN_SHIFT 23
7 `9 g1 ~- z# D! ~/ j7 T& Y6 x
! S6 x s3 D# K4 p( p7 ^ _$ A- static volatile int irqraised1 = 0;5 @3 O4 G6 l6 d; G
- static volatile int irqraised2 = 0;
# m% n8 @! O% [
+ _% A: r+ t; \) u" Z/ f, N0 ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; [$ G; b2 N. k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# u) {2 h7 {0 q" L. U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 }+ u. \7 n$ n2 z/ k; X, r, G7 ~
& [$ y" G2 o4 E% C" l! T3 Y- dma_addr_t dmaphyssrc1 = 0;
: Q6 y1 I, L( n: v2 q# G8 M - dma_addr_t dmaphyssrc2 = 0;
6 t) T) t6 z) n' s - dma_addr_t dmaphysdest1 = 0;. y- j, L, w( K& ]& ?, J- t2 v
- dma_addr_t dmaphysdest2 = 0;$ {. {( z7 g' z2 c& c3 O0 k0 L% j6 {
4 V9 v# c# v- |8 _- char *dmabufsrc1 = NULL;% z2 K ~! V) j8 k
- char *dmabufsrc2 = NULL;
! c: \7 j# d- x& l - char *dmabufdest1 = NULL;
1 w: r. z9 A. M - char *dmabufdest2 = NULL;
! s* }, f( ~" b8 a% m. L9 D, E
; ?, w% u3 d3 {- v- static int acnt = 512;9 i$ H$ h, W8 a2 Z
- static int bcnt = 8;! Y& [ p/ F2 f5 Q) z% c
- static int ccnt = 8;
5 y9 P* Y; y _
: j7 w- e" v6 W j: X. [- module_param(acnt, int, S_IRUGO);
" F) K/ {* R5 D' t7 y2 X - module_param(bcnt, int, S_IRUGO);: ^! c8 s9 L, z& [5 W
- module_param(ccnt, int, S_IRUGO);
复制代码 8 }- P" k, w/ t' k+ Y3 i- W
8 \ _1 `4 L' ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& f5 @ j3 t. l! Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ C9 E: @, \& B4 w( s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* h B: N: N% {2 i
9 }3 n, Z/ L- L7 L9 n2 F I2 }/ h$ Y
9 n5 b" f- z. ]* M0 y0 B
|
|