|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * N* H/ f; r9 g% k2 e
- [code]EDMA sample test application8 _9 H3 [: z0 `3 P
- /*
/ R; M" }& l) E2 P3 o - * edma_test.c
! p$ s& u' T0 o \6 k - *
9 p I. N: L! l( X) o/ s - * brief EDMA3 Test Application" b3 ~0 |1 p6 N7 }
- *
8 o+ a4 S8 P3 ]4 w3 Z) {) t - * This file contains EDMA3 Test code.
: Z; W. M: y7 H9 c - *
9 `7 H Z7 y$ k# C/ }5 u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. w0 z( ^: p6 R& Y9 |0 w/ ^' [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 R8 M5 ^9 [# Z; L4 Z - * TO CHANGE.
3 j! f! j/ r8 H2 ?8 x% z - *
- k( }& r# W' j% T8 ` - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) F* B* O3 P& U6 K# m6 v+ A4 t
- *
; m+ M* S# k4 s- _ - * This program is free software; you can redistribute it and/or
3 F& f7 f* K- x3 r- h. B - * modify it under the terms of the GNU General Public License as
/ N9 s# I# d- n. ` - * published by the Free Software Foundation version 2.
( ]) F4 @* T1 J K1 \ - *. V8 p! U. V, h1 g4 U( {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) ?+ t$ R& B M6 s
- * kind, whether express or implied; without even the implied warranty Z! @3 I8 h. b w+ Z+ Z# V# K( E5 D
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 S. T9 R1 h9 V/ T2 q) t - * GNU General Public License for more details.0 z) w% D+ F5 {3 f6 e! D" b7 m
- */6 l, }+ A( \) C
- ' ]# W# a$ q5 n: ?# r1 w
- #include <linux/module.h>
1 m0 W- y/ |9 T0 C" b - #include <linux/init.h>
. i1 I: \9 K+ M/ d: V F - #include <linux/errno.h>4 v& v4 ]' b. ]" T: [) Z; Y$ q
- #include <linux/types.h># `! h* |& o# j+ f$ r% d( q9 c
- #include <linux/interrupt.h>9 W' i2 U0 u% g9 L5 c% K
- #include <asm/io.h>, D& r5 P6 r I5 p- A
- #include <linux/moduleparam.h>
) _+ x* P+ @2 S! t - #include <linux/sysctl.h>
* J# r$ h; u/ O: ?- O! F - #include <linux/mm.h> u- H4 W) G x5 P
- #include <linux/dma-mapping.h>
% y! C& Z; ~) j/ e) ?5 t ]: ~
( b& s9 z* U: P1 j6 b0 _8 t- #include <mach/memory.h>
( C. ^0 B- T% H2 U; ?' q$ A - #include <mach/hardware.h>
5 k" N9 ~$ v( l" ~- ~ - #include <mach/irqs.h>
6 I) c$ A$ I+ L8 i K9 R, U - #include <asm/hardware/edma.h>
. z2 m6 @4 P/ N) E2 `. r& t& S
" D4 G' H) T2 r' U, d; W* o- #undef EDMA3_DEBUG
& j) w0 F: ]+ H" G% Z1 N - /*#define EDMA3_DEBUG*/
' g( g: w. S4 O1 z" B' ^
1 W" ]0 g; X- F- #ifdef EDMA3_DEBUG
: Y% d" K! e G O' g. r( r - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ E9 e; W, M7 w& k3 U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" @: _& t* @ x) K6 w, | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ ~5 X8 v. w- i, f. |0 J
- #else
& }+ J( ^6 s5 T9 R) \! X0 t; ~) g - #define DMA_PRINTK( x... )
}- A! s% |, ]6 @0 M - #define DMA_FN_IN
3 F0 ~" B3 F7 d3 K - #define DMA_FN_OUT5 E3 [) f* D- Q
- #endif2 K: n( l- N! C1 M- s$ b) ^# G/ S$ {
1 O5 `6 u8 Z! G- `7 {9 d& N" X. W- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; Q d6 A5 ^9 J% W+ M - #define STATIC_SHIFT 3& q8 b$ W" x6 ^2 i7 K& Y8 M8 Q
- #define TCINTEN_SHIFT 20
( h3 F* E6 j: Q0 @) c - #define ITCINTEN_SHIFT 211 r( K2 V) m0 z
- #define TCCHEN_SHIFT 22/ v6 r/ E! `6 `+ _
- #define ITCCHEN_SHIFT 23' g) q7 w" H4 `& w" \7 h/ O; v! v
- # n8 V5 R* F5 \; f
- static volatile int irqraised1 = 0;. b0 N. h$ F! l) f E: P: {
- static volatile int irqraised2 = 0;! v/ n% s- L* O: a; \! a% }6 J9 z p
' ^4 Z, Y9 R$ x6 Z4 a7 H7 a! }- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 A' i: Q7 `" |- T4 j: z3 U" o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- s, s+ i# @/ f) o9 q. B
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 X, }& x' ?8 j1 b9 _: t% v& H0 t% F
' v: b# G! q2 \4 Z1 S1 j- dma_addr_t dmaphyssrc1 = 0;
( r" f2 b0 j; R: p& n - dma_addr_t dmaphyssrc2 = 0;7 y( C# U( T; s9 r3 v
- dma_addr_t dmaphysdest1 = 0;- U* @( J2 R: A. ~: R
- dma_addr_t dmaphysdest2 = 0;$ w$ y1 o6 c/ e" ^4 C
- & r2 r' r) D% s* g! c/ Z
- char *dmabufsrc1 = NULL;
1 H1 W* |( u8 r0 a1 W - char *dmabufsrc2 = NULL;
+ d4 c/ H8 u/ H4 m% e' Y) |8 O - char *dmabufdest1 = NULL;
, X9 n' w& _; h: H* ^ - char *dmabufdest2 = NULL;! e4 c/ e8 P u7 Y3 L9 s. N
: W( J, c& v: y8 W6 D- static int acnt = 512;
) v7 G9 G H4 o' j - static int bcnt = 8;; d! c' H+ K( [/ i, ?0 \
- static int ccnt = 8;& z6 ]. @$ R5 W( y/ E" ?5 y
" R. H" i3 C0 M1 b4 }, p- module_param(acnt, int, S_IRUGO);, F# N& x8 ]9 S- ^9 E7 R, O2 i
- module_param(bcnt, int, S_IRUGO);4 K( L1 ]% ^; n) Y
- module_param(ccnt, int, S_IRUGO);
复制代码 b/ d3 {! _, i# U0 X, `
/ N$ W' x- l) S$ W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 K* T. p% e3 N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" B" G% M/ Y4 w1 F5 V: N) W- c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: i" `2 J* y1 r" h% O) |( u) f0 D' p% Y4 Z
- M3 A* C0 |9 M. d7 _ |
|