|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 w- E, {1 `! n8 @$ d
- [code]EDMA sample test application2 D: l! Z4 R# g9 y% x0 \
- /*
# P/ ?' i7 {( Z& y, z1 k& {0 G$ T - * edma_test.c% q _1 A- |& T u
- *
& u: x. y3 T0 _; ` - * brief EDMA3 Test Application
9 e" ?2 T( Z. ?. h - *
6 e* j' a: ^/ w5 J+ H& _' M - * This file contains EDMA3 Test code.
1 x( j( F" R6 e: F2 Z - *
, l, b' z- s+ x$ d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) H; T R: P7 P" S: b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" W4 w1 z/ t4 a0 C
- * TO CHANGE.5 W) Z; Y& F+ E9 U L! h
- *1 t) G# Z' K% s7 L; ?3 N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* w: D" } {7 S5 N( D
- *$ D5 }) Q, ~; P
- * This program is free software; you can redistribute it and/or. O/ T6 m7 q3 X2 L5 _* d6 A
- * modify it under the terms of the GNU General Public License as
# J$ I. R- G3 {* `7 E5 c - * published by the Free Software Foundation version 2.$ ?% K$ Z; v. s) _
- *4 i- D( T- `; y" @- [" B3 A! E4 v
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 r9 ?/ c1 @: S - * kind, whether express or implied; without even the implied warranty
' C9 ~, r7 @/ D" N - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 @% I( Q& Y4 I- g+ s7 _8 ] - * GNU General Public License for more details.( E( m* E: M: X) \: j
- */) @% \$ I$ O3 w. t) u. \
0 }1 N1 Q1 D8 s. \/ @- a/ v! i- #include <linux/module.h>! S$ n7 j6 b( Y/ j: O% \( h r+ K
- #include <linux/init.h>% m+ u; a: p/ `% A" e5 b' [' ~
- #include <linux/errno.h>
) p a( }- [1 D& K9 L) _/ k - #include <linux/types.h>
; q6 z7 p0 k7 @! b7 |: C - #include <linux/interrupt.h>
2 G: [" O" F+ |, W0 u - #include <asm/io.h>2 s8 x' p4 ^9 W" Y9 P5 ~! S
- #include <linux/moduleparam.h>
0 s+ w; t& D8 j - #include <linux/sysctl.h>" E6 I V7 H I/ F
- #include <linux/mm.h>7 Q+ h9 h g( {5 N) C0 s3 _
- #include <linux/dma-mapping.h>
7 x* S/ p# C2 M+ y% g' w
# a. L( B5 ^( X- #include <mach/memory.h>; n; A) k; y3 h) N
- #include <mach/hardware.h>
1 Z& |# R5 p; G. r/ x/ e - #include <mach/irqs.h>
2 Q1 o6 Z& t/ j6 n - #include <asm/hardware/edma.h>
3 o* r% r/ V( S) w ]3 }/ n
6 o5 ^$ M; `# @- #undef EDMA3_DEBUG
4 a5 C& J1 G( }* `) ` - /*#define EDMA3_DEBUG*/8 s+ k8 n9 O m$ L/ e
- 1 `# C+ k( u4 U2 h# Q2 @
- #ifdef EDMA3_DEBUG# G& A2 b0 j8 ~2 B: v; s% d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 ?' H% \7 y! @; A: y0 H+ W7 x6 T - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 N8 p, }% D2 A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. K- m: J, J5 ~ - #else
& w$ Y' L' q& M! G+ i - #define DMA_PRINTK( x... )7 _, k. o: \$ l, J" j+ H
- #define DMA_FN_IN" I! q4 t" ?% T
- #define DMA_FN_OUT$ e# F8 V+ G$ y$ S
- #endif
6 n7 Q+ n+ x+ y1 z2 u& z; P0 B* H - 3 M: \% k3 }+ B7 ?( v# [8 K$ h
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 t% {+ ?" X! @, u( C - #define STATIC_SHIFT 3
9 P& C# {4 \; H& k- D+ f - #define TCINTEN_SHIFT 20) p8 w p" y% u% L+ s, ` h
- #define ITCINTEN_SHIFT 21$ _3 y7 u% V8 g9 m# F
- #define TCCHEN_SHIFT 22/ r; z l3 P2 z
- #define ITCCHEN_SHIFT 23/ b: A' m! c" f6 x
- 2 j( m: S6 M6 b8 h d! y9 v3 x
- static volatile int irqraised1 = 0;
7 i2 ?; N I1 H5 }* ? - static volatile int irqraised2 = 0;
% q' T7 x' a/ p( l
5 e5 n% _9 d% P S- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 ?% y- r! Z2 [9 k e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, c; x2 o) q. {; }
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. M* T1 I: o4 w* L
- v- z$ E$ j$ L- dma_addr_t dmaphyssrc1 = 0;
! F0 |" i% ]* L, P) K - dma_addr_t dmaphyssrc2 = 0;
7 {9 h0 t5 J' m5 d - dma_addr_t dmaphysdest1 = 0;
( t( k' ?! p w# ^; |$ j8 D: s- ] - dma_addr_t dmaphysdest2 = 0;
0 [2 g: A, T" _ - ! Y$ w6 X! R6 z+ j: Z
- char *dmabufsrc1 = NULL;6 o& Q" |* A" G
- char *dmabufsrc2 = NULL;6 ~( |6 [0 A0 Q8 r" x) C
- char *dmabufdest1 = NULL;
+ M. h& `! c5 k - char *dmabufdest2 = NULL;- X+ L, V' F! u
- 9 `* `. R% Z9 W1 G" f
- static int acnt = 512;
$ Y/ N) t8 D/ U7 V* x& }3 L/ S - static int bcnt = 8;8 ~! X# K h; _, D( p. j
- static int ccnt = 8;/ E8 G6 T; T8 ^0 V, n! [
- 5 n2 l, X. \2 W( G
- module_param(acnt, int, S_IRUGO);* n1 ?1 {$ \7 U: m
- module_param(bcnt, int, S_IRUGO);
% o, _ g" ~+ x5 J$ a4 O: X+ O - module_param(ccnt, int, S_IRUGO);
复制代码 2 j4 N, D3 O: A- t7 o" n- k" p+ }
w2 @$ r# t1 h; q& r* s
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" d8 p* n) m6 Y, ^' [( V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; t3 P1 f* A6 Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! I3 V5 z8 a. w8 X
; c7 U- I+ p V2 Y" M0 w$ E9 w0 s" Y' L7 J( A/ V
|
|