|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# t- B. L: \- o2 {7 R" C, Y2 C6 y- [code]EDMA sample test application
: h% J7 ~: t& v( j - /*
" _) S3 U n" c$ G' ~' u - * edma_test.c0 f: q* h9 S4 D" H( ]+ }' e
- *
4 r2 \9 ?9 V- O% ?9 L% M- O - * brief EDMA3 Test Application
: H0 z$ |! a- N1 ^8 l+ i6 b - *
- ~! R0 P: w- l& Z' j - * This file contains EDMA3 Test code.
[5 B# z" p8 r& Y - *# z$ U; A) g8 K5 X$ r
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# v4 q/ O3 T5 ^6 k; v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% g) }" f7 N# ~5 l8 f$ s
- * TO CHANGE., J' U: E1 V4 S& p
- *
+ e! @) r' V, v: |% z8 h6 ^ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" H3 s/ X5 q" V+ b - *' i0 I" h8 |- \( q4 c
- * This program is free software; you can redistribute it and/or
5 t7 D% `% {, e - * modify it under the terms of the GNU General Public License as8 C& n8 A8 d# |+ f( Q: m' S F- J" L
- * published by the Free Software Foundation version 2.
2 ^/ a* i! L# p! X7 x - *
) `3 k/ I$ x4 d: d+ t! j - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- X9 q$ D" h- ~. K7 s
- * kind, whether express or implied; without even the implied warranty* X& H3 T" b& [0 v! \
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ Q9 f: c) ?* x8 y
- * GNU General Public License for more details.5 [4 _5 J- D+ H, _ Y4 n0 R+ [
- */0 k- R8 U( K V" j$ s1 y
- 7 b0 L% J! n* D1 G2 h* j; e( f
- #include <linux/module.h>
0 R0 x+ p% a+ h3 n0 c - #include <linux/init.h>0 ^- }! C; u9 @: i7 D d* l- P4 Z
- #include <linux/errno.h>
) P. \7 g2 D! s# y+ c - #include <linux/types.h>& A* k2 Q) y2 g# J: g- U
- #include <linux/interrupt.h>
* m7 N# f# |; q9 M - #include <asm/io.h>
6 v1 o; \6 H3 `* C6 K - #include <linux/moduleparam.h>3 \( S$ \$ U& f0 X) y1 l
- #include <linux/sysctl.h>
! `. \5 i* a1 l; J [" p - #include <linux/mm.h>1 i8 ^9 I% S& T( ^9 U# `
- #include <linux/dma-mapping.h>
5 u3 A$ l6 `5 a) n: c
* o @. J* m( Y- #include <mach/memory.h>
( K3 h( H( H$ \ - #include <mach/hardware.h>, w3 w' W) W1 Q* _0 @' Z8 h
- #include <mach/irqs.h>1 P" ?. y/ E% k% `" h
- #include <asm/hardware/edma.h>
8 f0 a2 a8 Z! o9 R% J' o6 z% J - 3 m# |4 A6 ]' E5 H
- #undef EDMA3_DEBUG
/ _4 y- u7 |8 q! {1 e - /*#define EDMA3_DEBUG*/
" {3 b1 I9 e1 ? - 7 L+ d/ ?0 |' i1 S* j+ B
- #ifdef EDMA3_DEBUG
9 y: J' F, B5 y$ i' t) v1 g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 }) D5 j \4 b9 E) [# m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! P5 n" r j5 B2 ~# r
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ [; n, ]9 \' e( x3 @
- #else
I X$ f g0 E0 \0 F1 D - #define DMA_PRINTK( x... )) C/ N) g2 E# @
- #define DMA_FN_IN
) N" u) P/ S9 D& a - #define DMA_FN_OUT# L& Z) r3 x# v& n P7 t4 n6 i: f
- #endif* r% O) q: r# P. E
- " ?: E2 r0 ~# O: M! h
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 {7 H/ k; y- y% @, z0 L& [; F - #define STATIC_SHIFT 3
# V% J @3 f5 y1 p: b - #define TCINTEN_SHIFT 20
F/ J; e/ L% R5 ]' U% t - #define ITCINTEN_SHIFT 21
7 \! C% Q! }5 [4 L! D i: Y5 u( m - #define TCCHEN_SHIFT 22 L% b: f' K. s. M6 d
- #define ITCCHEN_SHIFT 23* _, q; i% Z4 W
! F& }9 t5 f: P% J I- static volatile int irqraised1 = 0;
4 j3 r8 b- _$ j/ z, c5 s# f - static volatile int irqraised2 = 0;0 n; w0 T' x: D( k: h
4 m7 z0 G+ V, L5 B8 a+ u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% e* |, \2 s, l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; t2 O3 _' f7 l* Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# |& N; M/ g: F - 3 W: C. [: C3 F; c5 ^! n
- dma_addr_t dmaphyssrc1 = 0;/ r; ?+ J4 z) r9 G
- dma_addr_t dmaphyssrc2 = 0;
4 q7 P* z" R3 @# e0 K7 N% V5 o4 e3 R - dma_addr_t dmaphysdest1 = 0;9 D) O* |8 X0 c4 K
- dma_addr_t dmaphysdest2 = 0;
: @4 m0 l, T* e# t6 g
, U o n$ E3 t- char *dmabufsrc1 = NULL;
) y# P+ l; T/ n& ]9 @ - char *dmabufsrc2 = NULL;/ P% Q) N! |5 n/ m
- char *dmabufdest1 = NULL;' @5 C" ?/ k9 t6 W' E
- char *dmabufdest2 = NULL;
+ w% M) W6 ]5 M# P: `" N8 j
) x H& h' ^; I }# q4 O* {- static int acnt = 512;
. G3 a0 r2 _+ _) V* O" [* r - static int bcnt = 8;
) o. [9 P+ w' _& Z C - static int ccnt = 8;, K9 s3 H2 G, L1 Y. O
" t) G6 ~& j* O- module_param(acnt, int, S_IRUGO);! V6 }' c' c0 P8 ?; v9 G: g
- module_param(bcnt, int, S_IRUGO);
# M4 a% ]8 k& a9 S4 j) n - module_param(ccnt, int, S_IRUGO);
复制代码 3 |7 |& h' R; q5 M
( G* V& |4 ~5 `1 H; c4 M) y% F
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 N( U& f A( k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# d* N9 u; K, H+ z" A: Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; s8 d1 Q0 {' }, s9 I+ H7 J1 K8 |
; W+ P6 z/ z! D7 x! P |
|