|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - I# G8 l+ z8 w; C ~0 ]( Z
- [code]EDMA sample test application
Y3 _9 i9 r/ i - /*) n. K* H. h4 J# y& ]1 G
- * edma_test.c$ N$ _( Q0 \0 ^/ z. d) u! t
- *& s* Q: @( }- V6 T- c4 d
- * brief EDMA3 Test Application; R1 D @' }+ H( M2 u" ?
- *
) x" R: `/ V1 Q+ b - * This file contains EDMA3 Test code.1 v$ r7 O, ~2 R. y8 V" h2 A
- *
: m# v8 U" N1 k; Z, R4 y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, c6 q! d& I) }; {" o% _$ F- R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ l$ d% c3 K. z: L! H, r: ]
- * TO CHANGE.( S/ W4 e8 o& Q; K% P# @* T1 t
- *! ]6 H* L0 U' a& j T$ A
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( g% |4 `$ s- h. W, t9 L/ K - *3 c( R$ y0 x/ ^9 ]. b8 h* t
- * This program is free software; you can redistribute it and/or' r1 |% Z8 \# q T$ U3 ?- m
- * modify it under the terms of the GNU General Public License as/ R4 e) U1 @9 @1 m7 ?9 C" n
- * published by the Free Software Foundation version 2.
4 P2 S( I! x+ y( y - *7 M2 q8 {' W; l( P Q! e( @
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, o. x T" _! Q2 y, R2 @( s6 \2 k
- * kind, whether express or implied; without even the implied warranty
% F" C( ^9 E/ [+ a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! y- j4 g. q1 j C - * GNU General Public License for more details.
5 A- }4 u2 u0 L" U, U( L' }* ~ - */
/ n. d- z6 H, S+ R! H' V& A - ( k# p3 X" k# n. `" j7 S: {
- #include <linux/module.h>/ V+ v7 X! H4 S! Q7 h
- #include <linux/init.h>
1 h+ x+ D% v+ `! u [' Z# } - #include <linux/errno.h>
" B6 A$ D8 k0 Z, c" n' R! Y - #include <linux/types.h>" M& j5 p, F" _( A6 F' c- S& B
- #include <linux/interrupt.h>
% m; a. _5 {6 u* J8 c - #include <asm/io.h>
7 m' u3 ?9 E& _$ d - #include <linux/moduleparam.h>/ ]3 c" n$ K3 D8 I
- #include <linux/sysctl.h>
9 V9 R& L" S0 ^7 o" } - #include <linux/mm.h>
$ G0 H2 r. E1 X' E - #include <linux/dma-mapping.h>
0 N1 r J5 _# y% W5 h& q- j - 2 j2 z0 [: f& Y$ L! w' |: H) v
- #include <mach/memory.h>
2 k9 _% z$ o$ q% c: U9 Y9 H. ^, ] - #include <mach/hardware.h>
0 ? I$ n' F( L9 j/ L2 P$ [ - #include <mach/irqs.h>+ i: x! ~3 D. o& U
- #include <asm/hardware/edma.h>5 c0 x4 O& S2 S% w' I7 B6 W7 X
- 7 V0 v2 c5 C8 ~) }0 g* z5 r
- #undef EDMA3_DEBUG5 K) X: w' j' J( ~' t) z
- /*#define EDMA3_DEBUG*/& l% P" w1 X2 G- T& h
) C( Q) n- C6 Q5 y( @1 Z* x- #ifdef EDMA3_DEBUG
- x: @' h5 t, @) [' ]/ U# g3 [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 J5 x' @1 h- U+ F% }- T% ~6 a - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" }+ O% w1 u/ W V* | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* z3 ]% k% O3 T) t. L: C- v - #else
( G; ?, s; Y- Q! a7 n - #define DMA_PRINTK( x... )
2 ^9 u2 t% y8 x- f( |3 | - #define DMA_FN_IN
" U# v0 P% {% z8 V - #define DMA_FN_OUT7 p! g2 ]' \4 }- t+ O0 ]
- #endif0 H |5 ^, s) }0 E' Q' G
- ! Q O& ~0 w _ v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: m- J$ K- F& `$ E C! u4 w - #define STATIC_SHIFT 3 B+ P3 O. K' Y |
- #define TCINTEN_SHIFT 20" {) ^5 v* ?7 N8 c& B3 Y
- #define ITCINTEN_SHIFT 21
, q; t9 |3 G8 ?7 _+ K5 W - #define TCCHEN_SHIFT 22- j/ N5 y$ \0 M! R
- #define ITCCHEN_SHIFT 23
3 \8 p: v. I) V2 @/ x
. J3 C( R1 x3 b/ y" B/ s+ S- static volatile int irqraised1 = 0;# ]) G- _4 J" h% Q7 z6 w& m- N
- static volatile int irqraised2 = 0;# p' a( n! v% Y7 U* v, ~
$ ]/ R, p7 W7 T0 m* c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. O# Z F0 S' [: a( ^& H - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. w9 F3 n/ k9 k - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# h0 E- ]5 F# u8 T# f
- # g2 t1 h) s$ _' z6 |8 x
- dma_addr_t dmaphyssrc1 = 0;
. b& ~8 p! p$ g2 K - dma_addr_t dmaphyssrc2 = 0;
& L1 g* [: E* x* B0 e! D' g5 B6 e - dma_addr_t dmaphysdest1 = 0; W3 s5 r# `( x: R/ z' T
- dma_addr_t dmaphysdest2 = 0;
* t; U: h% V' g, A* n( i+ l# H$ h
0 |3 }% T9 }" ?% y- char *dmabufsrc1 = NULL;/ d( F% ]. y# u( T
- char *dmabufsrc2 = NULL;
0 z# @, I; x7 \) M, s' Y* M - char *dmabufdest1 = NULL;8 {" C0 K$ I: ^2 O. F/ y. S# s
- char *dmabufdest2 = NULL;7 n' ]1 E3 C. Y9 ~1 [+ A7 M
9 d0 A- Q9 T' T3 ^+ z2 X2 ?- static int acnt = 512;, i6 q/ n u- N6 U( Z. v8 V& L
- static int bcnt = 8;) x) ^$ @" E6 q0 h, W
- static int ccnt = 8;
: ~' |, W* K# c, e; l4 D
i5 A% ^7 f1 o; g$ v/ h' J- module_param(acnt, int, S_IRUGO);
- }' r* F( g0 a0 f! ?7 c; L/ z* Y - module_param(bcnt, int, S_IRUGO);
# F z' s- b) s9 w - module_param(ccnt, int, S_IRUGO);
复制代码 7 i8 Z! S7 V3 M8 P
( b, W% }- s, G6 H$ {2 f9 j; `
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 Z- X1 n& G2 _0 z8 |4 Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
k s" c. K: S3 D5 u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 m. v u7 J+ U p
# p+ j7 I- `+ r3 U5 K R; ^+ I6 }' w6 u/ D8 C
|
|