|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % w3 r" o% g4 N6 i9 D" ` w h
- [code]EDMA sample test application
9 |2 P- ~& e7 A; s2 ]' f5 ^( c - /*( K: y/ z" Z6 Z6 W; u
- * edma_test.c# a1 k6 ~( d. f# Z; H
- *
$ g( [# l6 g/ s- i; i: G# w7 N - * brief EDMA3 Test Application {+ C7 {" e2 G4 j" M
- *
e* T; \, R# X5 I1 U - * This file contains EDMA3 Test code.
. k- ?: a4 G3 T6 z0 _. c - *- M/ [- S* R& V+ c+ C- _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: f3 i; Y& g/ s+ f& z' v. a - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 o/ z$ B9 k( G& Z2 t) L% @7 x
- * TO CHANGE.
# O1 K+ I# F) a$ N) h4 B - *
1 n) X, Z5 p& d7 ^% M! V( d. q - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ l( _8 ]8 s# j `! X* f( I - *
l f% _) N; c; E2 U. e - * This program is free software; you can redistribute it and/or
4 d1 P: B6 a% v9 ~% t" b; @ - * modify it under the terms of the GNU General Public License as7 g1 ?3 g. f# p" K3 Y/ Y
- * published by the Free Software Foundation version 2.' i; y5 _# L* v; I( ]
- *
' {4 K' F1 |5 L" ]/ q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 J: T9 J- V+ ^3 t _* e% i - * kind, whether express or implied; without even the implied warranty& e" A0 E ~* h% n5 S* v$ d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! l9 S! X5 \4 h - * GNU General Public License for more details.
2 a; |' _7 U) Z, t: z6 H: P m: F - */
m0 J' O, d2 @6 { B
! x1 t, p# d$ u; C7 [- #include <linux/module.h>
2 e$ |1 `6 F+ {* ~ - #include <linux/init.h>7 p! X; o# K+ D2 y& E& E& s
- #include <linux/errno.h>
& @; M5 v/ s% E& q - #include <linux/types.h>7 s- Q; e4 |# b; G9 p/ ^% g
- #include <linux/interrupt.h>2 {; M. N' t2 y9 w: [6 x
- #include <asm/io.h>& L( G3 H* A$ Y( F7 Z
- #include <linux/moduleparam.h>5 m6 y' y) p- @% X
- #include <linux/sysctl.h>
8 F7 E3 k5 ]; R& k7 C+ p - #include <linux/mm.h>1 ?/ X5 J- r, Z/ j/ X
- #include <linux/dma-mapping.h>/ E- H0 ~! F7 U
) h( y# G, X! g8 Z- #include <mach/memory.h> \, S7 \( ]3 |8 H
- #include <mach/hardware.h>
5 x: B4 p! j; m - #include <mach/irqs.h>; V% u% D9 i* n2 c
- #include <asm/hardware/edma.h>
( O5 L" C. p& F# d* C+ ]5 t - / v. n g* q2 {
- #undef EDMA3_DEBUG! H0 `0 q6 _- I
- /*#define EDMA3_DEBUG*/
4 l0 I/ j) `* M% }0 L0 [. \
' O7 s1 `' ~3 |- p- f O- #ifdef EDMA3_DEBUG
$ B+ Q, R1 F* P$ t' v3 _7 W$ } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 r$ U" l7 G; U3 q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 d# v3 C" `, c( S3 H" N( A6 w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 f% d3 q8 u3 h* v$ l5 }
- #else8 X8 J5 u# m) F& E$ w! E
- #define DMA_PRINTK( x... )
. @2 z& p- t% u8 R' w - #define DMA_FN_IN
& V( s3 F4 P+ W - #define DMA_FN_OUT+ P+ p7 o4 a: ]* s0 S T% q, V
- #endif3 [' `9 K0 h3 t4 j y
8 ?7 ^. k8 Z* r5 {6 C9 n- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( _, Y+ V- P. v' O" H6 S4 P/ f& o' W - #define STATIC_SHIFT 3
# B4 q0 e& X+ D( m( @5 q6 } - #define TCINTEN_SHIFT 20) A" V4 Q: B3 S
- #define ITCINTEN_SHIFT 21
/ d. \9 ~6 J% M& ^1 r - #define TCCHEN_SHIFT 221 o4 B @: H. d/ L) Y: f& v$ q
- #define ITCCHEN_SHIFT 23' X) b) P+ h7 L0 x6 B8 F/ k+ _" k: \
- ) q' L( B1 |5 \# d/ _
- static volatile int irqraised1 = 0;' V; ?" G+ T# u# t7 P1 t
- static volatile int irqraised2 = 0;
/ @8 m9 u; ^9 U& K5 k f
$ m, P& G- g _& H, b% a- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- J- \+ u0 i, t7 K* J1 [7 ?; D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# E. d8 P6 {7 Z6 I! E) F2 q& C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 O* U& s8 I2 S$ t) G# n" m
6 s5 b) _# n3 O$ w! @) g- dma_addr_t dmaphyssrc1 = 0;' s' V) b4 H& m
- dma_addr_t dmaphyssrc2 = 0;
* i5 Z- H( y. L/ U3 I" F; |6 A - dma_addr_t dmaphysdest1 = 0;
3 y- `$ |) }# q, L7 c+ s6 _# H - dma_addr_t dmaphysdest2 = 0;
/ g! u: R# @) j - - t, R& ^8 z, U
- char *dmabufsrc1 = NULL;
# \& i0 k" ?/ M1 I - char *dmabufsrc2 = NULL;
9 ]# l) X I) o) v! W4 O( X! R8 ^ - char *dmabufdest1 = NULL;7 X N3 R, u+ K; o
- char *dmabufdest2 = NULL;6 x5 s3 ?) q1 N; O' x. c& h
- # U( c+ c+ b3 n/ i
- static int acnt = 512;
8 ?& @% @$ q3 L4 ^ - static int bcnt = 8;: L- `) [" Q, u! `5 s
- static int ccnt = 8;
' r! G% [8 h% v* L# A% w9 V& d
~0 [* s! n o! G- module_param(acnt, int, S_IRUGO);1 e9 M/ i1 ^5 l+ _" n
- module_param(bcnt, int, S_IRUGO);2 J& t. ?/ Q8 Q2 |8 S. n! T
- module_param(ccnt, int, S_IRUGO);
复制代码
" v2 m9 o1 A' g0 h
" D" } W! t* L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. _* O/ o& o) ?+ _: {) Y) L$ E6 Z+ warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 [ d3 i. l, c+ y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 }+ ^ [1 s! A4 L9 s0 _4 A; L0 R/ C
4 h( s. D% G$ P |
|