|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; }3 k! i2 ?# b! ]! K- [code]EDMA sample test application/ H) b5 y+ K' e* J: w: ^/ @
- /*6 r) e+ Y5 Z9 T- k7 ^- |
- * edma_test.c
+ R0 M$ }7 i# F - *
% E) m/ b7 I4 E z - * brief EDMA3 Test Application& s, a* k0 c& v8 M+ A
- *
7 x. p# i7 e1 f. k* [/ s: K w+ z% E - * This file contains EDMA3 Test code.0 m4 f3 F7 v( Y( n+ u& g9 R
- *
. G; h9 `' |9 q( h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) r/ K5 A( ]7 ^* P( b3 M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 J- }$ T0 e: D8 ]4 g: v% B& r
- * TO CHANGE.
- W$ [1 c* k: M) l) ^& J" T6 ^, [! m - *
|) z4 f! x% ~3 @+ e* b0 H - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// P5 I! {5 e- P* g! j" L& t0 |
- *
% U4 t" a8 g# H8 M+ r( k. Z* ~ - * This program is free software; you can redistribute it and/or
3 Y9 H" k- _8 H" d - * modify it under the terms of the GNU General Public License as/ v8 U+ i! P' Q* B' C8 e* n; E6 K/ B
- * published by the Free Software Foundation version 2.1 _* y& F" Q3 x1 N' G
- *
/ W o" K a" p0 z% |$ B! ]; o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ V8 l5 \6 ?$ @4 a0 c5 ? - * kind, whether express or implied; without even the implied warranty
- V: u, m. {0 ~! ?8 I6 O - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! w# }8 W7 t" B- s2 C! W
- * GNU General Public License for more details.7 ]8 ]' v3 p8 J: }
- */
3 r" g& I2 l. Q$ M7 F6 b5 T
/ X/ j9 q2 T/ K- E$ J# f1 |- #include <linux/module.h>( }7 w! B1 K. g/ M8 u3 e
- #include <linux/init.h>
. n5 J# f7 l% O+ x; F; b - #include <linux/errno.h>
4 {5 i$ ?- R5 H - #include <linux/types.h>
* f' [0 q* n) \7 _ - #include <linux/interrupt.h>
( z& R7 Y9 Z1 k& E7 G5 G - #include <asm/io.h>
* o3 `' o& I y - #include <linux/moduleparam.h>, T% | S d3 U9 x2 d% k$ _+ Q6 ^* h2 V
- #include <linux/sysctl.h>
! k+ L! V( V6 c/ r2 W - #include <linux/mm.h>
# H& J# d4 a/ U - #include <linux/dma-mapping.h>
+ `% V& F# N/ N8 p( G5 Z
0 j1 @- H6 G( P( p( H. {- #include <mach/memory.h>
: @: C* ~" W/ Y4 b, o - #include <mach/hardware.h>
( b C: }7 u- U' s4 h! l" j - #include <mach/irqs.h>! \4 d1 I( p& H3 p0 z3 I
- #include <asm/hardware/edma.h>' ]2 l4 X# j+ H3 f2 ]" Y
- & Y, ~: X7 e R6 s
- #undef EDMA3_DEBUG) |8 w. c+ J: `7 `6 j' r
- /*#define EDMA3_DEBUG*/' s0 b- d' U9 `! o+ I7 M
) f7 {! J7 T4 r+ I+ e X8 N( c- #ifdef EDMA3_DEBUG
: n6 _( f$ Y U. l" F$ [ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* i9 D) T+ F+ S! _, k$ J9 w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ t& ?% S2 ~; M2 t, e$ E" m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), x# Y& Z5 V- m/ T1 V* p) \
- #else
+ Y+ d1 a& Q: j. w, F8 h: V - #define DMA_PRINTK( x... )
W% h* }4 l2 C4 C' ]; ?8 U4 T2 m5 c - #define DMA_FN_IN' y" ?, |% d1 n2 `
- #define DMA_FN_OUT
I4 e8 b8 ~* [8 t3 j% v - #endif
8 R$ \: e4 D. P4 I* f. L3 S
# b+ _$ G- r- O/ m' J1 S6 X- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, A) w; p, I. W$ ] - #define STATIC_SHIFT 3
& Y: _( u+ B0 G - #define TCINTEN_SHIFT 20
6 {. c9 o% w$ b5 L+ s2 Y - #define ITCINTEN_SHIFT 21% \ ]9 {- b7 ~' [
- #define TCCHEN_SHIFT 22# t* ?: g( B& n
- #define ITCCHEN_SHIFT 23
4 p3 y# A1 i5 E. b
9 ^* j; N6 A& b7 c t- static volatile int irqraised1 = 0;
! G h0 X8 f, A' S9 T - static volatile int irqraised2 = 0;0 [7 `* t2 c9 s2 Y- p+ H
" Q+ b1 ^0 t, N# u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 l, G( n7 |# ]% d6 }0 O3 H! u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 c& j" U* g7 x% k/ g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ c* Z+ g5 D8 C2 _4 C2 r - 0 l3 m, Y' x. E! f
- dma_addr_t dmaphyssrc1 = 0;
, {/ b2 o @4 e( l, s% A - dma_addr_t dmaphyssrc2 = 0;, d" \+ G+ ?. x$ I# \
- dma_addr_t dmaphysdest1 = 0;, c1 R( C, \8 Y1 w
- dma_addr_t dmaphysdest2 = 0;
1 H1 V, X, [4 A5 ^2 L& }' {
! q. r; y% _9 E) l' z- char *dmabufsrc1 = NULL;
) o8 P' T! H. _8 z4 Q( m- L - char *dmabufsrc2 = NULL;( v( K+ B' s h; t- e
- char *dmabufdest1 = NULL;
$ E$ l. C q7 m5 h9 W! Z8 J - char *dmabufdest2 = NULL;
+ @8 O2 A* Y5 }7 ] - ' e+ q5 F7 e6 Z) V J6 J- N; v
- static int acnt = 512;
' A! B5 |$ Z" q; N - static int bcnt = 8;/ z; [4 @3 z e0 o7 h$ v
- static int ccnt = 8;0 G+ T3 E1 U6 y8 m) h& X1 w9 a, J
- : e1 r0 e" v$ z
- module_param(acnt, int, S_IRUGO);5 m" ^. p1 s$ I; s Y. I% @, D
- module_param(bcnt, int, S_IRUGO);
) G5 X) b! ?" k5 r6 |" O- t - module_param(ccnt, int, S_IRUGO);
复制代码 . ^% ]9 w) J' A9 {
0 |6 v4 f! C8 `, G# ]$ S
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 _) ^7 L* M5 n5 Q& 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 ~7 x ?/ p+ }/ {4 o) z, |( N
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 x" f& O( `0 ^; w/ y
j, Y. x8 i& y3 C* w9 b
" \0 G) k6 D7 i8 V. H |
|