|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# ]5 T* g/ @+ h8 g: h8 A- [code]EDMA sample test application
* j4 L: `+ W8 M0 t - /*6 X; }& i: p; ?& e& v! w# R
- * edma_test.c- f s1 V1 h* {: M
- *
; P8 r4 I5 L4 K: O# w3 B7 t - * brief EDMA3 Test Application. a6 b a$ d: ?) J
- *
7 n! R0 F7 o( {7 a' G - * This file contains EDMA3 Test code.
2 ~3 n; D: w4 M5 N' z5 l. p% {& L - *
) b4 N2 A% K- y) ^# i - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 M: n: Y. t$ X8 Y1 g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ U/ C" [1 t4 d( g9 d5 ^- {. o1 ?5 T - * TO CHANGE.
* O) m3 b& l- J - *: Q! R7 a ?& P) y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: |: H* ~1 o5 Q! G, Y - *
% V( y8 G" ]7 ]% }9 t0 Y - * This program is free software; you can redistribute it and/or! Q8 z; v* X- F2 [. _& u5 Q m0 T
- * modify it under the terms of the GNU General Public License as8 E6 B, b& K; n9 O" M( ?
- * published by the Free Software Foundation version 2.
0 P* V) R: {5 i- h - *
1 A: a0 t: [) _8 }1 j# B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& N# p% H( T% t
- * kind, whether express or implied; without even the implied warranty
# n& e& y& u. R' H% V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. Q3 r4 m# O% y: D
- * GNU General Public License for more details.! ~! s' {/ d. F3 q5 T8 M" D
- */& a5 n% j$ D8 S* ?
- - T% n6 d4 o4 c7 n7 L9 J, l" z
- #include <linux/module.h>
" R: R5 M6 I) l7 _0 b - #include <linux/init.h>
: s$ l* ?. M& {8 D: { - #include <linux/errno.h>* u- }' t4 \. D% h* ~& [. w4 V
- #include <linux/types.h>6 g L9 K7 i" |! \+ c5 T
- #include <linux/interrupt.h>6 g* b2 E2 C# p0 m' q/ j# s
- #include <asm/io.h>
. m2 {+ ?9 q8 Q, b+ D& x1 D - #include <linux/moduleparam.h>2 K; w/ o6 ~! ^. ?+ A) g) g( J
- #include <linux/sysctl.h>
" n& b) l8 `# P- q! r: T9 K - #include <linux/mm.h>4 [. ?7 h! t1 L
- #include <linux/dma-mapping.h>
3 y: _) G0 A& w4 a! M - " [% e4 V. F+ b( `$ U0 c3 g
- #include <mach/memory.h>. K7 n$ j1 v, A/ l
- #include <mach/hardware.h> T1 v0 K; w, L. ^' C0 R
- #include <mach/irqs.h>5 K, d# A$ Z" S
- #include <asm/hardware/edma.h>. L' X- ~7 U4 g, n. H7 l) ~( W
- 2 _9 n& \& _4 f8 S$ q% w+ q# j
- #undef EDMA3_DEBUG' h9 M9 e' K' ~+ G+ A
- /*#define EDMA3_DEBUG*/* Y7 o8 P# s7 |9 q6 f* c
- $ r N' K4 Q+ L8 m
- #ifdef EDMA3_DEBUG/ J p$ {* }! E- z) a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) u* _7 |- L; t$ A4 \0 x' \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 o+ |' C$ R6 d- \& m
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 z" G9 e9 V' d R/ t2 k - #else
5 V( Y9 ?1 g/ L - #define DMA_PRINTK( x... )
5 z" D: z8 m: c; M/ J. A; P - #define DMA_FN_IN
, o/ G' W; g. l& M, B - #define DMA_FN_OUT
4 l0 Y) G. \6 X8 w' ^" r - #endif0 y: c: h1 y* t0 [5 n& r
( l$ G) |* m; S: Q" O- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 M) `0 ]8 T) l% d
- #define STATIC_SHIFT 3
1 B4 |$ B6 G# g. V1 E$ C - #define TCINTEN_SHIFT 20
! Y5 `2 r$ t# e8 r - #define ITCINTEN_SHIFT 21
* V4 B: {3 G& f6 `! P, u! J7 } - #define TCCHEN_SHIFT 22
& {2 {, F2 x4 Q: @! I - #define ITCCHEN_SHIFT 23
3 q0 F1 E, X6 N - + a0 u; O; Z8 N& f4 w3 w
- static volatile int irqraised1 = 0;
% I* ]1 k+ i6 `, y2 X - static volatile int irqraised2 = 0;
5 l4 _' C* Q( b9 x, W, j! S
" Z7 i" Z" d u' t/ u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ H( L, j- n% u+ M* p3 V H
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' M! y/ Y! H+ \" z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! u* P6 [; [9 y% x2 `$ m
. M; X6 e/ i; b& H6 i, P: b$ H" i- dma_addr_t dmaphyssrc1 = 0;
$ {, i2 L! W1 z) Y: T - dma_addr_t dmaphyssrc2 = 0;/ n D4 q/ ]( N9 C/ \
- dma_addr_t dmaphysdest1 = 0;4 T2 R1 g# L! h) s2 q9 _% J( r
- dma_addr_t dmaphysdest2 = 0;4 d% t) V2 z2 Z+ B( [( ~ u
- * `3 k; O; N* y( u2 H; S* n
- char *dmabufsrc1 = NULL;
- o( {# J: } p* M# G - char *dmabufsrc2 = NULL;
( K6 z u$ C# E" A- v - char *dmabufdest1 = NULL;' L3 e/ [# Q* o3 Z" N! H
- char *dmabufdest2 = NULL;/ `5 u7 h8 N+ R+ Z! e8 \) b' |
' m$ V3 O" t# v& @2 Y! a3 N- Y- static int acnt = 512;; o- ?9 I) r( ^; u" b$ d" d
- static int bcnt = 8;) `/ A4 ^1 A/ s* p
- static int ccnt = 8;
: w9 y9 d8 b& T, {: X
( x) J* g2 h) X. E# o# t- module_param(acnt, int, S_IRUGO);
$ B. d3 {% e* Y5 `: ^ - module_param(bcnt, int, S_IRUGO);
' f/ X2 N% h6 u! E: F6 q! b - module_param(ccnt, int, S_IRUGO);
复制代码
: L2 }; ?/ l5 F9 ]- ?8 L1 Q6 ~! M- L+ Q% g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ L" V. ^6 H6 ^# c- h% S- Y( f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" h3 A [! I* ~ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! T2 j+ _ C; x" I
& |# ?- G u7 D
3 J# `% l' x5 g7 T7 [6 {4 w0 { |
|