|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# a9 i) Z$ K. f' @* A$ `, Q4 t- [code]EDMA sample test application
1 K+ x! K' V4 e7 f6 g! L - /*; p: T) S0 q8 h9 t( o
- * edma_test.c0 m" E, l9 ?- o- }9 G' O
- *
5 ?7 w$ p4 x0 v* E5 O. R+ s" e6 Q - * brief EDMA3 Test Application" J8 ^. W( t% g R
- *$ z2 w) x: S, Y: }$ ?
- * This file contains EDMA3 Test code.& V; }$ _4 N; h
- * L: F$ h+ i9 _+ A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! O7 p6 H! R" ]/ o - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 o) ^8 n% o4 G4 {
- * TO CHANGE.
* k( }; G3 m1 u9 u. y1 l - *
7 j6 }% q( N8 U# d+ i+ G% Z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 {. D f3 R3 I# ?9 I# q
- *
& H) U' O; U3 V: S9 D, _( y9 F - * This program is free software; you can redistribute it and/or, _/ f* d* ^; u
- * modify it under the terms of the GNU General Public License as& }/ e- `) h1 S* }! L& e- ~9 r
- * published by the Free Software Foundation version 2.
4 r+ l6 i1 j+ j4 J- [- {/ Z5 K' u% R - *" y, z, q( k3 `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any ?0 _! w3 }' @7 M0 i9 [
- * kind, whether express or implied; without even the implied warranty! }. ]% L! s) K% d, o
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- Q: J" v$ T& _2 ?
- * GNU General Public License for more details.6 v- J% r' g8 G2 V" s" I
- */
$ W1 }) s2 f) B( K
K& @ s0 h7 f' D8 }- #include <linux/module.h>1 L9 J# W9 F, v2 H$ K6 m: j
- #include <linux/init.h>% L T0 j2 f( ?, n) K6 o
- #include <linux/errno.h>
% o& x$ s* G, p* w2 o, y - #include <linux/types.h>7 Q' s+ W4 T% q
- #include <linux/interrupt.h>
1 R/ e: h1 u+ J9 y - #include <asm/io.h>
) L- i, V5 w; H% { - #include <linux/moduleparam.h>
" O/ `1 J) _9 {2 o - #include <linux/sysctl.h>
- @' H. u8 L6 y+ L# ^ - #include <linux/mm.h>
2 [( Y" g7 B, N) @* ~ - #include <linux/dma-mapping.h>/ o( E3 B4 u; {5 H& B
- ! \! a- |/ M' T+ b) V7 G) I- t# |
- #include <mach/memory.h>
8 ^, a! b$ A' M$ }% k7 U - #include <mach/hardware.h>
+ @! f( k, K& E) `/ N - #include <mach/irqs.h>8 h1 z) i2 ~' @/ [; a( |
- #include <asm/hardware/edma.h>' L+ h: ^- ~& b/ G4 A) x4 R" J& r' E
- j6 K+ i7 r: s, m' _- U- #undef EDMA3_DEBUG
5 ~. K' u# G) k - /*#define EDMA3_DEBUG*/
2 T4 z: J6 h$ v) Q5 h
! \& p. {+ a4 X" t @( G, j" x- #ifdef EDMA3_DEBUG
( w: D1 q. I* O - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* S# V+ J' K. l/ O4 a5 { - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
Z+ r3 Q' S. H- H - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; }- O# K# P" B1 k7 M# J7 f - #else
# u) M) |' B2 O& }% ] - #define DMA_PRINTK( x... )
6 r7 o, e- B; Z, o - #define DMA_FN_IN
! X) F- f$ o0 r+ H - #define DMA_FN_OUT& f: c [( \ ~
- #endif h% j$ J5 [, A' z( B$ }" |! m
& @' f# h' ?9 s- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ G0 |6 l: Z# W2 Q6 f, L% | - #define STATIC_SHIFT 30 M- a( G5 c7 v$ G+ a0 [' |: X
- #define TCINTEN_SHIFT 20
6 E' F' B: N" ]- z" V1 _ - #define ITCINTEN_SHIFT 21
4 E, C% K6 [5 v7 k+ f* Z% h - #define TCCHEN_SHIFT 22+ u& [; T1 V/ f$ o
- #define ITCCHEN_SHIFT 23
( b" i: j8 L0 y
- G8 ^5 R0 u; p- static volatile int irqraised1 = 0;
# @0 ]- s: a* v- c! f; W. w - static volatile int irqraised2 = 0;
$ }( ^9 B* C, {* f8 Y, J
0 g2 Q" [7 K; i& F0 n- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); U' m4 k2 ?/ \4 \* t
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( D% T; b/ P9 h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); \ I% g" _: [
- ( n" z* J" [& \% F" z* y+ X) s
- dma_addr_t dmaphyssrc1 = 0;
8 W# ~7 i0 V3 D8 x0 s - dma_addr_t dmaphyssrc2 = 0;/ r s; a+ ~) E/ h$ q
- dma_addr_t dmaphysdest1 = 0; _9 O1 P7 K8 M- k+ k; f L8 p
- dma_addr_t dmaphysdest2 = 0;+ U( W+ n. q. C& y+ {& [1 E) \! y
3 x, J) J- X$ G! w9 d& i, @. e- char *dmabufsrc1 = NULL;; t6 [+ J! S7 a; @
- char *dmabufsrc2 = NULL;
; e" R" D% [0 X - char *dmabufdest1 = NULL;$ @! k( {9 S) j0 p/ t( }
- char *dmabufdest2 = NULL;( Y ?% a+ M' {
- ! X6 I5 H2 e7 w$ F0 b0 R0 p
- static int acnt = 512;* A5 T; L8 O/ F! r# _: ~! I8 q
- static int bcnt = 8;
. v9 {" ^& s- l6 F9 B% O, P, ]* F - static int ccnt = 8;
1 n8 C) N, k7 E* b5 o% V - 3 J8 i1 D" N, p$ ]# a) D
- module_param(acnt, int, S_IRUGO);- R, D `. j" F# K- t7 N- |
- module_param(bcnt, int, S_IRUGO);7 Z7 I' n' f8 i/ q7 K# v! z) x" b
- module_param(ccnt, int, S_IRUGO);
复制代码 2 c4 }/ I+ I! p8 C
; j' _/ l; P0 P9 [9 ]* ^6 q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* P( g) a L' O8 i) J warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 i* o8 T2 a9 A Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( b9 R+ X, q9 p" ?, r1 `
# u1 e) m9 `! ?+ {; G, f& |- k; u T* S v6 _
|
|