|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ m8 J5 }& ?' c. U- [code]EDMA sample test application
' G- [6 R# T# A, k/ p6 A. O) l - /*$ r' e: U9 S' W% C
- * edma_test.c
- N( K* Y! D9 j4 O* M& @ - *
( F5 p: x# o( i - * brief EDMA3 Test Application
& S" ?& [. l. h [+ F+ j$ V0 R - *
1 S( k1 P& b, D; I" B( o+ @1 |) b - * This file contains EDMA3 Test code.+ x' q7 |" f* t, w/ x9 |! J/ }8 s% D, P
- *& K( C* O( o7 T
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# B2 Y0 H9 a3 l) P. ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 Q2 s; {4 n: n9 Q6 O( Y
- * TO CHANGE.5 B; c9 h$ l) n0 G z% s2 f
- *
3 P' J9 }1 `6 r) s; w: b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 m* P4 x6 f- @* R' ^$ ] - *4 h9 A' A; o! e r
- * This program is free software; you can redistribute it and/or& R9 r( Y% n* l" L# X$ q
- * modify it under the terms of the GNU General Public License as [2 q$ X; q% A/ l: m6 |' E4 b
- * published by the Free Software Foundation version 2.0 K1 `% \; c# H. ]5 |$ Z
- *
! A- I# d1 ?+ J0 M) P# ~& L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
P# m2 f0 l, @; U4 H- D - * kind, whether express or implied; without even the implied warranty& j4 N5 Z+ i! y% C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ e# z) ?8 @5 X. T - * GNU General Public License for more details.7 w# S$ q. v5 |; Y
- */
2 u$ v2 Y0 y8 }/ Y
+ f0 d# ~/ x1 @% L6 i1 D( E- #include <linux/module.h>, e. p' |3 ^, q1 j3 u5 p' T
- #include <linux/init.h>/ P7 U& i( T% D
- #include <linux/errno.h>5 C6 ?9 |+ }; ?) V* f" @/ b
- #include <linux/types.h># c( P7 I; S+ Q7 M; J* V( l
- #include <linux/interrupt.h>
" f! L9 u9 A& ] - #include <asm/io.h>% o. w5 ^, ]: N% S* `) l
- #include <linux/moduleparam.h>* i$ t ?9 ]% d9 u
- #include <linux/sysctl.h>
' j) I6 f" p* h; K7 Y# `0 i, s - #include <linux/mm.h>
1 ]& W. O6 q0 C - #include <linux/dma-mapping.h>( G& F3 b4 V' g1 ?
% T n8 ]/ e8 ~" L" k: q- #include <mach/memory.h>
# Z' d" m( o$ P - #include <mach/hardware.h>! s# Q+ m, T) F a) K# b$ R
- #include <mach/irqs.h>
O# m: E3 `7 q8 U/ q# C ^7 w( z0 L - #include <asm/hardware/edma.h>( p2 y% Y2 D+ d* V* t
- # b% o+ U# E2 g& w" ^
- #undef EDMA3_DEBUG; a) D, H' T) m, s
- /*#define EDMA3_DEBUG*/4 w" d# c8 M; `$ b5 O
- ' E# l* u5 R# C0 w
- #ifdef EDMA3_DEBUG
' V' I- [3 Z7 f: { - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" }; v: ?1 z$ n/ Q7 r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! Q, D$ J: K" O) a# @, P( z4 ]
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ E5 W% G) D; {7 ~ - #else
* y# R- L" |, q; \; a2 ^ - #define DMA_PRINTK( x... ): s+ r5 h+ K; y$ ~8 m; E4 d1 O
- #define DMA_FN_IN* e2 a: x' \4 ?: m6 o
- #define DMA_FN_OUT
$ i+ l9 a8 ~6 H3 S0 `: k - #endif# o2 s- q8 [3 R
- ' I4 P. u6 T/ J* L. X7 e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: { K1 n, |7 I# |; q' y - #define STATIC_SHIFT 3
% |# q9 @4 {1 G+ k/ b6 Z/ X - #define TCINTEN_SHIFT 20) t2 J, C! W& J7 n
- #define ITCINTEN_SHIFT 210 |, m& `% j4 S* @2 x
- #define TCCHEN_SHIFT 22 x3 l" F: j' o! f
- #define ITCCHEN_SHIFT 23
% ?% z) z1 p+ n+ l
4 {4 f x- M {+ A7 m1 b- static volatile int irqraised1 = 0;, E4 G8 a1 d3 Q2 u. W; Z
- static volatile int irqraised2 = 0;
; |+ u7 J1 Q' E
* b' b5 o' Y% [6 b- D5 B' Q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 r6 w! D7 Q: N2 V' i7 I
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# c" n. v3 _' C5 `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 m9 u4 U! M- e( G9 Z( |" c - 5 u9 M+ d `8 g; D: N/ m
- dma_addr_t dmaphyssrc1 = 0;! O6 o, D0 P% \0 q( V, C
- dma_addr_t dmaphyssrc2 = 0;
, j$ u% P2 m2 Q% T3 v- a/ I - dma_addr_t dmaphysdest1 = 0;
2 n! ~: \" R! m4 ^$ G/ Z$ ^$ r - dma_addr_t dmaphysdest2 = 0;
" p/ p: i$ q* \" k8 z5 f* i6 p( z
& g' u, G9 x/ _, H* j- char *dmabufsrc1 = NULL;
8 {& m& w! H% W( N$ H - char *dmabufsrc2 = NULL;. Y4 J6 |5 ~. `/ f& M1 I8 {
- char *dmabufdest1 = NULL;& g9 c6 m9 q! ~6 _( ~: _
- char *dmabufdest2 = NULL; R- ^/ k; t* d$ O1 ?+ R8 Q& x' E
- & E I' E4 B! l: z, }
- static int acnt = 512;$ i6 }% j, M( G; m) I
- static int bcnt = 8;( @) z( \$ E0 K. l
- static int ccnt = 8;
6 D: k( t: [1 K0 a( ]. S! v% E2 D! ` - & p {+ Q% a5 [. A' v
- module_param(acnt, int, S_IRUGO);
" z8 S& H2 Q; U- J - module_param(bcnt, int, S_IRUGO);
* |# i5 j' \. `/ \* V5 j - module_param(ccnt, int, S_IRUGO);
复制代码
/ A( q1 ~" B; k3 \+ v4 [5 S7 u5 L" J! ]- V) n2 ?" ^& W5 l. N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 R/ f4 |# w7 Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 M+ [1 e) ?4 S; E. Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ p0 y! V; ^+ y
& G) n# ]. J* e7 Z6 @
2 I! b, h& x- `. @9 y
|
|