|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 [4 g7 |0 y D) Z+ g2 } r
- [code]EDMA sample test application- }5 I8 [2 P/ n' ~( C
- /*
! \: t7 E: h# l% M; _' ]' t - * edma_test.c
; r# ]+ a" U2 B: S9 f - *
4 u* A1 M8 l5 o - * brief EDMA3 Test Application! O4 f9 ~! ]( s3 _5 _2 Z
- *$ n6 S9 P1 P3 h$ F |
- * This file contains EDMA3 Test code.0 n! D$ _/ G, b/ C8 b1 |2 A5 g& ^+ O
- * ]6 k- A2 d' C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- p% [, `2 g5 R9 v! O; s0 X
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& F8 }+ _: [: {: _
- * TO CHANGE.
: T7 H" a+ w! O% p7 L) S1 [! H1 b - *; X+ |/ L# t( L" V2 h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, _1 @8 {8 I7 N, U! S3 S
- *
: t7 t0 L6 E6 k0 B9 \. J! u - * This program is free software; you can redistribute it and/or; [* F& ~7 n5 S
- * modify it under the terms of the GNU General Public License as
, D i! I& ]% Z - * published by the Free Software Foundation version 2., k- @9 M! J0 |% v- d+ [) q
- *
/ K K& M2 r6 m: | - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& E+ s, H) z6 L6 }% A0 p$ v! g J5 b- h# f
- * kind, whether express or implied; without even the implied warranty: n4 o$ G* t" L, }/ f- ^! Y' K
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 W% I3 v6 W1 n) Q& s& i - * GNU General Public License for more details./ q3 j+ c/ D( b1 l; [
- */9 k, s$ r8 O8 R, o
- & _4 F I- u; S; o
- #include <linux/module.h>
. T' R) H; t0 U) w! ]/ j1 G* X - #include <linux/init.h>" Z: _) K* }! ]( U8 ~3 a
- #include <linux/errno.h>/ C2 n' Z+ c" D* l" X
- #include <linux/types.h>9 O5 `0 S, m: D1 A) o
- #include <linux/interrupt.h>
1 r! h5 w/ X+ _8 g9 H8 c* e; u8 I - #include <asm/io.h>
& g) _/ M- C. m+ L) O& B - #include <linux/moduleparam.h>% F8 e: y0 g, f$ J' _
- #include <linux/sysctl.h>
% c0 L% }2 r4 J - #include <linux/mm.h>4 i7 {) h& k* g# m( f$ t2 j, G% u1 a
- #include <linux/dma-mapping.h>
- [( K7 V. u, e/ Q
: T" ]! \" M) F: T J' F- #include <mach/memory.h>
# \$ y0 y/ E* I# H0 |& z - #include <mach/hardware.h>3 X' g: [4 t& @! k: Q7 t. ~) X+ `
- #include <mach/irqs.h>
: h) |- m$ S. a( b6 h: _. o* V$ @) c - #include <asm/hardware/edma.h>
$ D! w4 j# F% r: x
9 l3 ?6 s% G9 f/ {1 ~ ]- #undef EDMA3_DEBUG/ @1 ^0 K2 J/ D" R4 v
- /*#define EDMA3_DEBUG*/" a- i+ F2 q8 M& ?. P9 f
- g, B, A# x" O% d( ?- #ifdef EDMA3_DEBUG# W- M! s# P7 W& `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- @& I' j& [5 l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 X# y: D$ A& ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' i4 t, {; X8 U: r- l0 S
- #else
" g- w" D8 n# ^. M& c* Z0 Q% X3 S0 z, v - #define DMA_PRINTK( x... )
! V) P( [: O8 X. F3 ]$ _! ^3 Z2 g - #define DMA_FN_IN
A2 ^0 J! W: C9 f$ _; R* v - #define DMA_FN_OUT c% v+ f6 d; Y2 B7 L# ?4 a
- #endif$ v( x9 W9 J: ~+ a S4 t+ t$ x# a
- " V4 x ]6 k# D* F% l( g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; p5 K/ _! T; I& E - #define STATIC_SHIFT 3
& F) ^' E- V) x- [' S# x0 u - #define TCINTEN_SHIFT 20( L( a2 y/ ~( ?# r8 G& K3 u
- #define ITCINTEN_SHIFT 21
) O+ C8 o( n+ C- [4 M2 E. W - #define TCCHEN_SHIFT 22
, y! Z$ u2 \# W( t1 J% m% W - #define ITCCHEN_SHIFT 23% `' J0 h l$ ]" N6 f% ~3 D1 I. O" |
, A, a9 M4 ?% D7 q. n3 x B- static volatile int irqraised1 = 0;
; A* D+ J) ]6 ?, I - static volatile int irqraised2 = 0;
: `$ G& [- _3 A1 C+ e9 d
; q! t& c& V* ]5 i7 J4 F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 X+ a! H# X: U1 m4 m, ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 w: p8 }+ M6 b- S- h8 A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# r. ~$ {" s* M" G
" M& F, n; Q, H1 _: ]- dma_addr_t dmaphyssrc1 = 0;) E) E3 F1 Y$ u
- dma_addr_t dmaphyssrc2 = 0;
+ M4 }9 m, }! R& B - dma_addr_t dmaphysdest1 = 0;
+ T* @' `' t1 D9 H8 D! P4 q5 n - dma_addr_t dmaphysdest2 = 0;
+ A+ G, r- G( d ~
9 {. W. {+ F" w, z- char *dmabufsrc1 = NULL;
8 N1 V; N% C5 S. I1 f/ }6 p% v - char *dmabufsrc2 = NULL;
L% ?9 {3 u9 L+ C+ J6 ^ - char *dmabufdest1 = NULL;
5 p8 \) j0 j; ]- l" U( D* R - char *dmabufdest2 = NULL;+ f8 D" U) {4 B
, F$ [7 V# R7 L1 w# K% s- static int acnt = 512;' c& Z+ q$ k4 a+ H( G. V
- static int bcnt = 8;# ^5 y. v [/ c& b$ k5 d5 ^' P
- static int ccnt = 8;9 C4 Q% F3 X3 O( Q
1 {5 t+ Z* v( R- module_param(acnt, int, S_IRUGO);+ d1 C3 J* V r B& e, P
- module_param(bcnt, int, S_IRUGO);; o _! l1 V, f1 I( u1 n3 ?
- module_param(ccnt, int, S_IRUGO);
复制代码
+ n- i( C: h/ ]2 M4 Z$ N6 i/ ~1 r& J( \0 p
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 `3 Z* C$ z8 O; E9 Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 x' x# B+ v) m6 w
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ q6 {' r% Q7 r* N, k
) F8 @* S& D8 {) ]0 q4 N
/ T' u. {/ y2 Z
|
|