|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) n$ k, i6 b0 d% n5 e* h0 t4 ?& K- [code]EDMA sample test application. a; f4 o9 d+ Z- s9 ]$ f( G% }
- /*
( \, o( h9 ~5 w4 k - * edma_test.c+ {" `" K' N- P) F
- *3 s. C2 T4 w) U5 }
- * brief EDMA3 Test Application
2 k, z3 _+ M) E \) E" j - *3 Z/ W2 q# t' U3 V% d
- * This file contains EDMA3 Test code.
3 p% S- c8 h5 d! G: t' E2 q* ? - *
$ d. y# I+ W; x/ E) L+ X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 }. r; r4 b" }4 G - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' M4 }3 q0 E0 z# a+ N6 X. P
- * TO CHANGE.. n1 b) e/ ^5 c8 r
- *
$ ?" z$ t Q P0 J6 W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# V2 \9 \6 w; Q2 O - *- n& U$ ~/ f# B3 t! Q" i
- * This program is free software; you can redistribute it and/or
2 f! [% L% V- K* M0 [) g6 r - * modify it under the terms of the GNU General Public License as; I" ?6 Q( i, m* i$ O5 F* w
- * published by the Free Software Foundation version 2.
% t3 s/ H$ `' v4 A2 I - ** p9 R# u, g7 K# U! Q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 H. e. T/ K/ ~) G( }7 f - * kind, whether express or implied; without even the implied warranty- a6 o4 g+ @& i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* s0 O# C" r" Q" I( k. T3 @ - * GNU General Public License for more details.2 W# F! J5 P% v3 O+ B8 b
- */: P" f a* B; K! D9 m/ c
+ F( t" g0 C4 J4 R; ?5 q. O- #include <linux/module.h>; \5 F/ p; l+ B4 r
- #include <linux/init.h>2 s) D, _8 I. m+ t8 y& y3 g2 X
- #include <linux/errno.h> g6 K1 Q* C) `3 Q
- #include <linux/types.h>
* P& L% q* l; {% o! n0 g - #include <linux/interrupt.h>
. f* F1 |- X7 G( R$ b3 g - #include <asm/io.h>- s( J/ [$ E" U/ G
- #include <linux/moduleparam.h>+ G9 M6 t0 A8 W C7 o$ s( }6 z1 ~
- #include <linux/sysctl.h>
; G! i. O, i1 l! u8 B; B+ Q# U - #include <linux/mm.h>
& f2 r2 }: [8 I9 e( X9 A - #include <linux/dma-mapping.h>
. W* j2 W/ `# [+ D5 B
" F8 g/ T8 z" @; m. a- #include <mach/memory.h>0 Z x3 p4 o8 i% K5 R0 `7 U+ B" L) m) h
- #include <mach/hardware.h>
2 v7 u. X% u6 _& w/ R - #include <mach/irqs.h>0 t- }6 ]8 J+ h
- #include <asm/hardware/edma.h>
- V; r, H# Z. X0 H# q( k - 3 G8 c6 N* J. J+ M9 ]2 _
- #undef EDMA3_DEBUG+ U2 U2 o! z+ p0 C8 S+ h# O
- /*#define EDMA3_DEBUG*/+ {8 t( c0 v8 m F* y3 A1 ]
) N9 k2 @/ {$ Z- @2 K* K- #ifdef EDMA3_DEBUG$ |5 V) D0 ]; f9 l! `& x
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 q* W' G6 a. B* B1 n4 _ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" C* Y. X. N0 y& e5 C) s0 q8 K - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 c- S6 c2 e! _4 @: q# W, S! E1 d
- #else
' G- b' L8 S- |7 Q - #define DMA_PRINTK( x... )
# y& [, s" ~" \( g" l - #define DMA_FN_IN d) T7 p+ }6 A1 ?* ]
- #define DMA_FN_OUT
9 r0 `/ a, w; Q' s: C( [ - #endif4 B/ b/ X; F* L, b% Y! E2 h
- % b5 s6 @3 n8 e1 L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 S3 h1 v. m5 l/ h - #define STATIC_SHIFT 3* B! e+ q) P- u4 ?
- #define TCINTEN_SHIFT 20
) X( r a5 z& z2 w! Q! ? - #define ITCINTEN_SHIFT 21# w0 i4 b" X3 h( I
- #define TCCHEN_SHIFT 22
- }: ^' Z& {; t+ w7 e5 Q - #define ITCCHEN_SHIFT 23/ Y# X8 x6 x y0 l2 |- P/ c2 m
- Z) G* s. `1 R& m. a" H
- static volatile int irqraised1 = 0;
) {* w7 C- V+ D4 c- ~ - static volatile int irqraised2 = 0;. u4 {5 V0 h' D; c/ w
" N. K; r4 K* N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- B, L" t5 ~, f4 u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) k8 L7 }6 r$ ]& V8 X" I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 G, f, ~# F) K& x, v$ i* H+ a - " v3 |; c: B1 N; Z/ V: o& N- {8 ?
- dma_addr_t dmaphyssrc1 = 0;( c* E! Z) ^% H+ E8 S8 D
- dma_addr_t dmaphyssrc2 = 0;5 H, d- `* q4 A" I- }
- dma_addr_t dmaphysdest1 = 0;
+ ^: L, D& f& n1 j) m. G - dma_addr_t dmaphysdest2 = 0;& i0 N3 `& b4 A& B) t, F
# K7 }# m) b ]- n7 w- char *dmabufsrc1 = NULL;/ O# @3 |3 `) t7 y6 _
- char *dmabufsrc2 = NULL;, ]. ^' W4 a5 i' b
- char *dmabufdest1 = NULL;
7 j/ E3 K( t) M7 t5 [+ k - char *dmabufdest2 = NULL;
# n) g, Z8 b3 v" R! M1 b5 K7 } - 5 `7 J" h4 X1 _. M8 C+ k. `
- static int acnt = 512;
0 U* k, k( }8 Z4 H( e - static int bcnt = 8;
) W' f! [2 h! z8 H* B l - static int ccnt = 8;
' X7 ^% p6 H# D+ T. L6 q9 t" W! i
- s4 k; e8 ]. g/ x J) r- module_param(acnt, int, S_IRUGO);
9 k% l% n* }, g! l$ p - module_param(bcnt, int, S_IRUGO);
4 L" x. h! [+ M( A4 N - module_param(ccnt, int, S_IRUGO);
复制代码
- l2 d7 E8 `5 [$ ^) q5 t/ Z, ?! ?5 f! j* R3 \4 o
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 ^& D/ C4 r2 ^& W7 h6 e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 ?& b7 T, M( N 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 v+ R$ }9 r2 i5 u' G5 e1 `0 e9 h3 d
4 j( |. i1 D# t( r |
|