|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : n6 n% A e- [7 o
- [code]EDMA sample test application S' ]( I) _3 ], S; X+ R
- /*# t# Y" r& |0 J0 ?3 [$ }! M9 ~: C
- * edma_test.c& _9 C k; p. B4 ? Q) l
- *& C: v: g/ s# d: T
- * brief EDMA3 Test Application
& }4 F7 m- V* U7 a8 b) o - *
( G& L2 R; A) M2 A( ~3 V+ ^( o) T. v - * This file contains EDMA3 Test code.6 M9 p+ j) ]( T
- *
! E9 m0 d) W8 [2 Q; Y1 P+ M1 o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 P& J. k) L# ]' {* ]6 `, I - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 P6 E& W0 P e - * TO CHANGE.2 j! p* a$ k$ N) E7 w
- *
. P* s. M+ B. R, k% K/ l: p) _ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! x; Q0 _: h% [* `, ]) G4 K - *
* b+ }, J: D5 \3 D' E7 c. H: M2 A) X' J - * This program is free software; you can redistribute it and/or, F0 T+ A( c) \
- * modify it under the terms of the GNU General Public License as4 V: D# Y2 t; ] [; L
- * published by the Free Software Foundation version 2.
$ d X& k, ^9 r; \ - */ c4 I7 H, [8 y Q3 i; o$ ^' L; {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) B: c) t/ |6 _. z% e: @ - * kind, whether express or implied; without even the implied warranty4 m/ g7 X2 Q% x- n
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 @! g6 X) s4 e9 I, w! t$ U
- * GNU General Public License for more details.1 A" G/ X. Y" w
- */% k4 t0 x, `1 ?9 s
$ v/ T; v' \+ L& p2 Z8 k2 `- #include <linux/module.h>
2 D2 D& P3 S" t - #include <linux/init.h>
* h h" H/ Z6 t+ ]3 h. c - #include <linux/errno.h>
) i7 x6 n! [- h* Y) | - #include <linux/types.h>$ Q# S; T6 k9 W& R1 ]: F7 V+ B
- #include <linux/interrupt.h>( f5 s2 l* j1 }. Q3 Q' v" h
- #include <asm/io.h>$ [ K2 J* \: c- ^; C0 G% @! y
- #include <linux/moduleparam.h># j3 A) m* Q. V {# K2 Y
- #include <linux/sysctl.h>- T/ K, @8 I, Z0 T/ H
- #include <linux/mm.h>
$ ?. J |; p4 m8 T* S5 l0 h - #include <linux/dma-mapping.h>! i9 Q* ?' p, B2 t! T# C2 K
' S7 [, @9 D! o; }+ [9 r- #include <mach/memory.h>
1 f& K5 \6 X) g- u* N9 c- G - #include <mach/hardware.h>
. s! \! o# Z2 Q: p, F1 L - #include <mach/irqs.h>
) ?& [. C$ z7 n' d" f - #include <asm/hardware/edma.h>
, T& W0 t" V: o- ]$ Q
0 V" }8 N, s. K0 A% \8 q- #undef EDMA3_DEBUG
# p. g% M( X% q6 m9 |6 w( G - /*#define EDMA3_DEBUG*/
9 [0 ?7 ?: D0 B9 V
: O6 O2 t1 ?# g* W9 X; q6 y+ _- #ifdef EDMA3_DEBUG
, x( q3 ~2 W R! G+ }' {7 h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& U# z1 T* w- V8 j( |6 g* b6 | - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* A4 B- c* B1 N8 N
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) F" [8 V5 B$ w2 T' [8 F$ X - #else% \5 T+ j0 g/ ~& Q" D
- #define DMA_PRINTK( x... )
% S' z/ X5 J m4 v% ~, _ - #define DMA_FN_IN: a/ _* T" W, F- M1 K
- #define DMA_FN_OUT4 ^+ u/ K: v' ^' c, ~5 |" e
- #endif5 {- Q: P# \% e2 f8 W5 ?
3 I8 ^+ g# v m9 R, K# t+ I U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 i6 ^" ~( R: E
- #define STATIC_SHIFT 3' K; u/ U# B4 A% F
- #define TCINTEN_SHIFT 20
2 J/ P1 N# U; M: O; I - #define ITCINTEN_SHIFT 21
4 U+ n9 ?0 t/ o3 {, z. Z, ^ - #define TCCHEN_SHIFT 22) r0 t: s m- R6 c
- #define ITCCHEN_SHIFT 23
) N/ M0 V! @1 S, _. W% H1 J/ w7 S. P
6 o8 v/ `; J& J! a# z& A* D9 S( G" e- static volatile int irqraised1 = 0;2 s' a$ h. M6 o
- static volatile int irqraised2 = 0;
: R. B" E! W! @
1 ]8 W; T2 J, O! p6 |" w# V+ L( F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) {/ T% x; P& l8 x - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& R; c0 J4 H3 D1 u. q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ L" h/ U+ ]8 p) e5 }% _ - & V& c( J, N9 W$ g* O- ?
- dma_addr_t dmaphyssrc1 = 0;, i. I& m: K. d7 k3 x
- dma_addr_t dmaphyssrc2 = 0;6 X/ I/ H% z$ H4 t+ O
- dma_addr_t dmaphysdest1 = 0;; v4 N: F" M; x, \: v4 K
- dma_addr_t dmaphysdest2 = 0;3 S' Q4 v% N3 j9 B
* s: ~* @1 o/ K- char *dmabufsrc1 = NULL;
+ h) ~& L6 C" o9 X- _ - char *dmabufsrc2 = NULL;, Z# w6 J; Z. k A5 j( ^" H$ e
- char *dmabufdest1 = NULL;
% i" P5 V* p3 `4 Z: R6 F - char *dmabufdest2 = NULL;+ H6 f, U7 u( l9 a- u
- 1 x& Y% ^2 ]. n; a- g2 H
- static int acnt = 512;7 ~5 q' w7 L: @$ r) k( a5 S4 t2 S
- static int bcnt = 8;
( [, o' D W9 n5 V* F - static int ccnt = 8;
) m4 r1 D" C7 U) s
/ `3 N1 B( P$ e) B' V- module_param(acnt, int, S_IRUGO);
2 W$ {* t8 r0 [ - module_param(bcnt, int, S_IRUGO);
$ O8 Z! M9 |3 Y4 }" u$ n1 P( E - module_param(ccnt, int, S_IRUGO);
复制代码 ; {0 ^- n8 z; T7 T0 V
% y) I, w7 s- O; ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) z3 j) O# h: {' U& }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ J: P& M1 A4 G: U6 X; v5 `$ f
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 C, [/ ]4 M; I# K+ q" l5 g) K
) E& K( C/ z( r; q5 F! w
$ k3 |/ o3 H- H0 Y( ~, ] |
|