|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 |. I" b5 G2 P- [code]EDMA sample test application8 b5 X9 X S" \5 m
- /*1 g0 l' k9 r3 D, S2 }0 n# w$ i0 H
- * edma_test.c" l# l1 \$ W1 o5 r( N# n* ^
- *
A* Z0 \5 W1 g, @2 {) C - * brief EDMA3 Test Application( J7 G% B* j( ]! d+ d1 H/ r
- *
; o1 \) Y+ [) q# N - * This file contains EDMA3 Test code.0 z3 d1 K4 L3 L, m
- *
2 U- d" w; T1 k8 F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 o' t4 H; Y, Y; G* V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& s" ]. V1 C/ l/ A - * TO CHANGE.' d ?8 {: _5 D. M; |
- *. U7 ?8 H" }' V }# s: Z
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) T9 g7 `. c5 |$ W6 `% A0 ` - *# v1 Y5 }# q! w5 `
- * This program is free software; you can redistribute it and/or% G3 ~, E9 W) `! N
- * modify it under the terms of the GNU General Public License as4 i# w- o" e6 `+ s$ `. s+ a t
- * published by the Free Software Foundation version 2.
7 |3 W3 Q* u6 x) r. S - */ Y2 m$ s- M* a. Z" v6 b2 U
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: \" ~: ]% C& k: j- ~ - * kind, whether express or implied; without even the implied warranty' g# c7 O3 k8 V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" u6 S" [& T3 n) X% p; |* N2 b - * GNU General Public License for more details.
. b: V- E+ T S. B9 n( | - */% A' \) [9 u7 V6 T0 s* J
) l* T; l, _+ [% p6 X7 |) I- #include <linux/module.h>
/ u8 E1 H' Y- t% ], k% O - #include <linux/init.h>
$ U- A( S k5 g4 {, [% m9 q7 W+ v- G) j - #include <linux/errno.h>
: ?7 e2 x5 \5 D B; G, U - #include <linux/types.h>" J1 l1 N& b4 b
- #include <linux/interrupt.h>( C4 t" D4 M4 K% C9 x9 `0 k$ T
- #include <asm/io.h>* s9 ^# m9 |7 g9 h& N5 `3 P X1 k
- #include <linux/moduleparam.h>. ], X3 N: @5 w( l; q2 g
- #include <linux/sysctl.h>* G/ K+ _0 I; S' w( P/ k
- #include <linux/mm.h>0 K! u1 e/ a4 B: E4 L
- #include <linux/dma-mapping.h>
$ b7 H8 F5 ?2 z1 s8 Y - $ E M: o$ T/ L. i; w+ A
- #include <mach/memory.h>
- H; h! F( |! z. L$ h0 j; S* |+ \ - #include <mach/hardware.h>' J- ?5 a. v* j% _
- #include <mach/irqs.h>
% I5 a' U4 w8 A9 {, e& f S - #include <asm/hardware/edma.h>1 ~& ~+ k) E8 t
- ) |( E! L2 r |; F5 Z& h
- #undef EDMA3_DEBUG
) O: \/ [2 ]# }$ K3 @3 A- ~ - /*#define EDMA3_DEBUG*/
: ]* W* q5 J; ~( y" x
- {$ }$ C, X6 W# m3 e- #ifdef EDMA3_DEBUG7 ?( g3 d" d* j1 T9 Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 t. V& }& N5 D - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' m% T" f- ]7 F' \ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. Q; d: h2 J& \( ?2 M - #else
( E! ~9 D) l, B* { - #define DMA_PRINTK( x... )
( m: u. {- S) g+ t - #define DMA_FN_IN: k5 O7 p# A& V1 @3 ?7 @ m- N. o$ q
- #define DMA_FN_OUT
. c; t4 S; ]! [1 K" N$ ]3 q/ a - #endif
! u' u- V8 Q# q, R+ L0 U9 |' H - 9 Y! w+ F9 l: ?: G$ N$ ?8 L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" K; E' Q2 ~) B* V( D+ @7 m3 @5 ^ - #define STATIC_SHIFT 3
) v: ?# Z2 T; u$ m* a+ p* Z; K- G - #define TCINTEN_SHIFT 20
0 V% M6 I% s9 O: ~/ ` - #define ITCINTEN_SHIFT 21
5 M- s' E) i3 T: y9 }6 q ?$ F1 y - #define TCCHEN_SHIFT 22
. s' S1 o x8 ~8 a' F: I0 x - #define ITCCHEN_SHIFT 23
, m* s' l& G8 U w7 O9 |& O - : K( P# X( q9 r# K2 R o( O, [
- static volatile int irqraised1 = 0;
3 A3 j2 Q2 w0 |- c - static volatile int irqraised2 = 0;8 ~9 t& _4 Y* s$ O: F' }7 T( i" K
3 l; B a; m" G2 K' t4 A( T7 I- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( ^5 u9 H& J0 t' `; C3 T: k& t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) M# d/ l" [9 s& ?8 G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); f3 {! Y) k: B8 r6 K6 `9 h
- ) @( T2 q3 ]) e
- dma_addr_t dmaphyssrc1 = 0;- B: c% R+ i3 @8 p
- dma_addr_t dmaphyssrc2 = 0;3 A) X% p- h1 a
- dma_addr_t dmaphysdest1 = 0;
! H* Y6 S. y$ H7 X - dma_addr_t dmaphysdest2 = 0;
$ M+ M& q; f3 k, L5 ` a4 s
: f: D8 i8 f8 O2 `9 K- char *dmabufsrc1 = NULL;$ a" c: n1 d: h) h$ B9 g+ M
- char *dmabufsrc2 = NULL;
7 U( r7 n& J+ H3 T' A( \" l - char *dmabufdest1 = NULL;
" H; u, Y2 n1 ?+ E, A u* D, \( j - char *dmabufdest2 = NULL;
# v( {3 B" w% v+ |2 W - 1 D1 C7 B$ X6 R/ D
- static int acnt = 512;7 I$ V/ x! R' @* G" Y1 F ?9 n
- static int bcnt = 8;
6 D5 L- N5 U! p; g - static int ccnt = 8;8 n' z8 _! r" |& T2 N, o
4 |* m0 e3 y/ |: I0 V+ D- module_param(acnt, int, S_IRUGO);5 r8 P7 Z6 L; [/ x. N
- module_param(bcnt, int, S_IRUGO);9 G0 P1 m# }" X
- module_param(ccnt, int, S_IRUGO);
复制代码
, V9 O0 t0 e. C
; X6 U& }2 o1 P7 @ r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' a0 e/ C! A, S6 T/ W
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, K4 K" B4 [* r" Y5 k0 n 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# K. j8 D3 w6 @5 \6 h3 E1 k4 P
: ?$ F" D+ o3 [4 k
3 O# ^; z. B6 n$ N, b |
|