|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 N* [8 x+ _+ _$ [- [code]EDMA sample test application
; ~ @/ }# V+ e1 ~ - /*
7 W+ ?+ r2 U; k9 O4 m' @7 R' l4 k& R - * edma_test.c8 d' G S' g4 S3 ^( W+ `
- *- R/ U. |! l" q. o
- * brief EDMA3 Test Application
+ o9 N0 f( [# f" g4 q6 M$ t - *
1 \8 ?* U) y2 A- G$ z: }) }* L - * This file contains EDMA3 Test code.
0 \) @; o) v8 A - *( }+ S5 h, s! t5 s$ n$ i% ~) r* S
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( o3 q! l3 k3 {9 d* H
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ I3 X! ~# o/ l, i
- * TO CHANGE.( h. B. U; B n5 d8 [, A
- *
0 ]% ~) }% O' e0 {' P - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ s1 ?9 N" Q' s/ w- U4 j - *" P1 [8 Z3 q! V$ u
- * This program is free software; you can redistribute it and/or
- `) X4 m& D4 B& X1 \' }2 E. t o: o - * modify it under the terms of the GNU General Public License as
' Q( H- k" T) _ - * published by the Free Software Foundation version 2./ F5 ~( m" `2 l# {& I& T5 U9 e
- *, z( x: C \7 r1 R
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( j1 {" J" O% a9 [ P6 e; q; x - * kind, whether express or implied; without even the implied warranty
5 F) ]$ R5 L* y5 a$ ~1 ~/ U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. T" v1 J+ Y6 ?" E; `- W - * GNU General Public License for more details.
, u. ^! C* f2 {9 F* o D/ b" p) } - */) L2 ]2 I% ]2 Z5 A
- : J9 n1 ^/ y0 l! H- B2 B, v
- #include <linux/module.h>* q, p+ p! ]9 j* B4 o3 P
- #include <linux/init.h>/ N. Q1 i" ?5 O0 e
- #include <linux/errno.h>2 L [; c, B3 s
- #include <linux/types.h>7 Y5 s F( \+ ?3 i
- #include <linux/interrupt.h>
- A( b$ }$ ^+ t7 f+ n( q - #include <asm/io.h>
7 \! e2 h7 p6 K4 s4 V4 w - #include <linux/moduleparam.h>: r* e& J5 ]7 |' p. _- ?- {
- #include <linux/sysctl.h>6 T1 I& g* i, `9 i" U5 A" @2 X
- #include <linux/mm.h>: a7 H4 m: d) \% ]
- #include <linux/dma-mapping.h>) t1 F0 w; I+ A+ i ~) N
- # w. c# E: f: ^. R) T
- #include <mach/memory.h>) h: o8 z8 d+ Q1 ~6 W
- #include <mach/hardware.h>
% @2 d( Q/ G' } - #include <mach/irqs.h>
; _0 U) r4 }0 [& C! V" n) a - #include <asm/hardware/edma.h>
; c, K: z1 y7 I - % C0 F3 D; z# Q( X, Q, V' K
- #undef EDMA3_DEBUG. m6 w0 Q. M$ q
- /*#define EDMA3_DEBUG*/
2 R3 A( \; c+ w8 K% ? - U6 ~8 q% Q3 |$ ]
- #ifdef EDMA3_DEBUG
. J" G6 h( z0 w5 e m. j/ G - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% P- K( B! @. Z7 P$ b' P5 p" | - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( U0 y2 T' s+ l% S& ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): ?) K4 D/ X7 e& F6 U+ E
- #else
. ]2 z+ Z9 q8 L7 A& l - #define DMA_PRINTK( x... )$ X2 N- j0 V1 i @7 o
- #define DMA_FN_IN; [! B. G$ V. t4 O) T6 j1 [! X! Y
- #define DMA_FN_OUT
; e9 |3 p) Z0 `, u( I. d; W - #endif8 e* X$ z, g, Z$ U
- ! U" R7 T! ~+ ~7 I( D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 g. C; s7 P+ O5 B: i+ m - #define STATIC_SHIFT 3
! l0 J; d3 A9 p& {) C9 P/ j a9 p' U - #define TCINTEN_SHIFT 20
5 P. ~' M* C( V7 [ - #define ITCINTEN_SHIFT 21
, B, C$ O' ^6 Z0 [/ W - #define TCCHEN_SHIFT 22' [! Y( X. u: V2 W1 |' }# t7 |& J
- #define ITCCHEN_SHIFT 23
8 ]9 d6 L9 j2 w4 @ G5 |9 ] |6 H - ]9 m/ r9 v! ]; y9 o) O8 c- T
- static volatile int irqraised1 = 0;. W% _+ o- F" @8 u% `1 o' S
- static volatile int irqraised2 = 0;
% @% G4 N; V: b* U4 Y0 [/ l0 _ - : ]3 n# f) k& u5 t, }) D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. _, u; l/ R# d' ]; i1 T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) g8 j+ y# E/ x1 X& u, l8 o1 ~. G/ v
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 i( p7 K* ^! x1 c$ g1 S3 X- U/ _
" Q! c5 f( c0 {( l/ }- dma_addr_t dmaphyssrc1 = 0;
9 n% U, @# d- y. y - dma_addr_t dmaphyssrc2 = 0;
6 i; a$ R; a0 o6 Y6 g5 N7 e - dma_addr_t dmaphysdest1 = 0;
4 \) X2 F, ?4 V/ ]* P$ Q - dma_addr_t dmaphysdest2 = 0;, W. ~: A) x" |- N; E/ _
- 2 b: M! i( v, |( I
- char *dmabufsrc1 = NULL;
- E9 ~$ @. f. d8 B! M" y8 I; L - char *dmabufsrc2 = NULL;# I5 o( Q- \( s4 k
- char *dmabufdest1 = NULL;
J1 s9 \ B8 h. } - char *dmabufdest2 = NULL;1 Y. {# L, I+ o0 C1 G7 X/ t! W' [
" m% D# U: J$ f6 Y5 e# _) E! `, G6 [- static int acnt = 512;
4 n; O) T; d2 P7 E! ^: _ - static int bcnt = 8;
9 c5 L" N$ O* o% | - static int ccnt = 8;
/ O- R2 ~* _6 }! v9 S, q1 [ - - D! H5 S1 X+ ?
- module_param(acnt, int, S_IRUGO);
) C. `' i7 C$ X- p) g! D; I - module_param(bcnt, int, S_IRUGO);
4 T4 @9 m- l+ [' t/ j% F - module_param(ccnt, int, S_IRUGO);
复制代码 ' i, ?" t2 L5 x; j# A7 a+ b. j0 I% K$ o
% a* e5 W8 w4 O3 j/ u6 G2 I. n: w. R% q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 {- x* P, @. R/ k. k: N; ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. Z- s- u( W V1 a1 v) k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 @5 z/ s/ [' b+ }9 n" f4 ?9 v1 w G* E E( d+ W" Q6 ^7 i& j3 X% j
8 q& C' T; e* u4 V5 h% J |
|