|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; Z6 l; @1 e( J; q2 d: L# j- [code]EDMA sample test application9 @% K; u+ y. \6 O/ O! M4 A
- /*
. D4 m% q" B4 O/ O7 k, l* ?$ R! P - * edma_test.c: o0 z# v$ L: S! t6 Z
- *- G2 f# M! j, W9 U2 c, u
- * brief EDMA3 Test Application4 e7 Y& ~: C* |8 Q. ~ n4 Z
- *8 p- E7 o c9 Z$ v' R
- * This file contains EDMA3 Test code.
" [' T6 L. a' ]+ }# ]9 c- `$ g - *
# G2 I9 T% ~0 ^7 b* v1 m. s: l; ? - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 F" T E$ Z' k& Z! o - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 s9 F5 ~0 l F2 u - * TO CHANGE.
+ x8 _( U4 w* N - *
& e+ p( y* C8 |1 E- u1 v - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 C8 M+ A' j+ V- |% C - *- r* |! ~: D! w4 B6 i
- * This program is free software; you can redistribute it and/or- Y! v9 [' K6 I0 Q- B
- * modify it under the terms of the GNU General Public License as
9 d+ ~* j1 i3 u# r* Y m1 H - * published by the Free Software Foundation version 2.4 H8 F$ ]) x$ L& s5 J
- *
$ U' z, v# t' H9 w5 h - * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 F4 x' d% R) I' {. ?
- * kind, whether express or implied; without even the implied warranty
; ?; o; N% {6 J- Y( ^" c4 w0 N - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 @3 v, E: O! O, a4 n
- * GNU General Public License for more details.
# e5 O. p0 }" w- d; n E - */( f4 g) e0 D( f. o
- & j5 y; Z3 B4 x7 a- ^: Q6 p
- #include <linux/module.h>$ ^5 a# r4 k1 E4 c8 T d
- #include <linux/init.h>/ V( u. R) B; ~% Q
- #include <linux/errno.h>2 V3 C/ u6 @ ~, d; f% H' o% a, |
- #include <linux/types.h>9 _! \4 D: }4 {/ |2 i& }7 n4 Y& g' n
- #include <linux/interrupt.h>
( n" U1 ^! _" x# S- }3 A - #include <asm/io.h>6 N" C; U; V' f- U) N# f+ l
- #include <linux/moduleparam.h>
( E& d+ F R6 v5 p) w - #include <linux/sysctl.h>
4 I+ O3 ^/ }6 l* E+ e7 r, ^ - #include <linux/mm.h>
9 a( _. v3 G. p4 O - #include <linux/dma-mapping.h>
5 D; c% Q3 D' b' v' v) q
& R! C1 W7 E, |- S- #include <mach/memory.h>& H7 z* ?( s+ e7 P& Y
- #include <mach/hardware.h># B4 M6 ]/ `& \; |$ N
- #include <mach/irqs.h>8 M# a! o" L1 i& v! O' A
- #include <asm/hardware/edma.h>
+ I6 C5 ^7 @! q- f
# f1 H* Q& w8 L" \5 N- v. j- #undef EDMA3_DEBUG* x- q$ Q5 x1 o, L& n) u
- /*#define EDMA3_DEBUG*/6 a3 x4 J" @, ` J. w
' s( P9 p. w, U- #ifdef EDMA3_DEBUG9 y; Z# M y3 Y* G8 W$ q$ Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& V7 W3 J- c# p! V0 `( q: E+ y9 u+ U g - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: H. v4 i0 Y$ Z9 W) A1 g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 ^0 W: r- `/ H7 d% f
- #else" [) {/ L- H5 b1 S5 j
- #define DMA_PRINTK( x... )
2 ?& Z( B& I% n) b8 E( \ u! Q - #define DMA_FN_IN& ^: S8 P7 T; a9 w. Q! X
- #define DMA_FN_OUT5 N9 X+ N$ l' D6 D+ x( g/ `6 G
- #endif
* Z9 d8 {5 k4 v) @. P& T1 b - 3 A U) f$ y4 y- j ~
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 r+ i" N/ @" f5 F - #define STATIC_SHIFT 3
; t) X6 ^+ B7 ]* Z- M - #define TCINTEN_SHIFT 201 E+ z# I' L7 H8 w! C0 U4 |1 n
- #define ITCINTEN_SHIFT 21% X) i1 m5 }# Q8 K$ Z
- #define TCCHEN_SHIFT 221 h0 h8 }4 ~. G. `7 N& u% s
- #define ITCCHEN_SHIFT 23$ T/ S4 i# n! @1 Z% Y
- % Y& K" u7 t- s+ [- D
- static volatile int irqraised1 = 0;
5 ~1 L0 U; I" F C: A% O. S6 B! S - static volatile int irqraised2 = 0;
( R9 P! Y1 |$ n" r# Q3 P l/ ^$ N - , `# Q% a: ?1 N( s) `' Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) x' `3 `$ z5 q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: c4 x7 n: V' K; ], Q) T& \7 h - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ q/ d( }$ L- X
' Q% Y) y5 S9 E1 g/ U+ r1 F7 n- dma_addr_t dmaphyssrc1 = 0;
& n" d# l8 G1 ?: B# ~: n4 \ - dma_addr_t dmaphyssrc2 = 0;; `) L0 J6 A6 `
- dma_addr_t dmaphysdest1 = 0;
* v! ?8 U; d) v$ Z ^& T - dma_addr_t dmaphysdest2 = 0;
( \ b* f8 R) [! l - " M Y r0 ^/ p# u9 I N
- char *dmabufsrc1 = NULL;
5 L' `0 L0 @' T' K D( j6 y - char *dmabufsrc2 = NULL;
2 Y8 x% }& D( ?# D' J. m0 M - char *dmabufdest1 = NULL;
; W7 Z2 ^6 r9 T. \; b0 m - char *dmabufdest2 = NULL;
. G$ M6 G( \; f$ x2 ^0 I$ n( z - 7 @+ g# S$ @( }6 u0 |0 |: w( N
- static int acnt = 512;
?2 J! d1 k0 A' H4 o - static int bcnt = 8;
" M0 ~, ` Q) Q' \" p- u - static int ccnt = 8;' x8 K6 Q: A! d$ i5 c- \5 s+ k
' j+ F4 F" Q, X" T- module_param(acnt, int, S_IRUGO);* ^, N- y! ?. Y: j, h
- module_param(bcnt, int, S_IRUGO);5 z- `: }# F# \
- module_param(ccnt, int, S_IRUGO);
复制代码
h( t* ~! k: m! d6 v: u3 W
8 S& z' s+ g4 [2 U: s! v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- S; V0 N- I, S; f9 A7 w: Q3 J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# r/ m( h6 u8 o; c. |; | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# F1 {) ], ^0 o( v1 ]) l [" ^' Q5 W" U+ b' G' m' e( L9 C0 O
& m$ W1 l: v2 P9 z+ T+ H |
|