|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # ~8 y' I9 s# z/ u! o
- [code]EDMA sample test application$ v* ^6 ~/ W+ Y- J3 E7 _; n ]& w
- /*0 P1 P; ?: b" U1 x9 A w
- * edma_test.c
% V, S1 |; K- P9 s; }$ ^7 x - *
" z3 y# e. t/ Z2 R! s - * brief EDMA3 Test Application! H3 \5 F2 B; x! S+ E5 h
- *
) f+ `0 _, p7 H7 C% X - * This file contains EDMA3 Test code.. I: F9 f0 U& w, x. v5 a
- *
4 _ p6 R- ^" K1 @" k - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ t' F/ j- g/ Z% E0 U# q5 ~ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
e; n( I; l2 I" T - * TO CHANGE.( H0 x7 h; C7 Y i7 l
- *+ O" s7 x9 R2 g8 U# h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 J } \5 P' J8 D: N) w - *
3 {, p: F8 g. S$ p4 X - * This program is free software; you can redistribute it and/or! |. X- u$ F* B6 r$ d
- * modify it under the terms of the GNU General Public License as
0 w2 G# I4 Q+ ` - * published by the Free Software Foundation version 2.
8 |3 f; G) g2 q6 y4 c - *& \( r2 U2 ?- I" C# L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) X$ ^" d R3 y6 r9 M/ V V* s
- * kind, whether express or implied; without even the implied warranty [/ S- F% c7 s
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# [$ W, y0 R3 F, h- V! L5 A - * GNU General Public License for more details.
. O9 J2 ]5 q5 ^' l3 O7 _2 E - */, W* l- j2 Z( E1 D
( Y5 @- r( [; f: B( l5 e/ ^+ o- #include <linux/module.h>5 r) X0 C) ]" ]0 P6 R |
- #include <linux/init.h>; e8 A8 b+ N: F3 A9 }; n
- #include <linux/errno.h>
4 `9 K! {" K: c: F7 W2 c0 V - #include <linux/types.h>. n; f5 F5 m4 t- q' m" j2 n
- #include <linux/interrupt.h>
4 l# n# w8 w3 {- V) F - #include <asm/io.h>
& F8 l4 J' [) V1 o& n% \7 w" C - #include <linux/moduleparam.h>
: p' x% U0 P4 P1 E - #include <linux/sysctl.h>6 B( f, }2 G& _- y( s, u. o! x
- #include <linux/mm.h>
8 G$ f% M! p L( d; C1 w9 H6 D, h - #include <linux/dma-mapping.h>
U- s1 X6 c9 S( N' q' O' D - # `3 Z7 F# B6 z _
- #include <mach/memory.h>3 T7 L$ U6 S' u/ o; N1 @) ?9 l
- #include <mach/hardware.h>/ n- ~, {7 g; t$ G0 t
- #include <mach/irqs.h>' P# |9 x" Y- K: k# Q% _, `
- #include <asm/hardware/edma.h>- B2 |" `& p4 b
- 4 {' E$ W2 w, m: r; z8 g3 c, M
- #undef EDMA3_DEBUG! Z t* n- b- }% ?# e0 x
- /*#define EDMA3_DEBUG*/
$ v0 N! b8 B% ?- @+ m4 C* \& M, p2 d - ) w; z! F$ f- {0 K$ F& V+ Y
- #ifdef EDMA3_DEBUG6 d+ P. z5 C; l; a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 r& L+ S5 K0 q. x6 f5 o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 F4 K5 N) T$ X8 U0 F M% ?, O$ A. O
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 h: ~, \ G, x - #else2 X. H/ P: ?9 i/ f8 C( `& r
- #define DMA_PRINTK( x... )2 m" T% y% O" K( [
- #define DMA_FN_IN9 |2 j. V9 V' |0 J
- #define DMA_FN_OUT
. |2 D1 ?6 ?" _ - #endif
0 ^6 b' D0 \7 @; v! G
3 O! ~9 v- R# ]1 D6 s9 x1 P# U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 r( S+ f' [* [1 J* T& w4 c+ M4 S- T - #define STATIC_SHIFT 3$ K. x2 o" ^ U o; R
- #define TCINTEN_SHIFT 20- {5 L$ k3 m# J0 x8 U
- #define ITCINTEN_SHIFT 21
3 x( I- X3 z. M, T - #define TCCHEN_SHIFT 226 C# B9 p6 k' L6 q0 s+ h2 n" Z
- #define ITCCHEN_SHIFT 236 G8 c% x- e4 G' ~
- & U& ~9 Y# B# R* X ]! x
- static volatile int irqraised1 = 0;
A+ R& P, t9 a0 G( ? - static volatile int irqraised2 = 0;9 x; Y1 V% z( H7 I
- ! E8 a8 ~( a8 J8 c$ @9 P
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; Y+ x- N1 N/ ?# X" P/ i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" D0 o2 G! m& \- x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ o' K1 F! `6 G
0 N. q( G7 }7 P4 C: x- dma_addr_t dmaphyssrc1 = 0;. ^/ n4 N8 I9 X
- dma_addr_t dmaphyssrc2 = 0;
+ k! v% W A. f - dma_addr_t dmaphysdest1 = 0;9 o2 i' J1 o' y' S9 W
- dma_addr_t dmaphysdest2 = 0;
" b. S& m( g/ n - % m2 f. z4 _( [2 k' L# U- E
- char *dmabufsrc1 = NULL;
+ d' C R( Q' f s - char *dmabufsrc2 = NULL;- I7 S$ t& I- D0 |' V9 E: o. F5 Q, W
- char *dmabufdest1 = NULL;
" G5 H, a* z1 ? - char *dmabufdest2 = NULL;
; F5 l8 m4 r8 G& e/ I' w" m& f
( t# a9 M& W/ O6 p: ?! x5 ^- static int acnt = 512;' F& g1 w4 U" Y/ T6 t
- static int bcnt = 8;4 @& o$ U! E! ?+ T( C& i
- static int ccnt = 8;0 z, E+ k3 `! g! \
- 7 j% @$ L- B$ P1 Q$ R+ e
- module_param(acnt, int, S_IRUGO);# R( p+ `( A# T8 [$ Y) w5 W; Q: J
- module_param(bcnt, int, S_IRUGO);
+ A! ^$ f$ J: ~0 U - module_param(ccnt, int, S_IRUGO);
复制代码 6 N" N2 M) a3 g# Q5 m6 [( X
; ?# [ o& x1 K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" c& m) |) E4 O5 H2 O2 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" Y0 O L6 y/ i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' G1 W5 u! `% j/ k; n Y# W1 |+ a# E# H& {
0 o& l! u# H( b) g" F* \9 S: u: b |
|