|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' V* J8 S7 d$ R8 x/ c& s& W& W& D: d {
- [code]EDMA sample test application
) X2 T8 K! X; Q! \, d b& k - /*0 @0 @& F! Z3 s7 ?9 w
- * edma_test.c, Q+ c$ ~( G a6 T/ l9 H
- *
0 O8 _( V/ H: q+ y) R - * brief EDMA3 Test Application) I: W) D* e7 p/ N
- *2 X% Z) B& M% v F( o
- * This file contains EDMA3 Test code.
9 p6 C- g% _$ \+ v$ u- e3 c - *
5 \" V1 ]9 a q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 n0 L& }' ]' \0 l% A; {. V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, j# o8 x2 g4 a* s: }
- * TO CHANGE.
8 C, g8 `$ J8 I) u6 [2 H) P - *
% i6 o( {* Z/ J - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 E _* H }7 d8 @9 T
- *+ q! {, H5 e7 J+ l1 W# x
- * This program is free software; you can redistribute it and/or
3 p( t1 ?" v& }2 G4 F( k$ q/ T - * modify it under the terms of the GNU General Public License as9 p3 J+ i2 C7 _7 B n
- * published by the Free Software Foundation version 2.
: V, |, h0 J1 Y: \# s! r, L/ j - *4 V7 x# }' e" t& {3 W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 ~3 o+ b% r& ^ H; j% }
- * kind, whether express or implied; without even the implied warranty) M9 m" W$ n# O0 q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 m4 ^# M6 x% Q% K* j9 O; t( G
- * GNU General Public License for more details.
# X `+ Y+ Z" I" j2 N7 l) A) A - */0 a- [" @9 X: }* o0 q
7 x+ E8 \$ R6 y% n' f- #include <linux/module.h>3 W7 a) ]' v( ]3 y* M8 n+ W
- #include <linux/init.h>
X" Y1 h* d! x1 @ - #include <linux/errno.h>* w2 e3 v0 U D. q
- #include <linux/types.h>
) S$ q8 `) R1 L - #include <linux/interrupt.h>
; V* ?% y0 O* a, H! q1 A! _4 ? - #include <asm/io.h>. @+ s, @& C: \8 }% T: D( L% T" s* S
- #include <linux/moduleparam.h>, x) l' K: {& x" g" U+ ^: S
- #include <linux/sysctl.h>
. B( |# l( I; k+ V9 u5 M) l - #include <linux/mm.h>. P# }! I* x' g8 L
- #include <linux/dma-mapping.h>+ O4 r! g' _0 ?! g
- * f2 n. u% E( |3 i
- #include <mach/memory.h>
1 c8 ~# z; z! F$ ]0 `$ m - #include <mach/hardware.h>
4 U8 v" b1 K% ?" v$ | - #include <mach/irqs.h>
0 ?, M/ W! a6 `& v8 a7 V8 S- M - #include <asm/hardware/edma.h>
4 e$ N2 g- M& e3 X
5 d0 [# y7 @0 x/ R5 ~& j/ b: B, A* Z- #undef EDMA3_DEBUG+ ]3 G+ L' l) h; r3 U3 W) c: M2 w
- /*#define EDMA3_DEBUG*/0 V5 n- W# ]. ?! ^; {
- 8 W: {. B2 k& Z2 |+ W, X
- #ifdef EDMA3_DEBUG
7 o0 B( X# f% W$ J [! p# V7 ]) @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# D! o( V0 V$ m' u0 D; Y6 p - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ X6 b: X- I4 \. z. G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) h9 @$ Z* v: w& g4 Q' i
- #else
4 b2 s3 j9 |' Z- W' [ - #define DMA_PRINTK( x... ). P# q1 @/ r! ]7 I
- #define DMA_FN_IN
5 V7 L n" ?+ ~' W* t+ t - #define DMA_FN_OUT
" \: ]' s' C0 \5 o' i' e4 l! k# h" a - #endif
! k. y1 Z4 z5 y! q* ? - 5 M+ o2 e7 L) J
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' R* m1 G2 Z0 d ]6 x c
- #define STATIC_SHIFT 3
2 Y% e" a9 Y6 Q - #define TCINTEN_SHIFT 20
# h. M0 N) a4 B3 L6 h$ g7 B - #define ITCINTEN_SHIFT 21- ^7 t3 S, p$ @# l) ^. E% z/ f7 Y
- #define TCCHEN_SHIFT 22
% b* ]( S0 Q' d$ I5 ] - #define ITCCHEN_SHIFT 23& e" q- U, B: S
- ! K. j& x, _2 Y
- static volatile int irqraised1 = 0;% A! k/ F- Y3 I6 b, @. x) m
- static volatile int irqraised2 = 0;
- c+ Y2 v6 [7 @- U+ V% H) h o
) Q& [, k! S0 P7 o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 w- C, ~. e# [+ S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 W2 B; m/ m4 h- }; ^6 {
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! {0 p" C) X- C+ y
- z8 q' C ^. c, V( T* z
- dma_addr_t dmaphyssrc1 = 0;2 w" ] K/ B; @6 ^ a$ p1 G! e
- dma_addr_t dmaphyssrc2 = 0;
+ n, K$ e' [/ d* P - dma_addr_t dmaphysdest1 = 0;% V- u3 ^8 b0 U6 M: @* Z
- dma_addr_t dmaphysdest2 = 0;
; c+ \, i+ y1 B7 Y - " s/ q" O' T- \, g1 }1 e
- char *dmabufsrc1 = NULL;
& P7 Z# ?) h; P2 g$ [ - char *dmabufsrc2 = NULL;$ M9 n4 M% O q
- char *dmabufdest1 = NULL;
. A/ `) d" `5 m - char *dmabufdest2 = NULL;& S: B) l8 o3 M0 \6 z
n0 p! S/ C, K1 G0 z2 t/ L8 A- static int acnt = 512;9 Z: m2 q+ E+ u5 d% O
- static int bcnt = 8;( f2 e3 Y- }5 F- I' U8 [
- static int ccnt = 8;
7 L) ~* c8 b6 J& [5 ]
1 y/ l( x: t6 W% m: I# {6 t4 q' e, F- module_param(acnt, int, S_IRUGO);
( P0 F/ M' p% K- ? f# Z0 W - module_param(bcnt, int, S_IRUGO);
: Z7 Y& {' l9 H4 j8 L [ - module_param(ccnt, int, S_IRUGO);
复制代码 & O0 Z5 S' r, T! e
- s. X) A' L B& N- T1 }( ?/ H2 g
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ n% P7 {, V" l1 s# G7 L- zarm-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 `+ w W, C. @5 V3 S8 {' Y+ U 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ h7 W: ?4 W! A
& }! \* c& ^5 }. V% i; l1 n4 l: w }* x
|
|