|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 I9 s0 M' o/ w2 t
- [code]EDMA sample test application
# O0 j$ g4 |' ~! m6 m# v- L. ? - /*' x. |4 F ^6 n
- * edma_test.c- G& c5 @7 d( w( @3 e9 @
- *
' Z, Y) I! C% [- A; T- X - * brief EDMA3 Test Application2 N& e: {7 k% u) h& U
- *6 @3 L9 ~( k' K/ d, T
- * This file contains EDMA3 Test code.
( w+ @% K) M; h& z. Z - *5 r* S1 H. o2 J3 H8 t& K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! {0 N- \) T; E0 A% n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- Q, ^; ~) l. \3 `& r; V! b& C0 | - * TO CHANGE., |1 \$ p3 I6 z( G+ s4 m! Q$ ~
- *& G2 e9 D) u& q4 d+ |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ k1 r' a- |: L9 \$ o
- *& A( i; s8 T. _. {/ C. d
- * This program is free software; you can redistribute it and/or- S6 S! E# z4 B U. Y3 _% g
- * modify it under the terms of the GNU General Public License as3 [. d6 f, L6 d3 P5 P/ ]0 x
- * published by the Free Software Foundation version 2.
3 _" b: _( q, O: m - *" U; p: f8 {4 W* D
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 h; F8 B/ [3 c6 R s; J: O1 l - * kind, whether express or implied; without even the implied warranty
, Q( Q, D- [0 A; O; ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; E, g7 E8 w1 K0 Q N; [ n
- * GNU General Public License for more details.
& x: j) U3 }% f. M* R9 N) [$ Q4 {" o - */5 l& G0 g; V0 E# n: Z! _8 r! u1 O
- ! [2 @* V9 ?' B
- #include <linux/module.h>7 o, [; s5 T8 r
- #include <linux/init.h>
r: X. G' p# J; l. X' W - #include <linux/errno.h>
( x: _9 O; u. J4 r" v! ?# n# T1 l - #include <linux/types.h>1 ~# P* Z3 [3 w( m5 T7 j! r
- #include <linux/interrupt.h>3 u* C. o/ S/ x) o
- #include <asm/io.h>
6 d* I7 z5 A% K# a3 C2 x - #include <linux/moduleparam.h>
0 m1 J3 `6 k5 t# C6 f* |. r - #include <linux/sysctl.h>
% `3 c+ I+ x& u1 b6 _/ W - #include <linux/mm.h>' I: \& ], X; s0 }2 P& {
- #include <linux/dma-mapping.h>& {7 |3 t4 r4 w
1 `9 ?4 Z# j# ~3 p, {8 c" {' M- #include <mach/memory.h>) x1 s+ T$ n* f. \* x3 W$ ^8 S0 u$ u
- #include <mach/hardware.h>, Q6 d! i7 U+ d0 E5 A6 n% {
- #include <mach/irqs.h>% _% b: a# d7 ]. p+ f
- #include <asm/hardware/edma.h>
* S% u( \6 x1 U1 v& d - % F, d# ] Q9 @( W
- #undef EDMA3_DEBUG1 y) Y8 F) `! O, C! q
- /*#define EDMA3_DEBUG*/
: Y0 [9 U# P3 U6 e9 N
) Y# m* u! p0 b1 z l- #ifdef EDMA3_DEBUG
) ~; j9 e1 t8 m1 R2 _( f" Q) a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" P2 h o# K% M! m; P1 J
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- L/ Y8 i6 i4 L. X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 O0 Z1 w9 R. [: b2 _' d
- #else
0 O+ I# g& R. ]1 E2 E - #define DMA_PRINTK( x... )2 i! z3 ?! w L" g) F
- #define DMA_FN_IN6 |4 \- Z- [9 z# \
- #define DMA_FN_OUT8 D2 o# O b F/ v
- #endif( o( P3 A, _2 R8 s
4 |8 H' E" p$ m8 P- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ w$ r$ |1 e" L - #define STATIC_SHIFT 3
" w9 F/ C4 j! a; Y9 v8 h" k - #define TCINTEN_SHIFT 20
) U4 h5 v, O+ W. J/ M" q- V - #define ITCINTEN_SHIFT 21
/ q- j- k' S6 M+ N' _; D0 F0 k' a" f - #define TCCHEN_SHIFT 22
n7 T: @4 |0 z. b( j - #define ITCCHEN_SHIFT 23( S- a& R u2 y
- ' t; G& ~2 T6 a4 ~6 a( V
- static volatile int irqraised1 = 0;
?1 y6 v; t4 \" \" W% j# c E2 C - static volatile int irqraised2 = 0;
' S J5 w* A8 z( y- l$ H, N: z
1 s! A, t( l. y4 r9 ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ H6 p3 q5 ? u# K2 X# k
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' N+ T4 l9 S ` p( d8 R. [6 P3 Q1 w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 c* N6 F G5 l4 g
: K" W- d5 T+ o& v6 C8 u( a7 m1 J- dma_addr_t dmaphyssrc1 = 0;
0 W: x7 ~* m/ W# y - dma_addr_t dmaphyssrc2 = 0;
I; S/ w) z( x, k+ t7 q - dma_addr_t dmaphysdest1 = 0;
5 P# b7 _, ]: z) [8 y - dma_addr_t dmaphysdest2 = 0;
1 G. }: B5 W" B3 B/ a* D
. H$ A V/ m6 D% P/ \- char *dmabufsrc1 = NULL;
1 j- O3 r r9 B! Y8 V3 y/ j7 U - char *dmabufsrc2 = NULL;
$ a3 m X$ I2 U# H- \1 x, C5 p - char *dmabufdest1 = NULL;3 z/ T P/ E! t/ D8 {3 J. C
- char *dmabufdest2 = NULL;
# ~/ j) Q8 }( L# ~8 t# J' U
9 W- _6 b$ Y t- static int acnt = 512;
: S% _' b, D, w4 r2 N" q; _ - static int bcnt = 8;2 j8 N$ ]+ V+ H7 [2 F9 h' i
- static int ccnt = 8;
6 \) i- V- k4 Z- [6 ^ \0 P r - " o4 d) o# |, z( X5 `4 H( J3 x
- module_param(acnt, int, S_IRUGO);$ Z4 i' F( T( a1 Z
- module_param(bcnt, int, S_IRUGO);* B% p8 s/ ?1 o. v) A: p5 n
- module_param(ccnt, int, S_IRUGO);
复制代码
$ l2 s& h1 f2 Y# D+ e, a+ n& J) `
, H* J) z& L2 F7 b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* Y3 Q9 U+ S5 `. U# A$ J, Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 l5 F8 _, ^* r8 K 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 G( @ L$ t! ~' B: _9 K, k8 c" w
# h3 h% M/ K5 l5 ] |
|