|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 H/ ]. N1 t( `4 w: D7 ^4 h/ {
- [code]EDMA sample test application
8 u! X& D. t' z/ }- m. d; e - /*- ?/ W% C1 ^, \- K7 t2 v9 F+ a
- * edma_test.c
2 i5 {2 E2 Q+ U2 j3 V- `9 j - *
0 ~" K' q2 E x' K' [ - * brief EDMA3 Test Application
: f* J w! L- z4 T4 T( W- Q - *! K" b4 d* W: M4 v5 [, \1 t( b: W
- * This file contains EDMA3 Test code.% w7 M- a! Z: _7 w. e# G
- *; @5 R. @5 D2 F4 u
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 q$ T6 H% [) ]+ x6 i" _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' ` C2 v% S/ U1 U% ]3 g! s
- * TO CHANGE.; C; G$ o: ?5 K. _# u, `! H8 X
- *
. D/ u: p/ A+ a' M: e B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# `- ]% O' u$ N% B) w - *
4 s5 C+ [/ n, J! {+ z1 i - * This program is free software; you can redistribute it and/or% H, o* f: g9 }' t4 b0 z6 P$ V
- * modify it under the terms of the GNU General Public License as
* L# X3 R6 J/ J - * published by the Free Software Foundation version 2.
! b$ `* c5 }$ C: L. a - *' t$ w$ L0 w* r5 L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 {3 N6 e: h/ n3 `9 f; w4 m: U# S - * kind, whether express or implied; without even the implied warranty! s! K" K( n3 y) ]% E3 C0 e
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 K* V# ~; Y8 ~; d' p
- * GNU General Public License for more details.7 `! H/ V/ A: g! \7 {. ]# i% ~
- *// r4 E& Z5 Y+ f
; C! v; e( ]5 G9 L- #include <linux/module.h>
, Z) M# \3 U1 { - #include <linux/init.h>8 I5 M \3 G$ M- h! ~6 H7 ~2 z
- #include <linux/errno.h>- X7 ?0 h; Q0 d7 n& a; w
- #include <linux/types.h>1 I6 b4 R; C6 u* O; H: y# ~: _
- #include <linux/interrupt.h>+ M7 p0 [; x2 h9 |
- #include <asm/io.h>
|0 _& {& w# r M5 e - #include <linux/moduleparam.h>- v1 t3 x. f$ {! K
- #include <linux/sysctl.h>
. c- S3 Y, ]0 R4 x - #include <linux/mm.h>
; z/ U8 u' ~! ^ - #include <linux/dma-mapping.h>
3 C }; _! b/ X5 y
# y$ N" p r" J& q- #include <mach/memory.h>
/ b0 N: M3 x2 I: H - #include <mach/hardware.h>" W8 N5 y, V+ ~
- #include <mach/irqs.h>
% x$ }& G+ Y5 F8 K9 G7 W - #include <asm/hardware/edma.h>
6 K% E2 Y/ D: E# I8 B0 L& z |
) t5 D$ ~+ _1 k, W+ s: R/ u K- #undef EDMA3_DEBUG
4 `3 u: D+ A- S7 M3 l# M2 S - /*#define EDMA3_DEBUG*/0 u0 p8 y8 r( `5 t8 Z Y
- % R( F% ~1 {9 ^) t8 A* w- l
- #ifdef EDMA3_DEBUG& M) d. |/ } [8 O5 R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): I; b3 v6 E$ Z: |+ i" M. B9 v. X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& m- R' |) s0 a5 I. Z - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! G6 S+ z7 N" z! U. E0 F7 M( k - #else( X% O5 Z3 e4 _( }
- #define DMA_PRINTK( x... )
; s$ Q3 i9 ?$ m5 P6 H - #define DMA_FN_IN6 R/ f, a9 ^ p3 r7 ] a
- #define DMA_FN_OUT
5 b# s! O# H% u2 w8 G - #endif
' i E I2 K8 l9 |+ j4 C' ^ - 9 h) {2 G& z$ i* ^
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( I6 s# J; V# W/ f0 C - #define STATIC_SHIFT 38 `+ o" R3 W& {, V& _* D$ _ e
- #define TCINTEN_SHIFT 206 I D. p- T1 y5 ~# p
- #define ITCINTEN_SHIFT 21
, H ~* S5 F% `% `& R, R - #define TCCHEN_SHIFT 22: n4 C' b( H; g1 |$ G3 m
- #define ITCCHEN_SHIFT 23% C& u* H5 n8 O- ^: N) ]; y
- 6 q1 ~. ?9 n, E3 J1 u. ~- {: O z: H
- static volatile int irqraised1 = 0;
: w6 _" i- ?) c. S+ O( R) `# B6 ~ - static volatile int irqraised2 = 0;
1 f7 X& o* y4 A0 l* _
- z- w& r# I! }9 n* j- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" U( V5 M& r3 x$ Z7 J0 I) N7 d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# A6 N6 y. U& N8 u" y* f6 y0 b: Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' U6 Q: V7 `, i, u3 _: H5 M
; L' }$ O) K$ u. ^- dma_addr_t dmaphyssrc1 = 0;0 h0 D2 N2 i% h: w& |
- dma_addr_t dmaphyssrc2 = 0;
1 L# C& G& N! I: k( ]7 i0 { - dma_addr_t dmaphysdest1 = 0; L4 b% v) y4 M% L$ x4 X1 n V4 p
- dma_addr_t dmaphysdest2 = 0;
9 k* {& W& r2 w8 }+ P
9 v+ M0 J3 h; w" i- i4 V- char *dmabufsrc1 = NULL;0 K- q4 U$ o2 D! ] l% C
- char *dmabufsrc2 = NULL;4 D6 c7 Q( ~8 u, z {
- char *dmabufdest1 = NULL;
# K3 C2 a8 I) S - char *dmabufdest2 = NULL;
/ L: E3 W* i6 }2 u) e3 ` - & d: _1 O4 t& a
- static int acnt = 512;/ C; O1 L" G9 [/ c! m" U# P- Y a" P
- static int bcnt = 8;
8 g1 Q9 `. D) h8 d/ h - static int ccnt = 8;+ g$ N( r. g, k
- $ i# \! U, Y5 B M7 n
- module_param(acnt, int, S_IRUGO);% A$ w( u8 ~) ^
- module_param(bcnt, int, S_IRUGO);
5 z7 B3 j, v, n# C: ^+ g3 W" i; V - module_param(ccnt, int, S_IRUGO);
复制代码
" C! }+ j% }5 \/ y5 A* R C$ Z- s' C* R
4 U n4 U1 `3 `- v9 L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 d, W) K- q- H7 b# x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* P' U1 }1 o6 n6 T
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; H2 e9 x" d% I) d: F! X+ b1 X
+ I3 g8 j3 {, r
. `; n+ G6 ]: C1 G& a |
|