|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( |& H0 s& f9 p5 j8 G- [code]EDMA sample test application
6 C7 P+ k+ E2 I0 d$ h! t - /*
& J0 n x( q6 M. U - * edma_test.c! u" p/ ?' C4 [7 {. L& n8 O2 R) Y
- *9 T1 y; u7 [$ B' m: a" o
- * brief EDMA3 Test Application
" y) x# b+ Z$ L - *
" C3 v+ Q6 C( ^; y - * This file contains EDMA3 Test code.
! l8 R8 `3 t" t/ L$ V" ~ - *
6 v# [. m3 G, r3 n$ k) v - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- P1 g, h V" n4 q$ g - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* \' [; ?; T# N+ Z
- * TO CHANGE.
0 s* n( T1 I& [ - *
6 @- y" @ \9 j' G$ h - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! i& ^) K0 g O$ U$ o9 P8 f I F& M
- *5 E+ \+ v; ^& z$ I
- * This program is free software; you can redistribute it and/or
, W( j3 L# L6 J8 w6 I) @) X - * modify it under the terms of the GNU General Public License as' @& K& T8 I, f4 Q# r
- * published by the Free Software Foundation version 2.
: z! f" t" E' J! }" y) Z t1 u3 k - *: a$ g$ v* a& P& x/ w/ k" d
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* w f: A" }7 f) w( u1 y5 Y, D4 d
- * kind, whether express or implied; without even the implied warranty. \3 R$ X | { n) S4 Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 @# K$ L9 F, F' R6 S
- * GNU General Public License for more details.
8 ?! O% L* t1 H2 l - */ W9 V* v. f$ S
- + n1 D+ j+ N6 A) y) K
- #include <linux/module.h>
3 B% F# x3 ?9 P# r+ r - #include <linux/init.h>' p3 I3 b! P/ r* t8 @7 I0 ^9 r
- #include <linux/errno.h>5 x' P: m) A7 h" f- V7 S
- #include <linux/types.h>
& k4 E' N. Q1 @( o2 M; R5 r - #include <linux/interrupt.h>! _- U2 @/ e$ ~1 M: t+ @7 A4 z3 E
- #include <asm/io.h>
* }' A! Z- h6 u9 X. U6 x - #include <linux/moduleparam.h>5 f# w. O" [* r i
- #include <linux/sysctl.h>: g5 _- B4 A: E- O8 y! y; f z
- #include <linux/mm.h>( h$ v3 ^* o( c6 ]9 p
- #include <linux/dma-mapping.h>) ]; }* \8 e! q4 M! s7 e
- # D. g: R& A4 t$ T* ?) k2 R
- #include <mach/memory.h>; L/ l2 U; q7 `) |
- #include <mach/hardware.h>3 ?# f S, L7 K( u1 i: [
- #include <mach/irqs.h>
! }; ^' l+ h: m B - #include <asm/hardware/edma.h>6 m4 D7 E) i" l) L, x1 B
- 1 ^4 }% N* {& D0 M- `- A
- #undef EDMA3_DEBUG7 K! }4 P( [# P3 I8 }
- /*#define EDMA3_DEBUG*/
% X) G5 u* ]/ u
& H3 G9 v7 P/ h. j- #ifdef EDMA3_DEBUG3 \0 h6 M) q* j t. `0 @
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) U2 c# Z3 m( D% a6 @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ Z. F" d& j* u: `- L
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) Q7 Q3 ~) F* L9 d* _ \ - #else
: w0 Z, P) B& u/ ^3 ? - #define DMA_PRINTK( x... )
& o& {: X; ^1 U- x - #define DMA_FN_IN
! K0 `( p- H% _ - #define DMA_FN_OUT
3 X- g( I# v: p. D8 Q - #endif# ~. o" y4 G1 c6 ?
- ( \) Y$ a7 B" J( _2 u' c
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% y4 o8 ~! j) ^0 A2 u - #define STATIC_SHIFT 33 k# }+ H7 x5 b3 [5 X( l2 C% z. w
- #define TCINTEN_SHIFT 20
& F! L4 c. b& @. f - #define ITCINTEN_SHIFT 21 U$ {3 K) s) ^/ Y% l5 Q
- #define TCCHEN_SHIFT 222 m% H) R$ {9 C
- #define ITCCHEN_SHIFT 23
9 r5 d8 R; C. O% C0 ]
; d# h ]0 O/ x8 U& P. g7 M- static volatile int irqraised1 = 0;1 p5 T: N" U, ^( O/ T" ~( w' r" \
- static volatile int irqraised2 = 0;1 y2 t/ m* k5 H7 e' P* L6 K& f
! L" b- t, j$ G, U( s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' E" H7 y& ^* f, J" U0 b s0 ]. {* x% h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' f X7 H/ o$ R7 j# O$ Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* @2 N8 L @) Q5 j, |
. e& X7 W3 k$ h- dma_addr_t dmaphyssrc1 = 0;- U7 D- s) z- Q; e$ o( {6 ^8 I8 I8 {
- dma_addr_t dmaphyssrc2 = 0;. I5 y& J- A6 B+ L
- dma_addr_t dmaphysdest1 = 0;( ?, W9 Q# J( e; I# [# ^& \: G
- dma_addr_t dmaphysdest2 = 0;
9 U7 r" j# O9 W" F
\6 y8 F2 K; P8 o2 F- char *dmabufsrc1 = NULL;! a( V* ~6 I2 [8 B9 k$ T% [
- char *dmabufsrc2 = NULL; c3 \ y2 v1 m2 j4 V; s
- char *dmabufdest1 = NULL;
: f/ R2 C W. ]* G - char *dmabufdest2 = NULL;0 a+ J9 @% M- }5 X2 t3 O
- % Z$ ^/ _; z' ]% w3 a. h. Q, E
- static int acnt = 512;; [' H9 `& t5 S: a3 _4 ~$ ^
- static int bcnt = 8;: u% Z" X% W" u2 f! J2 s
- static int ccnt = 8;" _) X) z3 O1 D9 e) m: s
- + ]' p- r/ \/ N- M9 w4 w$ Y
- module_param(acnt, int, S_IRUGO);: @! Y: F! F+ n) r
- module_param(bcnt, int, S_IRUGO); {3 C h( g' k0 Q
- module_param(ccnt, int, S_IRUGO);
复制代码 : K$ N' D! l5 O' c1 ?" a
* [9 D/ T: }) r4 @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 o! B5 G0 c$ e) Z/ e( M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# R" E5 A9 k* y6 c* M# X/ o
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& y( m& c7 K7 c5 u! W. X
( y& ~- g# Z7 F& T( N6 T7 A' H6 ]+ E* Y5 {
|
|