|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * D; N6 C n2 h' C0 y; H
- [code]EDMA sample test application, o' ^. G& @& n
- /*# |/ A0 m4 ~2 B: |/ o, x, ?. t
- * edma_test.c
) ?) E5 E( q( U [ - *1 H8 r, _/ z$ B1 B& a
- * brief EDMA3 Test Application
. n7 k6 m; d3 v3 c1 e6 A; z - *
3 @( ` C6 o: G5 [ - * This file contains EDMA3 Test code.
/ { x2 r% j7 y! G0 a - *
" @% U4 F- X# a$ @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! z0 R7 l @) l F3 r
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( A; x; C" b, @
- * TO CHANGE.
/ \) |1 H8 j Y, F - */ d5 F: D ]( } N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" W" ^# N# F N3 n K& [
- *8 e$ a& l, Y5 V8 G S+ v; U
- * This program is free software; you can redistribute it and/or
. _" b1 U1 P1 M& d9 ` - * modify it under the terms of the GNU General Public License as' c3 H P6 ~# \2 l) H- q
- * published by the Free Software Foundation version 2.
) H( f2 p. v. E - *# K6 V+ k' I- M
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ B4 [9 s- e- J; q - * kind, whether express or implied; without even the implied warranty
: M2 r/ p5 g$ M: J4 u# d' z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) {& T% B- ]7 J' g# g" Z - * GNU General Public License for more details.
! B0 l# A- j' _4 G - */2 S" F, R, c+ M
# Y$ z; O! z! `/ l/ p2 N: z, [7 `) G- #include <linux/module.h>
0 o6 U; v" V( ?5 q% Z' w# X - #include <linux/init.h>
# s0 m9 y: i, ^1 c - #include <linux/errno.h>
; L( D7 D1 P) j' E - #include <linux/types.h>
. q' F# P% e: J# b! X - #include <linux/interrupt.h>
; e" B9 D( c& e - #include <asm/io.h>- A0 m e& n4 f% N% n! P5 r* j+ J, k
- #include <linux/moduleparam.h>
. c' {( u' `. Q0 l# e) O& v3 d: Q - #include <linux/sysctl.h>
& }, C: c+ U! U; M - #include <linux/mm.h>
- D' O9 \% \' h$ E- T3 H - #include <linux/dma-mapping.h>3 }: Z6 A2 G4 h- I7 K
- 8 O$ d, i) P9 |9 t+ A8 J8 j0 ?
- #include <mach/memory.h>
! K: F C$ u- `: V \ - #include <mach/hardware.h>
9 v. S5 a5 F" P5 }" F - #include <mach/irqs.h>
. U8 d& E8 ^: E N \ - #include <asm/hardware/edma.h>5 M: x# Q5 V1 {( [ H# v% N
- 5 J' Y5 T. m6 J2 O
- #undef EDMA3_DEBUG/ @: L) {7 Q8 D- E7 I
- /*#define EDMA3_DEBUG*/
& R9 S( W. q" z: E( b
: O, G* ]* F$ l3 |- #ifdef EDMA3_DEBUG) o$ }. `0 F9 ]% v) `/ `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): N; ~$ E- {6 Q7 W9 e% f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 k6 L ^* H$ {4 Y6 S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ q9 N. B/ G/ L- P* p- n
- #else. \6 l* T$ H% K: W( `
- #define DMA_PRINTK( x... )( y5 E4 O- g) R" L, }" p# B
- #define DMA_FN_IN
. k9 U/ y; x9 f" Z: f! x* E4 m - #define DMA_FN_OUT
9 | U6 b& }- k( M2 Y - #endif4 {* B8 J: h* c7 m
+ H( s. X! V( S9 q7 U& U5 c1 l. S- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- ]1 h( k3 @. ?. `, E" n7 L
- #define STATIC_SHIFT 3
+ [% b) k7 \; O- t& b- e - #define TCINTEN_SHIFT 20
6 D# G0 }7 R8 Z4 ]+ m3 `% S9 d ?0 X/ U% o - #define ITCINTEN_SHIFT 21
" ?' y6 D Z9 _0 w; z% `1 R - #define TCCHEN_SHIFT 222 O, s2 w" v& f3 D- M/ f/ \# ]: C9 N3 P( }
- #define ITCCHEN_SHIFT 23
+ Q2 W% S# W) P# C2 r4 ]
; U$ ^% s* w( w& ?1 Z& f. n. {3 p& d- static volatile int irqraised1 = 0;7 R( z8 a, G: M2 {7 X, I
- static volatile int irqraised2 = 0;
2 n* b) }, J. k+ _3 p
$ x( }) ?8 {! m C, V- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 N- e. P9 \ e8 L7 N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 V2 ^, C/ c5 v7 D) y, \
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ E/ ]# `2 l( i5 D' q* a' } G
- ! M* s6 d: c+ a5 X* ?4 s6 w
- dma_addr_t dmaphyssrc1 = 0;4 ^- f0 O: S" C4 n
- dma_addr_t dmaphyssrc2 = 0;; w' a5 r; l \6 F s5 h
- dma_addr_t dmaphysdest1 = 0;
2 v7 n3 D' M8 t6 d: Y - dma_addr_t dmaphysdest2 = 0;- R. Q( l, n- @; Y( v
8 a7 c/ O: g. q& L5 |0 {- char *dmabufsrc1 = NULL;. I" ~2 B/ u/ K; G
- char *dmabufsrc2 = NULL;6 f; ]5 q8 z% r) a) C8 F. W
- char *dmabufdest1 = NULL;; N/ ?, j' \' u
- char *dmabufdest2 = NULL;& ~- z1 q! b- M0 f$ n; t: m
% v! L D1 o. v, W7 C* Y) f8 |- static int acnt = 512;" ~8 {& l. u$ |3 g. \
- static int bcnt = 8;
1 V) n7 d( g: l$ t& z/ C - static int ccnt = 8;
2 O* N4 Q9 L9 J% A9 t% ]2 o$ ]' J! I - $ ]* e. M; S V% d5 Z5 h. \1 O
- module_param(acnt, int, S_IRUGO);
) I; x' G- p: {% a - module_param(bcnt, int, S_IRUGO);3 E5 D9 C, ^* g( {% A( D
- module_param(ccnt, int, S_IRUGO);
复制代码
) _' c, X9 i4 @. t' s9 N) v
1 L, T. Z% G( t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( f, A. M$ M* U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! `, P# U1 I$ j6 J/ c9 U m# q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 F# A+ X' X5 O
/ r# A- X% E9 q3 F" _
& ~/ i& ?; Z* Y1 v3 Z2 u
|
|