|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 u$ U7 o N4 K6 h( x
- [code]EDMA sample test application1 Q% B7 s3 r% N3 l1 J9 e3 {! Z
- /*' z0 k# Q% @& [6 R' u& _4 d
- * edma_test.c6 A: r0 E! y' w! G
- *
& \$ {8 c- w7 v' x - * brief EDMA3 Test Application" R* a, T5 F! h8 g9 J6 r6 U
- *
: r3 F6 |& U2 J# B2 M - * This file contains EDMA3 Test code.
4 P$ x- E4 @, ] X6 k& _" s - *
" O& m3 i, _! l% E8 h+ k) }& } - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 t. z3 a& [: d! O7 n/ h; a& o) q; a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ a, D% `7 Z2 s9 T
- * TO CHANGE.% m7 x4 j: J5 S% x, `3 w, K
- *
+ C! Q0 B c8 s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) n' i4 z: Y, H R; i - */ c' C. Y( C6 Z: {
- * This program is free software; you can redistribute it and/or
7 D. k7 u" E0 m( a5 z- J4 s/ X, ? - * modify it under the terms of the GNU General Public License as% h3 t: {) C0 l P) |
- * published by the Free Software Foundation version 2.* g8 v- {6 ^+ s( e
- *4 i* V! @) H) G; q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! G6 v7 o, [4 x) V4 s - * kind, whether express or implied; without even the implied warranty
+ y4 O3 O$ K! j - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% r* t# \9 j" J - * GNU General Public License for more details.
/ d0 h& t% P" M0 [- E* I - */
" J ?& m( _! j, Z0 s. P
4 m# J+ f, A% r, `- #include <linux/module.h>
% C4 S, O1 i' N$ C - #include <linux/init.h>* \$ D9 X. V2 k1 [; J6 N
- #include <linux/errno.h>
$ S# _% n; i4 a% J' z$ }5 S - #include <linux/types.h>+ \+ |0 c4 o% m: i$ n
- #include <linux/interrupt.h>
! W; O; V; H0 P9 h! V - #include <asm/io.h># g5 O! Z1 i* ?, t" m! K
- #include <linux/moduleparam.h>- I: Z7 N. \0 n
- #include <linux/sysctl.h>; X5 u# k# E5 h6 t! B5 i. Z
- #include <linux/mm.h>
/ O: g8 s) {: [: [% N/ F - #include <linux/dma-mapping.h>/ [& o/ V8 X! K) K9 e/ w j
- " q- L2 F% L Q8 X9 ]7 M% M. e
- #include <mach/memory.h>! W8 m F7 ?# S% V; X& u: R1 h
- #include <mach/hardware.h>
! k. ?% F0 E3 N! S& l - #include <mach/irqs.h>
4 p: }/ w9 x* M" ^ - #include <asm/hardware/edma.h>- y) ?0 E3 ]5 w
, Y3 q: |) j1 e* G- #undef EDMA3_DEBUG
n0 P4 R) v% H ]& t4 k1 E, B2 | - /*#define EDMA3_DEBUG*/- v$ A( G9 B+ t, R4 T; R# _: f
$ G/ i* z& c7 X$ s0 f5 t- #ifdef EDMA3_DEBUG0 q' [2 B0 {2 g8 L6 K( S
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 A) S% s' e$ ~) o( C" }+ _
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# \. O0 z7 m! j" D4 d0 K - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
L# ?/ y/ i4 r1 V+ X0 e - #else
4 K" p3 X( l$ i) r8 X* f& _ - #define DMA_PRINTK( x... )
9 b9 d- b6 p' B( J2 ]# Q( S - #define DMA_FN_IN7 P+ q$ Z7 L8 w& {5 g* c
- #define DMA_FN_OUT
9 m/ g$ x; q* n - #endif
* k" V7 R) I: M3 @ - 8 E6 \, Y o. ^ S: w+ e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( {. o9 o; r. I3 y# ?: o& Y" i, Z4 o - #define STATIC_SHIFT 3# l0 p# e& f1 W1 K+ m( O6 E u
- #define TCINTEN_SHIFT 20
/ v* G6 X/ ]$ U# n% T+ ` - #define ITCINTEN_SHIFT 210 L' @4 D; Y6 b- Q3 p# ~! Z
- #define TCCHEN_SHIFT 22+ V+ w+ s; @* s0 H7 G: q: F2 S
- #define ITCCHEN_SHIFT 23! p$ a$ \* ]% F$ T! _1 @
4 i% p% f3 u1 A" Z2 s; l- static volatile int irqraised1 = 0;
3 i) F" d4 q, n1 K* Z - static volatile int irqraised2 = 0;
& r$ G4 d/ M6 T* z/ v, b: s
, r( W) c: `) ^' A1 B* \3 p- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 G8 }- Y" z4 O. b( U z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: Q, s! j$ G/ ]9 G% d1 ] - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 m" v/ J0 F) [
3 v4 W) p7 k% m6 N3 k/ h- dma_addr_t dmaphyssrc1 = 0;
. J% y; p; O8 V - dma_addr_t dmaphyssrc2 = 0;
# x$ z3 U% L1 z+ r: G/ q3 | - dma_addr_t dmaphysdest1 = 0;
. \$ C3 S- D- m2 w5 F1 ^" ^ - dma_addr_t dmaphysdest2 = 0;1 G( {/ x. W! \. k0 m8 }9 s- R
7 I5 F# [. O8 w- char *dmabufsrc1 = NULL;
0 q: V9 |# U! o1 g+ O+ D - char *dmabufsrc2 = NULL;" f3 d0 F% c1 B7 e: Z
- char *dmabufdest1 = NULL;
" w8 H0 Y3 s! H - char *dmabufdest2 = NULL;
# L1 Y1 Q" b7 q3 x - 5 i1 b% _& Z+ Q; C( v h" v" A2 ^7 {. w
- static int acnt = 512;. [- R8 \$ ~. W- ~2 w# }3 u! _. B: w- N
- static int bcnt = 8;
" u( U$ N6 Z; g& h0 Q - static int ccnt = 8;1 T* p2 C9 Z# N( r8 s
5 S- A2 c2 I/ n# G" P- module_param(acnt, int, S_IRUGO);
l9 m& l4 K" f* k - module_param(bcnt, int, S_IRUGO);
4 m4 G! d$ M4 \) E$ U - module_param(ccnt, int, S_IRUGO);
复制代码
8 A6 e+ `6 F; \4 ?
6 O B: b7 z) i7 o( Z9 I 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& A; K% `$ E+ Q8 O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 d. z; t/ w" R; f& V( l4 Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: J5 `1 k/ [& B( G
: @7 o9 {. q' [2 N! d0 W c
9 { o2 H& q0 J; x) d
|
|