|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 P }5 g/ @7 f( j- [code]EDMA sample test application) X: [/ a0 @9 K1 E4 @" W
- /*3 ^" V9 r; F( O' m
- * edma_test.c
, g6 M+ L" j$ c [# U! ? - *
- M) u) q$ T' ^7 z7 w - * brief EDMA3 Test Application- [9 v4 `: u# ]' g
- *
5 F2 e! V7 ~/ v' \) J - * This file contains EDMA3 Test code.
: r) S8 S3 x( a* k6 E5 X8 \ - *- d% j# r& n& l
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" g- U e. c% I) ^- V% d% ] - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' l* a8 F% o u4 e
- * TO CHANGE.
@. K7 x% D* A3 Z6 f - *
{4 R9 l- Q! D, L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. i& f" [" `- G3 B a( t: [
- *' K1 W) `( k# |
- * This program is free software; you can redistribute it and/or' J* O0 o3 w- c, R/ H. p
- * modify it under the terms of the GNU General Public License as
! m' X( P m* A' u Q$ } - * published by the Free Software Foundation version 2.
2 ?. |' d, N( b! Y - *
1 R3 t5 M( H4 B9 x& D' l$ H - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ g1 m" P9 y8 f$ n" C+ h! G: F6 h
- * kind, whether express or implied; without even the implied warranty" k0 O! w; P0 Z$ Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ s5 ^6 Z- e- M+ m% e
- * GNU General Public License for more details.* i+ {+ L3 e. k+ M+ k# S+ ]6 B
- */" l. B8 \, P M1 L( j. F
( y- s6 z z8 A0 ?! r5 n1 m- #include <linux/module.h>
- X/ Y3 q% z2 O% K4 s4 g - #include <linux/init.h>
1 A+ j% B8 b( {6 v, S! ` - #include <linux/errno.h>
* E G3 C' H/ B6 U0 m - #include <linux/types.h>7 J) k1 i' t* {: E* K3 K
- #include <linux/interrupt.h>
- d7 S, R! v0 |4 I1 ]/ p0 G - #include <asm/io.h>
' j0 e2 k2 v& h - #include <linux/moduleparam.h>
% d( L$ E8 d% I4 `& T - #include <linux/sysctl.h>
" {- G% Z& A5 S1 e* f0 S# F - #include <linux/mm.h>
! u3 J% ?# c7 B5 O3 i% P - #include <linux/dma-mapping.h>. K% Z+ e c8 B- h
- ) X: _3 e9 S$ L2 r
- #include <mach/memory.h>
" E" M! h, V: a! @ - #include <mach/hardware.h>2 Q/ _6 h' Q o
- #include <mach/irqs.h>
: X }4 V. z% _! [" N+ | - #include <asm/hardware/edma.h>
, D$ W3 u3 J* u
9 w4 \- x% C4 p3 c- #undef EDMA3_DEBUG
! i% u4 Q$ m- I) Q/ K$ O - /*#define EDMA3_DEBUG*/
7 w, m6 }4 I: z B: i/ H( h4 ]
8 \" S5 u* h, w2 S- \- #ifdef EDMA3_DEBUG
* b6 `; B( K) |. u+ z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# t7 V! y, n/ O( p% l# p% ]8 W/ f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% T1 z4 t7 t* c9 Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 D& @; Y F, \" r) ? - #else& w+ k9 X8 w% N$ v/ b- f) }: n
- #define DMA_PRINTK( x... )
* u0 z, V3 I, Z! N0 ~: ]! d! ~4 w - #define DMA_FN_IN
6 D! |$ E* H {4 [ - #define DMA_FN_OUT" m7 K* v5 V# F
- #endif4 E0 v' ]* H* ?; V+ ^' u
- 5 w( @: x% r8 M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* w3 O) K5 K/ e3 h - #define STATIC_SHIFT 38 C& ], S- C' d8 z& z
- #define TCINTEN_SHIFT 20
* A9 g' l- \4 _0 d8 O- v/ y4 } - #define ITCINTEN_SHIFT 21* y5 e9 X4 X, J% C2 f: k! W
- #define TCCHEN_SHIFT 22: d7 p" Q g5 h4 B5 I
- #define ITCCHEN_SHIFT 23* y2 V# u T) m" V3 j. \
' \3 U M4 t2 q/ p- static volatile int irqraised1 = 0;4 V! S* c" N( M1 l1 g6 g
- static volatile int irqraised2 = 0;0 k/ u, V" f! u2 \" \. I
! B0 g+ s5 r j" b) ^- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 r! n. I/ g5 k1 R1 I" Z" ?5 D
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& j0 ?7 f$ j {1 N+ u$ J* [$ o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- {1 l+ D, t M) S' S
- u1 l% C& o7 [; ?- dma_addr_t dmaphyssrc1 = 0;% k9 }+ t( `) D& W6 ~; q( o
- dma_addr_t dmaphyssrc2 = 0;
2 T% n0 p. S2 R5 r" \' J - dma_addr_t dmaphysdest1 = 0;3 V0 _8 q5 M* F+ w% f
- dma_addr_t dmaphysdest2 = 0;& o3 Y* n. X- K2 [8 m/ N
! n" J! N/ O/ p- char *dmabufsrc1 = NULL;0 U* W! C, K2 P) e
- char *dmabufsrc2 = NULL;* Q7 C" C2 F! Y0 j0 Q
- char *dmabufdest1 = NULL; J+ ~# J! s/ v) i- l, K- y
- char *dmabufdest2 = NULL;+ F. d( T0 y8 n$ R( J
# f2 a: D) o& v) A- static int acnt = 512;+ e7 P" k8 [, w$ ]! {. ?7 m9 z
- static int bcnt = 8;
: x8 N$ l& n( I z1 J' D - static int ccnt = 8;. e& Y) i4 n4 `) q/ j, _+ \' {
0 w9 d% P" g3 A& N u" I- module_param(acnt, int, S_IRUGO);
2 U+ U* v8 Q- K9 @ - module_param(bcnt, int, S_IRUGO);
% y5 J9 p3 [- x. ]. P% p/ k" v- y - module_param(ccnt, int, S_IRUGO);
复制代码
5 e0 p+ G: b/ C: `9 o
0 q2 B; `1 w% b3 B6 I 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 w. v+ [" q8 L- A% g: l9 S3 Earm-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+ A7 i1 a9 ?' s2 Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 ]+ m- o; j7 p4 T7 x+ v7 y
6 g& g& Y4 t7 p) H
3 n+ X" N( W! ]+ v5 M9 O |
|