|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; I1 {! h; R8 c: {; M
- [code]EDMA sample test application% p0 k/ U+ d# }- T' f
- /*
; h6 B0 V+ |: o0 ^0 Q - * edma_test.c
6 K! v7 p1 e& O - *( |# O A' |6 q$ @& ]: H
- * brief EDMA3 Test Application
5 Q* i5 D% K8 I8 p4 ` - *+ O6 _6 V& j5 T A
- * This file contains EDMA3 Test code.
# M# Q0 l0 d* h, @( a3 ? - *' [" [% A8 n. \! g; M; r: i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% y& o$ r( j$ I1 Y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
|: y4 C, j: H0 |7 C1 w - * TO CHANGE.: v, M$ _, ?; I! I
- *8 ?- t k) C T3 J
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 v/ f0 K5 q9 h Y# |+ ] \ - *; I" ^' C V U4 A8 B
- * This program is free software; you can redistribute it and/or
+ D+ E* j: b2 R; L- t - * modify it under the terms of the GNU General Public License as
; q$ t/ `9 [" T ?" a- A1 d0 p - * published by the Free Software Foundation version 2.
$ E/ u$ u+ u0 I8 Y6 R; m - *: [/ [( d* j, p; n$ t# t
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 q8 E. b: e9 h
- * kind, whether express or implied; without even the implied warranty
1 v6 G8 o3 l. c* g3 m b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 H, x! G& t( [2 n! w8 m% e- v F - * GNU General Public License for more details., ?7 D4 ]& s7 _' I
- */9 M/ M* D$ g, k0 h/ C
- 5 |+ _. ^- L" L7 t: `9 X9 f% k
- #include <linux/module.h>9 F# [7 c5 C0 k
- #include <linux/init.h>2 ]0 z9 G6 @& [4 E: l- ^, l
- #include <linux/errno.h>
$ H4 u( }) u5 \ ` - #include <linux/types.h>
' R3 w; L9 H) M - #include <linux/interrupt.h>& r, ?/ g& n* P" y' n
- #include <asm/io.h>' h5 N) d7 D; Q- W7 Q9 ]. ~+ J
- #include <linux/moduleparam.h>
, [" C# ~; c3 V$ v( W; i! H' @ - #include <linux/sysctl.h>0 c! E* v* l- l( |. h+ g
- #include <linux/mm.h>7 z! W$ r+ e7 X$ q4 a/ z
- #include <linux/dma-mapping.h>+ u) u. ~5 s$ |
, `# B) z1 W/ T! P- #include <mach/memory.h>( t1 u. F3 q$ i( ^6 s+ X+ J9 G
- #include <mach/hardware.h>2 ]# g: X. P/ J
- #include <mach/irqs.h>
- E ?2 M, {5 l* C( x6 b, k, ~9 U - #include <asm/hardware/edma.h> e/ W S4 t( }- i& K
- ^" _$ }7 x( T8 z6 [6 z$ U' F" C- #undef EDMA3_DEBUG
8 ?( ]! @% |# P2 W4 Q - /*#define EDMA3_DEBUG*/
1 N" K$ f0 ~( r2 g6 [0 G - 9 j6 b/ M& Y+ Q" ?' S
- #ifdef EDMA3_DEBUG
. o! S) x8 L7 Z8 T6 ?4 G( c6 ?1 V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ U$ a, z/ j9 n3 F8 P! [" w1 Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 u( T J; T* {, e3 T+ L; \/ }
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) ]+ [6 o5 w/ E0 a3 ?5 C7 U, W
- #else
3 ~8 V8 o$ |% a# B - #define DMA_PRINTK( x... ); ?% @; Y8 d. @ {. P( W' C
- #define DMA_FN_IN# x a# C: U6 O1 G" V7 \ `; k
- #define DMA_FN_OUT8 R$ w9 i* m# d5 m# K: n6 `
- #endif
1 j7 ~0 D! U. ]! o9 T
5 }8 K* a/ Q \3 l& p- #define MAX_DMA_TRANSFER_IN_BYTES (32768); ^" b$ L C7 x: P, b' K4 A
- #define STATIC_SHIFT 3: J( k/ s) A- H0 W
- #define TCINTEN_SHIFT 20
& L/ x$ c C5 ~& s p# a - #define ITCINTEN_SHIFT 21
5 s$ U4 a% Y+ `9 P& C9 _$ d - #define TCCHEN_SHIFT 22
! f# O9 l( U7 n; y - #define ITCCHEN_SHIFT 23+ z$ `$ q1 T5 I+ }% z
% N3 k) Z+ [- {! M e- static volatile int irqraised1 = 0;/ _ x- W1 t7 t( O9 S
- static volatile int irqraised2 = 0;' E3 x1 t; O8 z" I3 V& B: O* W
- . F, i6 `7 _" z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 G8 [7 Z1 v- P8 r Y9 v
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- V+ ?+ K- H1 n, s" R - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 c% O' _! ?% J4 |5 P6 v - 8 E' `" D: C8 D' y
- dma_addr_t dmaphyssrc1 = 0;- x; t! d l1 b3 |# v+ {& V
- dma_addr_t dmaphyssrc2 = 0;8 N2 g% {5 t* t+ |
- dma_addr_t dmaphysdest1 = 0;
6 Z2 u+ x5 g" \8 s1 j, y3 ? - dma_addr_t dmaphysdest2 = 0;0 T; ^" b3 B8 S6 O
- , o, V, [* T6 F+ F# ~
- char *dmabufsrc1 = NULL;$ {. ]% n4 k: ?
- char *dmabufsrc2 = NULL;
. F' `+ i; Q7 R! S. f - char *dmabufdest1 = NULL;8 r. r2 Z4 x- @, Q0 |% c3 t
- char *dmabufdest2 = NULL;: _$ V5 t7 U# ? D1 S
* U; [! g3 J( U- static int acnt = 512;
- W' K: j9 l$ o$ U3 T+ o - static int bcnt = 8;' H) o4 _( |$ W7 l- S& d
- static int ccnt = 8; G8 ^# k( O( n2 E* X' W Y
, i$ Z. z% j: w- module_param(acnt, int, S_IRUGO);
$ p9 |5 B9 n; l% z+ l3 s0 D9 k - module_param(bcnt, int, S_IRUGO);* K' J( O. x( i
- module_param(ccnt, int, S_IRUGO);
复制代码 7 m9 G) F0 K$ P+ u
( I. O+ s4 g# g6 C0 T 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ B! j, l/ m& h9 w* d) y: X$ jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 p) y$ W9 `, U" _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& W8 v, w7 {5 J; ~. O1 u# ]% ~3 L$ T% \
# Z' H4 o1 E+ j' [$ T8 t. M5 c
|
|