|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) J0 u( T/ }. f* n+ f3 e2 R. q
- [code]EDMA sample test application
& ?& q; Z7 e0 B. B' |8 Q; b - /*
# E( ~9 }$ A9 } - * edma_test.c
1 ~" L$ T" z5 ~1 l" |5 z/ c$ [# F - *
: o! f w# g, T( ~) L) B0 R& N - * brief EDMA3 Test Application
, A+ F5 B$ m9 F, `- K) T" Y - *0 g/ U: G O2 c3 ?2 W9 ~$ q1 T2 W1 ~
- * This file contains EDMA3 Test code.
2 m T: t6 {2 Y! E- C: ^ - *
6 M1 R) I: c3 x d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 D/ t( s2 |$ J( M s; Z# L# t; {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* V7 w) M9 }' A( `; h - * TO CHANGE.) I: u% P4 T- `1 G% X
- *
7 {4 H+ \: E( d - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 ^& B z8 ?* p
- *
2 Q9 i8 [" M2 \; H, E6 D - * This program is free software; you can redistribute it and/or
0 ]! Y1 s: R" [ - * modify it under the terms of the GNU General Public License as
; a$ s* e3 y6 u1 ~ - * published by the Free Software Foundation version 2.
+ W* e" M' Q* \* B" ]$ \ - *% F6 {- c+ W0 J( _2 V3 r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 c8 d3 u% |1 @' k - * kind, whether express or implied; without even the implied warranty9 @7 p( c9 S- z$ @2 a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( ?1 Q! j; [+ {6 N2 _( d
- * GNU General Public License for more details.- e" [4 R/ K+ d. A) Z
- */4 }5 e$ e% D9 A( e) ]# S
- 2 |9 F( {# N! w- h$ L, H5 {4 q
- #include <linux/module.h>- E' t, T2 u& s7 c
- #include <linux/init.h>
o3 {0 N4 D! N: R% v - #include <linux/errno.h>
5 b/ G5 _: Y* l, O/ R2 J8 T+ q0 L - #include <linux/types.h>3 u, a$ b! u: u. K
- #include <linux/interrupt.h>
9 R( h- [/ G8 R: P4 Y* Z' L5 |6 S& T, | - #include <asm/io.h>7 O3 o ]" C* o$ c; Q( ^
- #include <linux/moduleparam.h>) T* C) K6 M4 w4 L
- #include <linux/sysctl.h>2 t/ _2 m# I1 {5 r! d- y
- #include <linux/mm.h>
0 R5 ` ?9 h* F9 |6 F* J5 y4 q, j - #include <linux/dma-mapping.h>
" n {9 _5 p& E- x. `1 Q8 I
5 N5 p* i9 E7 |5 S- #include <mach/memory.h>
% B4 X$ n6 x% Y# L9 d6 y$ ~ - #include <mach/hardware.h>( Q2 h$ ~( z) n) g0 T$ _
- #include <mach/irqs.h>: R* ]5 U: p8 Y$ r M) Q
- #include <asm/hardware/edma.h>+ o6 B$ _: j/ e2 E1 m
- $ O$ V" K9 e; Q- s+ x2 o4 d( o
- #undef EDMA3_DEBUG
& i; h8 \8 I6 Z4 ` - /*#define EDMA3_DEBUG*/& a A5 b5 s" R9 _2 Q8 }: m
$ y% z( {. T( y( c: }- #ifdef EDMA3_DEBUG" `3 E- D8 g$ T9 t6 p% t
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
|. L9 s% k* \1 v' j" G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 l/ U, Q# N$ i9 i* I% T4 {/ z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' X# E# D5 ^, }& @7 k" w! D' O/ L
- #else
+ m9 i2 x! o1 c3 l$ Q3 l- Y+ M3 v - #define DMA_PRINTK( x... )
4 v5 ?8 |/ k8 n3 \4 u - #define DMA_FN_IN, I$ q- v2 P1 q0 U$ m( V4 }
- #define DMA_FN_OUT
, U! M3 J, V9 M* X" b* f - #endif9 r, M Q- Y, H1 f# o) P4 M
+ Z& E0 V/ M' K- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 a( [( c: \, A. a
- #define STATIC_SHIFT 35 `1 D1 Y2 y* a6 u; B
- #define TCINTEN_SHIFT 20. _# C! O0 X% ?
- #define ITCINTEN_SHIFT 21
: Y) A, o4 F) k( D( F, J - #define TCCHEN_SHIFT 22
, I/ I$ K# j! [' V* E - #define ITCCHEN_SHIFT 23% R( D# ~1 {9 y$ p7 M8 Q2 w
$ E" A8 r& p3 W0 G% ~8 b) p) b- static volatile int irqraised1 = 0;
$ y4 n/ k) z# I& ~ - static volatile int irqraised2 = 0;
- H8 K. Z ?9 x - ! @# w0 d5 f* H9 \. a+ ^4 C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ S- E$ N# ~! F2 E - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ y' k; b0 D) G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- U T' g8 Q. w2 T4 X9 @, s, i
9 |! t8 ?* p8 O0 K. X7 y g- dma_addr_t dmaphyssrc1 = 0;
0 k! U, t) R1 x; c - dma_addr_t dmaphyssrc2 = 0;: P8 k9 }+ O* b1 R5 S
- dma_addr_t dmaphysdest1 = 0;$ b; H( k) M( m4 f6 W2 @ H
- dma_addr_t dmaphysdest2 = 0;. |$ y/ V e5 U: v0 B6 H
! J' h' n4 C* {# `6 Q- char *dmabufsrc1 = NULL;
! d" O$ S5 H( l3 \; [9 n. j, ^9 Y - char *dmabufsrc2 = NULL;
4 d5 c% O5 E+ _; E! c - char *dmabufdest1 = NULL;
+ j' u& @- b; b$ D+ f. ^' {# x; K - char *dmabufdest2 = NULL;! |+ k$ U' z6 G0 ?$ y
, r* p) M1 \/ }- static int acnt = 512;
2 k( H/ ]+ O, O: _* [8 Z2 l. ? - static int bcnt = 8;
' N& A- z) G4 r- { - static int ccnt = 8;/ B8 F l) i7 ^+ h: F
0 T: K0 |7 l- Q& M, ~# f- module_param(acnt, int, S_IRUGO);
3 n) }3 o8 q/ L) l' y - module_param(bcnt, int, S_IRUGO);
+ ?$ D! G) X- q7 o4 H - module_param(ccnt, int, S_IRUGO);
复制代码 : h; \8 N6 p" R. o5 ^0 j, v) n+ J3 d/ F
( d3 R) q) q' b/ \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 r1 _9 i" H" o8 h. `! k& K: Z7 T
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 K$ o9 P/ M$ t8 B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! r9 U3 r( o8 E8 E4 {8 z% T
# y! c+ I( [: X# w9 i% H* s; h. R' h- U* S* Q: O
|
|