|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 }3 p; e% R) V0 D- [code]EDMA sample test application' O2 j) I/ }. e: u$ `" Y: l, {! o8 _
- /*
+ P% r7 `5 l8 @4 Z - * edma_test.c
! F: w1 o- {* t, d' |% t5 ~ - *# ~) a c- L/ c. x
- * brief EDMA3 Test Application: t5 j! k( F* U1 @2 Y2 l
- *8 r! q$ f! ^! |5 |
- * This file contains EDMA3 Test code., t B: y: D% q! p8 a; O
- *' y/ h% o0 |3 W# ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: c' J7 x% N$ s! x
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& O S7 T8 s2 i+ Z" g3 P - * TO CHANGE.
) d; @8 K, I9 U' U) ~ - ** Q5 b( r9 C( Z; n2 q( l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 U- v1 \* A, h" B2 B2 M; L - *' a3 X! v9 y2 k" o
- * This program is free software; you can redistribute it and/or
! L8 D8 h6 _, D `+ j7 W - * modify it under the terms of the GNU General Public License as
& q* Q$ L/ p' r& @# H& | - * published by the Free Software Foundation version 2.
6 Z% t. Y" u/ K$ Y) |; F - */ N3 X' e$ a( {, ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
C- t& T1 K' X3 f. q - * kind, whether express or implied; without even the implied warranty
2 q. u% A! H- _% E" [7 e( v - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a/ b) e3 O0 a6 @8 k - * GNU General Public License for more details.
' k& p7 B) ?, h; m, J - *// r+ o9 j! C" V
% W0 o" Y6 z" \- #include <linux/module.h>" M! [ x+ ], c( X9 p$ @" h. G
- #include <linux/init.h>
" i. W5 z o0 w4 ]+ {9 S, x* K; J - #include <linux/errno.h>2 ]( {, k6 U! u( b1 z+ `+ d
- #include <linux/types.h>8 e- J% e' w* p) J
- #include <linux/interrupt.h>
( U2 c$ h% Y* M: x0 J$ E5 _( K: N: g; t - #include <asm/io.h>" t6 A' q4 y9 }: K# V$ D8 }
- #include <linux/moduleparam.h>
8 x/ A" S8 n4 c2 X! M0 X - #include <linux/sysctl.h>
6 P! L$ ^9 r7 M - #include <linux/mm.h>
6 a N5 _% [& Q! G - #include <linux/dma-mapping.h>
( ?/ R9 k4 s7 z, {) I2 u
* |/ B/ | ]3 a2 K+ O7 K8 g/ h8 m- #include <mach/memory.h>* C% ~$ v7 P! P& H/ G$ X7 ?
- #include <mach/hardware.h>
# c) k R K) \5 f0 f - #include <mach/irqs.h>
5 v+ [5 P- B! S+ m" F - #include <asm/hardware/edma.h>
! t' ?, s; l' O. _- z% e, \/ n - ) g! ^% b v8 w7 Z X5 e
- #undef EDMA3_DEBUG9 r- k& i- y6 Q
- /*#define EDMA3_DEBUG*/
" A$ J& ]6 S6 F. O o2 w# a - 1 f. ^" E% _ ~# i! f2 U
- #ifdef EDMA3_DEBUG, F3 k) _% q. q5 Q S# v$ W1 s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- |5 M# S4 W- o4 @8 O6 }3 u, G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ S8 L/ z) W4 O' `) @2 i$ r - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 `8 y1 q3 q9 h. D9 L/ k
- #else. @8 }* e( a2 ^ J) }' |6 s
- #define DMA_PRINTK( x... )) |& E$ |$ u% U# r" c0 A5 a
- #define DMA_FN_IN
8 l# V" y7 h1 v - #define DMA_FN_OUT
$ y8 F9 ?1 o6 m0 d, f - #endif' D3 K5 ~( @+ w. Q
1 ~% ^2 r- Y9 Y5 \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 C, ?" g3 c' O9 ?4 P/ f& q' W, ~
- #define STATIC_SHIFT 32 c$ ?, f9 ?+ j$ {1 X' b g+ F/ L
- #define TCINTEN_SHIFT 20$ B4 Y- q+ I! ]
- #define ITCINTEN_SHIFT 21. S) n5 N4 b5 b; u U( ^
- #define TCCHEN_SHIFT 22) b5 r7 _! I( g, o: R2 c
- #define ITCCHEN_SHIFT 23
2 g& t. ~* ^8 K+ W! u$ O. Y& O* n: d
( S. U6 X/ S2 B% \- static volatile int irqraised1 = 0;
( v2 H/ g# P6 x% |* G - static volatile int irqraised2 = 0;
6 }. k6 i, b9 j- B
K: a1 F# T( D7 G% l; ^6 W- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# k; R. H' }: p3 y
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 q' ? z& y. p7 U
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% @: `) c' d$ W7 g# s
/ q+ Z, H. d) C5 b- dma_addr_t dmaphyssrc1 = 0;
% `6 S& T3 _* Y - dma_addr_t dmaphyssrc2 = 0;
4 U$ h4 o7 B) ?- a- _$ m4 g - dma_addr_t dmaphysdest1 = 0;
' R, G7 t2 c: K! r# E# S$ K - dma_addr_t dmaphysdest2 = 0;
& o; E# l; T1 ^5 J5 P8 E
0 f. b- l# g1 x6 e6 B% Y* i- char *dmabufsrc1 = NULL;
. D% ^, ?! @/ a$ ^* l - char *dmabufsrc2 = NULL;" Z7 ^. Q u j: v& m) |; X
- char *dmabufdest1 = NULL;
* c' C7 ~5 z/ v. P d - char *dmabufdest2 = NULL;3 q9 D3 K: c `( ]* v
* r' ]' |: G8 X8 _' ~- static int acnt = 512;$ | S4 }! D9 s
- static int bcnt = 8;
- H7 g0 M& {8 ~8 m9 O* S5 H - static int ccnt = 8; B# }! W/ h/ z2 g: o& Y
+ Q4 _4 P! V( _2 F+ F+ t- module_param(acnt, int, S_IRUGO);9 M3 Y9 f# X0 T
- module_param(bcnt, int, S_IRUGO);
8 _# ^- g1 k& Z% r4 y+ H - module_param(ccnt, int, S_IRUGO);
复制代码
& V4 c. g! X4 D' E; N4 v% o) J4 O3 g' E+ x9 q. m T# k$ P
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* I5 U9 `, h2 a, karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' H3 \# a2 x% l Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 p1 H" S3 i: R/ B3 K' T& F9 c8 q% {+ B3 W
. U0 X/ {; E) A) S% G |
|