|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ P3 T! B( I1 m3 w5 A5 {4 O7 n
- [code]EDMA sample test application, G! r) U' _+ H N$ n4 @
- /*- Y- G* h3 J1 A. @! c: h
- * edma_test.c
7 H0 I w& V! ]9 g! p; n+ O - *
8 Y8 Y: H- M" A. Q1 x( W - * brief EDMA3 Test Application
}7 \* O; R) h. Q6 u& {# P6 p - *. y% I8 [! l: E7 A q. W+ c
- * This file contains EDMA3 Test code./ Z3 `# N7 _* _: h% ~: _: b
- *
: B8 r6 O; R8 e - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, e2 G3 j* b! D' Q8 j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 X" }+ O {9 w, n5 ?9 }+ i
- * TO CHANGE.( H1 L3 d9 w) ?% |# @1 j
- *: f" N, Q1 F9 X& v$ s: p8 Z8 O
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" G& w- f! ]" ^6 D0 Y. x - *
) n' D9 W8 u$ A* o& g - * This program is free software; you can redistribute it and/or
. q; W- U- U* @5 _) `1 X, Z2 @ - * modify it under the terms of the GNU General Public License as
& ^0 L9 |3 h4 \5 q) O8 [$ j+ ? - * published by the Free Software Foundation version 2.
4 E. j' ?$ `% |4 A - *0 _- J4 r$ F( y! W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! G% f- n9 i( E ?: [' ? - * kind, whether express or implied; without even the implied warranty6 @; S! m( \7 V. d; A' U# a% L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; F/ s% C+ s |# a - * GNU General Public License for more details.
1 p$ [0 O6 ~/ ~8 j: r - */
# c) S8 V6 o; P+ [$ g - , t! \; J# z2 V9 O! W6 i' d" z* a
- #include <linux/module.h>
+ |+ w; @+ z% s2 M h9 C q - #include <linux/init.h>
4 Y5 |, K( B+ F - #include <linux/errno.h>9 ?2 ~0 d( ?/ R* A' `0 }: s
- #include <linux/types.h>8 [6 M0 ^* U s9 ~& c ]) B
- #include <linux/interrupt.h>6 ?# m' W, l/ T9 D8 z9 g' |$ z; g
- #include <asm/io.h>. L7 u# j* ~3 r
- #include <linux/moduleparam.h>
* l9 ]( {: f" q7 o- M - #include <linux/sysctl.h>* ~" }9 e; B8 m: e- v
- #include <linux/mm.h>' j O$ ?4 V; N- y G
- #include <linux/dma-mapping.h># O$ z! e3 U6 I4 S& [: e
- 0 Z8 l) e2 K. @( _( u! u
- #include <mach/memory.h>9 w( K3 d! j+ \6 v+ c
- #include <mach/hardware.h>
0 L7 d3 v) f6 a - #include <mach/irqs.h>2 h, j8 y7 |7 y5 M% J) R
- #include <asm/hardware/edma.h>
0 z3 q- Y& [/ ?& f- f - . }; D( g) s$ a$ l- f( J k; E
- #undef EDMA3_DEBUG7 g) U* m2 K& {+ Q) Z9 g
- /*#define EDMA3_DEBUG*/& p, T2 l3 L" h1 i# E
- 6 o/ }, r, ^/ y& P2 {2 w, I
- #ifdef EDMA3_DEBUG h8 C4 h8 A0 b* M
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 L% u6 R) y+ \$ J$ X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 l0 m0 V, P- P! X2 @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 \. A3 G6 k; n - #else+ r" ]- I, L7 o2 q* e4 Z
- #define DMA_PRINTK( x... )
" g7 l" u: \8 J Q* L - #define DMA_FN_IN
2 H' F; N& t5 \, T - #define DMA_FN_OUT4 m9 e9 A: C! l3 U" ?
- #endif' z: u! X; p; w' t8 B, E
( f; o. ^& U: i- ]/ h0 g4 _& \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- V+ K0 c$ a# r4 ]' J! ` - #define STATIC_SHIFT 3
# v1 I% v! {: {2 n, U - #define TCINTEN_SHIFT 203 R" h9 R% W. r4 G; Q5 w- \
- #define ITCINTEN_SHIFT 21* Z! b4 {' t8 a1 Q. i
- #define TCCHEN_SHIFT 221 t5 D- i) @* x1 i8 [' q
- #define ITCCHEN_SHIFT 236 A: Z" @% Z* e! K% ]1 ]
- # _( V- l: N; I" B" ^6 T
- static volatile int irqraised1 = 0;/ K$ m( u! R9 {6 l. x8 T6 o( j
- static volatile int irqraised2 = 0;
& u! e2 Z+ V5 J8 X - " ^ ]! {$ ~9 K! U; b/ C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 \' g5 L7 a" ~3 I9 E
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! e# A7 l: |6 s" @' @ ~
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& X: o1 {' n. h2 c
/ T8 h+ z+ H; ]- dma_addr_t dmaphyssrc1 = 0;# P4 _3 n6 p+ m3 |0 ^
- dma_addr_t dmaphyssrc2 = 0;
2 q+ _9 Y( O2 V% _# F - dma_addr_t dmaphysdest1 = 0;5 h3 O' p" B2 q8 C/ [( o7 Z
- dma_addr_t dmaphysdest2 = 0;0 K5 E( E R: H
0 c! `. `7 A3 c- U, v- char *dmabufsrc1 = NULL;& T+ J+ T4 j. @, ~
- char *dmabufsrc2 = NULL;
, O& Z9 y8 d6 m - char *dmabufdest1 = NULL;
& A" d D5 }* D - char *dmabufdest2 = NULL;
5 X7 D1 s0 K( M3 V7 H5 d2 l% I
2 [- n$ Q' X+ x6 {0 B# s6 L- static int acnt = 512;3 o' H7 h1 Y4 T$ e/ K! n
- static int bcnt = 8;
# q/ N* B& Q5 {3 s" h% e- R - static int ccnt = 8;/ B k; q0 f# X5 g
' r4 U/ @7 P9 _, y- module_param(acnt, int, S_IRUGO);
( I! k0 U3 } W" v1 e0 Y - module_param(bcnt, int, S_IRUGO);
* R, c& P8 \+ i; g0 d - module_param(ccnt, int, S_IRUGO);
复制代码 ) |0 e/ h; N& z u
3 A. d% M* S" J& H. V: W. [1 k/ ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 }- Q* j3 {. \) darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" [. M; B# U# Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. P& ` o* N) b+ Z
" [" `; ]; R* d8 e4 p3 M
. }+ @8 N$ J/ T6 B }# l3 K
|
|