|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 W) Q( n2 u, v, x' q, z
- [code]EDMA sample test application- b. ^2 r9 p1 N8 C7 s/ N
- /*: s! G/ `" ^* Z- Y! A4 j
- * edma_test.c* c. `: p* _3 v, I$ b
- *% b4 [* Z) e% T" k7 N
- * brief EDMA3 Test Application
Q$ i1 m# i* r: c; A" m - *( I( @8 k9 L6 k& E* T. h$ K+ J* e- J
- * This file contains EDMA3 Test code.
Y7 ^9 |) p& J& ~3 _ - *
8 @" r: C/ O$ ]2 E' f C - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' Q" l2 Y( n- E' N- U$ {
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! ~$ T. L6 C9 N0 {0 t( G) o - * TO CHANGE.: J& E2 f% k' k- j; X. Q# o
- *2 E8 j% w& F) Y+ t, m: P9 N/ x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 B' J( U% `1 i& p- V
- *
: X( ?3 A* Z9 T6 D6 ] - * This program is free software; you can redistribute it and/or
& i1 T9 X/ z2 K% p8 o# w: x - * modify it under the terms of the GNU General Public License as
9 ?4 _0 C' q& L - * published by the Free Software Foundation version 2.$ \# n! b( Y- U2 y2 [ }
- *: [2 l9 Z- d J1 j
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ D$ e8 G/ j1 X$ [3 O
- * kind, whether express or implied; without even the implied warranty7 F' _. b3 a: [! F4 c# W6 T
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 p' d, k! d) d/ z - * GNU General Public License for more details.
- S% Z b ?' ? a# r7 ` e! P( t g1 E - */+ T+ T6 P& |8 d# M5 _8 Y5 N# V
- , Y& q$ J, g" @$ j4 c
- #include <linux/module.h>
{3 ^# d" I& p2 x - #include <linux/init.h>5 J) W# B- o' c1 Z$ g% z
- #include <linux/errno.h>, p# g R. b9 t6 j* t* ? A! T$ S$ O
- #include <linux/types.h>/ ^: `9 M- H1 E$ D# K( r
- #include <linux/interrupt.h>! i9 n: P8 @3 w6 {% }
- #include <asm/io.h>- \) |$ C+ q9 ?
- #include <linux/moduleparam.h>7 [" P6 @! F# g1 @- M, |
- #include <linux/sysctl.h>
2 x# `" D% I5 M# J, t, v1 u8 ^ - #include <linux/mm.h>
/ K7 M! \3 }; y. T9 b9 q% O7 y1 X - #include <linux/dma-mapping.h>
5 L; N+ K, l1 L/ \, d% X - ]$ t' t6 |( }& ~
- #include <mach/memory.h>. x' B" O; k& N2 [. _
- #include <mach/hardware.h>
2 a* M& C0 G4 f) ?- E, h8 r - #include <mach/irqs.h>
m$ C! ^; b0 ~- y3 X5 u - #include <asm/hardware/edma.h>
. }( m& i( D; N' s - * Q$ F/ r" Q1 R4 ?0 v
- #undef EDMA3_DEBUG- Y V! Q$ v3 Z J o$ u& n
- /*#define EDMA3_DEBUG*/
* e) Z/ n5 c- _% p: a1 P$ |, E" d - ! a1 t) f Y- @3 S. g0 I5 X2 G8 n
- #ifdef EDMA3_DEBUG6 A8 A8 L2 m x6 q5 x+ O3 C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 j; X6 `. w# [1 m+ h( b% G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ \9 b* l) u7 k8 j - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), v8 P, L ~7 Y9 d3 l
- #else0 P4 U- P( i3 c' Y; L9 q8 \
- #define DMA_PRINTK( x... )" b. l* o, @. z2 h
- #define DMA_FN_IN
; I" L$ V# Z" [0 { - #define DMA_FN_OUT
; y7 s( r+ v- _ |( P2 u - #endif4 ^; c' M7 S: f) E! S' Y+ K( ?
- 0 |2 P9 `3 k6 y4 m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) o; ]2 V) }$ m5 W# _0 w: ]
- #define STATIC_SHIFT 3' f- D7 q- b/ d: a) J1 }
- #define TCINTEN_SHIFT 20
% H" f) y3 r, P2 A9 {. s* n# V - #define ITCINTEN_SHIFT 21' o3 L$ M& c$ W6 b5 O/ y0 T: b
- #define TCCHEN_SHIFT 22% s2 k- F2 h# U ]6 Q/ U
- #define ITCCHEN_SHIFT 23
3 {3 I) C) j( E8 w' ?7 Y - - ?6 D/ r9 G* T' Z% r
- static volatile int irqraised1 = 0;4 J3 P$ `$ C$ f v) B6 `
- static volatile int irqraised2 = 0;
0 G) J" V3 x. {: b* h% r3 G - ( U/ |: n3 W6 ^$ ^ |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# m. Z/ D1 A# B( o% y& { - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 E r9 r9 `( u4 v$ O - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 P8 _3 H. W" z5 z$ N+ F7 E - . M% }' M& [3 ~# E* g0 }% w/ M
- dma_addr_t dmaphyssrc1 = 0;
! J, D9 Q4 z; n$ j% i. U - dma_addr_t dmaphyssrc2 = 0;
. V! W/ z- z* F# X3 h; D - dma_addr_t dmaphysdest1 = 0;
. D! X4 C# H2 e, [; ?/ j. |1 F - dma_addr_t dmaphysdest2 = 0;
: S5 V2 q8 f7 y* u+ h
. G! w C3 @5 t! t2 U- char *dmabufsrc1 = NULL;- o3 _2 V) W% R; F4 g' f4 n
- char *dmabufsrc2 = NULL;
9 n% R1 d$ Q7 U( W! O q0 C - char *dmabufdest1 = NULL;
$ e% |) n' p/ I8 ?" ~5 _% t - char *dmabufdest2 = NULL;$ H0 i) D! u$ E
- 4 x* w, {9 `1 i$ ~( Y1 L& H7 l
- static int acnt = 512;1 V7 C% w# `1 m L5 s; u# [) D
- static int bcnt = 8;
e1 _8 i$ h! _6 @ - static int ccnt = 8;
) ]7 d+ V: P! \& O
' o6 J" S Y0 o- module_param(acnt, int, S_IRUGO);% I& L' F7 w- a5 a1 i
- module_param(bcnt, int, S_IRUGO);
! m) v+ m9 h# X. S/ | - module_param(ccnt, int, S_IRUGO);
复制代码 * w1 B/ R+ {! U6 W0 M/ q9 c0 R
, I1 | ]7 Y0 i) R* N3 e' H, E# e4 j; Q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* s3 Y4 x8 s3 X6 o1 m1 C( 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& ] ~7 @) q) \' H' ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- r) B. j$ v K- i
: B$ R) _! X) s& v. @* i7 }* D
; \# A/ F5 r3 T, [
|
|