|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ }& ?% c" }5 z! l2 N- [code]EDMA sample test application7 ^8 k% b3 w8 C& x3 M) z0 q2 s
- /*
3 H! W" e5 c- T9 d, y w; W, M - * edma_test.c
1 L- V- ]3 p q D/ l - *
4 ? `" ~0 j3 r' M# K j& R - * brief EDMA3 Test Application
: F |- m# R! q" @# n' z: Q7 Z' L - *9 J( l; m6 N( [: Z
- * This file contains EDMA3 Test code.6 G, C5 T+ b$ c) y* h6 f6 q
- *
7 w/ X1 y$ }% v3 t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ S+ I( d$ k2 t% L* o. k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ M3 Y8 ]1 X& Y5 |7 [6 X
- * TO CHANGE.
! _7 C( i0 M) s5 { N0 v- b! U) Z - *
, U! f" E- ?, Y9 v! Z% I/ a+ W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 s; l6 I5 L; I! E
- *
7 Q; S8 x4 \/ L - * This program is free software; you can redistribute it and/or4 h3 _* t" d4 N" m. j( y
- * modify it under the terms of the GNU General Public License as
+ l# k! e, t* s - * published by the Free Software Foundation version 2.0 v' U1 E/ Q( O1 [" @* r
- *
8 c$ ^: T: y( T/ N. t% _8 V/ \ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: }% P6 l& E' r; H7 R - * kind, whether express or implied; without even the implied warranty
, S2 R$ D }6 F3 @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) c9 X' X& E& Q2 E9 y: i - * GNU General Public License for more details.
6 O6 z! X. v7 [* ^9 D - */( c" I* L: v; `2 G- D3 r1 U! Z0 X
5 \2 W) C# I) x' z3 C/ E8 r% `- #include <linux/module.h>
6 I. K3 @1 I: n - #include <linux/init.h>
8 D Q8 s2 Q1 ^2 i5 ]! ` - #include <linux/errno.h>
% A# }1 V; D) n7 a - #include <linux/types.h>
0 t( |8 B8 @2 Z+ Z( X - #include <linux/interrupt.h>2 C3 L7 r7 D4 c4 I- i6 t* x
- #include <asm/io.h>9 N7 R8 e! |. X
- #include <linux/moduleparam.h>
) h# E+ I4 m. [! k7 l* D( u - #include <linux/sysctl.h>2 a8 P4 l* z" r9 K- H5 l
- #include <linux/mm.h>% I$ r; G" [0 P8 s" X8 k6 f* r* p
- #include <linux/dma-mapping.h>
$ d* O9 _) @/ `' w
3 j7 S$ M! M( A$ f- #include <mach/memory.h>
! g$ J& V: j9 @$ T, x - #include <mach/hardware.h>
# Q& m8 T) i6 Y9 N- r) i - #include <mach/irqs.h>) \, `+ q8 R, G1 u) U( A
- #include <asm/hardware/edma.h>0 r! F' n. \6 F6 f
T) { O% a9 ^8 C |- #undef EDMA3_DEBUG
/ U- h8 D6 c; H0 Y" }' F - /*#define EDMA3_DEBUG*/3 [" F9 q% c7 x- Z* e- {+ x. w6 Y
6 F5 u) J9 f. U0 Z% P6 Q" c9 E, u- #ifdef EDMA3_DEBUG6 ]* M' @, \. e" m5 ~! l' X+ h% n
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ W9 K7 Q" d% e, a1 _3 l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ Y2 A: E; d& n: u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 O4 F: t1 }/ t. R* O+ D
- #else
5 P5 e! |; w+ d - #define DMA_PRINTK( x... ), K3 h+ h4 e0 y% g4 X
- #define DMA_FN_IN
: i' D' a: h. P( E - #define DMA_FN_OUT
4 x! ?1 M6 G9 x9 V# X# @ - #endif: r/ l. }# |5 z- \# M4 ~4 \
- : ^2 Y1 m- \ G/ Q: B! l$ f" L3 A
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! w% c, [# z! y - #define STATIC_SHIFT 3: m# W8 o( w9 p6 @( L3 B/ `$ }
- #define TCINTEN_SHIFT 20$ e# H0 x! I, B% w/ F) \; a
- #define ITCINTEN_SHIFT 21
9 }" e" s& v% Z5 U - #define TCCHEN_SHIFT 22
( B7 L4 h6 T, x9 a7 U2 B - #define ITCCHEN_SHIFT 23
3 E ^/ L+ ?1 D: u A" g5 Q7 P - / n9 _: d2 r; v# m. r5 i
- static volatile int irqraised1 = 0;# o+ T+ B9 C7 Q0 Z6 Z
- static volatile int irqraised2 = 0;
- e9 w0 a4 R' b1 O3 @' J
' v6 v6 I$ a( L. O- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" H/ n E2 f( b
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& } s7 `' H9 J* e) C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! }3 A) T) z' `- w h2 c) K
& ^% f( [% m5 M# U& L/ K/ G- dma_addr_t dmaphyssrc1 = 0;4 Z* m$ i5 i# k# A4 u2 r6 }
- dma_addr_t dmaphyssrc2 = 0;
6 a- r* [% | D0 a6 S; V - dma_addr_t dmaphysdest1 = 0;1 m3 L5 J5 `/ d5 J9 o
- dma_addr_t dmaphysdest2 = 0;
; M- t; `& x" b+ q- s5 T0 z3 Y* ]
3 v4 h' Q9 o/ X: n& Y- char *dmabufsrc1 = NULL;! P& }; z+ p. }8 y( V8 X* Q1 I: p
- char *dmabufsrc2 = NULL;" A% O2 J) H: e- p
- char *dmabufdest1 = NULL;
2 J3 b" f2 l. S" x - char *dmabufdest2 = NULL;
4 x8 h2 N" j2 N$ e
+ `/ D! c# }2 z/ B; T! C& [8 [- a8 S- static int acnt = 512;$ j' X0 ^- A2 I, l9 k
- static int bcnt = 8;
& E) X' C/ B' ^' Z - static int ccnt = 8;: m( D( e! A) `& t, u( w+ W
' z) z+ [+ Z- G3 Z* R& n3 c- module_param(acnt, int, S_IRUGO);; q" j3 G% Z" `$ i6 A+ g J
- module_param(bcnt, int, S_IRUGO);
) o" {- T5 E H2 C- |( i& u - module_param(ccnt, int, S_IRUGO);
复制代码
5 C+ z! }# f0 W/ T4 U" c% @) n6 M, K4 ~5 l' j4 e4 [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 F4 i! C! e8 {8 o( L' }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 O- x/ Q5 L7 Y! P) d) x
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ e1 |8 W% J8 M" {: {; v" _! w- A
( _" ~. }6 o% ]% N' e: [
& l; s. J1 e# x O& | |
|