|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- K5 f% h9 }3 S) I# H) _4 u- [code]EDMA sample test application
% Y& ]5 [1 C+ g) E* H4 j6 x. W) G - /*6 H+ T* U7 j4 ]
- * edma_test.c; |/ f& E: W2 D; Y. s) V6 _0 G2 l
- *) D" x* P! g7 r7 M3 `
- * brief EDMA3 Test Application
: e# v5 R9 x G& ` n" f4 \ - *3 g, N/ S7 \" S' `
- * This file contains EDMA3 Test code. r9 y+ f) T0 n* H8 J5 S8 v
- *
* o% @; z9 Q. B9 b - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ Q; E! B$ o, e3 }# r - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" A! L$ o0 q7 s. l6 k/ O% e1 R) N
- * TO CHANGE.9 Z+ b& _! A$ S7 v* p
- *
+ S+ r* T3 p1 p; c# H3 W4 v - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 a9 k9 f: S$ m5 C
- *
- @) p/ I9 l- p - * This program is free software; you can redistribute it and/or9 f( a1 H- c( \5 w3 U( |
- * modify it under the terms of the GNU General Public License as6 x! d. g6 C: {) U, K B5 R( t
- * published by the Free Software Foundation version 2.: a! [; ^1 `- F
- *
8 b& P+ w$ b, |( W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, V' `" {% R% c: l, |
- * kind, whether express or implied; without even the implied warranty
- u8 ]4 l. p0 t8 s. D! F3 U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; b6 l7 t$ C- J- \5 p5 |7 z
- * GNU General Public License for more details.' N) j7 L% M! S/ ]. M: R# `4 j* T/ O
- */6 m$ M7 e% o, {
/ f% W$ ?2 k% m/ X$ {9 F- #include <linux/module.h>( e7 x) Z @( Y4 _
- #include <linux/init.h>
; K9 _3 s, t) \# Z* Y - #include <linux/errno.h>% R# B4 A+ L7 I8 U6 B; c
- #include <linux/types.h>( Z3 |1 J/ o3 M
- #include <linux/interrupt.h>' q9 w7 X& _( M; K6 `' n, H* {
- #include <asm/io.h>' i i% e$ ?8 i2 ?* K5 b& X
- #include <linux/moduleparam.h>, G) T) |5 s% x/ ^ N. n0 N
- #include <linux/sysctl.h>
6 D+ i8 H) @' b) D/ c5 E5 e - #include <linux/mm.h>) K9 C1 u" s. o7 s2 a4 }2 P
- #include <linux/dma-mapping.h>
* u, y5 A% k5 Q5 i# _2 R$ l! g
" O! Y1 v) q+ e7 M" Y j- #include <mach/memory.h>$ g# Z/ C3 E9 f6 P2 i6 P; a' m& \3 }
- #include <mach/hardware.h>, K( z+ g+ `0 c# c! d
- #include <mach/irqs.h>
0 s6 U" G( p S' h* k0 ] - #include <asm/hardware/edma.h>
' m' L, q k' z- L: H, y - ! k6 ^- j* J4 e3 }/ z7 Y
- #undef EDMA3_DEBUG1 o0 `* w, x* V1 v) @
- /*#define EDMA3_DEBUG*/8 E3 F7 f5 _' X$ D9 [( v1 d
- - r9 E0 \1 }$ R
- #ifdef EDMA3_DEBUG
3 a7 s2 q* Q6 R6 E4 p) Y+ K% N, o7 u - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 l+ o9 e; g9 D3 u m+ A
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) U/ j; H3 G8 Y% ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 L* N* d* V9 x
- #else
, m3 X5 x& N0 x& p6 w; K. _ - #define DMA_PRINTK( x... )
7 o3 V8 d2 I( y1 _" b - #define DMA_FN_IN/ |2 e3 H$ H' Z
- #define DMA_FN_OUT
: u8 k8 k0 B1 Q5 F - #endif
a: b9 [9 O8 `" L - $ E# e' Q( q6 c/ O) C2 O- k% n' l1 L \
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* l- m5 W. y* H) m, X
- #define STATIC_SHIFT 3% t; V) \7 q( u6 {$ p
- #define TCINTEN_SHIFT 20
% N" i2 I: M. H! G' y2 h - #define ITCINTEN_SHIFT 21: m2 d3 ~' D6 ?
- #define TCCHEN_SHIFT 22 ~7 S0 F! }, d+ I; y* f. c' L
- #define ITCCHEN_SHIFT 23
1 g! W& P3 @) G+ [. K" {! ~
6 d5 B" b4 w) K9 n) h. [. H- static volatile int irqraised1 = 0;8 Z) B$ s# g& R
- static volatile int irqraised2 = 0;
7 [! l6 G z; R. u0 T
# O2 i( v- ] Q5 u: r) P% E2 H7 @- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ X5 J* _, v; y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 r, T- v9 L$ ] - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 |& f# v8 p4 L; W
- , { K- T3 j. ~/ s) X4 Q
- dma_addr_t dmaphyssrc1 = 0;! N; H3 @% i+ f) a6 ?* @/ f; f4 ~+ H
- dma_addr_t dmaphyssrc2 = 0;1 {) \7 Q7 n J9 L5 N+ W, d) a
- dma_addr_t dmaphysdest1 = 0;
! {7 I$ {/ T4 r: Q- d3 a - dma_addr_t dmaphysdest2 = 0;5 {7 C( }1 o. t1 u, F
( U9 F, O, \. G0 Z4 b4 |- char *dmabufsrc1 = NULL;3 \! H9 u9 Z. I1 @
- char *dmabufsrc2 = NULL;( d' r& k, Q. Z' ]& F
- char *dmabufdest1 = NULL;3 {& c. M/ R0 G4 c* p$ B' X. ]
- char *dmabufdest2 = NULL;. h0 o' e X2 ?; Y
- % l* u1 O7 r$ \0 ^4 g q
- static int acnt = 512;
$ z- ]; P4 `! _+ R: F - static int bcnt = 8;4 N; u3 |3 s2 p+ _- k/ B
- static int ccnt = 8; \: R4 w* }$ j% R
& z/ }" k7 `- p" X# l. z% W6 E- module_param(acnt, int, S_IRUGO);( H! F0 I0 q1 i4 v! Q6 E
- module_param(bcnt, int, S_IRUGO);
5 e4 b0 y2 F. X! u3 h! c1 Q - module_param(ccnt, int, S_IRUGO);
复制代码 " U9 s5 w! A( [, a( g2 H" }6 X
. d* n, E7 @, w; N/ j8 U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 {1 b2 D! b2 r" c9 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ Y% c* U4 j P' U
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 p( p; o0 [+ H$ q& Q9 h: [% [3 S j" d; M
4 O2 I# Z* g; |" ^$ J# r6 a$ u |
|