|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ n3 Q* e) R* z- [code]EDMA sample test application
0 [4 z: d0 ] K' Z. c6 b - /*
0 P" _, V5 `$ B3 ~* G/ L# T - * edma_test.c8 _! ~+ z+ m$ E. @, Y1 N
- *1 U P4 E6 m) H/ w. u# k/ u
- * brief EDMA3 Test Application, e: a; M. y. H" r9 l1 ~3 L
- * S) R1 J; E6 J5 y# b
- * This file contains EDMA3 Test code.
9 l$ n2 \3 O' D& G+ L- ~ - *
9 T- H) w, A ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# n# V! a; z; B* m
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ u/ h: X* |2 g; e - * TO CHANGE.
: I/ w C% s8 a/ c - *" {' T% J2 {& N, L
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ W2 D5 b( M& D7 y# {# q( z - *
% f q0 ^% l) t+ |9 o - * This program is free software; you can redistribute it and/or, z* P' e& \7 w2 i* A5 H$ C
- * modify it under the terms of the GNU General Public License as
( t0 ]& [% }% Y: X9 O - * published by the Free Software Foundation version 2.. L- ^$ i3 n' k' Y: d- s) O7 ^
- *
+ z3 y" b8 v# c: v3 B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# A: a1 Z% Z" D$ \4 I4 B/ l1 s, k
- * kind, whether express or implied; without even the implied warranty
: l4 g- _1 M4 \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, n) O' C/ j6 u4 H
- * GNU General Public License for more details.; m0 b0 F' I3 H2 D5 c
- */8 s; M* v3 _1 J' j5 f
, |0 p8 H; ~0 K4 _3 d' Z# x- #include <linux/module.h>$ v( |' |! H6 b: ^0 H
- #include <linux/init.h>
; _& I( e; v" w5 O7 f2 h - #include <linux/errno.h>7 w$ n( O% P& [' U8 _
- #include <linux/types.h>
3 \9 o$ K" j" @' }' C" s/ i - #include <linux/interrupt.h>
# s4 x0 V9 C% ?; U+ i - #include <asm/io.h>& V3 j* C4 g8 e8 X
- #include <linux/moduleparam.h>: n7 S3 W! R% a
- #include <linux/sysctl.h>
# i' e5 B) C6 D2 Y1 x2 r( H - #include <linux/mm.h>9 ^( I& ^1 u+ l1 x( ~) g6 H g7 \
- #include <linux/dma-mapping.h> {: r1 x6 S# L" j+ _; B0 B
- 6 L$ p j) `% Q+ D3 @" b. ]
- #include <mach/memory.h>
4 J% ?* l8 B& o - #include <mach/hardware.h>
( t9 N) O' r* b' z7 v- o8 A. U - #include <mach/irqs.h>
8 h, c* K# ^" j7 x - #include <asm/hardware/edma.h>
$ |/ c9 q5 }, u: E: v: n {
9 Z: p4 f" y- q/ P8 U4 [* d- #undef EDMA3_DEBUG
, \$ ~% I9 ~- L3 x6 R, \3 `# N4 M - /*#define EDMA3_DEBUG*/
7 Z: i1 b4 W, u8 @
1 w4 s4 {' t8 m4 Y3 }/ c/ H* W( g( v- #ifdef EDMA3_DEBUG
" A* T# U8 `8 s5 U& _" } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 i$ W5 H& {4 [8 E3 {2 T5 s; F, t6 Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 | \1 { Z8 ~' P1 V$ Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. ?( P% C6 e/ d+ d - #else
3 o* s6 P/ J9 I. C - #define DMA_PRINTK( x... )
5 u8 D) g1 W8 ^2 m9 t - #define DMA_FN_IN
1 m4 P% y5 ~# X9 J - #define DMA_FN_OUT
: n2 t) R& d0 k6 _2 C! J8 \ - #endif
+ O0 {' Q! K, Z$ q8 P - * S2 M! o0 ^ W1 P+ e- {. b' Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! Z5 \, V7 q& V: U
- #define STATIC_SHIFT 3
. Y. E' W4 p; Q - #define TCINTEN_SHIFT 20
3 I7 r0 R+ Q, p9 w o& H- p) o. y - #define ITCINTEN_SHIFT 21' m1 U0 X8 k8 w+ P
- #define TCCHEN_SHIFT 22% c! n4 b$ l( j0 T6 J
- #define ITCCHEN_SHIFT 23
5 L8 L, c. X6 x3 L
! K5 a# k0 S- I- static volatile int irqraised1 = 0;
- a' F6 t, n- n' d& V$ e) h - static volatile int irqraised2 = 0;7 C/ n' p K( g
( |8 w8 e; l5 H, }3 I- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. P; f* v! y4 \) d6 t" k4 z4 T" \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ }6 |) [" b' ?. z. {/ A
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- [0 D7 O- N% C" c y ]8 |
7 [! I9 n0 ~+ h* L! J# ~- dma_addr_t dmaphyssrc1 = 0;) c9 B3 t0 n5 V3 `7 g' r1 {3 Y
- dma_addr_t dmaphyssrc2 = 0;) x7 Q2 _( I4 P, ]7 ~" V# ]& o
- dma_addr_t dmaphysdest1 = 0;
- K6 G+ d* }2 c# d - dma_addr_t dmaphysdest2 = 0;/ M/ K) B: F: u5 K* s% u
" y& ?' e0 B6 m6 |% k- char *dmabufsrc1 = NULL;0 W/ n' ~9 H0 M3 o! T& m
- char *dmabufsrc2 = NULL;
1 S& b4 z7 y# e; Q3 p: } h. g - char *dmabufdest1 = NULL;
& j! ^% z' _& h - char *dmabufdest2 = NULL;
3 ?6 J7 c, G! P9 P9 _# F
( ^( _ ~1 Q$ h9 @+ y5 ^- static int acnt = 512;' Z4 J7 u$ ]6 q- ~% s/ r
- static int bcnt = 8;
; {7 D/ F/ g% g/ k$ [3 Y, c" O0 ?0 M - static int ccnt = 8;$ q6 s$ r' Z! U8 v$ } m: L. y
& k$ J' m, M$ {% F- [2 N: w- module_param(acnt, int, S_IRUGO);# s- t5 t5 ~% C' d1 u
- module_param(bcnt, int, S_IRUGO);% e/ |* @3 }- q: O) ]: e
- module_param(ccnt, int, S_IRUGO);
复制代码
/ u3 F! U' S @) @' H4 _" J1 B% f/ [5 ], L6 [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& t N5 d* A( H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- i" p9 l, Y( \/ A* t
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 ~* \" D$ r" B& d1 b" O- _- {( F; h) |" q( P$ e
: f3 G2 C* T0 I* d |
|