|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * |$ g, F% O& ~0 b
- [code]EDMA sample test application) {& N/ `% I0 K# m% k$ j* N# L6 t$ h E
- /*5 u, o! x% E" E/ r6 A
- * edma_test.c+ C* s, c% t5 H9 _5 p/ w" I5 _- I
- *% I0 Q5 L8 b) y. j" ]4 R# U
- * brief EDMA3 Test Application
5 S' o$ ]1 x: Z/ d! [: J - *3 F3 p8 W! d+ B+ x0 A$ G
- * This file contains EDMA3 Test code.
; t$ j% @( |$ d% X - */ Y3 \0 n" B+ E" {2 ^$ f* w6 m) ~. K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ Q A2 a v- }0 h# S - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: Q2 B8 t; p) z: r& v/ o - * TO CHANGE.
$ X' O' Z# |+ `0 N2 v, O$ S+ z$ }5 t" y - *" Y2 \8 \/ t# h0 r7 F; R; M5 M: B
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. F5 N s @6 d7 s l" _/ }- g
- *
' _0 H4 w: b2 g( @6 @& {! l - * This program is free software; you can redistribute it and/or
h5 S, A7 T( v+ e7 ` - * modify it under the terms of the GNU General Public License as
/ h8 f1 |! n% K' \ l& ^ - * published by the Free Software Foundation version 2.1 b* E7 h3 s& [" p6 S$ C! a! M
- *- e2 O! c5 f; j! c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 Q4 V9 r- ?. m. v5 J1 y( C6 U5 g - * kind, whether express or implied; without even the implied warranty
/ r4 T# m7 u1 L$ ?& [/ k& V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ X& f$ M/ u$ C
- * GNU General Public License for more details." I* s/ V" h5 A
- */
7 Z" ^2 v" ?1 o* F - 3 d/ l& E0 C+ q4 s9 `
- #include <linux/module.h>& z5 o2 l( ]1 ?, P. b8 E
- #include <linux/init.h>
7 O( K6 x0 ]5 x3 O8 m5 i - #include <linux/errno.h>6 g+ s. e! N- ~2 I' L0 c# c! K/ r
- #include <linux/types.h>% X/ N9 P) b* K3 |
- #include <linux/interrupt.h>. J7 u& ?2 p1 Q) J3 }
- #include <asm/io.h>
5 E0 y& v4 P3 _! G" K - #include <linux/moduleparam.h>
' B/ F+ Q7 G/ o - #include <linux/sysctl.h>) Z. K: I" z$ @0 Y9 j; ?
- #include <linux/mm.h>
; u# y G N) y) b. K3 q - #include <linux/dma-mapping.h>
: L- w: `& {5 M; l - * R- {3 G; }/ ]- N' W7 H% o
- #include <mach/memory.h>
: l9 ]' r: ?1 V - #include <mach/hardware.h>
. F: A6 X9 z* T0 s! W3 Y$ n - #include <mach/irqs.h>, a/ W! O7 p2 Y& @
- #include <asm/hardware/edma.h>1 u9 {$ {/ O, O9 w/ `8 Y: \8 n
9 o. d* v/ z6 l* q9 B- #undef EDMA3_DEBUG
6 {- P, W" K6 Y C! z9 N4 H - /*#define EDMA3_DEBUG*/
# O, r- A5 A6 q9 ` - " h1 b6 ?$ {" h/ w N5 C4 I8 I
- #ifdef EDMA3_DEBUG2 e7 U. ~# v4 R+ \2 w
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* \, l# a" X! c( O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 M1 a; |$ I6 r2 p2 g' r" x - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% B# Z2 P6 j6 |$ N$ r+ _ M- n - #else+ Z+ n2 A+ x/ V' \" I
- #define DMA_PRINTK( x... )
" r1 \; k' N9 L' U; _: I - #define DMA_FN_IN
! e% x& B; R) c" o; l - #define DMA_FN_OUT
8 X; K& I6 [7 G3 ]6 W k - #endif
7 u. u; \. {- r7 k3 x* N3 b - ' }' V* A2 L7 [9 [) ~7 G9 B
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! U& t& K$ @' h8 e3 L# \! [
- #define STATIC_SHIFT 31 d& m/ q: k" H
- #define TCINTEN_SHIFT 20, ?- Y6 Z0 Q/ i1 e
- #define ITCINTEN_SHIFT 21
% P2 i0 c5 {4 A - #define TCCHEN_SHIFT 22
$ n$ J* e6 T) k, W6 j* v4 R - #define ITCCHEN_SHIFT 23
% ^2 I- q+ Q8 i5 n
$ \ F7 ]4 Y4 U- static volatile int irqraised1 = 0;
0 A$ O$ X0 u. C. r; W- i - static volatile int irqraised2 = 0;! P4 K: u# Z' c5 F4 t
- . t4 P$ Q- z& m7 Z4 g: R( J. y, J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; q/ [% T! Y7 O+ x - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ s# M3 Z( h3 B; D* J
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! x8 C3 G4 s$ o) i2 G/ A - \+ A ^4 o @6 S9 ]$ L7 a
- dma_addr_t dmaphyssrc1 = 0;
' @2 ~( Y" E. Q0 ^ X! i( b - dma_addr_t dmaphyssrc2 = 0;7 T" o G0 V0 A+ b
- dma_addr_t dmaphysdest1 = 0;8 F! R' F+ ^, n6 g
- dma_addr_t dmaphysdest2 = 0;
8 |! ~5 {- I. g4 h; ~ - " I8 O0 J+ Z; g' T1 ^
- char *dmabufsrc1 = NULL;, e! q: s0 m/ m
- char *dmabufsrc2 = NULL;1 y; {, p3 N( O0 ]& `; a, \0 V9 a
- char *dmabufdest1 = NULL;; L* B' F" @# g8 ^3 r
- char *dmabufdest2 = NULL;
" l9 k5 H3 E, M f0 Y" N, g* g
& L! ]" } p, D7 V/ u8 f$ K- static int acnt = 512;" d$ |) }, M! P6 m8 w& q6 P1 e
- static int bcnt = 8;
/ Q4 G+ I8 j2 b2 C" G$ D' r: n - static int ccnt = 8;7 R! B) i# x& m2 U5 u
9 M5 \: T: s: X5 k" D- module_param(acnt, int, S_IRUGO);! ^* q( J4 h1 T& S; u
- module_param(bcnt, int, S_IRUGO);# ~. {1 }2 ~* v1 E0 Z2 g
- module_param(ccnt, int, S_IRUGO);
复制代码 1 v: w; d: q) y _
" X0 U# W; p" l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! W; H4 b7 `# h( L# a5 A" g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% D% u( R/ Y' l7 `* `" @/ _ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! n. Z4 K$ ?' T+ x- P1 y! u, @: y+ U2 {2 P4 M
" @0 `3 x! w; h |
|