|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' H8 w" ~# z0 j% y4 w0 i- [code]EDMA sample test application
* f$ c2 K4 a6 x! v! G - /*( {; H+ \. }0 r9 }
- * edma_test.c
4 u$ |' ~/ h& m8 V; ?) y - *0 o. z5 Q8 q* E1 ] Q2 \9 j
- * brief EDMA3 Test Application9 `: W8 s4 L, S, n" h' {- X
- *, a% X" z! A( Q, i# C. F
- * This file contains EDMA3 Test code.
7 d4 s/ m$ z o/ t8 h$ X - *2 V- h9 t1 X8 P3 [& u
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 L2 s: A/ l5 O b; F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ U1 o$ ~, Q1 ~+ u& R' ] - * TO CHANGE." C: B6 @+ z( ~2 K* w# o5 w
- *7 ~. i+ F7 `7 j1 A$ I! y- X
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' A% @1 s# i, l3 _1 q
- ** ?! \0 h% {( }! w B' }" M
- * This program is free software; you can redistribute it and/or
7 W6 i+ R5 W+ C$ i - * modify it under the terms of the GNU General Public License as$ t& n6 T G/ d) T* ~. m
- * published by the Free Software Foundation version 2.3 L# j: b+ i3 ^6 e: c" a, a) i
- *
$ L* T7 q/ x$ \% t" l' B: @; V/ ~& k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ k! K8 z% j4 s6 B3 R8 g/ \8 u
- * kind, whether express or implied; without even the implied warranty
& c0 m8 P, h, I4 _ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 }9 V8 F( e6 H) [
- * GNU General Public License for more details.
7 H- J T* v: Q. K: f6 L; K& \ - */
( ^6 X; @ k. K( S* t" p - 4 Y, [" w/ Q1 K# k( k$ k" W
- #include <linux/module.h>
+ R8 A& j" G, ~# N0 N2 Q; B: h7 v - #include <linux/init.h>
& I7 E' o* ?. m( s& c7 @ - #include <linux/errno.h>
3 V- N& J5 N" N" Y, k3 x - #include <linux/types.h>. G6 X& |7 n- } K& p) K- S
- #include <linux/interrupt.h>' T" }$ W5 D% x
- #include <asm/io.h>3 G" v; h6 b# r1 H& m
- #include <linux/moduleparam.h>
! H" f/ f" I* ?' O5 M) J - #include <linux/sysctl.h>
% s4 |3 M, q* f/ O - #include <linux/mm.h>
* |- V( f+ ^. t" y' B5 B" ?4 U' | - #include <linux/dma-mapping.h>
- Y6 l& m/ L" F- {( S3 t |& M3 M
' ]$ S& u- w5 t2 q6 J$ b+ M$ J2 a- #include <mach/memory.h>
3 V, y9 c# S; d% W; V/ v - #include <mach/hardware.h>
0 U9 Q- T4 v1 g X - #include <mach/irqs.h>( R# p, T% ]$ Q' b8 d3 O+ m J/ w
- #include <asm/hardware/edma.h>
5 M1 }3 l7 G+ a) s5 s2 F - ( A& y& J! s5 `- n5 h+ C# M* Q
- #undef EDMA3_DEBUG
+ X {7 c+ P3 Q! ^0 E, j; b - /*#define EDMA3_DEBUG*/: R- S" x1 h; e" ?5 d. H; M" b
- ) m0 { P8 \7 i8 N* @1 a/ M! f4 o; B
- #ifdef EDMA3_DEBUG1 @8 h7 A* b/ a& G5 ` z* @* j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% j }' N* ]& L5 J+ l+ K - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 R# C( s/ o( }. S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. l1 y& z9 w" F- N( w - #else
8 j% j v! S2 X9 C- z; M - #define DMA_PRINTK( x... ), e+ n+ |" C* F( G& C2 u' M
- #define DMA_FN_IN
, C1 ~0 }2 a$ L' z( H - #define DMA_FN_OUT8 u3 d& K& g y4 a9 g
- #endif
8 O9 D# h' m( E8 [
+ }4 l% h4 {5 E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 u7 ~6 R: `- x% X3 ?
- #define STATIC_SHIFT 3
& E3 F9 }+ y# f' k - #define TCINTEN_SHIFT 200 G. X3 r+ ]$ w$ r Q: a
- #define ITCINTEN_SHIFT 21
8 L6 D" ?6 }) e Y. I* {8 E - #define TCCHEN_SHIFT 22
& B% j7 Y7 J$ y6 L4 [ - #define ITCCHEN_SHIFT 23
" A }# f4 C6 P3 I
7 |/ r7 ^; ?( S7 V2 R& p- static volatile int irqraised1 = 0;
# u# [. W3 L: P! j r" ?- V1 n - static volatile int irqraised2 = 0; s) W2 c% L o* d9 T
7 u) ~: R- x6 ^$ m( g- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 H3 e- e" {$ k/ S. } - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- T& _" i' q( P7 X1 w$ c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' [6 R* V2 s8 Z+ _7 O - * h" g! l( Q6 C
- dma_addr_t dmaphyssrc1 = 0;6 g# s3 F N: O! G! u, ^
- dma_addr_t dmaphyssrc2 = 0;
; @% h1 w% y% Y - dma_addr_t dmaphysdest1 = 0;: c* x- V: _3 [9 A, i! m
- dma_addr_t dmaphysdest2 = 0;
) G5 D; v% P' ^5 a3 G - $ G1 ?, z1 W/ r4 {$ G& L( [9 N
- char *dmabufsrc1 = NULL;% w5 ~# Y9 I$ M; S& b
- char *dmabufsrc2 = NULL;% H. Y1 X+ h, n
- char *dmabufdest1 = NULL;
# k& _" B8 q9 c - char *dmabufdest2 = NULL;; f' m6 c2 I) A6 s
- - ^; p: k, h8 K- o Z7 K
- static int acnt = 512;5 Y4 B+ f* v( Y9 Q
- static int bcnt = 8;% u" P& }) N+ V
- static int ccnt = 8;
$ f" d! k$ _0 @$ T. v - ]. v" a6 q' c" v; @) V
- module_param(acnt, int, S_IRUGO);- Q, m0 x& U$ `! x0 u9 {
- module_param(bcnt, int, S_IRUGO);
' \- ^' G$ }( S* x& j - module_param(ccnt, int, S_IRUGO);
复制代码 3 r9 e3 o" \$ I7 d
; i+ ~4 R, j1 B) M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 _& o) c$ x' M, Y9 l' r9 L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 H% y7 Y. s5 }, ^- n7 }! Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( S7 J: G x( k; E
5 |1 d) S, W) S5 \# ]# d0 `# G0 W
# D" E+ c1 {! A# u# w d* k" ]0 t( z |
|