|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 r* W, [2 Q9 J6 ?' ?
- [code]EDMA sample test application4 ?0 u6 B( B* M" e
- /*
2 f, C1 |" E" m; U) v - * edma_test.c
/ l$ {. U, O9 ?/ ^ - *# l2 Y1 r7 I- n7 t: M8 f
- * brief EDMA3 Test Application
1 ]9 `6 C& x4 f% l - *- w" g6 R3 Q+ l) @2 U, r' Z3 j2 v" W
- * This file contains EDMA3 Test code.* N1 b# U+ F: r7 ^* V( t1 `! m) J+ x
- *2 X/ D1 }, k a# b
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ U- J ?8 M/ A8 l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. s1 H" s- u9 h% t
- * TO CHANGE.
' n& e+ ?$ s, ^) P! u5 w, _: _' c9 Q - *
; f' r& d& |# q! P$ G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ Y6 L& p# L- X
- *
9 I- G+ c3 B8 w6 w8 `- ^% W - * This program is free software; you can redistribute it and/or
O i% g1 ?. d! V2 O, U - * modify it under the terms of the GNU General Public License as
2 ?0 W3 u; {! Q# ^, G - * published by the Free Software Foundation version 2.
* G8 [5 U$ S3 Q - *
7 i- Y2 x! ^# c5 ] - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 i$ p; h$ F5 u- n3 ~5 e/ p) Y
- * kind, whether express or implied; without even the implied warranty. n# b& \3 D) V/ V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, V$ V. Z8 e% ]- D- H, M4 p8 [ - * GNU General Public License for more details.
" \& r; Q( G- f* _1 G7 D - */
" p9 Z, H" i- E
2 P, o; K0 k9 W8 h+ l( |. S& l- #include <linux/module.h>. H7 J8 O, k W5 U& R: W, i
- #include <linux/init.h>+ ~! X5 z' C; {( s# k+ a
- #include <linux/errno.h>
6 l M6 k- p+ M" H0 u. ~' S3 _ - #include <linux/types.h>
( |# r; y, [* D; v! a+ G - #include <linux/interrupt.h>
7 s3 S9 e4 V6 v* H) O' L) B - #include <asm/io.h>' X- F3 V' `' d% q4 J: e; Q4 r
- #include <linux/moduleparam.h>
, R0 A# P0 ?5 g' P2 J" ^ s% \9 O - #include <linux/sysctl.h>
[0 D3 c$ P. b; u# \7 k. G1 O) u/ v3 c - #include <linux/mm.h>4 r0 x. ~, I" Z* X' _1 Q8 x- q
- #include <linux/dma-mapping.h>
& o, J6 C3 |" q# k, p- A$ w0 t" f: j
) T9 P- t% X8 i- #include <mach/memory.h>
! W8 w, Q/ b- u+ A0 D1 w7 P& @ - #include <mach/hardware.h>$ v# C$ h r: V, n3 m
- #include <mach/irqs.h>9 u3 K: R( k3 Z+ V
- #include <asm/hardware/edma.h>/ y* c% ^5 W! h: c3 q
- P+ L, C# l( G8 I& @- #undef EDMA3_DEBUG
6 H" P( t0 s3 ~9 |) ^1 p1 e: @ - /*#define EDMA3_DEBUG*/
/ J/ H0 X, Y0 e2 Z
; e) F" y& g& F# z6 F( y+ U$ M- #ifdef EDMA3_DEBUG
3 ?8 m" z$ `$ o( X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 @) t @, ]6 L8 L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# F" L- ]5 }* ?$ p, O F
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& y, H& m8 I1 T
- #else' F) a0 L, b9 U; u2 |" s
- #define DMA_PRINTK( x... )
- \( i% s" g7 m: F+ P5 ? ?0 n - #define DMA_FN_IN
: C3 H& F5 _$ b+ W. E$ W; ]6 R. W# b - #define DMA_FN_OUT
! F% I- F' t( H6 g! O - #endif
9 P& u: Z- ]1 J. M& V& {+ B1 L
5 k. ~0 P8 D1 `% j# D9 w( q) x- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 L# `5 r7 y: v n
- #define STATIC_SHIFT 3
: a* W% J4 [, F: O0 y+ b - #define TCINTEN_SHIFT 20
4 R2 x7 J3 X; N - #define ITCINTEN_SHIFT 21' j8 b8 q! w! O1 i
- #define TCCHEN_SHIFT 228 E; ]! Y/ I) g! U! V! a
- #define ITCCHEN_SHIFT 23
' m* Y" f9 u* v - % @& Y% }9 R; P7 Q7 V/ ]
- static volatile int irqraised1 = 0;2 Q8 I. \# \. K4 ^& B: a7 q
- static volatile int irqraised2 = 0;
1 [# X% @' H7 W* g4 h) h8 E" y
: S2 T( m& ?' j6 v4 Z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 u$ [' V( r0 h% ~7 [+ x - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 j4 |( ^ e; J6 z4 `, T# [4 r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 w l/ x) X) e2 |/ E+ ]* k; ~3 `
5 A( q3 ?$ @2 q0 a% N$ A3 Q- dma_addr_t dmaphyssrc1 = 0;
* {3 Q- r* M9 a! c$ D - dma_addr_t dmaphyssrc2 = 0;5 o8 M% m$ F% T) E! h( a
- dma_addr_t dmaphysdest1 = 0;
& U+ ~9 w% R; t& x! h" |( g) i - dma_addr_t dmaphysdest2 = 0;
/ [" \) u( C$ K; M: ]/ n: h - % X# v, c* E- E- I6 [0 y, `2 g- W8 Z
- char *dmabufsrc1 = NULL;
- H' V% p8 y& K9 \, [7 }& e - char *dmabufsrc2 = NULL;2 J0 f. I% M" \/ C0 z! }& j! v- Y+ z
- char *dmabufdest1 = NULL;2 n) b' `- ^0 \. U) l- d% s/ i2 ~
- char *dmabufdest2 = NULL;
3 `; h. H3 b, s9 G* Y. U d - ' Y7 c. d, d9 y3 i
- static int acnt = 512;; V, X0 I" p( X* h( E8 t E
- static int bcnt = 8;
' D$ _' L. ?) ` C+ y0 ] l; [ - static int ccnt = 8;
6 a& w' ?- i) j1 K, d
! t; x# F( N, I- module_param(acnt, int, S_IRUGO);
) _+ e' f2 [) G- p - module_param(bcnt, int, S_IRUGO);2 L5 \5 {0 C* Z. a9 Y7 T
- module_param(ccnt, int, S_IRUGO);
复制代码 ; G2 d) S4 z5 B ]0 k1 c& k1 n" h- `
; L: J# Z6 ^. ?) v& e1 R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, B' U0 e6 `; a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% l, l7 _. W5 k+ ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 W- X$ ], b% g, T& Z
& v( }" M" S6 B- o( A+ [9 Z
8 d! E$ p% z) A! P# G |
|