|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 E i; k/ e6 p! w0 i- [code]EDMA sample test application* x% T9 g8 Y( f2 q
- /*
5 Y1 F/ L6 v$ x - * edma_test.c- L! H8 ]9 t9 c5 L
- *
% {- ?, u% G! J - * brief EDMA3 Test Application6 Q$ g; [) V+ w
- *- m4 o: P* m0 R; u
- * This file contains EDMA3 Test code.
; [0 J! }* R) g( a' A0 s - *- A" f7 c+ C3 ?2 v, I! i1 v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 N" Q. Q8 C0 i - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 \; B# J1 Y# q L! D, H- O0 I- y - * TO CHANGE.$ n3 Q7 G& ?$ t( q0 X( i# m
- *$ v& v! H" Q2 i3 ^, r3 m7 R5 Q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 X b: U6 g6 c' o - *1 ^7 t" Z; c" W F1 d8 P! `
- * This program is free software; you can redistribute it and/or
7 ]3 A! ~5 q1 c- a& Z( |# R - * modify it under the terms of the GNU General Public License as
- D M" h, D) G( U - * published by the Free Software Foundation version 2./ T+ h3 F1 E4 o$ e5 `
- *
0 D4 b8 j" o3 W! t' f+ N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 K, ~) d7 i0 T# C, ^5 o
- * kind, whether express or implied; without even the implied warranty4 X4 B7 n+ D: B7 ?2 f5 I# l' ]% h5 d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( v% Q. P8 ] n E4 R
- * GNU General Public License for more details.# }) D% `7 g' d9 D
- */
9 ]3 u2 ?; ^0 c
( d4 }3 O% A5 C' X7 {, ^- #include <linux/module.h>1 K$ X7 t! T/ V2 _
- #include <linux/init.h>5 s8 C' M/ {/ u/ f% o
- #include <linux/errno.h>
. M" M' n- R% } D) Y - #include <linux/types.h>
, T$ k% l; Y8 `0 e, R - #include <linux/interrupt.h>( M6 j6 ~6 D |" O
- #include <asm/io.h>9 o; O, g( v3 @& Y6 z
- #include <linux/moduleparam.h>
: C* R% G m- o' l6 S - #include <linux/sysctl.h>2 b1 ]+ F# k* Q) E0 B6 x6 g
- #include <linux/mm.h>
: h! W) v `- w3 K$ c3 `+ Y) @. e - #include <linux/dma-mapping.h>
! t& N+ v' s8 v7 v$ y P1 y - 9 R9 `8 s- y4 N/ f! f/ g; ^2 h
- #include <mach/memory.h>
7 [3 l. a. z* U - #include <mach/hardware.h>$ I5 A0 i) b2 ^' I1 g7 w
- #include <mach/irqs.h>
. C2 M: i% p: R* i/ g - #include <asm/hardware/edma.h>. b" i5 M( i9 v* ~5 k; j' l: t
, w5 f7 a5 h& y- #undef EDMA3_DEBUG' C3 r% y+ h3 }: f- S( X
- /*#define EDMA3_DEBUG*/
, A1 T+ l) R$ ?. p. P* z! t; h
! T- M# Q2 t- Y9 S: K- #ifdef EDMA3_DEBUG
. }" o3 T( V$ V9 A6 }/ D! ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- F6 Q' r1 S1 O1 n7 k7 [( a8 M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% X+ g9 ~# O7 n- e! `7 l - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 T" y3 }2 @$ O; p* F& e9 w - #else
7 W+ v6 d3 y; {1 g - #define DMA_PRINTK( x... )9 e k5 ^! o5 y. V3 `9 |
- #define DMA_FN_IN
) |: V, v6 e9 j& L% ?; F7 k - #define DMA_FN_OUT0 E! Q3 Q X, E, H
- #endif) R# [3 a) G% \) V1 |" h
& K0 p7 A4 V \- v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 f/ S* [5 b+ k( S$ J0 `5 Y9 ?$ P& l; _ - #define STATIC_SHIFT 3) ]: R& y& J+ ~0 x2 @+ b
- #define TCINTEN_SHIFT 20; v) }: k3 Y9 [/ b, \
- #define ITCINTEN_SHIFT 213 P8 n( o+ Y& m' R
- #define TCCHEN_SHIFT 22: Q- y5 H" D1 L, s' s8 S+ S6 i* }3 e" T. A
- #define ITCCHEN_SHIFT 23! \. `" D& h4 Z6 [$ }# H8 Z- E7 p9 E
- / N% U" j T3 z! F4 w
- static volatile int irqraised1 = 0;
5 N6 s* b1 o6 I5 a$ L" F - static volatile int irqraised2 = 0;
, O% L; L) P# e0 u9 m - 7 Z" r: G: s8 H. y/ B. S/ F
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ \3 Z1 E: m, V/ M! v" ]9 H' o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
U8 O; {/ ^4 H" D: c4 W8 a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ o* p) ?2 K/ U- o( g1 r - : W7 c+ J" {5 {
- dma_addr_t dmaphyssrc1 = 0;
! Q( s6 |0 [3 O% Y - dma_addr_t dmaphyssrc2 = 0;* Z; S2 t3 \4 a3 j% t- \
- dma_addr_t dmaphysdest1 = 0;2 A7 G% X) K- F2 \" F, V; R
- dma_addr_t dmaphysdest2 = 0;% W) D1 C" B4 p' q3 g' M, w' |
- V& z! G6 Y! Y
- char *dmabufsrc1 = NULL;5 Y8 x4 P& ]+ r* c2 R
- char *dmabufsrc2 = NULL; e, [& C9 ]" p, i
- char *dmabufdest1 = NULL;
0 m% A$ a$ d) E* U# N7 s$ V3 [ - char *dmabufdest2 = NULL;
- p* h7 `% ]& j: o5 x - : A1 N7 E- |$ z4 \! R9 o
- static int acnt = 512;
2 k3 w- I1 B7 s' _ - static int bcnt = 8;" s2 Z7 v6 e' u1 n
- static int ccnt = 8;
) l; z( m1 i( |+ R& z
, c: [& _3 b6 H- module_param(acnt, int, S_IRUGO);
9 V; w' ?* G" t1 d, |! M - module_param(bcnt, int, S_IRUGO);
& E& [- z' d9 _ w) {$ j6 A - module_param(ccnt, int, S_IRUGO);
复制代码
- A- T* G& G/ B W
3 c0 p& v5 h" @ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. }+ P* k! Q6 {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ g& F, e( h* v9 y. w: K* Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% p. W$ \- u; i b1 | e
' g3 \ o6 b) Q3 E$ A$ f
' j$ P( a- V* V3 X7 H |
|