|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& P- S6 y/ V# R+ ~: r2 w- [code]EDMA sample test application+ j; `( k$ |# r4 C- a4 S$ B
- /*
- ^" X1 _9 `$ T# i - * edma_test.c% H, t; g2 Z, _7 o
- *
# I0 Y4 p8 ~, _& n8 Z) L - * brief EDMA3 Test Application
0 t q" Y! y3 I - *6 e: ^' h& q. @# J: p, U
- * This file contains EDMA3 Test code. ^4 R- H" }4 ]# t+ n% [2 B! n- x+ B; H
- *1 p7 o$ H( z/ e8 W& }7 q: v: M
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 O! e# y4 M* c+ P1 d/ w" G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 E2 c4 v, x) E0 ?. {4 k
- * TO CHANGE.
% }+ I) \; a) d& n- k# L - ** S' T1 O7 D/ B
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" K( h! |2 I- n% D% h* Q3 } - *
; k/ R- o2 \2 T - * This program is free software; you can redistribute it and/or0 r* Y/ K9 w, T: Y8 c/ w7 N( h9 ^- P
- * modify it under the terms of the GNU General Public License as* i. u# {! L+ u9 C4 x
- * published by the Free Software Foundation version 2.2 n' J5 w8 U4 Z' ?% a
- *. @: U4 }) w; R/ a7 b- F' V! w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- Z8 l4 `7 p3 g) G( V |. A" o
- * kind, whether express or implied; without even the implied warranty
# U8 ?. o& l5 f3 T6 b$ w$ K: t! s - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. k5 ]8 j: d" y - * GNU General Public License for more details.2 Z: c% R+ N9 V0 t) b" B
- */# d8 Y' l& |! {
- } z+ M/ z8 R; E
- #include <linux/module.h>9 _. H, W" U& L- D
- #include <linux/init.h>
; C" O+ w p- Q+ R - #include <linux/errno.h>
. ?* ?' N7 ` _8 C7 n - #include <linux/types.h>9 ^) d! l& V0 y6 V; Z
- #include <linux/interrupt.h>& ~% H5 S3 H& a
- #include <asm/io.h>
% a! e4 U {7 r% p' h - #include <linux/moduleparam.h>- f8 Q4 h' T5 m7 x& p5 x2 s6 v$ ~
- #include <linux/sysctl.h>
- I3 }2 y6 `* A, y! {, n - #include <linux/mm.h>
u; X9 s( e `* y" K: Y. P* n - #include <linux/dma-mapping.h>
( o" W; L' I9 x; A, j* N( i+ L - & b0 v- F* r! l9 n8 ~+ A% u# `
- #include <mach/memory.h>5 M6 K6 K+ {" }, l4 a
- #include <mach/hardware.h>
7 U2 x; m8 [% V7 t* h( b - #include <mach/irqs.h>" }1 |+ [# K% W. Y1 F8 a# x
- #include <asm/hardware/edma.h>5 T2 z8 ?# A% t
7 W6 Q3 d0 e( H4 E# t: s- #undef EDMA3_DEBUG
8 i- Z6 O. f7 P8 B - /*#define EDMA3_DEBUG*/6 x1 T9 ~* u. c: @
- / N2 }" \7 `3 k1 r# M# X. ~
- #ifdef EDMA3_DEBUG
: H% U4 p$ {8 M* N( t - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); j% v0 G$ X# a; [0 h- Y7 F2 R- w8 u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). P" J( }- u3 K- \- ~" ^( J6 a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, l" p# A: i' ?7 k7 j& g - #else& Q4 S+ W/ Z6 ~% E
- #define DMA_PRINTK( x... )
0 T4 v" x% Y! l. P7 g# F: |' \ - #define DMA_FN_IN
3 J* e3 `4 ]) x# `3 o6 Q/ ?. e. H - #define DMA_FN_OUT
* L! h2 s4 n6 S7 X9 I% L - #endif0 A7 h4 |$ @& A
- 0 q! o! O: }% p( ?! {3 e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 o$ t7 w1 l _) _% h% `" I - #define STATIC_SHIFT 3
7 `+ [& U& G/ [& z7 ~& B2 ]! N - #define TCINTEN_SHIFT 20 k( ?$ d6 C; U+ c# R2 K& w! S
- #define ITCINTEN_SHIFT 21
7 a. {8 Q/ ]9 C - #define TCCHEN_SHIFT 228 O6 s0 E C" z$ |( o7 g
- #define ITCCHEN_SHIFT 23' A0 j/ @! Z! F% X9 C
, y/ E$ }/ T6 x- static volatile int irqraised1 = 0;
) e" c$ c# C+ c/ P - static volatile int irqraised2 = 0;# ^9 j) k8 g: {% l3 v4 o
- 1 S+ t: `6 H7 j' v2 b6 s, y, ]% A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- Y k4 [0 o" W7 S/ d9 P$ T9 F5 R - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. r# @- G8 e* t- l4 H# C, p6 \2 \ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 v' b: ]% y3 a! R( |6 f% D. F
! j( o; @$ U2 L& b* i5 c; L6 f- dma_addr_t dmaphyssrc1 = 0;1 z8 K- P. T6 ~# l6 S" \ h; j( f
- dma_addr_t dmaphyssrc2 = 0;& O6 A/ g! L. E$ o, x
- dma_addr_t dmaphysdest1 = 0;
- k/ ^ p9 S& I# Q. R# A - dma_addr_t dmaphysdest2 = 0;
( k1 k9 p1 I z - 5 n. h) o' H' y. I0 @6 ~; E! X( n
- char *dmabufsrc1 = NULL;
+ @) _8 c! }9 B- W! f, F. G* ^ - char *dmabufsrc2 = NULL;5 k6 p8 J+ e+ ]( a9 w/ l, s ^
- char *dmabufdest1 = NULL; A# H+ U0 u2 S3 G3 G' K' R/ O
- char *dmabufdest2 = NULL;9 t& ^2 c( Q2 Z2 v. B3 z! [
: }- `0 m N. z& ^& ~8 M- static int acnt = 512;
K( `" u7 Y+ F. H) O7 _$ ^$ l$ [: E - static int bcnt = 8;
! x' n9 ^ B! A - static int ccnt = 8;% ~$ ?& c$ T) T" L0 L# }4 z; Q
- - Z- ~: u- D( r8 A
- module_param(acnt, int, S_IRUGO);
0 k$ u% \& V2 i1 A4 Y: G - module_param(bcnt, int, S_IRUGO);- r! }6 R1 C3 B/ n# H9 \& s: a
- module_param(ccnt, int, S_IRUGO);
复制代码
: e6 B2 y; b7 E ~) w) u
) C" m$ s/ x: r- @9 z( P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: B+ Z" }& O0 `. O7 ^0 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 m% T! k1 T- f/ s" _: {- Z9 ~$ }' `
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
o4 _6 `( U( S9 s( M3 |$ j
/ I8 w: I2 g6 w+ c, B) _
) f; a5 _. p, D3 R$ _ W4 ~% L |
|