|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- d% f( m1 ]8 G% H- [code]EDMA sample test application
% M6 v$ o$ K/ R$ ^ - /*
% ?1 a- O9 \8 w, j! ~- m& j - * edma_test.c6 K3 f6 T' y% [$ s1 p) f2 R0 v. o
- *
& k9 y- [; w/ o# Z1 \* Y - * brief EDMA3 Test Application
$ G- f" Z! ?! `! T6 P3 G/ S/ s - *
4 P- i" E. ?$ F - * This file contains EDMA3 Test code.. |& O) w# n8 v$ m9 _
- *9 R; E4 ^1 f- N! ?/ z( t! K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 h% Z$ |& t- ~% S+ k, M& a( X
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' h2 O, Y8 f) e/ C, D7 m" t
- * TO CHANGE.& Z/ Q; A$ c" e1 p7 T
- *
" m B. z9 r. p - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ T( e( ?, Q+ o& L
- *' ?$ R; ~$ m9 {, M" o
- * This program is free software; you can redistribute it and/or
( {6 ~5 @0 A8 o. O- l6 G2 m - * modify it under the terms of the GNU General Public License as
e- @6 k9 z: @ - * published by the Free Software Foundation version 2.$ Y/ h. E$ `" s! [$ R3 h
- *
; F7 K! E+ i8 `! [9 d8 v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ _# g) Q& E3 V p5 d
- * kind, whether express or implied; without even the implied warranty/ j5 a5 J; n- O+ f% h7 P/ q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. E7 a9 a8 t: W9 j- Y# D1 N - * GNU General Public License for more details.
, o7 R# z' @- P8 e - */
; _( \, \2 `9 |# r4 \: { - 1 l& w0 v' V: m( l t
- #include <linux/module.h>5 z5 ^2 {0 ]/ d7 v1 [5 M: j, ]
- #include <linux/init.h>
$ H9 R& |( }& U/ G/ v# f - #include <linux/errno.h> R8 P( t1 j5 J
- #include <linux/types.h>; l+ x% z S5 Y3 n1 D4 _: q! V. X2 f
- #include <linux/interrupt.h>
4 a. l7 g' j R- p3 u: H - #include <asm/io.h>
$ B* U6 i, {( |# |8 k - #include <linux/moduleparam.h>; A {/ G9 }2 H3 r3 _) s
- #include <linux/sysctl.h>: d3 j8 w2 O" _* s
- #include <linux/mm.h>5 {9 U0 `( y7 `' s! k
- #include <linux/dma-mapping.h>7 W- g% i& K& j2 ^* s6 E/ v3 o' n @
" q7 V( t7 T9 K! p% T i2 B4 Z- #include <mach/memory.h>
! S3 q* I4 k- T - #include <mach/hardware.h>0 V+ k! q3 M6 m0 E9 d
- #include <mach/irqs.h>1 q7 N( [/ u, g( }! _
- #include <asm/hardware/edma.h>" {( t; g+ |* r' @% V
- ( z! I0 M% ~. E; X$ G% l7 P$ z# |
- #undef EDMA3_DEBUG- n7 Z! d" T' J4 V& L3 \) U
- /*#define EDMA3_DEBUG*/3 R2 R: Z, L6 _4 I
- U1 W* d1 f! l$ i( \- #ifdef EDMA3_DEBUG
' W8 V9 O8 }1 c/ d1 |9 t - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! \/ J9 K' h9 r0 q1 h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: M- y! c1 h1 i: V - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ j) z0 e; v1 M5 `, O; l/ [
- #else2 L/ j5 }* }9 U" u& w
- #define DMA_PRINTK( x... )7 ~9 O# b4 N: A" N+ y1 p3 B7 m
- #define DMA_FN_IN7 o% h2 f* S. W6 k% u
- #define DMA_FN_OUT9 Y9 W" U- L/ {7 P. h" P: o( x( E/ P
- #endif: M# H. t- z5 m
4 k" h# M! I+ e9 t& @0 \: i# I- n% ~- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ g9 m: X; u6 n- D8 k - #define STATIC_SHIFT 32 q9 ~ q0 M, v" n% d; b: g
- #define TCINTEN_SHIFT 20
: \2 Z* ?; p7 O0 r( u - #define ITCINTEN_SHIFT 211 l- x8 g% k- O7 M+ t: f( d
- #define TCCHEN_SHIFT 222 i6 ]& R ~! |% r9 G
- #define ITCCHEN_SHIFT 236 F! r! k0 @2 L C
- ! J5 J: b9 `/ m$ w) e5 h
- static volatile int irqraised1 = 0;
3 ^ B8 p# q' R8 g - static volatile int irqraised2 = 0;
: K; `, N4 X2 ?8 R - % Q$ f8 v$ w% n! i
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 N& q" X' C; x6 ~
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( T6 J S5 L, t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ^8 G( _5 [. ]+ d; `) g* h) s
- 2 {6 @$ ]+ T" o6 k
- dma_addr_t dmaphyssrc1 = 0;+ f3 G0 W* Y# S" P3 j/ B1 b& U
- dma_addr_t dmaphyssrc2 = 0;
( K2 J( f# e# T; [# q, E) Q7 d5 D - dma_addr_t dmaphysdest1 = 0;2 ~: ?7 L2 [# H4 @1 t) ~/ i5 M
- dma_addr_t dmaphysdest2 = 0;
* e9 @# ]# x" @0 F$ I, f# E. E
1 a- t7 y, { ~+ \ U- char *dmabufsrc1 = NULL;
. j$ r; {! k1 e- v" ]7 s$ d8 r/ d - char *dmabufsrc2 = NULL;
- L4 m& i, m: z - char *dmabufdest1 = NULL;
. g- ?; V; `4 K) a7 r - char *dmabufdest2 = NULL;& }" H/ v% B8 x; c2 A2 h
* d' J& k1 [ y( i3 A- static int acnt = 512;
5 N. I7 A5 a4 o - static int bcnt = 8;
8 J s; r& r) g - static int ccnt = 8;
. x. O7 [1 p$ w - 0 l ]% [+ Z) [8 h
- module_param(acnt, int, S_IRUGO);
1 {$ q& K! o* W. ] - module_param(bcnt, int, S_IRUGO);
7 P, M1 ]( W% n. `3 ]$ n - module_param(ccnt, int, S_IRUGO);
复制代码
4 P2 T/ R( J; [ c/ E
- m5 t7 h5 F$ @; J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 M G U1 O. k0 Z: x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 N, f1 A" c ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 Q3 R$ z& ^9 a) V% x
% L$ w) r6 J0 v' W# i2 A. J
7 e7 }: E& h9 _1 z9 b# \5 p$ } |
|