|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& R# [, C6 y7 i! ?. w% v# F. |. K- [code]EDMA sample test application6 F; L5 c; ^) ~) j+ I( v( F1 K
- /*
3 {" l1 s0 W" \, Z/ Z) w' N2 Q; ^ - * edma_test.c
4 ?/ G5 _& \$ `5 F - *
( t; M. p K( { l$ J - * brief EDMA3 Test Application% p+ q- Y* r- c
- *. O" T" D8 e x" d+ d- g7 m4 w
- * This file contains EDMA3 Test code./ n, J/ O6 i0 _
- *( r3 @1 [* g- ?6 z/ a! `) X3 @3 t/ w
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* s* ?7 P# f! `- u- F6 F - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 R* e4 B2 V; c6 |
- * TO CHANGE.
) g4 Y% U: h" Y. k/ M! \2 k - *
+ Z& _2 S- D% J# h" x$ v - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: B% z- ^9 ~/ r" ~- x5 k, C
- *
" l: W9 {3 r+ s" P - * This program is free software; you can redistribute it and/or2 l- p% i g6 Y) z+ o( G
- * modify it under the terms of the GNU General Public License as
1 V: I" L G, I) x% }5 J' N - * published by the Free Software Foundation version 2.
5 J% `# z/ A/ B" }; L+ s9 D - *
' E9 h: f, k5 Y# L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 ~4 s+ _ ]/ B1 H5 @" ?- G: b - * kind, whether express or implied; without even the implied warranty
7 \& i# z& S' s W A |! Y6 U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 v7 Y* x# Y4 D: x+ Q, A - * GNU General Public License for more details.
; @2 L$ g0 d- H! m( B - */) K, g4 u m) w3 U/ t
- + K/ L7 C' S$ h/ @
- #include <linux/module.h># ]+ m. y. U" ?3 Z* S3 w& [1 \2 t
- #include <linux/init.h>
8 y) C# j# ~5 ^+ [7 X3 P H - #include <linux/errno.h>
! R; H" [8 X& U - #include <linux/types.h>! T/ Z+ b) F' F+ M9 N; ^
- #include <linux/interrupt.h>
$ {8 l' ]( v) N/ U - #include <asm/io.h>
9 j/ O% }" f2 N - #include <linux/moduleparam.h>% }* b* `' o9 K# e5 B- E0 e+ W
- #include <linux/sysctl.h> u. V8 g0 M! |4 u. c
- #include <linux/mm.h>, q: \" z% H, h$ ~+ l0 v5 z
- #include <linux/dma-mapping.h>3 z$ N; k4 g, g6 B% f
' j- h. P4 G3 \8 U* }0 h- #include <mach/memory.h>
5 W5 \% S' |0 e; z5 X, T0 E) v - #include <mach/hardware.h>
2 o* n8 r1 @* K E - #include <mach/irqs.h>; e. M( K Q. P2 J
- #include <asm/hardware/edma.h>5 c4 A z/ T) a
2 n, i) Z9 p9 X7 W) t, ]0 `- #undef EDMA3_DEBUG
$ v! u8 w+ C0 i8 P+ B% q# H7 x7 V - /*#define EDMA3_DEBUG*/
f3 D0 r2 i' P+ x' c2 M$ `7 x
8 H) [" {/ s/ W, t2 I/ E4 `- #ifdef EDMA3_DEBUG) _& P0 U% y' c" w' l1 _8 J
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 E7 O$ S" @3 i# V, X, w5 X. F
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 u! s; o: d8 p: R, q4 N! {
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): _1 F# S* ^/ _/ ]8 j9 n1 U
- #else
& D$ p8 b3 Q; } O+ P9 b% A - #define DMA_PRINTK( x... )
& ^! ]7 c9 [$ b& M7 @$ v - #define DMA_FN_IN* t6 a \9 `0 Y! \4 D
- #define DMA_FN_OUT
- b+ O% p/ {- a/ Y1 b1 Q4 u - #endif/ J, H5 q9 G' Y+ e3 T, D) W
- ) y7 t r3 X+ Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ t- e5 k6 r( u9 z
- #define STATIC_SHIFT 3' q: d' v) b/ P( e7 H
- #define TCINTEN_SHIFT 20
! C, I/ X) v, |+ E2 F - #define ITCINTEN_SHIFT 218 f5 A& v; N2 I. U! q* p# t1 a
- #define TCCHEN_SHIFT 22
, t8 {( R- g, w# y+ `& L0 V - #define ITCCHEN_SHIFT 233 Z, m+ n: {, B# ^8 Z$ t1 u
, r9 a* G z2 U; a0 a. x. q- static volatile int irqraised1 = 0;
8 |, N3 D1 p( g - static volatile int irqraised2 = 0;
1 R8 q$ P$ \# P
; L% {6 ]4 }( r- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 }2 F+ R! e) ^% _ f7 I5 R
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 ^' F6 h' A, p0 i+ [4 {" q4 W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' W( K7 f ^: t0 V
- * L6 g! n5 g! l9 p5 I1 O' O+ E" f4 Z
- dma_addr_t dmaphyssrc1 = 0;' X+ y ~$ k2 [
- dma_addr_t dmaphyssrc2 = 0;1 s' R+ G% |) j" E5 E$ n3 ]% G
- dma_addr_t dmaphysdest1 = 0;
1 B) z A1 i" B6 C - dma_addr_t dmaphysdest2 = 0;
$ d9 B3 H8 L; r' {9 N! k+ \! c
) f! J0 Q, l! r; c( f- char *dmabufsrc1 = NULL;3 ?; U' X$ e* r5 X& Z0 o
- char *dmabufsrc2 = NULL;
* H( g% W- s% q7 e2 V+ B9 f - char *dmabufdest1 = NULL;1 q- d/ D: E; \/ `9 B+ y' O
- char *dmabufdest2 = NULL;
5 X, e5 i8 A# M$ }7 f - & k- U0 E9 A+ t" h. x& H
- static int acnt = 512;" U% T, E6 Z1 r* p
- static int bcnt = 8;. `" X) a8 F ~ I1 \: k
- static int ccnt = 8;8 I* D- Y( R W
- ' S9 H2 c0 U; N( B5 X8 D; t
- module_param(acnt, int, S_IRUGO);/ Z8 W: l1 y0 r9 X
- module_param(bcnt, int, S_IRUGO);# ?4 M, i5 c5 O
- module_param(ccnt, int, S_IRUGO);
复制代码 : T# r. n( b6 `; u. j# ?3 I( G
7 n p) y8 Y8 O+ d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 K# ~2 Q4 Q" z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. y/ a5 h8 F9 p& N' z O' _ p" s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) Y' x6 K' }! y p+ n8 w2 c
% r9 e" e I3 e8 N( C
- L: S. N0 b+ p1 J- A |
|