|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' A) s' L! L7 I+ r: B5 W1 H
- [code]EDMA sample test application
9 F, |1 i" l" M; e y - /*
6 _1 E9 R! C! P+ M) V$ ] - * edma_test.c$ \; |* |, v/ l1 s0 c" C
- ** b7 F. `5 K8 k! {3 `# Q$ D
- * brief EDMA3 Test Application
! u& k% P5 d/ s+ Z; `* ]; O% p - *+ ~6 p% c+ v( l& b( O- k# ?
- * This file contains EDMA3 Test code.2 D h! e" g- w+ g- h
- *4 t' j5 y$ ~7 ~2 [- D2 m
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) \4 t& Q5 S6 g6 V' P% M ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. @0 ^: L' D9 G* ?# P1 x# O0 W% _9 H
- * TO CHANGE.
) m6 h8 v# t9 j/ x - *
% b2 ~% \9 \8 g' Q0 P. I - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 L7 {+ e4 T5 h. @
- *, `; R, O0 U' z5 T1 \
- * This program is free software; you can redistribute it and/or
4 a) W8 ]( v" A: k# w# v - * modify it under the terms of the GNU General Public License as
4 V% O* p$ w: q; I1 K - * published by the Free Software Foundation version 2.
: ?& F1 i: ^ p. D$ @( i - *
! n9 t& d; O- g& c - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 ^1 _' `7 p7 M! r
- * kind, whether express or implied; without even the implied warranty
1 A: I5 z; B* ]4 A3 h. R% v9 S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) h( ^0 B' n0 C* Z: h7 g# D - * GNU General Public License for more details.
7 W( M5 w: ~$ Y( a0 w) X - */) [" l$ E8 \. w# ]; ~5 ]( o
+ L+ x- h& i8 _; O# z9 T- #include <linux/module.h>% ^4 |: I% i: j6 D8 u: l, L
- #include <linux/init.h>
% i, e1 q* {7 r' @0 S7 n - #include <linux/errno.h>( C( R! n/ G t, N# @ }& w# `0 f
- #include <linux/types.h>
# y2 h, q) ^. f; `9 `7 { - #include <linux/interrupt.h>
( Q* w& ]* F* I7 I4 y1 x - #include <asm/io.h>! u3 d" \' B( M& Q+ a* Q
- #include <linux/moduleparam.h>
# W4 ^$ V3 S6 e" ~ - #include <linux/sysctl.h>
0 l! N* E. z0 n) y0 Y5 K - #include <linux/mm.h>& s. }, D: L% I! Y
- #include <linux/dma-mapping.h>
5 o, o q! A. J7 D# |3 Z: n1 l - 1 H8 |0 } H5 h) M; P
- #include <mach/memory.h>
8 X3 U3 j( t! M" M. @ - #include <mach/hardware.h>7 ~1 l+ @$ k* ?6 q9 _
- #include <mach/irqs.h>
! {* v$ d3 l J& L - #include <asm/hardware/edma.h>" n* ^9 A' b$ @) Y
- * r9 }& b- p! e v0 X1 e
- #undef EDMA3_DEBUG8 P" _4 j J8 o. x8 @- C$ L
- /*#define EDMA3_DEBUG*/
8 Y, A- ?* N# [9 y! r - ! t) H0 R1 z0 J q
- #ifdef EDMA3_DEBUG4 E2 b/ A/ q) {, t7 e1 i# K$ U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 W4 I/ ^8 Q9 ~% l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 d! W- t2 }; p$ y# V4 K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 w# U4 j' f$ K9 H9 P7 {9 q - #else
) A; b. {+ b D- E3 N, R - #define DMA_PRINTK( x... ). R( `) E3 d8 S
- #define DMA_FN_IN
1 p8 R9 N5 D3 x6 [$ F' v& A - #define DMA_FN_OUT! ^6 r' t! O& W* |& S. M6 ]' g ^
- #endif
- ^- d8 [7 c; _& X7 ]. N - 1 ~+ f2 N f7 Y4 K: L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ q$ I0 ?+ U1 o1 q- I
- #define STATIC_SHIFT 3- Y( y" x( N/ ]" O! m
- #define TCINTEN_SHIFT 20( p, S! [' l" M" ?* Z6 z# n! K' [
- #define ITCINTEN_SHIFT 21* S Q' J: n! v! I0 [6 Q1 {3 B, o5 ]
- #define TCCHEN_SHIFT 222 }! ^) V* e3 \3 E! G
- #define ITCCHEN_SHIFT 235 L C! J) P. o8 K, k
- 4 |( j9 e% H. k/ c2 b/ W$ R' `
- static volatile int irqraised1 = 0;
1 H; N0 Z% G9 j - static volatile int irqraised2 = 0;
# J7 K; j! j3 m2 {$ K
/ Q: y4 I2 K6 _ e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 V8 W6 q! v/ x9 c- ?5 @5 y) ] - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ }5 r) B, K% z# E1 Z/ W8 G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, N6 Y/ L o6 J" R# Q( v; ~9 u9 b
- $ ?3 j2 Y; p' w! \1 A2 C
- dma_addr_t dmaphyssrc1 = 0;; N7 U. f5 I1 F, S
- dma_addr_t dmaphyssrc2 = 0; I% a% n8 u2 H2 v C4 f
- dma_addr_t dmaphysdest1 = 0;
( ] n' t, j3 c. G) k7 r - dma_addr_t dmaphysdest2 = 0;
& S+ v/ J/ U" l' b* i9 C# U; k* K+ M - 9 M1 P5 @- s- m9 N2 u
- char *dmabufsrc1 = NULL;
, L8 b% t4 E4 k - char *dmabufsrc2 = NULL;7 U/ M9 |% h3 v- N2 ^0 D
- char *dmabufdest1 = NULL;" j' p1 T' I& I2 n: Y
- char *dmabufdest2 = NULL;
; b. O2 Z1 Z# B6 a0 c8 h - ' }. z7 _5 v* {& [7 b% t, ?
- static int acnt = 512;3 _$ N- @8 l) Y8 x7 v
- static int bcnt = 8;
' n/ w7 t$ y" x, O - static int ccnt = 8;# G' o; ~) U) G- C
" Y9 ?, C* x4 ?' E. M+ h- module_param(acnt, int, S_IRUGO);
( K1 r+ L( \5 _) W: o - module_param(bcnt, int, S_IRUGO);( i* w1 C% K6 G; t5 B+ D- G! ^
- module_param(ccnt, int, S_IRUGO);
复制代码 # }1 a3 B1 z- {
- B. V; z! G- h, H$ K P& o& _
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ H! G2 B9 m5 Z6 ^$ |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 C0 M/ F _6 c) z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, E7 v2 q; t: C: Y
5 v/ Y7 V( y! K L/ ~
; Q3 h: M4 @# z, {6 v# @: O0 h |
|