|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 T9 V4 i2 B2 h+ t/ F0 b- [code]EDMA sample test application
- J* i7 |% Q$ x* T+ A - /*
0 r( v3 g% M- v4 o! Q! v6 z& b - * edma_test.c
, U7 x. ?- _% @# H* ~- c4 Y - *
# D1 h l8 I3 H1 O; s( B6 R - * brief EDMA3 Test Application' S% S3 m0 G/ P! [$ H# o+ |
- *
( J9 V# |& b! \. Z3 ?% O# _ - * This file contains EDMA3 Test code., X, i7 |5 h5 F: n/ r: V% x
- *
- U" f4 Z# F; | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ l* Y. l8 U6 v* I2 S* c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 e1 A; N0 J% O - * TO CHANGE.
9 _: W) ~+ \3 I) C; ? - *- \# A' S# Z* L- F/ ^
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 s$ ^; x6 h8 B V* w1 [ - *7 G% q4 S* |5 ~' o6 z4 y: v
- * This program is free software; you can redistribute it and/or
- P( g: F; [9 R5 m* [4 X; P$ M - * modify it under the terms of the GNU General Public License as; Z2 X6 ^$ S; [. O$ T& l3 o
- * published by the Free Software Foundation version 2.; l4 V3 ~! F% v7 Y
- *3 z! W4 U% k. h# j
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% A2 K# ^5 b4 h4 p - * kind, whether express or implied; without even the implied warranty. a& z1 O5 J8 I
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' w6 J! c9 d3 O; H
- * GNU General Public License for more details.) J4 _1 r, u/ x+ z: c8 Q
- */( P* K L$ C" o& M
7 Q7 o a, E A7 L7 i- #include <linux/module.h>
2 n0 [4 A @& D- h6 P - #include <linux/init.h>% k. z' O# }5 U
- #include <linux/errno.h>& B( F6 Y: x4 w2 C$ c0 x! l
- #include <linux/types.h>. {% g- |6 d4 W( o3 d0 B
- #include <linux/interrupt.h>7 A! P& z% Z& k. {+ R! z! H
- #include <asm/io.h>
/ p" m. ~4 l6 P& E. k - #include <linux/moduleparam.h>$ J- M5 U% P T3 p/ ]2 B7 K- t/ N- l
- #include <linux/sysctl.h>
( z$ @. D- F. g h# a4 u - #include <linux/mm.h>
" \, |! W& l! {) C% ~. n/ E/ f8 r - #include <linux/dma-mapping.h>
9 P- u! Z# V5 ^8 V. {0 X8 U - . V! B; D8 R8 `2 c F9 w+ Q8 O8 l
- #include <mach/memory.h>
2 }/ J. X; [7 s3 d - #include <mach/hardware.h>
; L1 l0 l! N4 X; Y, m+ w, v/ m- v - #include <mach/irqs.h>
+ {/ q/ S( ]' U9 v' G, @( x- ~ - #include <asm/hardware/edma.h>
2 p# ~7 C- H( m2 W% d$ q b$ E - ( | H$ }% X/ q4 l1 i
- #undef EDMA3_DEBUG$ }. r+ i- R+ V+ f
- /*#define EDMA3_DEBUG*/
7 T2 g5 a- j, c) ?0 P/ l - m' c/ I4 E8 @, |5 _0 S
- #ifdef EDMA3_DEBUG+ B, o6 b k1 j! P! t* V! A3 O0 _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ n: h! R4 F3 x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# a/ {" H; T* r# W! e! L - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( A$ E: g" F; L2 ~, y3 d3 o
- #else
! N0 J/ L/ D4 ` - #define DMA_PRINTK( x... )
& I4 T1 Q( r! l& Y# x. S - #define DMA_FN_IN0 l; k9 \% Z3 A& a5 p1 X
- #define DMA_FN_OUT: s: _) X/ Z. \3 O6 d1 b; Z2 Y
- #endif
8 P. R, H/ Y+ b- e1 A/ W
0 t# l+ L6 ?( k* o* S- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 H! ?, ]- s6 x
- #define STATIC_SHIFT 3$ S0 A% f1 m4 }. `" C
- #define TCINTEN_SHIFT 203 N7 R O" @" X; H d/ L$ B
- #define ITCINTEN_SHIFT 21
5 l1 A, q: q" S9 h9 ] - #define TCCHEN_SHIFT 22
# }( H9 ^9 Y2 H2 m, L( K. W4 M - #define ITCCHEN_SHIFT 230 a) T3 C. D7 G- I3 \% Y+ s
; V4 ]5 P& ?% ~8 D" G5 R: Y+ s- static volatile int irqraised1 = 0;5 k& @' M _' b" [* v" W( x/ E
- static volatile int irqraised2 = 0;
6 o8 a* Q! r5 M3 t3 K' r# \. H - ( s0 N; H1 x4 x' x! P; {# V) L: M
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 v3 n. Z+ V8 j: F* e8 R+ g - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 {# G! ]7 ^* V s; e& N" d - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ E6 K6 `7 h* c
- }/ ?% j. Q/ G) z& V' S+ @
- dma_addr_t dmaphyssrc1 = 0;
3 ?. v' R9 j# e- E" E - dma_addr_t dmaphyssrc2 = 0;! l/ a! _ \* C3 F6 A5 `
- dma_addr_t dmaphysdest1 = 0;
" T3 j" A; y O$ B, _2 _5 ~7 x, D2 R - dma_addr_t dmaphysdest2 = 0;' g! a, A; ~( u V) H& h
- ; F9 A5 X# A0 c
- char *dmabufsrc1 = NULL;4 K) ~% G$ q/ U% y
- char *dmabufsrc2 = NULL;
, V; L4 a. n [9 R1 k ~' R - char *dmabufdest1 = NULL;5 h5 F6 `- r, C% Z- c' {/ S4 @7 S
- char *dmabufdest2 = NULL; u' `) v+ b% c3 H; V) u5 @/ \
- 6 q# @1 V3 g# p. o, V1 G0 f
- static int acnt = 512;1 u! x5 k7 Q4 B* p. `' r! a! F
- static int bcnt = 8;
" C" T* C/ w5 a7 j% `) o - static int ccnt = 8;2 y! D4 ]# k/ e" J. Q7 L' h5 g, C/ u
8 U5 v4 e( }/ B9 \- module_param(acnt, int, S_IRUGO);( o9 k7 Y. a. g2 O
- module_param(bcnt, int, S_IRUGO);
6 m7 v' t6 |* u - module_param(ccnt, int, S_IRUGO);
复制代码 $ ?7 D( n$ Y: ^ P
8 j: ?9 D' h7 U0 ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* r9 B0 {! C9 l9 x. n% h& e! d/ d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 T" b0 q8 U$ F) a 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( ]6 }0 M Z5 j, ]- [, X2 J" n/ `5 [/ A/ n
" D- W3 l2 c/ i9 i6 A |
|