|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 _1 T, q7 Y7 j3 v
- [code]EDMA sample test application
7 ~ _+ Z3 }# v1 T" A7 S6 `4 y - /*$ m0 y7 v7 q5 F. }( E
- * edma_test.c" }3 |/ F3 ~3 o* k2 ^3 X
- *
: z ?2 v" e" k1 s- E0 b2 y4 Y - * brief EDMA3 Test Application; P$ Y0 B/ Q% E3 C
- *( ]: K2 O* y0 B" y# L- V2 x
- * This file contains EDMA3 Test code.
: T; v: O1 U; ~ - *8 a% N& d5 V* m) w# B4 A/ a
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' K( s/ w, \- D" D* _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) a2 Q$ H% Q1 E& a/ w+ T4 D - * TO CHANGE.! [/ b) i/ y! C" n8 C4 d, m
- *- E4 Q8 U* i; e" T# }0 U( h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, `* g( Q: z2 q - *
- `- z3 ]# w: a% e% F - * This program is free software; you can redistribute it and/or6 e0 [7 [$ c8 W: `. ^( e1 {0 a
- * modify it under the terms of the GNU General Public License as
& Y \4 k0 v/ t4 |7 A, T0 P - * published by the Free Software Foundation version 2.+ a' A. K' a9 g1 U! A0 C5 J
- *+ v+ b3 _- z/ }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ {5 e9 k& z3 y9 l
- * kind, whether express or implied; without even the implied warranty
0 T6 q$ J! n" c" z! @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 ?& q; ?8 s2 i5 K% _
- * GNU General Public License for more details.8 Z, y2 l4 L O$ B
- */
4 ]5 K2 C6 S7 S" u3 ?: V$ a
. S( Z% P8 W2 }- #include <linux/module.h>9 Y' L- r. |! o H2 M' G
- #include <linux/init.h>; U4 [" B+ a+ B2 ^& p" N! k
- #include <linux/errno.h>5 U7 C$ D6 J7 ?7 d: i6 U
- #include <linux/types.h>+ t6 w" w# J! E& {( @3 y! g
- #include <linux/interrupt.h>
0 Y3 F9 H) _5 M/ y9 E" D. u# G - #include <asm/io.h>
& m$ G$ ^4 |9 e+ X( C6 m - #include <linux/moduleparam.h>5 c: ~1 ?8 F5 K# H e" d# v D
- #include <linux/sysctl.h>
( F, }( N7 n. t5 M- J - #include <linux/mm.h>
2 t% X. x& l+ q6 {& X8 x - #include <linux/dma-mapping.h>
* r$ n. Z* ~! ]4 A. H" T
; U# z6 q4 ?2 c* F- #include <mach/memory.h>" y G5 Y6 v& E- [. R2 M. \* `* H+ y
- #include <mach/hardware.h>, V# w- h$ x+ {. _ q$ q5 |
- #include <mach/irqs.h>4 k8 O" k W5 [, r
- #include <asm/hardware/edma.h>
% U, C. F4 C; c3 a- l- Z$ E/ f - 7 Q! Y7 I: [2 m: _
- #undef EDMA3_DEBUG
) A+ g7 T4 b. x3 Q b - /*#define EDMA3_DEBUG*/9 U, B% G4 k R4 j3 R
- b+ J6 u) V' l! ]9 y8 R8 m4 \
- #ifdef EDMA3_DEBUG/ q& z5 D5 X. O. @( a$ g
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* }; F5 ]/ U( B0 s1 r3 M1 I3 E
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 j* \: i3 i7 Y" Q6 @
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ I# s9 I z9 f. {4 x
- #else& p) d; Q: ]+ s2 K) C
- #define DMA_PRINTK( x... )
) M+ O! i+ C* L V, d& _ - #define DMA_FN_IN2 ~0 U* U4 T9 q. j! W
- #define DMA_FN_OUT
6 B! z2 A6 ^ p+ [ - #endif
7 F( e/ F7 j, P1 b1 h$ l - 1 T5 A% \( o, ~) n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) F* |5 \+ x4 ]) v - #define STATIC_SHIFT 3
8 I3 Y$ ^' L' q9 M - #define TCINTEN_SHIFT 20
& y: f/ ^; }9 C" y - #define ITCINTEN_SHIFT 21/ {; B5 Q) Y2 `; R! O# i
- #define TCCHEN_SHIFT 22" d& B6 } o& I9 e, p: t7 F- \
- #define ITCCHEN_SHIFT 23
& }2 K: n% }- L" A+ `/ G6 C
8 i( N+ f, \1 C) w- static volatile int irqraised1 = 0;
, D% s, i* {7 E% R2 K% M - static volatile int irqraised2 = 0;
! I8 L4 i# h: _; R
' N: V" a' p9 ]% d- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 z: | j1 V6 F2 u
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 U, v. q7 S& v5 T; A/ [. O' z# a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 f5 l( n; U9 [6 r - - s8 u, u! d/ e
- dma_addr_t dmaphyssrc1 = 0;1 W& t4 T# F) H2 s
- dma_addr_t dmaphyssrc2 = 0;. \: E* f! ^7 y0 B1 z$ \# p
- dma_addr_t dmaphysdest1 = 0;* g5 K3 N' O" v& l9 b5 h
- dma_addr_t dmaphysdest2 = 0;7 P J9 K8 f, Q, j& y! b( ~
* o- \2 ^& b& R, S" Z3 J+ _- char *dmabufsrc1 = NULL;
+ Q+ D l3 x% U6 F$ S- N7 J6 R2 ~ - char *dmabufsrc2 = NULL;, Q) {4 g& I9 T5 q& @ y! y
- char *dmabufdest1 = NULL;4 A ?- m, {% M7 I x; ?9 A. e0 n
- char *dmabufdest2 = NULL;# `) ]$ K/ j* g. R1 Q- q
: O. t. y* K; j( A- static int acnt = 512;! Q* l- ~( v3 T# Q, u6 P# R( F
- static int bcnt = 8;! m5 r- }: X3 p
- static int ccnt = 8;
8 ?& W6 k! B! o8 l( m- `
9 Q ~# z) g0 h( n/ n; {! W- module_param(acnt, int, S_IRUGO);! W% B" O Y# G/ c5 ~
- module_param(bcnt, int, S_IRUGO);1 v! V$ B- W. Z
- module_param(ccnt, int, S_IRUGO);
复制代码
h3 C, U- j1 j7 q0 y2 {9 O( l3 @6 A8 q+ a' c1 m" s
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! A* n/ P, @0 X% v8 I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 t+ [6 k2 z' Z$ f 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# C% y5 p6 z& n9 l9 @( }$ M3 E- q
- s5 K/ r. m) X. J8 C+ O4 y( n2 m" t0 R; m
|
|