|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / y; g$ E, c3 f6 I# c
- [code]EDMA sample test application) ~7 A" D9 X: q! r1 w# u) f% @7 ?
- /*
. ]! C( X, k$ g* g3 z2 f - * edma_test.c
; F& d9 K5 n" i8 @7 N - *
$ X: i" k* J# g& z4 c; W8 i5 W9 S - * brief EDMA3 Test Application
( k! J' i+ n8 B - *
6 ?6 T6 V1 j% q. L) u( ]2 W2 o, H - * This file contains EDMA3 Test code.
! g4 @% @7 B6 M4 y - *
1 h2 A. C$ I! N/ a' q, ~ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! f z, b) j3 m! q+ b3 G - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 c) p# u0 c" Z+ H/ M - * TO CHANGE.
0 P, T1 V, `9 G ?# C& P - *
3 f; q5 a: Z1 Z; \/ `) z5 D% p - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* d/ m. |/ J$ _, c! `+ S
- *2 }- h k$ S6 D) {! I2 ?, T
- * This program is free software; you can redistribute it and/or
+ L8 k ~' c% }( ?/ D - * modify it under the terms of the GNU General Public License as
, }2 O* @# X3 P3 D; e# h - * published by the Free Software Foundation version 2.
# i4 }# H* y8 P9 h+ _ - *6 I2 |' z( V5 K$ }. `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ U; Y. M9 O2 v# r6 k8 Y% }
- * kind, whether express or implied; without even the implied warranty+ v- |3 R8 ~6 T0 c" u- X! s
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 J8 z& B$ }/ L6 W" f# ^3 i
- * GNU General Public License for more details.! c. o' p' O% H9 \3 Z# M7 `+ A! M
- */
. ], ?" {$ ?. ?) |5 }7 T/ I - % @+ O& l0 Q+ n7 _1 e2 F9 D
- #include <linux/module.h>3 l3 z7 ~ V! [, n& H, b! N
- #include <linux/init.h>- A' I" G( X* L8 F
- #include <linux/errno.h># T5 O) B* r8 p
- #include <linux/types.h>2 f' P/ t- }& C' _( D/ G
- #include <linux/interrupt.h>
! G8 e6 i6 }6 ]$ v - #include <asm/io.h>
) J' u$ J& V7 V5 i9 ] - #include <linux/moduleparam.h> `. B3 ^# W1 T; k' Z
- #include <linux/sysctl.h>! U1 L( @5 i1 _/ K
- #include <linux/mm.h>
$ V' {( H4 n/ B4 `8 B9 ? - #include <linux/dma-mapping.h>
9 [' E; z/ \9 e* p7 s
8 j) S7 J: M( L2 c7 H# F- #include <mach/memory.h>
, {6 q+ ~ B- s) t% h+ f4 | - #include <mach/hardware.h>; O# k7 L5 P- @! k
- #include <mach/irqs.h>3 g, X! q1 M+ z( X- x8 H
- #include <asm/hardware/edma.h>
8 [8 \5 o) H& J) H. W/ n
8 H; B2 C7 B/ {: L/ g- #undef EDMA3_DEBUG
' v3 W* v% X4 s, f5 C) m - /*#define EDMA3_DEBUG*/
5 ~+ |/ O5 S) _
& p, Z. U' {( l ~- Q1 u5 j' j- B0 }- #ifdef EDMA3_DEBUG
4 Y, f; G# J/ V. r$ _/ h* | - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& C+ M! [8 [4 f) [( g9 D* w - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
M$ ~& K% e- j1 T) }7 a - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' z: K' g' {# P+ M0 u - #else: n4 ?! l6 f3 c T) p
- #define DMA_PRINTK( x... )
0 Q* C* j [7 O, e - #define DMA_FN_IN
3 Z! }* j$ ~1 v" Y - #define DMA_FN_OUT$ z7 ^3 V/ F3 F8 a& k1 B" `
- #endif
; c3 I, P& g$ ~& i) o: a5 ?/ X. B
$ Z% D1 c4 Q! C# e- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# I0 J. C/ r# G, B1 Y- g d
- #define STATIC_SHIFT 3% g9 @+ m" [( z1 I- ^+ G( s
- #define TCINTEN_SHIFT 20
- C! |" q/ K5 `! |' h# A8 | - #define ITCINTEN_SHIFT 21, v+ `- K6 A) ?# H0 S( s- ^& R
- #define TCCHEN_SHIFT 22
4 F: K( a# w. v; ^ - #define ITCCHEN_SHIFT 233 O( ]) P8 H; \ P
- 0 ?0 F: `) K" Z# _" {0 W
- static volatile int irqraised1 = 0;
$ g7 G" _8 w; A# |3 [ - static volatile int irqraised2 = 0;
3 |$ ^, z7 P. @1 T$ Q
/ B) G3 \( S; c; K0 J( w" T1 S' v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! W8 ?; R t6 W/ m0 K4 i: T- d% a - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: |8 i- M# l+ @1 F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 v) P5 X$ k9 B/ l
+ q) G/ D, _- F$ _* f* B- dma_addr_t dmaphyssrc1 = 0;. J. E' j5 p8 T1 O; d
- dma_addr_t dmaphyssrc2 = 0;
9 }" c& i" h9 g7 m# ]4 W - dma_addr_t dmaphysdest1 = 0;
3 z$ k& F4 V' d! s" s - dma_addr_t dmaphysdest2 = 0;. Q* l6 v3 d6 S/ n6 m6 G
- 6 C3 A# q3 b1 w, C' x. v! H
- char *dmabufsrc1 = NULL;# b5 k* h; U \) k$ a
- char *dmabufsrc2 = NULL;7 d0 P( o+ G G& O/ N/ v1 J
- char *dmabufdest1 = NULL;7 }( J) ?" N3 ]5 a) Z
- char *dmabufdest2 = NULL;) Z2 a3 E5 ~; }
1 a7 D0 H' \: I% d0 a- static int acnt = 512;& G: x- T3 G- R/ m1 A. H o
- static int bcnt = 8;: B# ?. H: T% G
- static int ccnt = 8;+ t- K1 F0 B! ^) T3 y
- # Z+ W3 `7 L+ P: X
- module_param(acnt, int, S_IRUGO);
% T4 l |( [& ^! m, L - module_param(bcnt, int, S_IRUGO);- ]! n' z3 H) @1 ]% G) a0 V
- module_param(ccnt, int, S_IRUGO);
复制代码 . Z7 @7 K F" N1 ^7 s- {
. B4 l; m7 c" K/ q, c6 N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 g3 M: I6 H* C) d8 N0 I( V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- ?. K( r* A, C% G; g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: c' s- ?- g- ~9 X4 h% T
9 ]0 j+ }8 D) P, \/ x; m" b1 i
- }3 F* X- S0 W3 W' j0 H) W7 ]* l |
|