|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. h0 k7 Y/ d. H' f1 M/ W- [code]EDMA sample test application3 r9 U1 V d6 Z$ ]7 @
- /*# p: A7 ^9 w3 a$ i( `3 P
- * edma_test.c
4 U' R& y0 G6 o( t' T% | - *
1 ` }. I& G) k7 ^' J* _ - * brief EDMA3 Test Application
5 |3 r' ^9 P# }6 n1 j; S- |7 v. M - *( u: t& H0 N1 n, F0 v7 V
- * This file contains EDMA3 Test code.4 v7 b: v" O+ D
- *- t3 k. E* {! j" a) {1 w9 q9 i
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' c) a7 D) a+ n: n) k6 Z - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& \" T+ u u6 s+ S- g& z) i - * TO CHANGE./ Y$ h, _, b1 j) @; Q, C
- *
9 j: _5 ]2 Q8 F/ A7 S/ Z2 H7 s$ s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ H, B% M9 P, U# ` - *
/ }: @% N( Z6 U9 ^" F0 J* K3 `1 K - * This program is free software; you can redistribute it and/or
: _' i. ?5 q0 L% x% N - * modify it under the terms of the GNU General Public License as' U9 X3 ?/ e1 u" s% m2 m
- * published by the Free Software Foundation version 2.
' e( ]4 a4 E; m; b+ a+ K i. s - *
, e: h5 j9 ~3 m! c( w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! a3 e$ R* C. D6 f - * kind, whether express or implied; without even the implied warranty
* y! u' s( t) [/ @& w0 N - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e2 j, D& m" l/ ?9 X' }) c - * GNU General Public License for more details.
' }% \* s' T+ k" W - */1 u0 @% p: m3 J
- $ ^8 S( K& b% T- P: ^/ ~- X
- #include <linux/module.h>7 s. v# {4 R! c; M5 i
- #include <linux/init.h>% \4 K$ _7 H/ V; S! n
- #include <linux/errno.h>
1 u, H6 U A. ~0 q/ Q9 C' I - #include <linux/types.h>, j U8 d/ z2 d" W0 `
- #include <linux/interrupt.h>! Q+ l# V/ @* ]7 l6 y. o# d
- #include <asm/io.h>! S+ E- s% w4 a3 h7 W* v, X
- #include <linux/moduleparam.h>
3 c; T5 X7 v/ Q2 K& N0 E# |: T2 z( D - #include <linux/sysctl.h>
) o+ ^( ?" u+ J9 V" K/ o9 | - #include <linux/mm.h>" w% c8 K7 p0 D+ f9 p
- #include <linux/dma-mapping.h>
q! w. }% Q" E - " p: T9 x9 ^% H G' z
- #include <mach/memory.h>7 j3 u8 s8 c8 V+ ] P5 y
- #include <mach/hardware.h>
& m8 D& V! H& Y4 m - #include <mach/irqs.h>+ ~- |7 ~9 e6 w- h
- #include <asm/hardware/edma.h>
6 \) D6 y5 v3 a+ s - 4 T7 s8 }0 h1 L5 _0 r& q
- #undef EDMA3_DEBUG) A" j% G' b, P! [
- /*#define EDMA3_DEBUG*/9 W/ U, b1 K; m+ P
3 G$ S% }9 Q9 l7 E- #ifdef EDMA3_DEBUG8 a1 T9 ]# T$ q/ z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 y* Z; p) {- J; b3 F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 _2 @6 m. `" M P! H
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" {+ B6 z' Y' E2 U% m# T1 Z& U
- #else) }: v% W% o1 @) I) \+ q. ^' A
- #define DMA_PRINTK( x... )
0 h) I* {7 I7 D" b" x& }* ^ - #define DMA_FN_IN* l4 u5 `( X# k" o$ M
- #define DMA_FN_OUT
b2 k+ C9 w5 i" G - #endif3 b$ d( W+ P) Q: E8 {. n( o8 x
- 1 \0 v- m, Y# {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* h H: R/ c( Y2 y3 V8 a
- #define STATIC_SHIFT 3
. O+ p1 n- p& b& D0 o: F# ?% B0 q2 ] - #define TCINTEN_SHIFT 20/ [3 u% E6 _& r* K
- #define ITCINTEN_SHIFT 21
$ s& W! ]- ~( [5 t - #define TCCHEN_SHIFT 22
( b: U7 _6 A, K9 v - #define ITCCHEN_SHIFT 23
5 H, `' _) T |
% H" F# M$ s ?4 R( [- static volatile int irqraised1 = 0;: W5 t. D& q1 s
- static volatile int irqraised2 = 0;6 A) H' J, U% h
- 8 J6 w- a5 g# @' v( i$ f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 {8 y" R; O& [( A7 }
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ f9 m* Q& q4 S5 c' [) I9 s% } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. P6 a# l& V A; f$ Z - # r% P% P; N/ {( w. f5 b; [! h
- dma_addr_t dmaphyssrc1 = 0;
6 ]$ f/ ?8 O+ g+ N2 n C' N1 |: } - dma_addr_t dmaphyssrc2 = 0;
9 J+ A% Z# T' F$ H# y1 E - dma_addr_t dmaphysdest1 = 0;- i( ~ L$ u+ |2 d& t' Y. P/ F; n
- dma_addr_t dmaphysdest2 = 0;6 P8 m$ W' q. U6 Q* d
, z0 M2 A; {2 d! k( D- char *dmabufsrc1 = NULL;
. |+ H0 z n; Q# n; K" j g - char *dmabufsrc2 = NULL;
) I$ K8 F9 c& g/ F - char *dmabufdest1 = NULL;
" |- g4 |4 ^( }- w/ Q - char *dmabufdest2 = NULL;1 q$ X; W3 X$ |4 j3 f, Z$ h
& G0 A( ]9 ]! [3 `% W; E2 G- static int acnt = 512;9 e6 Y( [6 n$ s2 I1 b# ^ `
- static int bcnt = 8;, O0 a1 \, \; d" K d
- static int ccnt = 8; b+ A5 ^3 A! f; n0 s* u# j( O
* B- E' {# Z" u5 y1 F- module_param(acnt, int, S_IRUGO);" D0 _8 ?4 O( Z: }" R
- module_param(bcnt, int, S_IRUGO);
. K3 e! m- t2 D! g: J! `3 l - module_param(ccnt, int, S_IRUGO);
复制代码 % u( ]4 a1 l7 h8 v; C; G$ S6 X) [
. P- z" v& h. u7 S7 S$ ?5 a9 P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) V; Q$ e a( D! Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 d0 _. Y: W. `1 W
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* j5 ~2 H/ c* j* y3 s% [7 [2 h: N- x# [. `- y: b! f
/ f9 _& V( z6 P0 y' b9 q" Y: K/ V |
|