|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 I0 N+ _5 N5 R& p5 G0 X9 Z# O5 @6 `2 S- [code]EDMA sample test application* G. f' G1 e5 @* I: V
- /*
1 Y- }7 g J7 q/ f% \1 P' M5 r+ a - * edma_test.c( Q$ r2 `+ {& {" ^* ` F$ d
- *
6 [! v. N- R$ N* p) o8 g - * brief EDMA3 Test Application
6 @# Y X7 {; ~% y6 u- f5 _, g - *, R- N4 k& O& e- i
- * This file contains EDMA3 Test code.. f" x+ |- X; ~4 o
- *
2 ~3 \& v# S) {. ^6 B6 k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 n: V# t* [( u& Z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 B7 U% V/ u4 j! N8 X - * TO CHANGE.
3 O6 H$ Z/ o2 L5 k) i - *
" N9 w5 S; H6 @+ Q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' h, \9 s5 _6 e2 e - ** m; e0 g7 L/ L6 b) h7 Y+ @/ _
- * This program is free software; you can redistribute it and/or
* R$ ]: m# c) O - * modify it under the terms of the GNU General Public License as+ M1 L& X- J6 I) Y% [
- * published by the Free Software Foundation version 2.% C n7 @6 J* j: i
- *
2 J1 O: d+ O3 M- { - * This program is distributed "as is" WITHOUT ANY WARRANTY of any. S0 D. i2 L% o; X0 u
- * kind, whether express or implied; without even the implied warranty0 w8 p/ F3 l2 a: \9 f1 l6 u
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, Y, b9 K$ H8 Q( f" A) O# W* x
- * GNU General Public License for more details.8 P3 R) ?2 P+ m3 P1 a6 Z3 a2 L
- */7 C' p0 U: e, H* p: R2 r3 y6 @- m
3 P- {9 P7 V! F/ g- a$ f- #include <linux/module.h>9 y4 S- w5 o* h7 U8 ?
- #include <linux/init.h>
2 D9 ?" W0 V! A- Q5 @5 u, Q - #include <linux/errno.h>$ s2 H$ b a; m' E
- #include <linux/types.h>
. }* N- Y4 o; [ - #include <linux/interrupt.h>9 w; b1 |7 G8 p3 Z* m% t. e
- #include <asm/io.h>5 H, V1 M) B4 z6 a8 Z( h
- #include <linux/moduleparam.h>
. t$ s1 H+ r) S) T$ N8 r3 p - #include <linux/sysctl.h>6 i3 R4 W1 w9 [7 L: g+ Y
- #include <linux/mm.h>1 B& q( B8 [$ u4 Q
- #include <linux/dma-mapping.h>" T% f) p5 l: _
$ Z" ]( T% i" | N- #include <mach/memory.h>! @5 y( O3 h! _, l* Q$ X1 Y& u
- #include <mach/hardware.h>, d( c" {; i2 O! T8 L0 ^: R, W
- #include <mach/irqs.h>! F; w8 r# @' ~5 g: j5 j0 N
- #include <asm/hardware/edma.h>
: W' o P# d) c' `8 |% k' ]0 Z - , |/ }" ?# S y3 g, X, K
- #undef EDMA3_DEBUG/ b, A a h) E, l
- /*#define EDMA3_DEBUG*/: J. g2 d# d% d6 p7 l6 y
- G2 l! n# N, M3 S
- #ifdef EDMA3_DEBUG
2 F( e6 B6 d" |) D; @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' w6 h& ^% x4 X) R
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ k! h ^, c0 f7 B3 r
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ I- a. R; ?+ N3 W$ o. a6 y0 b
- #else& O7 X* i- D+ A
- #define DMA_PRINTK( x... )1 M9 w2 a* G! d; i
- #define DMA_FN_IN0 y% n1 J4 l+ M. y# `
- #define DMA_FN_OUT
2 ~2 b7 X+ n; O0 t C - #endif4 L- H! E0 [4 s' ~! y
$ G7 j* ^8 S* b. Q7 K+ k% g- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 f4 B& ?4 Y1 K9 v- ?% x+ | - #define STATIC_SHIFT 3
e) D$ r( R" q! c3 l - #define TCINTEN_SHIFT 20
2 X) E( N/ e8 M A, H8 k4 V3 g - #define ITCINTEN_SHIFT 21
* r! k& y+ |* ?4 u4 J - #define TCCHEN_SHIFT 228 s( t. k8 C- f% o0 i
- #define ITCCHEN_SHIFT 23% o0 n, A5 U/ p( k3 d9 w1 m
& b f$ j$ V. A( w' x9 k! x- static volatile int irqraised1 = 0;' ~( }0 Z0 i: D& I* O
- static volatile int irqraised2 = 0;- ^. _0 Z9 ^) P }" [9 G$ F
- ; b4 p: ^; w, G/ e
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& O+ F6 O' e" O t! l. d# B- L8 K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 m4 s7 O. H+ m8 d2 x4 }$ a0 e% J
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( T% f8 C9 ]) I, f( u! p {. P - + H" l8 D( `. o1 |9 i x4 i
- dma_addr_t dmaphyssrc1 = 0;
! v5 O% }/ a0 I: Q, c; E - dma_addr_t dmaphyssrc2 = 0;
8 D6 S3 M- n8 e9 \! r( x( { - dma_addr_t dmaphysdest1 = 0;5 k/ k& [( ]/ Q# {4 E
- dma_addr_t dmaphysdest2 = 0;( K' x4 l% E" u6 k! H$ T* U
- 3 v; ^7 p/ g& t) D- l4 A: ]
- char *dmabufsrc1 = NULL;9 Y$ {4 A6 V. g' i
- char *dmabufsrc2 = NULL;( |' C; J# Q1 [" s/ g: U+ }- T
- char *dmabufdest1 = NULL;, A* P) \3 U+ o D+ z
- char *dmabufdest2 = NULL;
; u: o6 r( b, W/ Y+ ^5 ?6 s7 @
3 T9 h- I' v9 S; G# x/ e4 j- static int acnt = 512;
; M8 J! p! j6 z/ {: [4 l4 s: } - static int bcnt = 8;; b! e) _9 v# g( F0 N7 X7 B' [
- static int ccnt = 8;
8 y( G: _0 ]9 m3 {- g/ ?! s
# p2 Y, F1 c8 f$ n- module_param(acnt, int, S_IRUGO);; z- [" s- z% o. w/ H" V4 r( v8 o$ a, Y
- module_param(bcnt, int, S_IRUGO);1 W, O' C( V( f* n7 {0 L
- module_param(ccnt, int, S_IRUGO);
复制代码 ; _+ k( K% M9 U5 L6 C
% s6 H5 R7 X! z0 C
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) [4 p+ F4 k& ?' h, J e" ]9 a' 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, n9 D" R$ }6 d1 _. _. W; S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& _- Y1 P7 j/ P9 e- y" o3 }3 E+ M" Z* ~" F- \
( u) s0 m5 B4 Q* n: N; h
|
|