|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 k. U! P' y+ ^( B" }: j1 ^' s- [code]EDMA sample test application
7 j% [4 e2 n- y5 S7 R' u7 B - /*; s& U0 x7 F' t! H
- * edma_test.c0 m, O6 F! b" b9 Q# j& y
- *
. z. F' l/ y( Y Z - * brief EDMA3 Test Application5 [7 U- @4 M1 W" N; U! Y# x, b
- *+ v- ?) `$ k: n) R; M A! y
- * This file contains EDMA3 Test code.4 Y) G5 b5 l% B, X! j. M
- *
7 h3 b! R3 P4 t2 Q8 \ q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, {, {" r: Q. L+ W
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- n4 j& B% i! A" }. N. z - * TO CHANGE.
9 f" K! v' ?- S, B - *
9 G. p1 G& H, l: |. E - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
\6 w) E# F% U* N - *
5 g! B$ I4 \3 W* Y& Z7 ?' N - * This program is free software; you can redistribute it and/or+ u. \$ ?; X' p e
- * modify it under the terms of the GNU General Public License as9 J- a& F6 C) U: V
- * published by the Free Software Foundation version 2.1 }1 {0 s# \& S+ [+ h8 @$ [+ X) T4 T
- */ K5 l, `0 e- G* |0 t- k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any# n" N [( J2 Y1 S' Q
- * kind, whether express or implied; without even the implied warranty2 z" H, R5 {, H1 H2 a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 u0 S7 F# M& o1 I; a* D7 i - * GNU General Public License for more details." C7 n+ W3 V3 R! m! C% j
- */# O( S4 Q" f. n
% W8 x. R& b0 ^# @. p1 D- w0 O- #include <linux/module.h>
( s1 Y+ \ @/ ]! H" a7 |/ J - #include <linux/init.h>
( g: K. e; i. p v" E* L8 T# J# d# ? - #include <linux/errno.h>
6 _* L9 G8 g0 p" P, U - #include <linux/types.h>) u7 F0 m7 N5 B
- #include <linux/interrupt.h>
8 J+ m$ S/ O; W; p$ ~* p3 Q - #include <asm/io.h>0 n/ a J4 c7 B9 l6 N1 F
- #include <linux/moduleparam.h>
6 H4 M: Z/ q& t2 x# P - #include <linux/sysctl.h>
( ^6 q9 w' D' l( F/ p - #include <linux/mm.h>
( c7 H0 _: c9 P4 f. t - #include <linux/dma-mapping.h>2 [. m. |4 _+ t- _ |
- 1 {" Y2 A& f$ `! `6 L$ y4 [9 e
- #include <mach/memory.h>
3 Y. U$ {* b+ w0 X) O# p - #include <mach/hardware.h>
9 v' {8 d/ y" _) J3 H$ c% j - #include <mach/irqs.h>* \1 a/ _% G0 h7 S* i
- #include <asm/hardware/edma.h>. [ ?$ k2 y t& I
- b/ ^& z2 e5 P; B9 ~3 r( @+ ~- #undef EDMA3_DEBUG$ s j1 h; a e! B4 Q) c
- /*#define EDMA3_DEBUG*/; Z! b3 p- _* G' b$ Y5 _
- 6 {7 S: ]) j" m" E8 j9 P/ p1 E
- #ifdef EDMA3_DEBUG8 Q/ e4 N% M( |9 J7 [, U, C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ c# c- d" l" n( ]3 }- H7 G
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); Y" a9 g0 I i* h3 m# f7 L/ J
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' l. X. n, ]6 h. F - #else
& t1 y3 V% w6 t0 ^ x - #define DMA_PRINTK( x... )+ _: ]. ^8 K% ~0 E, M+ h+ h
- #define DMA_FN_IN
5 Z' n8 N. X* |0 E) `4 n8 h - #define DMA_FN_OUT8 V( M3 E% {1 e" ^* I
- #endif' {, u1 t5 n. A9 J+ ]' ~( Z
- 2 w8 S' L( T6 T! f* v
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): U" Q$ ^3 X- }4 {+ _; f: H
- #define STATIC_SHIFT 30 w8 _( f4 }1 ]; c9 F
- #define TCINTEN_SHIFT 20
( X: W8 Z+ S; {; r0 Z! y3 M - #define ITCINTEN_SHIFT 21
1 l4 I z ~! Z3 ` - #define TCCHEN_SHIFT 22
0 u& G3 U! p: ^8 F) Y0 X9 F r - #define ITCCHEN_SHIFT 23
1 V+ {! X4 M) n1 j0 y' N
5 f3 a' X1 J- [2 ?2 v1 ~* A1 E. r8 r- static volatile int irqraised1 = 0;
`) L& E U/ I; l _! d1 b - static volatile int irqraised2 = 0;
* @5 v3 ?; m5 r; p. q
3 y7 s9 J# d8 w. `! v* \1 a: f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( H7 g6 n" G0 Q1 O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* z8 ?) n/ y& Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. P! ?8 w" q4 R
- + l0 L( }" w# ?2 D0 @
- dma_addr_t dmaphyssrc1 = 0;
1 A- k. Y r! q( r1 s, G% u5 g0 P - dma_addr_t dmaphyssrc2 = 0;
1 K4 \/ i' i( |6 r - dma_addr_t dmaphysdest1 = 0;
8 |. F i" B# E9 L8 ^: g* j - dma_addr_t dmaphysdest2 = 0;# N' r0 z9 i# p& u
- ! H1 l5 D2 G" {6 p, h% |# g% D
- char *dmabufsrc1 = NULL;
; ] V3 h, w7 s2 { - char *dmabufsrc2 = NULL;
Z2 s! H6 V& K2 m* b; X$ H - char *dmabufdest1 = NULL;1 f9 C3 [2 m7 r
- char *dmabufdest2 = NULL;
! Q& h( p$ K% J0 ^+ W
# [, F' a9 I$ m' ^! Z- G3 i- static int acnt = 512;
' Y% p/ j0 w- C. O9 f: l - static int bcnt = 8;/ k8 r5 g4 ]9 Z
- static int ccnt = 8;4 s/ U' ? N( L) H4 ?
4 z0 K4 X( m- K9 d9 ?$ \- module_param(acnt, int, S_IRUGO);5 X/ k& s' j* d9 w4 c
- module_param(bcnt, int, S_IRUGO);
& ^2 Z4 I) G8 a4 }/ L7 X - module_param(ccnt, int, S_IRUGO);
复制代码 5 a5 U0 W1 p J5 r8 r3 n9 C/ n- W1 |
$ U+ L7 i( t0 p6 b v7 C9 q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( O$ l* x. u; o' [0 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( ]+ b. t8 u8 w! U) ~1 J; p' c
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- s* s$ K' S3 |! [8 u5 e
4 e8 }: e* w# `) h8 Y. S* Q6 t. Z9 J: Q4 ?6 E& g
|
|