|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 F& P' o0 E& E; t- [code]EDMA sample test application5 W" q* W. q3 \, Y% I
- /*2 E% Y. N" `5 s) e9 R7 u6 k
- * edma_test.c
+ T" C: P) B! w+ P3 @ - *
. v6 J z4 Y$ p: n5 V' v) p - * brief EDMA3 Test Application, f5 W$ R+ A5 A8 ]! N( W
- *& l# d4 T: K+ o# A
- * This file contains EDMA3 Test code.! @/ p+ c- w% W8 ~
- *, @0 I. P6 V2 O) u8 ~( \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& g+ n3 t# w' J* [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ T, z, X) L8 m# J- @3 Q
- * TO CHANGE.# o" i5 y0 @+ }/ Q- N7 M
- *
" G! [2 H! I% t. {6 E( x - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% ]/ a( P, K5 z: f7 }5 Q! W# e' n8 i, u
- *
9 a9 r }5 G* N- h$ e - * This program is free software; you can redistribute it and/or3 y- ~+ O' ?% `- }. W
- * modify it under the terms of the GNU General Public License as3 }1 H6 Z$ Z/ U* E
- * published by the Free Software Foundation version 2., W! U, x2 H5 a; a4 y# {0 k
- *
+ j O5 m1 g3 D# @- I5 l0 l4 k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. o9 u8 G2 U2 d2 D; z9 z" n - * kind, whether express or implied; without even the implied warranty1 n6 P2 S3 p0 w" O# R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% S/ O+ u' U0 N) C; v1 j: H4 Z - * GNU General Public License for more details.
( b M/ m0 E7 y - */
+ y& \3 q# a3 V! A V - & \' W$ c# i+ b( g: P
- #include <linux/module.h>) O, {* w; p. W# i
- #include <linux/init.h>5 J! |2 a+ R0 h. O: r) Y
- #include <linux/errno.h>
9 f* ~4 K* R4 t' N: ?* _3 k - #include <linux/types.h>
5 O( C! ?+ A# I7 {: g, j- Q - #include <linux/interrupt.h>
; L0 r9 r4 Y: q. t' L3 P9 C% [ - #include <asm/io.h>
! C3 Z2 q! e1 }7 j1 t, ]0 Q - #include <linux/moduleparam.h>: ~* W% @. f4 A+ L0 C
- #include <linux/sysctl.h>( z6 r# |. [$ g( @8 h5 P7 X
- #include <linux/mm.h>7 X9 b0 G4 \: m* m. Y, S
- #include <linux/dma-mapping.h>( R, Y7 B# P/ X
- " n' G4 U* W/ C- N) ~7 I
- #include <mach/memory.h>$ W; h. l O4 `, P7 W; o
- #include <mach/hardware.h>
: B% W2 p$ {" {$ D$ j - #include <mach/irqs.h>
# j0 \' Q4 y+ l - #include <asm/hardware/edma.h>
- \6 ]3 E! f( `& }
x! t' L- a- [9 x- #undef EDMA3_DEBUG' m: o! p: d6 t
- /*#define EDMA3_DEBUG*/6 r I, o# ~4 C- x- e
6 `- l- N- Y) u2 s0 d5 F7 ]- #ifdef EDMA3_DEBUG
- d% Z/ ]) F1 t: z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- P% ]7 v0 v" n6 ]$ U" `7 u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 B+ Z5 Z" f ~0 _. z+ r3 e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; F u# n3 T* y& F - #else% ^* Y" r0 Q2 r6 C3 \
- #define DMA_PRINTK( x... )
- Y$ B$ K3 N" S8 X6 @ R1 Z - #define DMA_FN_IN
% I7 _1 T& P6 [& |: M - #define DMA_FN_OUT
0 E0 W7 W6 y% \# P M1 H7 R - #endif. k) W/ J9 X2 p3 H4 s8 d* V6 U
/ {4 M x7 ^+ V7 f- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( N ?9 W; W' x; Y- `2 Z9 A
- #define STATIC_SHIFT 3! b6 h6 P# }/ E
- #define TCINTEN_SHIFT 20
+ R/ G, M% D8 \3 c5 o$ @5 S* w - #define ITCINTEN_SHIFT 21! ]- U) t8 v/ ~5 ?" a6 _
- #define TCCHEN_SHIFT 22$ p" O: g% s6 V3 H& w
- #define ITCCHEN_SHIFT 237 |6 R3 a5 p/ p) i8 e8 ]9 i
3 o+ o+ i, P! i: F- static volatile int irqraised1 = 0;6 m# i" c) ~$ B* F M
- static volatile int irqraised2 = 0;% d3 k, U% x+ C) ^3 n
g) U, _0 n6 S [- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- c' h. v/ h7 Y7 L8 M2 | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 T5 M& y* ~ y/ S p" l( m* K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 y$ K' @6 g# L9 C! h
- # j1 o% Z& S) w6 @, ~$ f
- dma_addr_t dmaphyssrc1 = 0;. w( V7 p" H) o7 g# ?
- dma_addr_t dmaphyssrc2 = 0;
- }, V$ p) A# ]% G* M' c1 U+ H! j+ W - dma_addr_t dmaphysdest1 = 0;
8 j! s5 ^2 t: E6 \! _ - dma_addr_t dmaphysdest2 = 0;
8 {) d# J/ Z" M7 Z' _! D. U* Z+ a - 3 ?! d K& X/ z! g1 v
- char *dmabufsrc1 = NULL;
8 H1 Y q3 Q: j8 e3 f0 B - char *dmabufsrc2 = NULL;
3 i; y6 Z& u) d$ L9 q - char *dmabufdest1 = NULL;
6 I& B3 I N7 _ - char *dmabufdest2 = NULL;6 u4 E }, O- X
^( Z L) c6 s$ }/ \9 z6 X- static int acnt = 512;% A6 |- m' L4 ~; L
- static int bcnt = 8;/ M& X/ j5 A1 w, d) Q1 r: A
- static int ccnt = 8;
3 E3 ]8 a; X$ c. L$ [8 \- c6 ^8 F3 E - * ~$ k l; w5 @: V5 j- D
- module_param(acnt, int, S_IRUGO);; `7 }! H) x2 m5 Q5 U) |; \; N K
- module_param(bcnt, int, S_IRUGO);% j5 q$ ~& V/ {1 Y$ b
- module_param(ccnt, int, S_IRUGO);
复制代码
3 G( s0 L/ f. @% R' C& p6 m2 N# R ^0 ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& Z% p D- ?7 barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' S: { L+ @/ o1 @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 a% b, _! a( D
8 q. o6 W7 g ?
6 d6 w a* u' g6 H |
|