|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- M: K/ u; R: |% |" [2 N( B- [code]EDMA sample test application2 z) r* j( a0 P
- /*& p" i# `+ ?2 c" J& r. k7 Y
- * edma_test.c
4 f- g! c' }: b$ v - *7 x" v- b! P; d [6 V) t7 x- n2 j
- * brief EDMA3 Test Application9 W+ u7 @# C* v
- *
# S* ]9 h% b% C7 l, M- m - * This file contains EDMA3 Test code.) j: K" B* n. s- k E2 l D
- *) V, L, [# F# H% U6 Z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ v, s5 M# {. L% w& H. G% I
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 x; m6 X5 R5 S* j% ~& D+ p3 V2 E - * TO CHANGE.6 B @4 w& ]4 U* U5 I$ m/ \# Z
- *! q. f& o7 `# A
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* W: n7 b% n* I$ Y- q( o, Z) N
- *2 N) o/ Y! h7 _ ?; J& ]
- * This program is free software; you can redistribute it and/or9 z) d& t* a( s/ F- h' s% L- o- Y9 z
- * modify it under the terms of the GNU General Public License as
/ @) {" L- q0 Y+ \ - * published by the Free Software Foundation version 2.
! E) B+ r% l2 a4 @ - *9 Y! L8 n- E, N6 H& D, l5 y; Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! q1 \; h+ ]/ f- h: {. X/ j* @! q! f; n - * kind, whether express or implied; without even the implied warranty/ n3 d4 @' {; U- Z, [ V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* p! c" \7 m+ g, g/ F - * GNU General Public License for more details.
: q, v0 Y2 t' }. u$ s - */
- V. h9 u6 Z) o' S* q5 q! T
) @$ Y. T1 B( [. I- #include <linux/module.h>
3 j6 B) I4 n$ Z5 \& l+ {- M - #include <linux/init.h>) {2 X2 k- F" c# M
- #include <linux/errno.h># f8 e1 y# ^2 f
- #include <linux/types.h>
! j( k$ H1 T- o' w* T) n& K - #include <linux/interrupt.h>
, e& B2 h5 u2 ], X! q$ M - #include <asm/io.h>) r% e+ Z% W0 D0 y& e* L
- #include <linux/moduleparam.h>
$ b4 m. K, |; a( I& L - #include <linux/sysctl.h>7 t# \% S( i L! A! Y; R8 i2 _
- #include <linux/mm.h>
; I: w$ g* `, h - #include <linux/dma-mapping.h>7 h6 K% D' j9 `) C: _
: Q. N/ f% v1 y9 A- #include <mach/memory.h>, j& a0 @9 f, b5 {# |8 Y
- #include <mach/hardware.h>
- u b5 Z2 }- H5 z - #include <mach/irqs.h>
' A: c% N' r6 z) P2 E6 A' C - #include <asm/hardware/edma.h>
- Z1 l j+ R0 _. T( n
2 |( X# P6 d8 B- #undef EDMA3_DEBUG
: r9 Y p' x. q& k* j) F - /*#define EDMA3_DEBUG*/( w m; I( c* m1 I0 a8 i
- 0 V4 a% E5 E' o/ F0 e, E
- #ifdef EDMA3_DEBUG
" f# g; ]" W* S - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, V/ p) n7 @+ z& X" n4 Z5 g4 b - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* b% N9 V7 `( @3 U3 k$ e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 }/ j* r7 l [
- #else
0 F! E9 b3 ~/ b m" | - #define DMA_PRINTK( x... )% b$ ?' R/ C5 G( ^9 i
- #define DMA_FN_IN
9 n/ H% F( _$ v3 }; t - #define DMA_FN_OUT
9 A @# ~6 r/ K0 U& y. J, j8 ~ - #endif
6 u; ?5 c$ r# H" l
- q- A4 @- J) f1 _' v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! X/ _ Y8 P% }" i3 U( h
- #define STATIC_SHIFT 3
& |: h N+ j. W2 x - #define TCINTEN_SHIFT 20, R+ D b( |/ Q7 J; x9 d- z: n% L9 q
- #define ITCINTEN_SHIFT 21. ?& E1 `- ^0 _4 N& m3 G6 `+ O/ u
- #define TCCHEN_SHIFT 228 ~+ t8 O, V6 ?
- #define ITCCHEN_SHIFT 23' m5 Q! }9 P7 y: Z' }' ]! s
6 ?1 M& x0 C2 n$ V& N- static volatile int irqraised1 = 0;
/ A& w8 i/ ?& U* x5 ^2 M2 j! ~3 d - static volatile int irqraised2 = 0;! w# P9 ~2 u9 f [
! e0 e# Y% g/ O* V @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 j8 V! p( [. Y4 i" _- y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ s) W4 Z( M" L7 F1 a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: L. Z% Q1 d4 A- o
5 l) ~7 a- Z- H3 u+ W' ^) p: {! f- dma_addr_t dmaphyssrc1 = 0;; W- S8 U" _9 p; j- `( K
- dma_addr_t dmaphyssrc2 = 0;
5 W" H! |4 C; Z4 \: W - dma_addr_t dmaphysdest1 = 0;
( V) _- K" ~& q* {) t; j$ m - dma_addr_t dmaphysdest2 = 0;/ ~6 B) ]; F, u# u+ |' w5 Z: B
! X* r! d) i# f0 k0 B5 s/ J- char *dmabufsrc1 = NULL;
; J% c# k% N& t% s1 l - char *dmabufsrc2 = NULL;
& J7 y6 g0 \' J7 _& T5 q - char *dmabufdest1 = NULL;* w6 x" ~4 D* ~5 D5 F
- char *dmabufdest2 = NULL;
/ @0 Y( I; x4 R# U2 D4 B - 8 q$ [+ T$ ?# O1 D. {* s# `5 z
- static int acnt = 512;
& _* } U8 }$ T! c - static int bcnt = 8;% A5 b' d' E/ U) S' R4 Q. D
- static int ccnt = 8;
- t$ n% f* S$ c$ r" m6 ~7 } - 6 w6 ~9 ^. X* {
- module_param(acnt, int, S_IRUGO);
/ j% o! H+ F; S( T# `$ d& b - module_param(bcnt, int, S_IRUGO);
, O- ^( `: F6 n* ?( z - module_param(ccnt, int, S_IRUGO);
复制代码 ( J$ J/ M# P: e( K& B$ R+ c
/ ]8 T9 E; O8 ^/ r1 R8 ~& y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 t7 m& o2 R# {1 G4 Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 E2 p: o$ \; H" J+ l$ B0 z5 F
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ A* r, b" p. n4 m0 u3 F
* b8 P2 u7 E0 r6 U& u3 A3 x
& F0 m/ L) J/ y( f/ D, l; { |
|