|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" m a6 p0 k* |- c; v& a+ S; ?- [code]EDMA sample test application
! o) E) O' n. \* d" J - /*
+ s3 f" z; G/ z, E - * edma_test.c5 r# L- H9 S8 M- k
- *
8 e- U* \, J$ e: ]) J2 [5 _ - * brief EDMA3 Test Application# A7 j" p) @4 J7 T6 c8 j& g
- *. J0 v. A" ], t P* h* `
- * This file contains EDMA3 Test code.
; c$ V# J( E% h: A, e - *
/ C- c# M! e* I3 b' ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ K+ _0 v7 R7 s - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* b; x6 S$ P9 d; _ - * TO CHANGE.* M p* M- P, [
- *
7 m8 |, s+ d% J) k) Z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 B, w, v6 t2 I6 a- X1 T; a
- *" S8 i1 \( {8 t& [' _6 j
- * This program is free software; you can redistribute it and/or4 _4 Y- L3 B0 z, B! p5 h5 N$ R0 b
- * modify it under the terms of the GNU General Public License as
; j' s3 {+ o) Q! ]7 b# Z3 v - * published by the Free Software Foundation version 2.8 R6 H: g% ~0 z& e8 J5 Z
- ** b& f- r' ]% J' z* s
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ R6 a" i) d1 @, [) I
- * kind, whether express or implied; without even the implied warranty( f: i1 H7 R8 i/ s* Y8 X9 Q0 _, B
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( k% c% I% }& f0 X
- * GNU General Public License for more details.
6 X$ h1 ]: p+ t' y2 j; u; { - *// {- @1 p d Z' b; r& C7 I9 \' A! \
- n' h! _! L* D5 o- #include <linux/module.h>
( s* ~+ }5 W9 Y0 V9 E+ F - #include <linux/init.h>
0 p4 h' a+ ~. _& q! _% l/ V - #include <linux/errno.h>
3 n. _* ^5 e+ k) K1 k. }) f - #include <linux/types.h>
/ \" [6 K$ q9 J5 Y" x* f" c: |4 j - #include <linux/interrupt.h>
, _) q7 S3 Z. w8 M/ ^1 I0 ^8 | K - #include <asm/io.h>! X1 }9 ^* n7 }* |1 a" D
- #include <linux/moduleparam.h>
8 g0 I4 G, \! J - #include <linux/sysctl.h>
1 L$ Z3 s& Y) h - #include <linux/mm.h>2 A7 k: D% D. s- j- v( `6 U$ w
- #include <linux/dma-mapping.h>
( d% {, N' {, E9 x" A" G- Y
3 T, w- p( \/ ? ~. `- #include <mach/memory.h>, G& K* E' u; D2 S* l0 ~
- #include <mach/hardware.h>) m3 ^3 J9 L7 `+ d
- #include <mach/irqs.h>4 ` z1 x$ \1 X) e! q5 ^! q
- #include <asm/hardware/edma.h>. M$ s2 g, j1 b* e1 X
- ' I7 H+ }4 ^; \& L3 b" S
- #undef EDMA3_DEBUG, g, A0 r/ q7 ]* Z
- /*#define EDMA3_DEBUG*/9 g5 K9 d$ q! {
- # ^, N! Q) q7 o. F9 l7 d
- #ifdef EDMA3_DEBUG
+ ~9 \- r3 n9 D5 X' n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 `, {& X; }, E, ~8 w o& p7 O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# D+ q9 j2 i% t3 |0 m2 U7 z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: h* i0 ]9 n8 s, j1 z) o - #else" @' K! W7 V7 R: v. Z/ K
- #define DMA_PRINTK( x... )
* y0 I+ v. ?0 U M - #define DMA_FN_IN
; }6 b# G2 n. X' Q; w$ P, N7 |/ G: l) z9 O- Z - #define DMA_FN_OUT7 J; [& I- S' k" x
- #endif
: `; R" h0 _! a - ( a+ S5 x' H. h% n( Q- R: [* @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): {$ G# K5 P3 f1 {4 |9 w7 x
- #define STATIC_SHIFT 31 A& U2 Q0 D8 H' h: K) t' R
- #define TCINTEN_SHIFT 204 ]) ^ n. V% I+ T
- #define ITCINTEN_SHIFT 21
# v6 E; R# S( `7 B$ z) Q - #define TCCHEN_SHIFT 22+ ^1 @4 t5 L+ C X$ ~) B1 W! s; C2 `
- #define ITCCHEN_SHIFT 233 E) v1 ^) }6 T- W% ?$ ?
- ' X7 d9 x* {% T$ U* t1 B ?) S
- static volatile int irqraised1 = 0;
. k H2 ^0 n( M" S - static volatile int irqraised2 = 0;$ o a! Y- Z) r" S
- 7 G- ^; B5 ?1 C- ?, n1 g4 V' d
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# g# b9 ~% i: w0 R/ v" M: h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 H+ ?6 B3 |% D' N* T, O3 e: O# ~ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 O% p3 ]# R2 W K - 0 e. x5 y! X y$ [* l
- dma_addr_t dmaphyssrc1 = 0;8 P6 S+ I5 B9 d) D+ \
- dma_addr_t dmaphyssrc2 = 0;
% Y/ a- D2 ^8 [+ X, ~( ] - dma_addr_t dmaphysdest1 = 0;
! Z$ @7 ^$ G* e! [ - dma_addr_t dmaphysdest2 = 0;7 Q% R. h8 y+ C, B" }, u
- ; C- s; r4 C- W+ g9 {1 j o
- char *dmabufsrc1 = NULL;
: s: z& U; L3 M( L; [% l - char *dmabufsrc2 = NULL;$ b7 V+ Y/ F$ J! j! {8 b! \
- char *dmabufdest1 = NULL;
5 I. N) f6 p' g - char *dmabufdest2 = NULL;
6 n( _( j$ K4 C s) B/ P
. W$ {# T) M- {+ Z. B- static int acnt = 512;
; R/ @ {( k+ ~8 Z% a+ w - static int bcnt = 8;
2 A9 I/ l& X; h, u# _% q - static int ccnt = 8;( D" n5 W& s: i" v& ^
3 Z2 {: _6 _4 ?2 f3 G$ w2 p4 [- module_param(acnt, int, S_IRUGO);
% c l2 D; m' [* k - module_param(bcnt, int, S_IRUGO);
5 S+ T I9 o; t2 y9 d8 Z6 C - module_param(ccnt, int, S_IRUGO);
复制代码 ' f* H2 H/ z& F$ `: a! G
& l& q$ e( s B. @1 B/ u. g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* K% W( v: W- H. Q% 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' d! A; g: O) c p! f+ t4 W
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 H7 [2 R; ?8 A3 a/ d1 p
# p4 b# G# w# [1 R# \( f2 b: p3 Y. @/ N+ d2 @$ n
|
|