|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( U; T4 F5 E; v8 J* i! b# X
- [code]EDMA sample test application
- ]+ { G: |7 h3 G; H) P0 s - /*
' b, x/ }* P* \( h7 ? - * edma_test.c
3 ~8 n) K4 l# ?! m - * M5 `* O; p, @$ U( ?2 @
- * brief EDMA3 Test Application
! @& y8 E- h0 h; O - *
8 V$ L, T+ [- L, x/ M' U S - * This file contains EDMA3 Test code.7 w0 I# i' Z3 D1 }( U. [
- *# }* `; O! i3 T, T: r
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ g5 Q5 y S o- i - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ m" J3 W) b7 w6 k' u! G, n
- * TO CHANGE.% U( p0 C+ m% l
- *9 z0 M# S' ?$ F5 e
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 L; g& y4 m. G2 [; o) ^/ j - ** G. `0 c" P+ T" H5 y" P# W, D
- * This program is free software; you can redistribute it and/or p4 F8 F' D$ _% X
- * modify it under the terms of the GNU General Public License as
* S h( ]3 |( |" `. z6 M - * published by the Free Software Foundation version 2.
5 F/ ^, h4 b* d M1 } - *; u2 N, b8 v; t5 k9 E3 O: {% j
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 h+ D5 |8 }. l* F& ^ - * kind, whether express or implied; without even the implied warranty1 E$ Z$ O4 X& ^. X6 e
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 `# u9 M9 E. k, r* d
- * GNU General Public License for more details.
4 i0 X$ r! p2 K) `# \9 ~6 A - */5 b0 `# \5 X% k% ?3 t7 D# E" i5 L) e* h
! p7 t- E* c0 M- #include <linux/module.h>
2 k4 n# W7 p2 U& @0 H: D - #include <linux/init.h>
$ z6 u' m+ s6 K* I" x; }0 o4 z - #include <linux/errno.h>
* i; q, T" W+ _ - #include <linux/types.h>
. G7 ~4 H6 g6 M% k) i - #include <linux/interrupt.h>8 e4 I6 t a" \9 ?- N8 m8 I# d7 g
- #include <asm/io.h>
" J/ S- [9 E2 n, b! ? - #include <linux/moduleparam.h>
9 n- j; i3 G0 R: v - #include <linux/sysctl.h>) s1 q! V8 u' a1 f* t$ f
- #include <linux/mm.h>8 K- |+ x0 y0 \
- #include <linux/dma-mapping.h>9 M2 [9 m/ y- F4 `; O
$ L# y+ K/ X' B/ ~- #include <mach/memory.h>
* e Z2 g$ ~ M/ M1 O. j0 O - #include <mach/hardware.h> p/ } h: O4 F6 C5 P1 G6 K
- #include <mach/irqs.h>( r W' z" u- m6 [5 J/ H
- #include <asm/hardware/edma.h>% e3 X0 O$ u$ |
& [' t% v& _! r# [: }9 z- #undef EDMA3_DEBUG! U6 o! y" t9 C
- /*#define EDMA3_DEBUG*/3 ~3 t1 U" A% _8 t5 r# v
- , K; V1 Y+ H4 w. z4 i" |
- #ifdef EDMA3_DEBUG1 E7 W8 o0 w+ N$ M. M
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 w5 U k2 D& f1 V6 @# A( e8 Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" q$ ]5 e$ r) F1 S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 t6 k9 s$ ]0 ]# P5 p/ _! ?/ q
- #else7 y4 _& c: H0 k9 g
- #define DMA_PRINTK( x... )
- n4 v& U1 p0 D! H* C: c$ D - #define DMA_FN_IN
{' F9 q& [+ m) q, a: Y4 L" p - #define DMA_FN_OUT
4 i0 M+ u' K6 ]2 I7 M: p - #endif% C! J& `( M- z& c& t
8 [- \# _2 z% S( |- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 a: @: T3 k- X- b: u
- #define STATIC_SHIFT 3
- {1 O& G' U( D - #define TCINTEN_SHIFT 20
# }& k5 I6 d0 H# l! a) J# l$ ^ - #define ITCINTEN_SHIFT 21
5 u; R4 M; G) D( L - #define TCCHEN_SHIFT 229 Y9 U, s$ h4 E/ I7 @" N
- #define ITCCHEN_SHIFT 23# W3 @" o2 V, L, a4 k
- 5 D* [: s+ y3 ~3 e5 X& E }# k) P$ Q
- static volatile int irqraised1 = 0;: a0 K/ Q0 a0 P' c/ \+ d
- static volatile int irqraised2 = 0;
/ C; c# z2 I3 M* B, h - & T/ u9 u2 w4 o4 M" W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 E' _: v2 ^. h! ^: ` - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ g: A2 I- c# \ l7 c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 Y9 N0 B4 x* ]" E. S - / s2 J6 r* Q( N0 k: m) q
- dma_addr_t dmaphyssrc1 = 0;5 g7 w7 O* H. S4 J
- dma_addr_t dmaphyssrc2 = 0;
, N! f3 |# h- m; z H/ \ - dma_addr_t dmaphysdest1 = 0;
. @! B! m, `* O5 C* y* Q% l( o - dma_addr_t dmaphysdest2 = 0;
: c Y2 ? p5 V! F, [; {7 S
) ?, N4 q' P* m- char *dmabufsrc1 = NULL;
; q( g+ P/ ]: b - char *dmabufsrc2 = NULL;
8 m; l4 ^2 Y: V0 _4 K, n - char *dmabufdest1 = NULL;% @$ w7 G6 p- h# z/ k
- char *dmabufdest2 = NULL;( K' z. @ u7 R; q$ Y
- " z6 H2 ~; V7 X' z ]- Z. G
- static int acnt = 512;
6 R8 ~ X& G' }. Z% Q; v - static int bcnt = 8;7 Z9 z( C/ @2 j& S3 B2 d. s
- static int ccnt = 8;
% `2 z% a. C- B" @ - 2 T1 Z( R4 @/ t2 o F' b3 s
- module_param(acnt, int, S_IRUGO);; I/ W$ v5 }3 S8 v0 v
- module_param(bcnt, int, S_IRUGO);; d0 g) ]- k: W/ W2 X d; k
- module_param(ccnt, int, S_IRUGO);
复制代码 7 M+ V+ h1 E# G" N
, K$ `% F5 G0 e2 [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 o0 j# O( \7 L* C/ ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# D v, Y7 G6 ]! ~3 T) k
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! T9 |. w+ m7 f1 n
- D' z% X3 u; L, m- d3 Y
% m* `+ @+ r- ]6 S) y8 x6 G |
|