|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & W- f# [5 Y& m' D# g9 C6 [6 o
- [code]EDMA sample test application
2 v( k" ]+ q. G- ]/ [+ [1 i - /*
" K7 g- ]# U5 [1 J+ F - * edma_test.c+ B- j( c3 U! b. u: J) Z
- *' u& e5 d' J" h7 W* R- }
- * brief EDMA3 Test Application
7 X, [7 Y- f4 R2 U/ | - *+ o/ ^* K( g: T% x" g) O
- * This file contains EDMA3 Test code.
! T- E# ~6 F9 z3 R. y$ I - *
3 G$ f% i5 y- z# f! P - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, c1 w& S2 P# L3 p( |1 {5 e
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! a+ Y) ?& X" I9 N+ s1 ?- H& V9 \! O) p - * TO CHANGE./ d% X, P3 c) \# F- N2 i K
- *0 h& L0 e- G' R
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, I7 s, j" A! n* ~* K) P* b - *
3 o) L# u0 Z" r3 `* K - * This program is free software; you can redistribute it and/or* ~6 [5 S' w8 [( N! b
- * modify it under the terms of the GNU General Public License as( D$ A% n' J2 z* w% y
- * published by the Free Software Foundation version 2.
. l3 l( k. v0 D! @: M3 O% H - *7 L' I6 u. M+ g5 N6 \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ ~+ T/ T4 w' ~4 J, d/ \( }2 t - * kind, whether express or implied; without even the implied warranty0 r8 N- \2 u2 f2 M! K9 p' U
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
V& f) k/ \! Q; O - * GNU General Public License for more details.5 s; c& C) u1 z0 h6 U. C! x6 k9 s
- */
" G) g# y3 |% o2 q - % X) j' y6 h2 U* l
- #include <linux/module.h>% x8 C5 X7 G1 I
- #include <linux/init.h>5 Y7 B3 e2 c. }9 \: e
- #include <linux/errno.h>
. q8 u2 ^ W1 ~+ Q0 } - #include <linux/types.h>" V. D q2 ?. K; Z- p
- #include <linux/interrupt.h>
& a3 n r6 q1 u% Y0 U - #include <asm/io.h>" p) k$ D& N! z% z, V1 ]9 |
- #include <linux/moduleparam.h>
7 O+ S! O" e. l( H8 N0 } - #include <linux/sysctl.h>
5 P3 M* o0 f' B8 Z1 m8 z3 E - #include <linux/mm.h>
& ~& y1 }$ }8 `4 D2 y3 ?( x% V - #include <linux/dma-mapping.h>
: y5 w0 X& I* G
) R. M& U/ l! b, f, H- #include <mach/memory.h>+ z, W. F+ e8 Q8 r9 g+ N
- #include <mach/hardware.h>9 a" E; X$ p& z8 O
- #include <mach/irqs.h>$ x N1 l# l2 r. J; X1 c2 F
- #include <asm/hardware/edma.h>: _1 r* e4 y' d p5 ~
% z) M, F' F, w, }9 E+ W/ c- #undef EDMA3_DEBUG
1 n$ {2 Y7 A" l! l% m: j, P/ x, c) r - /*#define EDMA3_DEBUG*/* N ^$ |1 n( S" _8 @! H* P2 @
" W" L7 d: f* L) C3 {3 y- #ifdef EDMA3_DEBUG
" D3 n. g3 C, n: l3 s6 q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 H" h/ S) N/ X3 @( D
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" r2 T1 Y+ U _ F, V) R6 S# Y8 { - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 i9 A7 K+ d# K$ `* l
- #else
8 s3 W% c5 R; @5 r' K0 t - #define DMA_PRINTK( x... )
1 Q/ E$ R2 q( g3 ~' f9 u1 ]" m - #define DMA_FN_IN
s: \/ @1 `, Z - #define DMA_FN_OUT& m+ d2 I% }- y/ ~. F/ Y
- #endif
7 g( b( f" E2 X. N
" F6 v: B8 F; O" L* _$ j |- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; R9 D6 u) }# a {: z - #define STATIC_SHIFT 3) l, @& |" W9 s7 Q0 Y2 Y
- #define TCINTEN_SHIFT 204 l1 {7 x/ t9 Z: r/ w; a) V( Q
- #define ITCINTEN_SHIFT 21# ]7 e5 g- _+ ]2 k- W) C9 d
- #define TCCHEN_SHIFT 221 H( ~8 C' G B4 e1 | j W& u
- #define ITCCHEN_SHIFT 23
7 ?3 o9 N) S7 e) W - 9 ?; E Z4 J8 B4 Y9 b
- static volatile int irqraised1 = 0;3 @& ~8 j8 ^" P& C/ s
- static volatile int irqraised2 = 0;7 F( Z; l+ z2 l
( j, y# D) L) r& B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 E, \( {1 m/ m( M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( Z) |& B8 M/ |; Q+ B8 i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 j0 p) E# ~( D* T. N/ i8 G
# x) [& Q2 w4 ?: p+ J- dma_addr_t dmaphyssrc1 = 0;
' F& q- o4 l8 L( U$ W6 O - dma_addr_t dmaphyssrc2 = 0;& y5 C* X: Y$ _2 Q5 c8 d( c9 H# a
- dma_addr_t dmaphysdest1 = 0;0 F N9 Y1 c$ R7 Z( `
- dma_addr_t dmaphysdest2 = 0;
( v" g& m+ i& p: N. L - ( }: p4 w* m" l" a1 ~: {
- char *dmabufsrc1 = NULL;2 E3 K7 o8 |' p, z9 c( @1 S! d
- char *dmabufsrc2 = NULL;
/ l* P2 a& W0 A/ K! v/ T3 Y# D" n - char *dmabufdest1 = NULL;
. l7 W5 E. S% I& }8 X J& l - char *dmabufdest2 = NULL;& d4 o2 _8 X- ^- q9 [/ O5 s
- - q4 e& H# }2 w* Z
- static int acnt = 512;
& H- w; |( [4 @$ z - static int bcnt = 8;
8 b, L& [+ n w" g/ a) ]9 P) C - static int ccnt = 8; C( F& _# g- p0 n% ], x. h, v
4 n' D8 _. Y' K4 [4 r; N" K; \- module_param(acnt, int, S_IRUGO);
4 {# I% z9 a& X- G7 N - module_param(bcnt, int, S_IRUGO);
8 r" F N0 z6 _0 ]% L6 c - module_param(ccnt, int, S_IRUGO);
复制代码 6 @# F0 M, B* b! u
: ~( j0 A" F. e8 G8 K$ `( z/ U) R' M: [ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; ^, ]7 V% R3 m- b. t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ h% g( T& `4 |6 x$ V3 o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) q+ W# D7 G( z% D r/ u; I) F/ M% q: P+ n0 M9 p
2 C& y, Q2 [# e* }
|
|