|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / I% W4 I0 j: k1 ~" B! {2 a
- [code]EDMA sample test application
3 j. t% ?1 P/ S. h1 z - /*( H, R& k3 M e' X( I( N. C$ Y
- * edma_test.c
1 B! }1 F1 ~& q+ s* R - *# R q7 z$ H3 D- E" R! D
- * brief EDMA3 Test Application
. u* i! D9 R8 \6 J" I3 `0 J' ] - *
2 p$ ?; H2 O4 I1 |' y - * This file contains EDMA3 Test code.
6 T2 W; {3 d! ?0 D9 k- ` - *) C1 O* N' C/ H& k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 b# z* g c! d; J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 V( S$ m: P" w6 [ - * TO CHANGE.' ], y- a' ]4 I. w9 B& N3 H
- *& |2 m. `. W( s, I( V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 Y$ f2 t& D7 J2 H) [' ~2 ~' u2 u
- *
6 _+ b, Q2 ]& v) C. [0 M - * This program is free software; you can redistribute it and/or
) U. c. h! D% B- } - * modify it under the terms of the GNU General Public License as
# k* B) g% K) v* t; [$ v$ r - * published by the Free Software Foundation version 2.1 Q1 D) _& W% }( K) {8 }0 k; {
- *
/ c2 J* x1 F/ d7 G. `+ L0 a% L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 u1 M `% o) w$ @. ]0 G4 F - * kind, whether express or implied; without even the implied warranty" t, h$ a, o4 U! {# e2 d8 v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( u! d, V5 m. n( [! P. u- T* Q, }
- * GNU General Public License for more details.
- l( e6 P; x3 ]' Y - */
3 O& \ o& [/ W# s4 E# D
/ W( |# W: Q" v5 o; {/ {- #include <linux/module.h>
/ a1 \; C) D6 X' W2 i' ^0 W - #include <linux/init.h>9 i e+ H0 d$ ]5 ~% F
- #include <linux/errno.h>
3 Y' G @- q5 |2 } T2 \4 Y - #include <linux/types.h>
( B& `4 n+ Z+ H9 @ - #include <linux/interrupt.h>" S+ Y3 ^% F; l( g3 A
- #include <asm/io.h>5 J+ L" y0 N8 k7 Q
- #include <linux/moduleparam.h>
, k7 X9 g7 X; i* } - #include <linux/sysctl.h>6 M/ z! o1 [; [/ ?7 B6 `! h9 }) S
- #include <linux/mm.h>
5 S! d+ ?. L# }# {7 Y: P - #include <linux/dma-mapping.h>
2 P+ y6 Z/ Q+ I+ X- ? - * S3 [+ A/ X9 v( ~% h: k% f2 ^
- #include <mach/memory.h>
/ y' `* N7 i2 r/ r9 f4 G) p - #include <mach/hardware.h>
$ Z% R* S( \, j! A4 C - #include <mach/irqs.h>! u: r, \5 e5 p/ v6 u+ S- V
- #include <asm/hardware/edma.h>$ ~4 S( `% i- b7 t6 F6 {2 H- `! }
- . j: l+ T! b5 A) L5 C
- #undef EDMA3_DEBUG
- Q' f* ^: ]$ u' i - /*#define EDMA3_DEBUG*/! m6 o! X' r4 W! T @8 f
- $ x- p( F, D r$ F5 D. X0 g& g
- #ifdef EDMA3_DEBUG
1 ^- {! ]' i% T9 S, I - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- n! O9 d. \0 f: h0 G5 T2 ?1 K" U$ o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* D# n8 q; o0 |# k8 h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 E& t0 f! {) T' J( ^
- #else4 v! b" F! M" t
- #define DMA_PRINTK( x... )/ {5 p O# J% Q" c* b6 Q8 i
- #define DMA_FN_IN) a1 \+ H* [6 A/ t5 G9 I; x0 z& Y
- #define DMA_FN_OUT
/ y( a) ~# ~2 B2 @9 p' N; Q - #endif
" N% r% Y8 o' _1 g: j+ l. H) m( g - * r( c; b" f; d( Z5 I! m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& ~$ h* K3 a1 q9 C - #define STATIC_SHIFT 34 o' o3 L9 {6 R, k
- #define TCINTEN_SHIFT 20
8 s! T8 E9 ]: S" l6 {# h: W: @$ o# c) J - #define ITCINTEN_SHIFT 21
$ x B6 [" q* e - #define TCCHEN_SHIFT 22* S/ B+ B8 _4 O8 r; I' _) R
- #define ITCCHEN_SHIFT 23' [+ k. r2 _3 k# l3 X
2 l; W+ \4 u2 C/ `- static volatile int irqraised1 = 0;
1 G8 D" O, ]! |! P - static volatile int irqraised2 = 0;% F% l! ?* i+ t4 G
- 0 T7 T7 Q% T0 K- J x
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ y" _5 u. G7 ~1 n7 o. Z' j
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: X* l ?0 l7 S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 m2 H+ D: @ D1 s, J - + L# w1 X5 A; D: n9 y# \
- dma_addr_t dmaphyssrc1 = 0;
! q9 t( O4 s7 R - dma_addr_t dmaphyssrc2 = 0;# ~$ u1 x6 a6 \$ P' A; w
- dma_addr_t dmaphysdest1 = 0;. u( u& B% B' r; S( b
- dma_addr_t dmaphysdest2 = 0;
. n' ]/ H! Z a; [% v
/ t( c! r$ d$ T& N% s! m$ B- char *dmabufsrc1 = NULL;" C- h, b7 e T3 d4 i8 H; l
- char *dmabufsrc2 = NULL;/ x4 T$ @ Y* V( t. W
- char *dmabufdest1 = NULL;
. |. Y; a: Z5 W8 _" d - char *dmabufdest2 = NULL;0 l( |% I# c2 |# Y
- 5 Q5 B% u+ F; L( k( {- n6 m
- static int acnt = 512;
3 _) ~1 j! T- b6 w1 n - static int bcnt = 8;
- |/ y! J$ A% q: M, H4 s - static int ccnt = 8;( x% i7 |# w* `. l9 g
4 x0 k& e: ^5 k4 ^ W& H, o; E8 E# @- module_param(acnt, int, S_IRUGO);
9 i! g/ b. w, w: r6 e- @6 P' X - module_param(bcnt, int, S_IRUGO);5 R; y9 P) Y1 T5 V8 ^1 C
- module_param(ccnt, int, S_IRUGO);
复制代码
. @' I7 p6 W7 I/ v
/ d3 y! `3 ?/ O+ \) _ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- ~ m3 ^: c" b- q4 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 D3 d. P- F3 [: e! D
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# K4 u. K5 _" U! y. \9 n0 X+ ^ U& L) }1 b% f( [
2 q4 T& {. w. a |
|