|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 I+ q% @0 r& [- _1 \- [code]EDMA sample test application
( K) k1 n" T4 K1 M% ` - /*
/ j* [% _% H- ]( m" d! | - * edma_test.c
9 X( J8 E$ U4 C* ~; V7 x! `5 J6 f! c - *
. n S# I1 c9 S9 p; v - * brief EDMA3 Test Application
& Z( V. [ C+ L4 `& I1 H - *1 ?4 b9 W2 a* @+ G ?8 `
- * This file contains EDMA3 Test code.# g) Y5 P" X+ e0 t) L3 k
- *
7 u5 R* D! L) ]" r3 Y+ E3 U) D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, m- b& b2 r. T: R, y8 a7 b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 L8 A% M* V0 g& ^4 m9 g6 ~
- * TO CHANGE.6 p& @0 k0 r5 y7 k
- *1 M- r. {/ R* O8 i# Q y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ ^( S: m5 P4 W/ D' E0 ~$ N - *8 K. l4 ~' b a3 O1 T. I
- * This program is free software; you can redistribute it and/or
5 v3 F2 H8 _5 ]4 ^ - * modify it under the terms of the GNU General Public License as, ^$ U& P3 }# w( J- H
- * published by the Free Software Foundation version 2.0 g' w$ q% o: s% _8 Y
- *" N3 p. O2 w/ \' y. {% q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ b; C0 U" I: J9 d( n9 S# n
- * kind, whether express or implied; without even the implied warranty+ {8 {. c! }* Y) Y* e. P
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( t4 \7 j- C3 r) _7 z - * GNU General Public License for more details. U4 E: S) n' d1 K; h( i% W6 ]2 d
- */, v7 J. `* n! J+ D
& d& y9 T9 I# \1 u. q- #include <linux/module.h>
+ M3 P( x' p i. ~+ h, G/ y - #include <linux/init.h>
. Q1 c% H- a, _ - #include <linux/errno.h>6 N9 T; ^- n5 J# a' _
- #include <linux/types.h>
& I+ Z" r" c p: q8 p - #include <linux/interrupt.h>
2 x9 p& y7 X" m3 z/ P( E - #include <asm/io.h>- u) e- G: [0 r8 w$ d) z; Y' q+ S
- #include <linux/moduleparam.h>& q+ [9 }1 x, f' A( e) D2 H% S
- #include <linux/sysctl.h>
" U0 Y+ h. R3 a E9 g7 D9 F8 w - #include <linux/mm.h>1 `6 {7 C' J/ J; [7 ]( C
- #include <linux/dma-mapping.h>8 l* y$ ?/ }7 Y, A8 s
- 8 X1 ?/ ~" ^9 ~. O9 i6 Z0 e
- #include <mach/memory.h>
4 J) g( ^9 X$ Q - #include <mach/hardware.h>9 n% h+ a+ j9 N. R6 l
- #include <mach/irqs.h>3 @9 Y( d2 n( y6 X* e7 Z
- #include <asm/hardware/edma.h>" U, ^, A1 N. f/ y; V
- - T+ ?& h x4 Y/ m* m
- #undef EDMA3_DEBUG
7 J- [6 B' a/ \* }! j# k& v m* O) C! P - /*#define EDMA3_DEBUG*/ E+ i6 D& z4 N" d
: o3 r% V9 G' H- #ifdef EDMA3_DEBUG6 F/ }* ~% @& m! O
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 G# M) F9 i. i, i# n( ?* U/ t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( n% ~9 z! O- x8 T; e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 ^, t/ o6 Z& J7 R; H
- #else/ A% S+ X5 m( F7 U
- #define DMA_PRINTK( x... )' r) L/ D9 M h2 W; g
- #define DMA_FN_IN
( c3 |5 I9 O, ]+ G& C - #define DMA_FN_OUT
. _& l& P. G% j6 W5 D5 H7 ~" Q - #endif
2 K+ K: u9 B8 R5 ? - - S' \6 O- e% ?6 p( e- r
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 ?8 P' K7 Z5 G. }; v1 Y: { - #define STATIC_SHIFT 3
0 a- j2 n# J; C8 ^ E5 M8 T6 \ - #define TCINTEN_SHIFT 20
: g( ?: O# h: \ - #define ITCINTEN_SHIFT 21
. b, x! N* M. Y3 U5 z& P, d9 q7 n# q' O% q - #define TCCHEN_SHIFT 22: L; o4 R+ V6 e( t$ p7 }- F
- #define ITCCHEN_SHIFT 23
, Z* x# j! I# _6 Z9 n8 L0 r$ X
" s- L( t: d2 j" |9 f! q- static volatile int irqraised1 = 0;! ?: e2 o9 K* D
- static volatile int irqraised2 = 0;, k9 N9 @/ ^; s3 |
- 3 Y4 U6 l3 l4 p; B8 C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: ?1 x0 }; q }# W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' L) H) [, i( G, P/ S. B2 l
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 A( C, e. o' s& R6 t
5 a6 Y ^7 w6 N! o& L) N- dma_addr_t dmaphyssrc1 = 0;7 A3 Q( n$ u4 C+ u
- dma_addr_t dmaphyssrc2 = 0;
5 S; h4 x' t# N& W- E - dma_addr_t dmaphysdest1 = 0;
6 Q* q* L' _+ T. U& j: p: u9 z - dma_addr_t dmaphysdest2 = 0;
+ @) f4 v8 W3 ^4 \4 w" B5 _
+ `( U/ a) r- f- char *dmabufsrc1 = NULL;& X0 J; {! ?9 H% @5 F; w* g; S
- char *dmabufsrc2 = NULL;
2 w8 P. D8 u, g- i - char *dmabufdest1 = NULL;
2 ?8 x5 k# H4 D* @) Y - char *dmabufdest2 = NULL;
2 a9 K. j6 Y# l4 O - " O3 X a) w3 C/ U% `4 K: ]
- static int acnt = 512;8 ~9 N8 N, i8 z8 r1 F3 i8 [
- static int bcnt = 8;
* q% ~; i" f& N3 R$ J" u2 ^/ x - static int ccnt = 8;1 m6 Q# X0 p% P# | ?
) ^3 V+ F- b% k$ a* R1 Q- m- module_param(acnt, int, S_IRUGO);# ~, U) `; o! ~5 L$ A: D' g
- module_param(bcnt, int, S_IRUGO);' r4 M- q1 H2 x7 V+ w; ^
- module_param(ccnt, int, S_IRUGO);
复制代码 6 \+ \. m+ {) q2 `1 c5 A( {
* f! | N1 h( h. o4 R) N 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 w5 a" `- ~2 [" Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 C2 b& G' P) j; W
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: L/ m( m3 b2 V8 @( {9 x% G5 v
. _6 H; A$ k/ m
; d) z) B b% W |
|