|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 B/ k% M E( b6 L7 |2 q4 D- [code]EDMA sample test application2 g" u" S; K0 J0 D
- /*) u9 K) g' k" ?
- * edma_test.c
+ V, s0 g$ t: ?! y - *
; q/ h1 L0 b$ u0 ~2 v+ d - * brief EDMA3 Test Application
6 W, {! J' `8 U5 V9 b! ^ - *
+ k$ J% I0 ]6 T$ E& e - * This file contains EDMA3 Test code.$ d% G9 s) |! w/ E# w/ W
- *
. Y, C: {1 \$ _! c5 {2 _; u+ T J1 g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& U( T. u* b/ c - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, J3 d# Y/ d; |8 E! l# E# m t - * TO CHANGE.* e! G$ A9 V* d* k* k6 s
- *" C% L# ?( b |& @9 n
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 T4 G: N8 @- i. t( A8 j! E
- *
' C" j0 I# f8 o$ \1 T - * This program is free software; you can redistribute it and/or
2 y E* V$ k- A f( \9 V$ Z. m9 D - * modify it under the terms of the GNU General Public License as
# ], r8 ~! H1 W. y& R# _ - * published by the Free Software Foundation version 2.
& y6 @/ C6 }& }' H+ F* `6 l0 C - *
$ \: C- H: k1 _ q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any: x- m* P; G( u) C- s
- * kind, whether express or implied; without even the implied warranty
! O' q) h. o$ x$ V9 H3 h - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 Q, Y) D7 r9 a# V& H: [$ r; i
- * GNU General Public License for more details.
) a4 [$ }* r9 F. W) F - */2 f& s! ?* K- R; t* V0 y0 A
. B9 Q. E6 u2 }4 x8 d5 z& I- #include <linux/module.h>
; E; D5 k7 d$ b5 P - #include <linux/init.h>
3 ?- U# u* j `0 i; t; B m; i - #include <linux/errno.h>: L6 i4 X3 z3 A
- #include <linux/types.h>& z4 S* t, G K+ Z8 t, Y% M7 O, B
- #include <linux/interrupt.h>4 J* y& K# j( t) L8 b2 X+ Q9 e
- #include <asm/io.h>0 G `& S2 N. X3 e4 r
- #include <linux/moduleparam.h>
0 p8 c# X4 U4 \ S - #include <linux/sysctl.h>
, G! u+ N: N# P- l$ Z, c - #include <linux/mm.h>% P! {7 v4 d$ P$ X' z" [* F
- #include <linux/dma-mapping.h>8 A1 R3 q$ J1 y. G7 a8 C! V0 U
- 5 }7 A: Q8 F; V" D
- #include <mach/memory.h>
# Q; y Y4 o0 u7 ?, d6 }6 w - #include <mach/hardware.h>$ s1 ?! W6 w1 W1 ^# s
- #include <mach/irqs.h>
+ \& G+ J6 v5 ^" {4 ` - #include <asm/hardware/edma.h>' S2 {! J1 \+ v* Y
1 m, n: u h7 a/ T- #undef EDMA3_DEBUG U# g- I/ X3 z$ \; I8 x9 n/ ?
- /*#define EDMA3_DEBUG*/5 w; t- B# K5 f) U* o
( `2 W0 o$ x- h7 S2 p& X) N- #ifdef EDMA3_DEBUG# R" b$ f8 t# U# ` r! e% @
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), f2 }) q3 } p+ v2 j! U* T. V) w& X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& X3 W( R+ J0 R2 }! S+ \+ `" T2 X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 q% B0 H* M# v - #else
! V+ e G) B; [ - #define DMA_PRINTK( x... )
" V) F% G. ~/ L9 i n - #define DMA_FN_IN
- v+ c1 Q1 d8 f- t# z/ z - #define DMA_FN_OUT/ {% Y4 {* b3 Z/ R$ z" t* J
- #endif
0 q8 s! [: o2 C% O' n# N - ' ~; P* i1 q5 B
- #define MAX_DMA_TRANSFER_IN_BYTES (32768) P) t0 m2 x- R
- #define STATIC_SHIFT 31 @1 i; J' C7 G8 S
- #define TCINTEN_SHIFT 20
$ y, l) S+ p; x; e - #define ITCINTEN_SHIFT 21
" O7 ?4 w- M' v/ X$ r7 U7 ?9 R - #define TCCHEN_SHIFT 22
4 H' g6 z! N/ B; X% v- | - #define ITCCHEN_SHIFT 23- a" z. v% x! c8 u: G
- ! D+ {. B- i/ ?& N. w9 q8 I4 {
- static volatile int irqraised1 = 0;
% Z" T i; P# E - static volatile int irqraised2 = 0;3 Y. M8 H: ]" z1 c
- $ _" |" E u5 C3 X
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
v' j5 J& H( U9 w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 @! j" R( W' |+ y% _2 Q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& l. Y |# A8 f0 R- ]
4 S g2 |0 Q; B- dma_addr_t dmaphyssrc1 = 0;
. C2 ^+ @$ F& M( b- B - dma_addr_t dmaphyssrc2 = 0;
" `- x+ w' p" X& c; { - dma_addr_t dmaphysdest1 = 0;1 Y6 u! U2 Y7 c. v- j3 h2 O1 }
- dma_addr_t dmaphysdest2 = 0;5 z, J9 x2 ]0 y2 {$ g1 F7 M
- - m9 u! e! S0 ?+ L9 j- _
- char *dmabufsrc1 = NULL;/ R5 l, Z" b# d. [
- char *dmabufsrc2 = NULL;
K8 }) j* _* `% C% u# j - char *dmabufdest1 = NULL;: ^5 i c, W7 V5 p3 M7 J
- char *dmabufdest2 = NULL;+ ` g# g) Q' i+ o; S9 ]
- ( C; h: z" O" q& ?# f; `
- static int acnt = 512;! P* w0 a4 _: n# J0 e6 t
- static int bcnt = 8;
]' ? U2 r% j% a+ w- l - static int ccnt = 8;
d8 L7 U x: b9 T, c/ f
9 N$ B4 v; |; r$ U7 u- module_param(acnt, int, S_IRUGO);5 x# x6 q( _* W6 n
- module_param(bcnt, int, S_IRUGO);
& d) L, p; q- A1 Z1 J$ n - module_param(ccnt, int, S_IRUGO);
复制代码 + l5 ^! y+ S( N* n
$ R( y k$ D# a8 w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 h2 [4 a/ T9 }/ G' f( h: Y8 M" Z6 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 ^: c6 m. u7 B4 z' T! L8 } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; a' m+ N' }1 Q5 I+ }0 K3 |1 O0 @8 d9 z9 \3 w' l
! J/ S8 w# A3 d; ]
|
|