|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 E y8 K% A/ O0 N; ?* w
- [code]EDMA sample test application
2 Q; G/ M( z5 J3 o - /*, L4 e/ A. G1 k; t
- * edma_test.c
7 z3 y) Z3 g9 c3 `' Q9 j( i - *0 Z: W+ H* T) V# b6 Y' D
- * brief EDMA3 Test Application1 s8 f2 |# ^0 R- [; t$ y8 {2 R8 w9 X
- *
5 a' p; Q$ b* u0 [& n7 _0 } - * This file contains EDMA3 Test code.
+ E; u! M. D O& k9 z - *
& C8 y, i- n9 V8 r7 s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 V1 }2 T. u- A9 `+ m$ F( H9 F) U
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# ]6 N9 E5 I; {8 Y9 V& r$ y( g5 R - * TO CHANGE.+ [6 h! H/ H. a2 ^+ Q' V
- *
! e3 M$ n5 A6 U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 a/ N" K! ]1 _% w7 E& I i9 i3 b
- *8 ^; m6 _9 N7 }& D
- * This program is free software; you can redistribute it and/or
5 E+ h5 k) ^8 Q! `4 H0 v) k1 D+ }" W - * modify it under the terms of the GNU General Public License as
0 A" B7 i* O6 Q* u+ l - * published by the Free Software Foundation version 2., C) [8 g: s1 s
- *
7 b3 ? n$ S& E0 B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 p0 F+ e, f4 X d" y' s/ N
- * kind, whether express or implied; without even the implied warranty
# P% w) k7 Y2 [( Q `: ~( u/ k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. f/ P* U a, }" g# W4 N - * GNU General Public License for more details.
- s( ]+ R) p+ c2 S - */8 P' ?1 E+ R: h: P
) V4 E' k- L; [4 }4 m8 Y- #include <linux/module.h>
3 b% T: C' r' s8 C" J - #include <linux/init.h>
% Y9 q; a" W) j% g. p - #include <linux/errno.h>- z! m7 i# I/ |9 D/ ]& G
- #include <linux/types.h>
6 X# W/ X8 F9 p" |. o7 L, F - #include <linux/interrupt.h>
2 H! E1 O8 ^. n* ` - #include <asm/io.h>, c" d9 G9 D/ l- d+ e- O1 z
- #include <linux/moduleparam.h>9 ~1 v; }8 V, Z
- #include <linux/sysctl.h>1 G1 O1 A% e% W5 w
- #include <linux/mm.h>
. L* C: S" A1 c( F8 J5 f - #include <linux/dma-mapping.h>- y: y. i! w6 ^* X/ \
- 8 f( g" F3 P: l$ a' J
- #include <mach/memory.h>/ y6 Q" ?: { v( L x
- #include <mach/hardware.h># H- V; Q" [5 }* i; @9 V* N5 L5 i% k
- #include <mach/irqs.h>3 B, y7 U1 A. v! h3 k: k
- #include <asm/hardware/edma.h>6 Z/ J# ]8 N U5 G% ^/ ~0 L1 B z* ~' t( W* B
- ( o' p4 [/ q3 E3 u
- #undef EDMA3_DEBUG( D& ~1 C6 v" O' N% a
- /*#define EDMA3_DEBUG*/* p# ]( J3 |/ [; C3 p: n
- 1 B4 B* C2 k+ F
- #ifdef EDMA3_DEBUG5 W5 U6 y' z6 d# p7 T' l5 x) [
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ ?! D6 u, e4 }7 I5 A5 k5 b5 c% {
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ h# R+ o7 A y4 q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), r5 J( y. F4 r. @
- #else7 I% ]* d) a* c) J
- #define DMA_PRINTK( x... )
- T* ~& z( |. b* V }/ L) ^) m) N - #define DMA_FN_IN* k0 u& G8 g( a' Y$ z, x3 j
- #define DMA_FN_OUT
( l7 y# H% c5 _' a+ L& ?3 h. a - #endif/ u8 O7 D7 ^# k2 j6 l& [' }' J
$ r6 e8 u( G% \! G- i' q& a- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! K+ ~ o3 L; d: P- g) l' g
- #define STATIC_SHIFT 3% S2 m# M& s* \* w/ X g1 x
- #define TCINTEN_SHIFT 20
1 B+ y. p+ S, c, t q - #define ITCINTEN_SHIFT 215 ^2 _: ]; M5 y$ t+ U
- #define TCCHEN_SHIFT 22
; k+ G# O, N3 }4 I& f& x - #define ITCCHEN_SHIFT 23& A H+ o* }8 {
3 S7 I/ P, P1 f" z- static volatile int irqraised1 = 0;8 O0 e N1 J! R, z* X3 f
- static volatile int irqraised2 = 0;8 s! f- S- a. |( M
/ X2 I- P9 ?5 r' _6 k0 A/ w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; k3 q' Y& U) i+ p; Z6 Y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# w6 K/ d$ }6 b9 A - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& r0 ^! c0 K* t+ l! k6 ^
- . c; m4 q& f6 N7 {3 ?
- dma_addr_t dmaphyssrc1 = 0;
. j3 | i9 o( c" u: {4 M! K. m - dma_addr_t dmaphyssrc2 = 0;) P* i" N, {" P- L
- dma_addr_t dmaphysdest1 = 0;& N5 f! ~9 e! K2 d2 f9 _' y" h
- dma_addr_t dmaphysdest2 = 0;
$ M; N4 S; S3 r, R - 3 f4 C. P- J# q: L* r8 ]6 l
- char *dmabufsrc1 = NULL;* X7 `. r% ~6 }, w5 _9 M
- char *dmabufsrc2 = NULL;4 l4 h0 X" b! {$ v6 n# [
- char *dmabufdest1 = NULL;% H% Z5 E3 H4 n. Y* d/ X
- char *dmabufdest2 = NULL;
/ f- L$ y/ ~8 Y9 P, C4 ^ - ! r8 i4 ?. C$ g2 ]5 k0 A1 R
- static int acnt = 512;6 G' h/ ]; T- |; ` n
- static int bcnt = 8;& M* @$ a7 A- J
- static int ccnt = 8;: F; z& M8 o; M$ R8 |. b
" I/ a9 X; L8 e2 Z) x1 o% r- module_param(acnt, int, S_IRUGO);) J0 C2 z9 `2 a. y1 e, N7 I4 K% e
- module_param(bcnt, int, S_IRUGO);+ o# F5 O6 f0 k/ f
- module_param(ccnt, int, S_IRUGO);
复制代码 / Z- M5 V+ q% g) Y; n. J5 ^/ `
! {. ~# @5 o' K4 F: s+ t8 b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ D0 C0 v2 J) j: a3 carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' r" v# B9 k8 L
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 Q& b2 x* x9 ?
- v) S+ w" f$ q7 Y/ q" x" E( p% V- y+ I
|
|