|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 I% s2 o# {1 y0 v* K9 ]- [code]EDMA sample test application. x* o4 M( I% f* u8 z7 d
- /*0 t: h' W0 R; m/ B/ K
- * edma_test.c. v. J0 J& K5 o! G. \. G( Q
- *+ U" Q# g3 {, R: e8 ~
- * brief EDMA3 Test Application4 J3 f: M, u' |; y; M
- *8 G, i4 Z: C# ^0 ^& z# D
- * This file contains EDMA3 Test code.+ b, T" A# p( \1 H
- *
& Q% e& o) k' [0 X! p$ I5 h! f4 s# O - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" H# Z* K! s3 ~3 f1 p - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 w5 B; d2 P9 C* w% @: B6 E/ h - * TO CHANGE.
$ }2 F# |5 v" X: E, T" u6 Z - *8 L+ m" Q$ q) G. x: M; q" c5 N( Q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* O" x. a) u. l3 Z( M - *) z0 J5 Z6 E r: X
- * This program is free software; you can redistribute it and/or( a1 S! m+ F; x" V6 T, B
- * modify it under the terms of the GNU General Public License as
' y; _/ L9 S' \ - * published by the Free Software Foundation version 2.
$ w+ a4 R1 `$ n7 S4 i* U/ m - *3 t( A' G5 t5 _& g( n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( n9 p4 b+ r% A5 d3 F6 z6 X9 Y - * kind, whether express or implied; without even the implied warranty C4 z1 m: ]0 e
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 D! }5 m8 F1 m' d! ^ - * GNU General Public License for more details.
% X, w) ] T E& I8 I - */
+ V0 O8 ]; l4 I0 c6 Y - 5 p0 V/ j) w4 g1 j# L, O! N
- #include <linux/module.h>
' P7 Y* U" T, I - #include <linux/init.h>, `, ^/ ?0 O u" Y& q R4 `
- #include <linux/errno.h>
5 c/ d) q" ^2 V) H - #include <linux/types.h>
S% {6 J' b& j) | - #include <linux/interrupt.h>' G @! e1 T0 i& f+ b7 E, p
- #include <asm/io.h>
( y- x- I$ t/ _# x! [; @9 @ - #include <linux/moduleparam.h>. g* w1 @, n6 Q: W& n* N: X
- #include <linux/sysctl.h>! N# U2 r. |8 h+ Y
- #include <linux/mm.h>
* M' M6 u$ ?2 \8 `$ U- e9 a - #include <linux/dma-mapping.h>
/ I$ T$ g% J9 u9 @
9 ]) ]6 p/ E' H0 S) Z2 |5 j- #include <mach/memory.h>
6 O" r S8 Z; S8 T5 U* g - #include <mach/hardware.h>
/ k- {/ \/ | w7 Q) p - #include <mach/irqs.h>+ A8 h8 T6 y5 ^
- #include <asm/hardware/edma.h>
( y/ X% X/ e& r - 2 G4 a+ P# n$ Y, j/ x% I* u
- #undef EDMA3_DEBUG2 p5 R! `$ e9 x) k. Z2 g
- /*#define EDMA3_DEBUG*/
9 {( }, z; E1 ~% _- c. P# @8 B5 S - ! s2 c( B8 R% O( a7 B3 c
- #ifdef EDMA3_DEBUG
! S) j. L- z& d$ s - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 U1 l- S! }* s! R! s9 I - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 l6 i( I% w, O+ j( q% Y8 [! W0 Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# y0 F0 y# g# T6 l - #else0 v0 X3 h$ ]) w! M7 D2 ^9 c6 r6 K
- #define DMA_PRINTK( x... )1 o2 u3 ]* F/ e) N% O( Y
- #define DMA_FN_IN; F0 s' v' n: Q
- #define DMA_FN_OUT
' [. s9 X4 g0 T x - #endif
2 z( M, L1 f; F& a - 3 t- L; i4 V& _$ E7 D
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ j7 z! [+ u) N4 ~
- #define STATIC_SHIFT 3" x2 E/ c b6 a. A8 G
- #define TCINTEN_SHIFT 20
0 w" I. q' a5 ~3 G - #define ITCINTEN_SHIFT 21
: B% n7 G- w& g! A6 V% J( h, v9 b - #define TCCHEN_SHIFT 22
4 e2 R. ^9 a9 t7 x3 n, W; N$ ` - #define ITCCHEN_SHIFT 23
% ?$ V& [: \- S1 _$ x; z! m
+ Z; k5 s+ Q2 K9 u- static volatile int irqraised1 = 0;
9 s9 `+ E* y0 L1 x - static volatile int irqraised2 = 0;3 q) n! R: b0 K% U
- ; b4 v. `/ S' r9 u5 c, n' C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ R0 `" I$ A6 {9 W3 b
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 f2 `4 L R9 O' x& I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 ?) n" w) z0 Q- l% c$ U( P
0 B- _2 N( W9 L: k$ G- dma_addr_t dmaphyssrc1 = 0;9 x' a& T' k2 q3 V
- dma_addr_t dmaphyssrc2 = 0;
/ `' H+ u% A/ q; H0 ? - dma_addr_t dmaphysdest1 = 0;
& E6 J2 m$ x6 m2 Y: w* |0 N, { - dma_addr_t dmaphysdest2 = 0;, ?4 s6 d" ], z4 K
+ @2 ?$ p; r$ b" A- char *dmabufsrc1 = NULL;
3 N7 c) j3 t6 X. D' [* F- N" L - char *dmabufsrc2 = NULL;! j( u N: ~" R, z3 D& N& I
- char *dmabufdest1 = NULL;
2 L& E6 ] r5 c; e$ q( j - char *dmabufdest2 = NULL;4 ^* C& a, n! y1 |
2 Y: d* h1 a/ z6 q D- static int acnt = 512;
; b3 d4 [( } F' X9 H - static int bcnt = 8;
! k- Y4 Z( Y- X X/ v( Q - static int ccnt = 8;+ Z7 o* i- ~1 a2 f l
( t) o8 A6 g! Y9 O- module_param(acnt, int, S_IRUGO);6 |% n1 ~. e- J9 x, o8 ^% `; J* d
- module_param(bcnt, int, S_IRUGO);8 S# ?' g+ D0 Z; A9 a
- module_param(ccnt, int, S_IRUGO);
复制代码
" N3 W$ B- F9 A+ d: `, y% a7 o }( A2 p; u+ w5 L# g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 q- G" L& r: @" {
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* z( o/ T. J; `0 C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: [8 h! p$ v# l, ]* G
, ]; A) k* N& T0 b: o: v
. V2 y0 ^. J1 g' E. B. z6 S |
|