|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' Y6 P- W* v. `- [code]EDMA sample test application) ?3 V: V) E6 e
- /*
+ s% n& [4 v2 M7 s8 e - * edma_test.c
6 \2 f/ q R: V - *
7 x7 t# m- z- Z5 Z - * brief EDMA3 Test Application
8 ?) ?# z [: R$ J5 J6 _' t4 V - *
' L2 d8 K8 M6 g; z; |$ q - * This file contains EDMA3 Test code.$ J/ c ^& i' s1 C5 m: ~7 c
- *
( V- O' S# o! ~$ L9 t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 _9 @: K: i+ Y- f; ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& u1 c5 y% Q$ o! r, P7 s' g( z
- * TO CHANGE.2 r3 E" S% x- e# t4 z9 H: g/ L% n
- *
9 S" H9 {6 [: }: x0 f" I - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) @# h2 w5 [1 |0 A5 Y/ f1 G9 C! @4 M l
- *! u" p- x5 X7 f$ D% N- A' ^" ]
- * This program is free software; you can redistribute it and/or* S- n: f5 L+ ?# Z) w
- * modify it under the terms of the GNU General Public License as, D' U; d( R8 e0 L2 r6 V
- * published by the Free Software Foundation version 2.2 v: ?5 Z8 s* ?7 z
- *+ c% ^3 N7 x `4 m
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 i. q& Z- z4 Y! |0 Q
- * kind, whether express or implied; without even the implied warranty
6 |. k0 j7 H* }( h - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ c& n t1 ~$ Q
- * GNU General Public License for more details.7 U" m% o" \3 i# s. L& Y* G
- */
2 d# u& s& n+ }: Y& K0 t% i9 x - 3 P t2 a) |* L2 d1 o. d
- #include <linux/module.h>
! N) U9 r' I7 z5 A) o) g - #include <linux/init.h>4 d# o# s* I2 g' r5 Q, ~! X
- #include <linux/errno.h>3 I% h) Y1 j- b( U; v/ p
- #include <linux/types.h>
# z4 h3 |9 `3 Z: t4 f% b5 W# D, F4 ?! O - #include <linux/interrupt.h>! e1 Q$ E7 D3 e) z
- #include <asm/io.h>0 T0 K5 b! D% r9 @' X/ d8 b0 n
- #include <linux/moduleparam.h>, O- O1 W# k4 j' B/ \
- #include <linux/sysctl.h>
+ T& ~) _- j0 q, w! N - #include <linux/mm.h>
* [4 \ e# T' J# Q6 J: m - #include <linux/dma-mapping.h>
) K. u- e2 l G: n6 K. @5 D: o. l - 9 [; e' t/ M7 G- g: q- Z
- #include <mach/memory.h>
$ e1 D. _# ]3 i6 \- ~ - #include <mach/hardware.h>
# f$ J! V5 }$ x+ }+ M& H0 a9 K$ x9 I - #include <mach/irqs.h>
; L+ X( a2 B* P: g - #include <asm/hardware/edma.h>
8 m2 @8 j5 e$ `4 F" b% G) S. _
$ h2 N* d7 R1 k9 I: R0 v+ _- i- #undef EDMA3_DEBUG* q9 h f" \( b( d0 E
- /*#define EDMA3_DEBUG*/
; Z1 i6 @; a# W6 a$ ^$ T( T
- o& ^$ d4 i+ T- S" |- #ifdef EDMA3_DEBUG& n! O$ ~7 D, M Q& j' h2 B* C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 @) s" c M* ]1 ]# n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
B: T) a' J W. @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( h5 q% o- g- x( ~" S
- #else
8 o M1 j g$ R0 w6 t4 U m# W! u! B - #define DMA_PRINTK( x... )
. g2 i7 z6 Y3 I8 b( W9 U - #define DMA_FN_IN
7 j* l/ \- K6 [4 f# ], q( q* [0 K - #define DMA_FN_OUT
1 T, U; N- ^8 Z; Q. g - #endif
0 V# W4 _7 c3 k3 X - 9 ~5 w% ?+ Q+ d" x( D F
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! k" ?- W8 M9 l" x4 H: |4 |
- #define STATIC_SHIFT 3: J' X8 c& V$ }" Q
- #define TCINTEN_SHIFT 208 N* P$ |2 B% q6 _ w
- #define ITCINTEN_SHIFT 21' J: E3 s3 [. X8 u
- #define TCCHEN_SHIFT 22, l) @$ Y# C2 b- m8 N1 \
- #define ITCCHEN_SHIFT 235 a3 B e1 G2 y
- & M( A) o6 H [, e {+ J2 @: @
- static volatile int irqraised1 = 0;* y1 h5 @/ m- v9 i n% T
- static volatile int irqraised2 = 0;8 [% p9 o' w0 z" a1 o+ V
- / j" |/ `4 N b! Q6 q2 C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 k* X7 e% d* m' Q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. G+ _+ A. J* e2 q2 t - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! I* h9 X+ ^. @. y) W0 P7 `. A$ _6 K
0 V1 m: b; N3 o8 z) r- dma_addr_t dmaphyssrc1 = 0;( }. @! H* _$ h' F; r# e
- dma_addr_t dmaphyssrc2 = 0;
" @8 R( o) c8 Y/ q - dma_addr_t dmaphysdest1 = 0;# `* n1 @- l, I( V+ z/ N
- dma_addr_t dmaphysdest2 = 0;
- y$ J: V% X) z" l7 g: I
* O0 y' H3 \ A( b- char *dmabufsrc1 = NULL;5 E( p* \) M) L
- char *dmabufsrc2 = NULL;
7 i& S6 ^! d& H0 p - char *dmabufdest1 = NULL;( r2 w2 K& Q3 A1 J( M8 N% B
- char *dmabufdest2 = NULL;
0 _# h/ @0 O5 Z- [( a# Y6 \, g& q - . \2 K1 y& b# V/ \( u+ I, z/ g
- static int acnt = 512;* @- `" y- m2 w! c0 T
- static int bcnt = 8;
! j4 B2 Y- H8 t - static int ccnt = 8;
# S% M9 f% `7 s* U. S3 M9 A& d* h - ! Y1 o! L, K+ O! O) h+ L
- module_param(acnt, int, S_IRUGO);3 t. i* E4 A7 U) ?3 S
- module_param(bcnt, int, S_IRUGO);( C! Z* N- l/ I' x0 [4 A& ?' |
- module_param(ccnt, int, S_IRUGO);
复制代码 7 V3 k1 G# ^" a% i# M! e1 x) i4 h
* X- x- V- q; [- m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( d) @2 w( _9 {4 z& larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ V- e( S; H- i7 W: x# B+ C( p
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, u d, t+ o2 \+ B% Q" ]4 F
9 E5 x: e# L6 o/ P1 M( s7 w" B: |) a8 z: a) c
|
|