|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 y) l5 I$ d1 A! X' q
- [code]EDMA sample test application
; d! q o# F. \6 {- ?. b. @ - /*/ c' Z, N8 x$ ?: d9 R8 F
- * edma_test.c8 p3 u3 |. x. `9 d, b$ Y
- *8 U1 ?/ B& ^9 ^
- * brief EDMA3 Test Application
, L/ D6 U- s" C M1 x9 ]% K# q - *
% _3 b% b1 D/ N+ O - * This file contains EDMA3 Test code.
' G. J/ X5 s# A7 |- v1 @ - *6 N( V# L5 q! L
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- k2 R) o4 T5 p+ B7 D6 z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
U& _) B6 i1 e. }8 r+ p - * TO CHANGE.
% v( E- C& {* G( u% h& Q. Z - *& L# \3 w, N: d+ [2 X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& R7 v" o9 e5 g" j' r& w [5 x. G
- *" T$ v5 B4 y7 p' ]1 d! {+ `; N) a
- * This program is free software; you can redistribute it and/or& `7 `( T2 c2 D% P" R' X
- * modify it under the terms of the GNU General Public License as) a$ H4 Y I" o: w% A/ O9 E2 f
- * published by the Free Software Foundation version 2.
; L# C7 C4 A( q3 {: ~1 w6 Q - *8 I H2 v% c: k/ `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any v. G3 p: z: O4 S7 R* b3 V
- * kind, whether express or implied; without even the implied warranty$ b f- a( \ F4 |* @* F3 G( R% M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: V2 c3 e# y1 N' P - * GNU General Public License for more details.5 P, A) U( f# D" F2 \# R% N* ?
- */
# a5 B' m# a2 _- H" B j, l5 g2 L
" p8 `! Y, J$ P7 n- #include <linux/module.h>
! B' v/ x0 b/ ]( a4 p$ q - #include <linux/init.h>7 y: [# I; J( Q6 ]" v
- #include <linux/errno.h>8 T8 o& T1 M# _8 l) S2 o
- #include <linux/types.h> T2 a. N9 t2 P3 K
- #include <linux/interrupt.h># S$ u* o! p" k, h, A2 l/ M& X. [
- #include <asm/io.h>0 u F8 e4 ]6 o: w3 T
- #include <linux/moduleparam.h>
$ I8 q8 ~0 g4 P. e3 @) m - #include <linux/sysctl.h>
: c. g/ x1 O$ e" L% p - #include <linux/mm.h>. Y' }% K# a K& v* E
- #include <linux/dma-mapping.h>
W @. _ y/ S, K - + \) W9 \1 b6 [4 Q& n0 M! K* Z
- #include <mach/memory.h>. c" B! l( d) n$ c0 b6 K$ f9 r
- #include <mach/hardware.h>! j& ]3 L! x7 g/ X
- #include <mach/irqs.h>
9 w/ r. D/ n0 O5 Q - #include <asm/hardware/edma.h>
& H& W) f! Z4 o; o/ C: H
6 [3 Q- ?: V7 z7 l, p# J; W- #undef EDMA3_DEBUG
/ ?+ O3 c6 c; m/ t1 ~/ M8 h - /*#define EDMA3_DEBUG*/+ t3 Z% z. O C5 q& D8 k8 {8 E+ u6 d
- 6 x' L3 @. n3 H
- #ifdef EDMA3_DEBUG" u% d- E! v& m5 O) x' c2 T K
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 ]0 f1 ~9 z& e M8 W+ [/ F; g - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* u2 @3 ~0 q, _ r - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 z. M2 b6 V6 Z8 o+ Y* D. O - #else$ Z/ ?0 [& d0 S' T- a
- #define DMA_PRINTK( x... )0 x# D2 Z/ r4 L; i
- #define DMA_FN_IN0 e" X' z) W/ M
- #define DMA_FN_OUT4 m5 e" E1 A0 k% n4 m% E! K# O
- #endif
* C$ t3 W8 d7 t6 [2 Q( O9 k- w
0 X" y. ^& I+ Z+ h* i- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 S( y$ f/ ~: B6 i# ] - #define STATIC_SHIFT 3- }9 U5 V4 {! s
- #define TCINTEN_SHIFT 20
* C: |$ A3 T. { - #define ITCINTEN_SHIFT 21
8 s& T6 f4 X" ^3 U" G5 y k2 _7 ` - #define TCCHEN_SHIFT 22
e0 q: ~$ J0 i" @, J - #define ITCCHEN_SHIFT 23+ g1 a+ r# ?" b8 y. _& H# u
m7 d- s3 ?, q/ l6 O5 B3 H* }- static volatile int irqraised1 = 0;
E1 t5 _7 U6 P7 Q - static volatile int irqraised2 = 0;/ [9 L9 j* R& ~' z9 ]
- A6 f5 V# b `& G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; P9 X* P# [2 | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ D% V# n! C6 I5 D' ?5 C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 C: F. E" G/ p - $ a' [1 t, O/ `, \# E) B/ ~( ]+ u
- dma_addr_t dmaphyssrc1 = 0;5 ^3 j$ F* D; F
- dma_addr_t dmaphyssrc2 = 0;; u% i! ?6 r1 t% R; o. z9 n h
- dma_addr_t dmaphysdest1 = 0;+ A, [; k9 S; I. v
- dma_addr_t dmaphysdest2 = 0;
/ r }7 w8 T: c3 [$ |( _& ~4 s - : i0 m4 `* J: L, h, } s/ ?" i9 O
- char *dmabufsrc1 = NULL;+ [- r; T: Q# R \
- char *dmabufsrc2 = NULL;
, @5 Z" [6 y0 B8 Z - char *dmabufdest1 = NULL;! O2 B$ ]" D" U) n
- char *dmabufdest2 = NULL;
, X) O6 s& T4 Q8 _0 X$ d
& J# H0 I) w$ [; ?7 C6 _- static int acnt = 512;- Z' e/ S7 z# C5 d K' d* }5 P
- static int bcnt = 8;9 e9 {7 ?1 m$ a1 W" j; T
- static int ccnt = 8;! K% L& C7 p- `0 i. O
- 1 [! b3 V& B( `7 B0 G
- module_param(acnt, int, S_IRUGO);
1 ]* o7 ?) L; |4 A$ a, L6 ~ - module_param(bcnt, int, S_IRUGO);
0 B4 g8 |! Q }0 @% d - module_param(ccnt, int, S_IRUGO);
复制代码 " |* c6 c' i6 _: F! p
, u/ X+ b. z) R, G5 V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% q8 l/ ]# w( S' darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 X, ]7 J0 O0 T7 v4 T- y8 E \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 k. j9 n$ e9 i7 j: l/ d4 Q
% Y2 j( F1 M3 d# j! \. Z/ ~/ T
4 n1 w" v e2 g5 E4 T+ u; H% B/ u6 c |
|