|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 |+ Q4 {5 v- x: y4 X$ _- [code]EDMA sample test application/ G% h$ K) c% D! O4 Z8 W
- /*9 J3 M1 s8 }9 ?& \8 {. z
- * edma_test.c
0 T7 \5 b/ E. N' h9 d - ** s { ^/ j2 ^* S4 n4 L3 c
- * brief EDMA3 Test Application8 r% s1 a& g3 b6 l6 L' p: D
- *$ ~! B: T% O) m" v: K! m T1 `
- * This file contains EDMA3 Test code.2 ~8 Y+ a0 o/ H$ ]
- *
% M R' P9 U K0 Y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
1 A2 [6 `0 s1 R/ Y6 x/ Z" p) g - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, c- A9 D$ ~ E. l4 t: o - * TO CHANGE.
4 C* R4 R% g, L2 a4 }: \9 _" ~ - *+ p' Q" O' r% Y. E4 N; j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; P" |* f$ W1 @9 t( _: M1 b4 R
- *
! l' F, g: v! H ]. D: k - * This program is free software; you can redistribute it and/or
: p0 G% r$ x4 c1 A/ s0 @# A( ? - * modify it under the terms of the GNU General Public License as
1 A4 c9 A+ ?& `% Y$ c - * published by the Free Software Foundation version 2.' O8 N/ W; C: E) c! O0 ?+ u
- *
7 k5 ^0 a5 I$ U3 {# e6 M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# L' K; x7 f: Y! s* T5 B2 N! N3 B0 H$ r - * kind, whether express or implied; without even the implied warranty
" {& M) W/ u( q" X7 d& A1 @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 S& u7 A, w8 b
- * GNU General Public License for more details.$ n7 `) k& S7 z2 X
- */
+ I& \' `/ q$ x5 E1 a: V" P# @ - 2 l- B2 X& M# x- V
- #include <linux/module.h>) U, @( z/ h6 T) y& Q* b0 c- t' _
- #include <linux/init.h>
3 Z5 Y$ b( ?) f- O, l, F - #include <linux/errno.h>7 Z! F" s: F+ E1 M; ^+ l m
- #include <linux/types.h>
) f! l+ z0 t) Q V: C" f - #include <linux/interrupt.h>, |1 ^4 _3 l; o. s; E, o
- #include <asm/io.h>3 ~$ b& j& m" r
- #include <linux/moduleparam.h>3 K/ v: S. ^* O+ _- F3 B% v
- #include <linux/sysctl.h>6 ]: c5 I& ?+ d& ?1 v2 o, ~0 O' h
- #include <linux/mm.h>+ P6 Y& X9 g% I5 p; R! n
- #include <linux/dma-mapping.h>$ y' Q# x2 R5 Q+ L1 @0 ~
0 g* N: E0 {# M8 r, {- #include <mach/memory.h>$ H* s! ~' F* v0 L. b' j
- #include <mach/hardware.h>2 S4 D1 ?4 l$ o3 }: |( _5 P% J- \
- #include <mach/irqs.h>
4 z2 n7 @" R4 [2 J k - #include <asm/hardware/edma.h>
/ S8 V( S6 j4 n+ `* ^. P( J; U
; F9 @% c4 M# H) g- #undef EDMA3_DEBUG
' |0 F' T# T# `6 K0 U- f$ m3 ? - /*#define EDMA3_DEBUG*/
% } B9 h* [& i
2 ~4 Y* L6 L. Y" G- T- #ifdef EDMA3_DEBUG
# a, f( K; x6 k( V! t; I2 w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' U6 ^: [. g: t# N' m
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! C$ c) k$ ?0 g4 {
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) \, T$ @, }# _1 i: F- L, x
- #else
$ s& y4 s8 `- W - #define DMA_PRINTK( x... )6 x i( w7 T/ l7 Z+ g
- #define DMA_FN_IN
H7 [) a& T: n0 F - #define DMA_FN_OUT
( H3 m$ C) {$ @6 d$ f' ^ - #endif
& V9 q3 D! g0 A' o% r+ a V
; q0 \+ L, ?, D# ^; L9 i, r$ X3 Y q8 c* ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. G h2 P4 h! y: Q: O - #define STATIC_SHIFT 3' o9 D$ L5 P8 d- _ N4 f
- #define TCINTEN_SHIFT 206 i9 a- l T) t5 s
- #define ITCINTEN_SHIFT 21: H- Z; @4 d9 j; B! P) P" A9 c
- #define TCCHEN_SHIFT 22
9 j1 i& [; {5 _# c - #define ITCCHEN_SHIFT 231 a- \, R# k4 R
. D& ?% Y. Y$ z* h2 Y2 K' F C- static volatile int irqraised1 = 0;
7 h' B, A8 I, l; U4 V- y; I - static volatile int irqraised2 = 0;
+ M5 D+ ^: E% |
' d/ f" y- _2 N! g- e$ M0 @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; u0 v0 T6 v1 k9 S5 `* o. {* j
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 ^ I' h4 u* n. b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! {/ i- Y. X8 b- u2 @1 N - # P- w9 _# S9 t( X
- dma_addr_t dmaphyssrc1 = 0;
) `. l. P% h; N - dma_addr_t dmaphyssrc2 = 0;
3 w2 B+ |, r) O1 C - dma_addr_t dmaphysdest1 = 0;
+ B6 e! |4 ]. @/ g - dma_addr_t dmaphysdest2 = 0;5 b: n( x* F% a- c& N$ P
. q' i$ K5 Q" G4 F) y' `* K- char *dmabufsrc1 = NULL;
. H- u0 ^/ y/ b3 e( J- z+ |7 a# A - char *dmabufsrc2 = NULL;+ l$ K7 L# r0 W+ e' u g0 F- T
- char *dmabufdest1 = NULL;8 e3 h6 @* [, V: d, F
- char *dmabufdest2 = NULL;/ u9 e+ o! F8 [$ _2 L9 _( K- b
- & @ _8 X& w8 d9 f0 f
- static int acnt = 512;5 N! _& w) u. Y9 V& j3 P
- static int bcnt = 8;) Q4 T: V$ Z, g
- static int ccnt = 8;
1 o! o' w8 v; v5 k
, Y- ?; e4 ~6 _( o- u- module_param(acnt, int, S_IRUGO);7 S3 E: ~5 K) P- o
- module_param(bcnt, int, S_IRUGO);
$ b2 }& q. X# B) v# E8 G - module_param(ccnt, int, S_IRUGO);
复制代码 9 K' @/ ?* z/ R h5 M
+ I' d) D; D7 y+ G. Q: v: ?+ P6 N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% R% s+ r( V( f- B5 B. l5 warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
F4 e" N7 A% x& W: k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- C8 }/ }9 M! H, C r! S( ], w$ `7 @. V+ x* g; w5 Q
5 N- @* u% J% W' e( d: H0 \
|
|