|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% v0 h# k" X U" T8 y; z( F- [code]EDMA sample test application! A0 s8 X2 J4 v+ i
- /*
$ G- ?. r! H: E; j! X - * edma_test.c
: ^( L7 Z, V4 S- F6 Y0 W' h - *
$ d) V a! K5 G0 W& L2 i - * brief EDMA3 Test Application
: U) u B7 E6 W1 p; m- R. ~, _ - *. i( O: c% [2 c4 Q, I2 P
- * This file contains EDMA3 Test code.
) N) U. u3 Z, {# p4 u4 ? - *: [/ w1 D. k9 Q) I4 @* b0 i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# r$ O( A% ~/ y. O8 g6 o& n) l
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- V# v& N4 \& A - * TO CHANGE.
1 {6 u8 s/ H' b8 X7 O \; Q - *
0 S1 ^; g$ Z3 b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% l( D# k1 {6 I, r0 k4 s, a: C
- *1 \! i. k' l3 X2 r* m* Y
- * This program is free software; you can redistribute it and/or
; t5 H$ L: K1 m# f) I% m - * modify it under the terms of the GNU General Public License as
6 d$ s1 O1 J: U/ u - * published by the Free Software Foundation version 2.4 b# [! G D% _
- *
/ z/ u' t. j: @. J+ Y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# N1 b* A/ g& \ - * kind, whether express or implied; without even the implied warranty ~! l. E. v3 T" D2 o, q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 u- W0 T1 p8 o3 J0 P+ I: u! E" r - * GNU General Public License for more details./ N" I. B) X# z0 G# V! _
- */. r7 b" K) ]" v+ A4 W; e& a: ^
0 R0 g1 q! [' V+ p$ A9 I5 e- #include <linux/module.h>
8 Z: k% I2 @0 {9 r1 \# v) M - #include <linux/init.h>
7 ]# e: v' L% f/ ~: K! S6 B$ M6 B4 A - #include <linux/errno.h>
0 d0 X3 G; a$ X, {$ Y% b8 m( r) C - #include <linux/types.h>7 F- q" y+ w# S7 M3 H
- #include <linux/interrupt.h>
2 [: s, E" U) c% o1 u - #include <asm/io.h>
; n. X" L- s5 D" V; C( r - #include <linux/moduleparam.h>' r: x8 R9 f1 n+ _
- #include <linux/sysctl.h>3 v3 `, J3 V: ^! ~6 N3 M0 W
- #include <linux/mm.h>
* P$ P2 {( |/ `% i3 V& Q - #include <linux/dma-mapping.h>
& ]- K. ?" P* T) u. t1 |* P - # @, C4 Y0 l6 z& ]( ?; U
- #include <mach/memory.h>
8 q- y' l4 L, Y' @ - #include <mach/hardware.h>7 e! S0 p, z+ ^; J
- #include <mach/irqs.h>
% @/ x/ q- X' A" J4 T, e - #include <asm/hardware/edma.h>
4 i2 f4 k4 P7 m
6 j, m' `( [- N7 w4 v0 R- #undef EDMA3_DEBUG
1 [; ~6 D% B/ Y1 W2 N4 y3 B - /*#define EDMA3_DEBUG*// k: n# e; X3 q, v6 L" e
+ m9 Y& d, s" D- C( E1 P- #ifdef EDMA3_DEBUG5 T4 n H( O. h Y8 Y0 l& H
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
L# k. F! g4 @5 | z! s8 R - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 w6 h0 ^' W2 |8 H( y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) D. V: x# {7 h0 ~ b/ N, _
- #else! B* p1 Y0 e8 r! t2 |
- #define DMA_PRINTK( x... )
. R Z) e' j/ s4 S) k- t$ U - #define DMA_FN_IN* i& Z1 I/ g9 [! S$ n) W! s
- #define DMA_FN_OUT
! k$ O H# U( g* C2 g- f4 s - #endif! [+ ]) l! _, f* n6 A
- 4 {2 X; e. O3 x. n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 n- t( g e- f+ P; ?6 G8 k - #define STATIC_SHIFT 3. C0 X5 ~/ K" F$ M
- #define TCINTEN_SHIFT 20! w U- Q: C3 q" j5 @9 w7 U
- #define ITCINTEN_SHIFT 21
1 \' [8 z" ~0 }; D& {8 O* w - #define TCCHEN_SHIFT 22
6 D7 T0 t. ~7 z' f5 f - #define ITCCHEN_SHIFT 23
. r, a9 N- P, F! u" Q. y8 m - L$ v0 b! V" O; W r& A$ u% [
- static volatile int irqraised1 = 0;
3 j8 F4 p6 `2 h' |$ K$ @8 F' j9 ^ H2 ^ - static volatile int irqraised2 = 0;
/ O, D8 O) c, b. v# G - * x+ e$ x4 q9 S) g, h
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 S) D* I% w: k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 ^6 r5 W7 ?8 x/ A+ J' A! [+ Y/ i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; I# I- [/ z r, N h% o
- * a' p T# X% j7 m" | t
- dma_addr_t dmaphyssrc1 = 0;7 T8 `( U" E8 H& I
- dma_addr_t dmaphyssrc2 = 0;* j! D0 j5 g: ?
- dma_addr_t dmaphysdest1 = 0;
- Y! o/ G4 n$ z+ T' q - dma_addr_t dmaphysdest2 = 0;
: p# s- } A1 P: U' ^" V, n" E, { - 9 m; W2 C+ `, n6 ^$ ~, n: R1 D% V. }, I
- char *dmabufsrc1 = NULL;
* {3 ^1 r% i. V - char *dmabufsrc2 = NULL;
% b5 ]: u0 T4 K! R# ^, g - char *dmabufdest1 = NULL;/ u- m. T8 i3 z6 r" k
- char *dmabufdest2 = NULL;
q5 ?: ] O- t8 ~& u - 5 G9 N) ^1 L8 x' K8 T. u3 N
- static int acnt = 512;
7 S2 ?& w* H3 J, R0 ^% P - static int bcnt = 8;: E* N) Y$ R# ~4 W5 H7 f
- static int ccnt = 8;# M% D' q" h+ x1 R5 N
- 6 m9 ?& o. t W
- module_param(acnt, int, S_IRUGO);7 r1 ?5 R1 M7 @3 f
- module_param(bcnt, int, S_IRUGO);
" c) `. m+ s% R2 _ - module_param(ccnt, int, S_IRUGO);
复制代码
& @" Q8 K& } ?+ l' \/ {3 s( E) B
5 `! F5 f: z2 J! Q2 k2 h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ o# u2 z* D( Y' m* {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 ^8 n" U8 j; W# L+ e3 u
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ T- h. B) M# |+ M E
" d# H1 i3 G( T0 R& d
# Q B; n, y5 R1 n3 X- [! g |
|