|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% O. h! Y3 t3 @4 w) A; V, g" d- [code]EDMA sample test application2 i/ E" h5 `2 c# u, ]- L/ Q
- /*
; h1 E: q0 i5 z - * edma_test.c& M. U/ G1 r/ d7 @2 \
- *
/ Z, C! {& Q9 p3 e2 @ - * brief EDMA3 Test Application
7 H% z; ]. T; ]8 v3 F& v! {1 ^ - *
) k, k; E* C3 y! a, v" N3 K - * This file contains EDMA3 Test code./ ]) ?# l0 z: q A+ u& R( }
- *
. u% Q+ p' n+ C1 T) ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 h* g3 E5 X$ e( m/ }! ?
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" v) f9 f- Z$ B7 l& _' L
- * TO CHANGE.
' b8 D4 G. R# @0 ]4 t - *
" I K1 |& D8 R+ B8 t; I - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' X$ m3 `: b* C C. C2 J
- *7 a- }7 Z/ Z3 Y) O8 f
- * This program is free software; you can redistribute it and/or
7 ~# G% ~! v7 t& s$ p8 {7 I( x - * modify it under the terms of the GNU General Public License as" _5 I+ N9 a a. t2 n( ~
- * published by the Free Software Foundation version 2.
0 ^1 K4 p. ]; h# H0 b3 [# p) V - *( z3 ?* p2 z: O2 V, P/ u0 p8 o$ L8 L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 }! u9 u- Z0 Z4 K& J& k
- * kind, whether express or implied; without even the implied warranty6 s6 R& }# P3 A
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 ~6 z! U9 l( T7 u# U0 M! P/ d
- * GNU General Public License for more details.
U% e3 y( G" c9 c! D9 G+ b- } - */
, C9 T: X0 s+ l; U3 }. r* P
8 `/ t6 _9 T" ]# a- #include <linux/module.h>8 ~1 n& {, ?: \$ | ^2 A; K9 f
- #include <linux/init.h>9 k$ h7 A9 N6 Z: [4 {* R) Y
- #include <linux/errno.h>
/ F. B e+ h# c1 X7 Y! c } [ - #include <linux/types.h>- Q/ r5 i3 I3 C; G
- #include <linux/interrupt.h>
9 n) N' E) p! f) h, [ - #include <asm/io.h>( O1 A r8 |4 G6 [- O
- #include <linux/moduleparam.h>
* T# @( ]3 r+ M - #include <linux/sysctl.h>
2 W4 ^' `7 u! c; `: p2 ?& R - #include <linux/mm.h>
, C9 O7 T+ a7 Q7 i+ t. D - #include <linux/dma-mapping.h>
/ V! r7 S' l0 p2 f- w
! k; M! _ L$ w" k0 ^ W- #include <mach/memory.h>
' G- M9 M5 q5 _% m! ]- H: t& Y - #include <mach/hardware.h>
N4 f0 X* Z8 Z8 U - #include <mach/irqs.h>5 P( q, |* r3 S* R. r+ ?2 o9 o. J% F
- #include <asm/hardware/edma.h>: j6 m2 T0 o3 v) m2 `& G+ Q
- 7 I) g/ K2 ^* ~" g& ~" b% j+ ^ G
- #undef EDMA3_DEBUG# v! {/ C7 q, a4 C' c
- /*#define EDMA3_DEBUG*/7 `3 n/ x k" S6 u H
- ! n$ ^$ o# g+ \( |* @3 o
- #ifdef EDMA3_DEBUG
. Y& Q3 D# |) w8 i# V. L0 @. e* h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: E; w% P3 G2 @4 h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 E+ h8 J& z/ e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). ^" K3 Y3 |3 p3 V. R+ Z+ o( {
- #else
# R6 ?* Z& H3 E - #define DMA_PRINTK( x... )4 U* A/ x t% ?7 q: s
- #define DMA_FN_IN" V7 ?1 f: ]2 M/ Z, n
- #define DMA_FN_OUT, K8 E. F& V- N$ G
- #endif
3 w2 Z# \" a1 x# q* m. ?6 f. `
, s% N; ?" t. T9 x& h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! W% |" X+ r3 W1 U R/ f - #define STATIC_SHIFT 36 D+ m. t# ` l# c. \/ \
- #define TCINTEN_SHIFT 20( a; L1 m7 @2 b' ~
- #define ITCINTEN_SHIFT 21
8 W6 E2 E" T* ]2 ]- `% f/ z - #define TCCHEN_SHIFT 22
+ F( u# K6 u. }1 h3 P% u' S8 Z - #define ITCCHEN_SHIFT 23
1 U$ v% B, Q: Y- E$ \4 e- e
3 y; j) ?$ p, f- static volatile int irqraised1 = 0;
% I$ X5 W) r" p4 M - static volatile int irqraised2 = 0;1 O9 I% h, n* A3 u6 O& l
: y" U" P) `* J W2 I- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 M) y5 U" e+ ~1 F5 T% \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ k. k P6 `$ v# e2 C9 [1 z/ r1 Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& b2 e6 l. ~2 P3 C1 h
: [& Q7 @4 U8 L+ X/ E3 G- dma_addr_t dmaphyssrc1 = 0;1 @1 A/ h7 Q, e$ u* G1 O
- dma_addr_t dmaphyssrc2 = 0;' S: @# W% |: x9 _2 A
- dma_addr_t dmaphysdest1 = 0;# P& N$ M) k' h* s
- dma_addr_t dmaphysdest2 = 0;& Q, `6 Y; o3 V- e/ T' l3 u
X. q1 M, q8 C+ X+ F- _- char *dmabufsrc1 = NULL;
1 h; X, G# f$ \3 H5 q' a+ l - char *dmabufsrc2 = NULL;
( {) z, ~, }2 i. W - char *dmabufdest1 = NULL;
5 g* j! X) k; k _ - char *dmabufdest2 = NULL;
/ R/ H/ w2 }' }8 K2 }5 f
3 G0 L1 A K- H6 X- static int acnt = 512;. j r& ~* R3 h1 k6 d
- static int bcnt = 8;& o0 x5 e9 `% ]
- static int ccnt = 8;: D! U7 P5 ^7 V; J: Q
- I$ x! k* U- _) C5 ? x2 C- module_param(acnt, int, S_IRUGO); ~7 x y* A: t7 P5 _/ z
- module_param(bcnt, int, S_IRUGO);) N2 {( r% f$ k# \
- module_param(ccnt, int, S_IRUGO);
复制代码
B1 | j5 B+ w7 Z8 P7 {. A+ u- l4 U# W. s; w, N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( k5 x# y5 Q0 X) C9 @+ |0 {7 _8 Z3 sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. A, |+ G% W' n5 e `9 W& L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* `5 l$ Z# Y# P r( _' m! ~3 f$ Z! g4 D6 V8 a& W/ u. z6 r! X. E
( ]& ~* U K: R+ s8 Y |
|