|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : t6 e! k: G% m* `6 ]
- [code]EDMA sample test application
2 [) G7 J& Y; f# V( h - /*
5 Y7 z! [" }; Z5 _$ T b( ^' \+ Y - * edma_test.c
! ^; Y. u8 M/ b. d Q! l - *
4 q2 ?( y# N9 t% C9 q2 Y+ v - * brief EDMA3 Test Application1 }1 r5 L5 v3 R) v( ~8 M# S
- *. i0 I. E ?( K) n3 p9 z+ O6 C
- * This file contains EDMA3 Test code." v4 X" ^5 y, T9 L" a
- *
4 R( S2 ^0 {$ Y - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 o4 [2 ?7 c3 R; e' O8 |9 Z" V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* C0 g' U0 M! z( ] W - * TO CHANGE.8 J; U* X( c# |
- *: [# P: l9 k$ K4 ~; e6 Y& H
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! P, K# J+ m; c* K' n
- *
! z6 e. B/ P+ L* |0 L) L9 g5 p" p - * This program is free software; you can redistribute it and/or
5 O" K+ U0 V; k# i- Z - * modify it under the terms of the GNU General Public License as
9 I0 b0 w. t! W& s - * published by the Free Software Foundation version 2.* j6 z* m+ r; D1 D! m+ |
- *
$ _9 K# a. ]3 M, K: o/ p" i z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any* W- D* J, X+ p2 {' |. ]: Q L
- * kind, whether express or implied; without even the implied warranty( V1 o8 a8 W B: e
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* {1 T4 l0 h) `2 y+ i
- * GNU General Public License for more details.
C5 t# Q) E0 K; x& y" k3 ~: v0 M - */
4 v- ^* ?5 p6 N) s/ x+ _ - 8 u( e2 e# i \6 ?6 g3 z
- #include <linux/module.h>8 ]3 z: E2 I, S# [" V* p
- #include <linux/init.h>
% I& R6 {9 f! H$ Z% n - #include <linux/errno.h>% ~3 O5 {1 w: S S: |0 V/ v4 j
- #include <linux/types.h>. H/ Q9 S3 z; l, p1 l. L
- #include <linux/interrupt.h>
2 i4 U2 ^2 f( k) [' K1 D* g - #include <asm/io.h>
4 }5 C2 i6 l- x7 K4 c - #include <linux/moduleparam.h>
# I, O! j6 W9 w9 c6 Z, i7 R7 U - #include <linux/sysctl.h>
9 G0 M% k* k$ g9 L - #include <linux/mm.h>% `7 n: f7 M2 T5 B$ l+ w
- #include <linux/dma-mapping.h>
& Z1 d8 E% A/ ~6 t _5 p
5 i% I/ L( {' @4 R7 K3 o- #include <mach/memory.h>
3 p- }* x( B4 m8 S) \* A - #include <mach/hardware.h>3 [! E# a. P% X, H+ f
- #include <mach/irqs.h>1 Z& n# C4 P" m
- #include <asm/hardware/edma.h>* }6 M/ P: h) T) {3 M7 [/ a0 d; p& j
- 8 ^% K4 Y& R! T3 R; z/ G* n
- #undef EDMA3_DEBUG
6 b! Q" @+ Z% b' b; E8 [ - /*#define EDMA3_DEBUG*/
# X( Z6 \8 v1 b, N" w4 }5 ?4 j' ~ - k Y1 [+ j9 B# g& _
- #ifdef EDMA3_DEBUG
4 B+ x. ?7 E" r% M* W" i - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- [: m# V) h9 \6 v3 Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: g! @2 z/ @% ~$ | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 A$ i& x* b1 ^/ G1 A- W6 w - #else9 ^; ^1 ^! p/ ], R
- #define DMA_PRINTK( x... )3 A/ l5 k% l* M/ ^. K
- #define DMA_FN_IN
4 ~9 L. s w; ?1 F: t5 s - #define DMA_FN_OUT f6 L9 S7 `" R% C: J g
- #endif
% N; C5 {2 r; i2 L
- } ]9 e( B; g& ]0 X4 f. p- ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- I$ G0 T% z [4 c1 u
- #define STATIC_SHIFT 3
! x' r& X/ [& U6 J, j2 H - #define TCINTEN_SHIFT 20* f1 I" S, o+ C$ f
- #define ITCINTEN_SHIFT 21
) E8 f4 E4 L" h* r6 v - #define TCCHEN_SHIFT 22# [$ N$ d) K' K1 U! @$ p& e) D, [- c
- #define ITCCHEN_SHIFT 232 U- P+ m" e, R5 o, V0 l2 M
- ( u6 C+ a7 p" h. b5 k) g- D' E
- static volatile int irqraised1 = 0;
4 z" q/ B9 B; n+ J - static volatile int irqraised2 = 0;
- x7 M# F" Y" E" l7 x8 w- w
- \! h* ^9 b+ H V! c+ e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- F+ S: p) h T' e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, n; J) C1 O4 K- v0 j$ T' |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
y4 v4 @& G& Y, {6 o8 F( @1 P/ ]4 \6 u
5 F- _7 f7 t1 Q; R6 j3 Z- dma_addr_t dmaphyssrc1 = 0;/ [" c$ y. S+ Z7 w* {
- dma_addr_t dmaphyssrc2 = 0;8 ?2 K4 l4 ?# L! ^; [) T) F( O! w
- dma_addr_t dmaphysdest1 = 0;- H2 q+ q' e4 M5 D. S8 B6 @$ L
- dma_addr_t dmaphysdest2 = 0;% f6 y. `* l* J B9 L! i
4 z' H6 O. l7 [+ {- char *dmabufsrc1 = NULL;
9 Q, I9 r: ]+ T" Q9 v) B6 u - char *dmabufsrc2 = NULL;
& Q4 i7 u! N; y9 t+ ? - char *dmabufdest1 = NULL;
& N; H" e) l7 {0 s0 z& d* Z - char *dmabufdest2 = NULL;
; P1 x! p% I9 _- N# p$ ?: P - % m& H7 _- O6 @1 K
- static int acnt = 512;
# `: ~! D9 ~5 e$ g - static int bcnt = 8;4 t6 e# @. \ f
- static int ccnt = 8;
* t2 [" e# W/ _: ?: I - e: n* p1 Y T& d
- module_param(acnt, int, S_IRUGO);* S' x+ X# Y, {
- module_param(bcnt, int, S_IRUGO);' W: U4 C4 `- i0 ?
- module_param(ccnt, int, S_IRUGO);
复制代码
) B; S6 m5 m, R7 F& U
( ^9 p$ |' k+ c: q% L8 f 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 u9 e* x1 f1 f* g! o9 t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ e. B% ^$ }" A) ? 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& i) x+ X8 f- C/ F. N0 @' K! z9 c
0 @3 N& _5 G% @3 `3 r
% O& X3 c6 w+ C5 F: }. g |
|