|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 m* O7 O) W9 H- [code]EDMA sample test application
' _) J4 Q/ U* i4 ]$ \+ {+ _ - /* X! K, a, T- F. V2 j; ?
- * edma_test.c
9 e3 t% U3 l, Z* @: Z/ V/ c - *
8 Q) ]9 ] V! Y( o! l- K2 D, O - * brief EDMA3 Test Application
9 |0 L4 @) z! g. q' W - *
- V4 \; \8 O4 E, o2 A9 c - * This file contains EDMA3 Test code.
P [8 P* [. \& J2 C/ e5 r' F& ~ - *3 M# Q; e, |! C! u: J
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 r3 `' p( `- m) i - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ Q/ x8 l% F( y& P2 d - * TO CHANGE.
' ~0 g3 n2 y* _ - *
: y6 w$ y7 j% Z. i. d - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# g* a( o, ~& u: \( O - *: \& [- F. e7 n5 k4 j2 u' w' Z
- * This program is free software; you can redistribute it and/or2 e' y% `8 j) I4 [
- * modify it under the terms of the GNU General Public License as
# G1 f H# _* w2 H9 s$ B+ L$ C - * published by the Free Software Foundation version 2.; B/ V5 e$ T" H; G6 }9 `. e
- *
5 _1 o6 m/ o1 T7 u- T# b6 ]7 a5 ` - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# v, q: ?( L, r0 g6 F n - * kind, whether express or implied; without even the implied warranty: S4 i: I% g: O V+ |4 \/ p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& U7 F9 Q9 E' w: Y( X% Z- I; e
- * GNU General Public License for more details.
2 x/ y9 p% } F/ a& w3 v' n - */
2 F8 Q0 `" V* v1 t. n
$ ?3 {( ^8 E M4 `% t% X% n# {- #include <linux/module.h>
; M9 d+ L, ?! _$ ~8 |- v: X1 S - #include <linux/init.h>6 b | K S: i; v* c; F! D
- #include <linux/errno.h>
% \* A w- s, [' y& r# e* V' F - #include <linux/types.h>
) }9 F9 B- s! E- E - #include <linux/interrupt.h>5 }: G& K4 m9 k- w7 s N: ~! C1 U. ~1 U
- #include <asm/io.h>
1 z( r/ y; R' D0 S - #include <linux/moduleparam.h>$ ~9 n, Z. Q0 Z7 Z6 i' ?4 e; _
- #include <linux/sysctl.h>- n/ a' ?; e( O$ q2 x
- #include <linux/mm.h>
L- Z" ^4 M$ R* B4 N8 z - #include <linux/dma-mapping.h>8 e0 O# L- K5 Q/ w# j0 c$ F8 y
- 4 m; K t. s: R! d
- #include <mach/memory.h>8 x' }/ r( D: S) E3 G
- #include <mach/hardware.h>' \; |! G/ U9 T- p
- #include <mach/irqs.h>
) K4 U4 |" I1 n - #include <asm/hardware/edma.h> N$ ^5 u: ]- u9 z8 p: ^0 S- B
) Y Z+ r% s# h) ^# u4 x: Y- #undef EDMA3_DEBUG( R- R0 s% l" r; C0 i' {
- /*#define EDMA3_DEBUG*/( h4 Q% Y0 V3 w
4 a% S, W7 {4 S! f- #ifdef EDMA3_DEBUG! M7 M ]; ~4 H6 g2 b
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 b% v ~7 z4 J9 g! D/ \6 H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% T" S$ L3 W6 P* } Y( G/ S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! W' N x0 S+ p) X7 [/ S2 B. D9 _
- #else
U& L* ~$ a: c6 G - #define DMA_PRINTK( x... )8 I0 A: }* V1 }
- #define DMA_FN_IN
$ e, I4 P7 m$ H W) X0 u$ n0 H - #define DMA_FN_OUT: i3 i1 O' v9 Y0 Q/ ^
- #endif
- \5 s5 e1 m# z; X% l; X
0 f9 r6 s& K; B* V0 g- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 {: o$ k7 n0 N/ j& @) P: I: r% E
- #define STATIC_SHIFT 3
2 a; `6 _4 i) I. v8 G - #define TCINTEN_SHIFT 20, O. M1 E: H* c* w
- #define ITCINTEN_SHIFT 21 k# B& _& K( g# x- Y, h( I
- #define TCCHEN_SHIFT 226 R. g' t1 j, g/ Y! M
- #define ITCCHEN_SHIFT 237 E! c N( ~2 m# E$ M' \
' D& e5 H6 M3 c* `( P4 b$ E- static volatile int irqraised1 = 0;
; Y0 o9 w! d% h1 \4 b' L. L - static volatile int irqraised2 = 0;9 w5 @2 A/ J h' e3 g2 S
- 3 g7 C) ]$ `. o! n/ h( K" q
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 Z' H; V, ~3 U - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) N1 b! ~& w0 O; E3 C3 `+ m0 ~ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. C9 y0 S0 X$ Y* m3 O' W- @
( O0 g8 `, y3 C1 V7 c- dma_addr_t dmaphyssrc1 = 0;
$ n/ G" Y' i- a8 s9 b3 O/ w - dma_addr_t dmaphyssrc2 = 0;( `% t+ i6 ~: r
- dma_addr_t dmaphysdest1 = 0;
& S X. p& H2 `, b% ]6 c7 @( f - dma_addr_t dmaphysdest2 = 0;$ I& ^; i; F6 b+ l! P3 n' R' x( r
- $ t+ a6 v' M& i: Y/ {2 l! M
- char *dmabufsrc1 = NULL;
2 c6 F5 D% y( @* @ - char *dmabufsrc2 = NULL;
4 D1 \0 `, ~, p: O& H1 _ - char *dmabufdest1 = NULL;
. G* D9 o0 `$ { - char *dmabufdest2 = NULL;
- U6 i4 S( h( E8 p- x, V* I+ E! D
) _# `$ s+ a% N. I: T# a- static int acnt = 512;" j, F1 S: Y: o8 E2 |
- static int bcnt = 8;
% @/ k5 K. z- }1 {9 { k( a' w - static int ccnt = 8;
+ f; A1 h! W( ~1 s - 7 h. [" M- r6 q9 N
- module_param(acnt, int, S_IRUGO);
2 X& T- D" z3 O6 J6 E4 l0 G - module_param(bcnt, int, S_IRUGO);
( Q* r, P+ M3 r - module_param(ccnt, int, S_IRUGO);
复制代码 - y8 Z1 y! _& B) B+ a4 G
% ]$ v! T9 ~% w9 b) ~$ J# `0 z, X3 H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! {% z0 x) V2 Z7 R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( L N+ o. `# b0 q4 H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% A4 w5 D7 Y* N0 P9 r/ L; c4 V3 B0 |' i4 y% @, ^3 }! |* c
# s5 M2 Z& p. | |
|