|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 k6 z1 J) x! g0 @
- [code]EDMA sample test application& R" W5 `" @2 d
- /*
j# U% `' i) h( S# R5 @2 w - * edma_test.c' Q; L/ P( j0 W: Q
- *+ V* s0 x7 K( g" V ^# Y
- * brief EDMA3 Test Application0 D0 x& n2 m( d, R2 h
- *% y; q" V% \) [- i+ g g1 S( O7 }0 |/ T
- * This file contains EDMA3 Test code.1 a; l9 C6 V. r- ?: P
- *
5 J0 U+ i6 Z% Q- m, `% I9 }, v8 f4 { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE d' v4 G4 I) j$ O- |3 a/ {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" D0 x2 y8 X/ Z/ q% H: G
- * TO CHANGE.; k4 |2 o& r" |- u7 E3 t
- *
0 M' }) _3 J8 ]9 j4 S; ?: M+ o* T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' |& ?% L i5 t O0 |9 z! D0 D' d1 _
- *- M4 e! f: W- v$ h
- * This program is free software; you can redistribute it and/or
) M+ I7 C& ~7 V7 d# T - * modify it under the terms of the GNU General Public License as6 Q" U+ F0 ~" F" e7 m$ Z
- * published by the Free Software Foundation version 2. V( `* j) V- g# F) |/ T
- *
& c8 v! p3 p8 { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% N4 v5 e) I }4 b6 y; d
- * kind, whether express or implied; without even the implied warranty9 U4 _$ l3 f5 `) b* L1 ~, D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 L" a$ c5 o/ q- m6 V - * GNU General Public License for more details. Q$ h1 [* E, x! S4 B9 E5 D
- */
" J' U) _4 b2 u! r; F - , A3 m( w- K+ k' b+ H6 E5 _! T
- #include <linux/module.h>* X0 i) t9 K4 q9 Q7 b1 z* V
- #include <linux/init.h>
: {2 e4 |& ?7 }0 p, ?( H - #include <linux/errno.h>4 I# F* ^7 g' l% H+ t
- #include <linux/types.h>$ K5 v+ H0 e# A/ V, K7 `
- #include <linux/interrupt.h>
$ y% {! e7 z# ]3 a - #include <asm/io.h>
' ]- H( L1 @$ i! g( f2 j - #include <linux/moduleparam.h>
7 }2 W9 N. A) G - #include <linux/sysctl.h>
# `. P% ^5 M% M2 I' b5 O - #include <linux/mm.h>
8 ~$ n) x6 E- X: `, ^0 v - #include <linux/dma-mapping.h>, T0 Y) j7 Y) q
+ n1 r6 s: f- k4 V9 {4 f; j) Q- #include <mach/memory.h>1 @* I# B3 y7 h1 H
- #include <mach/hardware.h>
* P4 F% H3 O; X - #include <mach/irqs.h>; G% C4 o T7 h( s
- #include <asm/hardware/edma.h>
X( t* q% p/ w- Q# E - " i/ [. y) E) S2 Q: Y$ [3 a6 R; W5 N
- #undef EDMA3_DEBUG" S( r: Y# z9 K( o; p
- /*#define EDMA3_DEBUG*/4 J' Z) ?5 f5 Q, y* z% D7 a
! R' M4 r" _, V% Q3 t- w- #ifdef EDMA3_DEBUG# m3 M. ^; q p- s5 N8 ]- I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): W7 |! I1 b) h4 _( \8 r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 _1 J: ?* Q9 z/ t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 @6 f" J! ]" {% W% D2 V - #else7 s7 @) E6 k! P/ k: v! h) Y" u6 }- u
- #define DMA_PRINTK( x... ), w( [- ~6 X3 q4 u
- #define DMA_FN_IN
- P6 e+ @, V0 t - #define DMA_FN_OUT
5 E5 @5 p9 ^) m& B5 L - #endif
. ? _. O4 x+ A. W! X+ r! n$ @6 v: k" z
, ]. q% a5 b' x! x- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 x A) a" \# ^0 D! V
- #define STATIC_SHIFT 3
9 k2 y u8 A" u$ w& G - #define TCINTEN_SHIFT 20
- W& V0 E) x1 s - #define ITCINTEN_SHIFT 21
; J: q& r9 [1 s# j - #define TCCHEN_SHIFT 22/ m9 A/ P3 R, i: v
- #define ITCCHEN_SHIFT 23; _4 C7 X7 J/ a V _$ \
- M% d! @# K2 K6 Y0 h- static volatile int irqraised1 = 0;4 j C0 V9 V# D- a
- static volatile int irqraised2 = 0;
4 s% Z" F4 ^( ^% E- S - 2 p7 q4 R: F0 E c3 U, g4 ^" r( q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 | W. b8 W& H6 ^, c: h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- N5 J+ r8 ~; {/ R& M/ L/ H
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 u Z8 }) i) O$ L: y - $ n+ Z ~- G N# c5 E( h0 D
- dma_addr_t dmaphyssrc1 = 0;9 R- t. \% T _
- dma_addr_t dmaphyssrc2 = 0;/ K+ u. \1 u* M7 X
- dma_addr_t dmaphysdest1 = 0;
2 ?( [/ W( [3 {3 k+ S$ M) _ - dma_addr_t dmaphysdest2 = 0;% u5 u( E0 _8 P
- : v2 ?! z/ o' T/ U m2 c4 y
- char *dmabufsrc1 = NULL;: S8 E: U* W0 p- [" [7 V
- char *dmabufsrc2 = NULL;
. s# g! \6 a; K/ |9 G) T - char *dmabufdest1 = NULL;% @2 j; m: k, v- I- ?1 q5 s
- char *dmabufdest2 = NULL;) ]0 O, R: {' l& n6 R* V# P
* o( t% C. V1 D5 w. M- static int acnt = 512;4 \1 _5 M8 D/ i o! Y8 @/ _" q
- static int bcnt = 8;
! a, l+ y9 T' S3 K0 ^ - static int ccnt = 8;$ d! [) C% J( F6 _" k
- * l) f6 Y' F2 w2 e+ s' B- H
- module_param(acnt, int, S_IRUGO);! u" z( d- |* {; f- b
- module_param(bcnt, int, S_IRUGO);
) o$ t9 H" l8 f+ O) | - module_param(ccnt, int, S_IRUGO);
复制代码 0 G8 r" g9 |& Y
0 ^7 U) ~. e7 q9 h! J7 d& q8 j 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 |6 u* g/ C+ ?2 J( A" 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' T$ z8 |2 Q5 [& N( o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ ^3 E9 |7 e# `# |( R: p
) s h1 @: b4 t; e+ l
! A% B6 e0 w: X2 J; Q% N |
|