|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 S5 O; f2 r- r( i* ]- [code]EDMA sample test application
3 d: H+ m$ n% [( R* y - /*
4 l" G7 m, L# N# H - * edma_test.c' F8 W1 U" G) H0 b! \& N
- *
) `1 S) }% L7 D5 O% F8 p) w - * brief EDMA3 Test Application
" i$ ]. b/ W1 J! T) e& x. \. v( c - *
$ K- c+ L5 g4 m5 y - * This file contains EDMA3 Test code.8 ]5 \' ^5 u' S, k
- *
: d$ \! e. j* F9 r! k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, N, M: k5 S% P2 m% M3 K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 o; ]* [* v5 P - * TO CHANGE.6 X6 C1 x+ [/ j6 ~
- *
" {/ d- L. R2 b4 t! m - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; M, o- w( T9 ~6 B* \ - *
, u0 U( i$ [) Z u6 n; I$ B - * This program is free software; you can redistribute it and/or( F8 {( K& h+ f8 R9 o6 ]5 i4 r
- * modify it under the terms of the GNU General Public License as
5 ?" X* c# N# L5 E0 {8 `2 U! x - * published by the Free Software Foundation version 2.! @! O+ y2 {+ ` m: c" [1 |: Q
- *6 I. L3 E( ?) j( N: K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 s; t: T6 c! m. ^
- * kind, whether express or implied; without even the implied warranty
: m D( ?- | Y: A6 b* g - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( Q! W7 R5 _7 t7 z- P
- * GNU General Public License for more details.
, R' H6 ]2 p5 v! R% P1 _5 m - */' D1 ]+ U' R# _/ D! N3 M6 y
- ; N/ s! P/ s: [# J6 F
- #include <linux/module.h>1 z: Z3 _, ^- n. O+ E
- #include <linux/init.h>3 j7 W; H0 b/ b& n( z
- #include <linux/errno.h>
4 C/ H1 {. L6 @" x) ~5 i - #include <linux/types.h>' o& J% v3 z- r5 s+ }, p9 ? M; j; e
- #include <linux/interrupt.h>
7 A* D9 ~) `% v( A - #include <asm/io.h>6 P# w: ?+ f; N0 w
- #include <linux/moduleparam.h>4 L# g% [4 c0 q' |9 V* o
- #include <linux/sysctl.h>5 {4 q( o4 U! p9 [' x
- #include <linux/mm.h>/ N/ _0 }# C% k: V% m/ f1 S
- #include <linux/dma-mapping.h>) U. I& V7 _5 [5 j$ \% C8 A# B
5 I9 L T4 S5 L6 U- V- #include <mach/memory.h>4 t( _1 j5 k7 u3 N+ }" x2 o6 i
- #include <mach/hardware.h>$ } `7 ]. ?8 L( S( n
- #include <mach/irqs.h>
. G& k- t0 ?6 V - #include <asm/hardware/edma.h>! r/ ?$ T. N1 |' w; o) c8 a6 \! e
- 2 C$ b) S8 d' v! i7 q9 M' l
- #undef EDMA3_DEBUG
2 `# g0 R) M) h- {1 Q$ h% ^0 d - /*#define EDMA3_DEBUG*/
( _8 T5 ^/ D4 ~" u - 7 x0 p% b8 ~' G+ @) S' T }8 d
- #ifdef EDMA3_DEBUG, G4 m9 }$ h% }1 A
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 L. Y- ^+ ^, @* q, h* g) e6 I
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# _& I- B: l2 @
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, j) _: ?/ p, \7 K - #else
: j# L1 E2 u, ~: ~' r2 S ^ S - #define DMA_PRINTK( x... )
, \9 |3 M! M6 ^* N0 R/ P - #define DMA_FN_IN! n3 \: G L# C' C! b
- #define DMA_FN_OUT" d' H) y- |& |
- #endif4 V. D) U, Y( c, w) P
# Y, U7 S9 q3 `' n' [* x6 u) P- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ z0 ^. _) n8 G - #define STATIC_SHIFT 3+ O' l5 o' ~" T$ C; A7 @# M% D
- #define TCINTEN_SHIFT 20
$ Y7 V4 S# Z% r* r$ h+ b - #define ITCINTEN_SHIFT 21$ L2 V$ I. k b
- #define TCCHEN_SHIFT 22
4 B# ~, v; u: | ^ - #define ITCCHEN_SHIFT 23
. I7 S- D, Z# R4 m: H7 V* A# w - 0 v8 ~5 r. l) b- _8 _# y/ m
- static volatile int irqraised1 = 0;6 N$ O5 N5 ^' `% L' s% [
- static volatile int irqraised2 = 0;
9 e+ N1 K* t7 w0 ?; P3 p4 N! i' \ - 3 M! h# E7 e: u* [- o" V3 x6 J) j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 }% g" I7 e5 u% J) s' y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
c2 A, s; Y" I' P7 { - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. A0 h5 \$ j! J# p8 l- B* j
2 j( U: @0 A3 h3 X2 v7 w- dma_addr_t dmaphyssrc1 = 0;, h( L7 L& q/ ~+ L; K
- dma_addr_t dmaphyssrc2 = 0;
X: J- V3 T a! k+ d - dma_addr_t dmaphysdest1 = 0;* X" Z+ b U2 ~4 G8 ~/ X: n7 N; |
- dma_addr_t dmaphysdest2 = 0;7 ^( v3 R4 }3 s. _3 j+ i
\1 Z& ^: `( I3 i S- o- char *dmabufsrc1 = NULL; I& o( D! i' h% j, r
- char *dmabufsrc2 = NULL;
$ H- Q+ U* i$ w5 Y, V- p( q - char *dmabufdest1 = NULL;7 _4 e7 B: P# x6 [' {3 z! ~2 t
- char *dmabufdest2 = NULL;" @4 |, Q* _% p( M
3 O2 ^: U4 y ~( c4 d/ ?- static int acnt = 512;
& B9 U ]8 @! O, P4 t3 y4 @& n: n - static int bcnt = 8;5 ^6 V+ a: q$ K0 d4 Z M. i* g' @ \
- static int ccnt = 8;0 k1 g" B ^6 d
- ( s. ?7 s: Z5 N4 t# S
- module_param(acnt, int, S_IRUGO);
2 G! x/ z' }* @ - module_param(bcnt, int, S_IRUGO);
; n8 T( k+ ?5 c& M8 o" ^: A - module_param(ccnt, int, S_IRUGO);
复制代码
* i) Q8 q9 S- r/ h6 d5 v9 `. W9 ]/ N* v. Q5 b
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 D3 W7 Q) o& 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 w3 r. R; C6 E! i; h4 j3 \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 ]/ s* u0 s! x$ r, H; J8 ~
1 w- \3 ^, R ?$ g& l" B2 i, H" v a5 L
/ F- V+ N) B0 J$ q' S$ v$ R
|
|