|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * i0 S( o) N" p2 ~5 k0 T
- [code]EDMA sample test application" ^6 G3 V$ y0 m
- /*; g/ n& H. X& N2 ^( Q7 ?% y
- * edma_test.c
% U9 T7 o( e1 q - *
( S; a) M6 i" g3 Y b( U& l- n! J - * brief EDMA3 Test Application6 K3 A9 l, h2 }8 B/ `
- *: t5 Q5 n7 C1 i2 z
- * This file contains EDMA3 Test code.: O$ U/ a! M' j8 w
- *
X8 @; z' Q5 c& D! T( d) ~& k% j9 S x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
I. h D) ~7 L+ D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( L' B: v3 M a7 |
- * TO CHANGE.
8 `* Z* R) _% J3 ]; `. Y - *
: |& @# F) y( x; @ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# i4 I( Z8 N/ {! R3 g% e
- *$ P3 ^" F# b" T! y4 B" P0 r0 h9 s
- * This program is free software; you can redistribute it and/or
{' C; V+ S1 R0 ~* G6 F. S% r - * modify it under the terms of the GNU General Public License as
0 b" v, B6 p8 a- W- { - * published by the Free Software Foundation version 2.( ]$ v+ S9 J2 X$ {& I. d
- *+ G4 v) ^, ~4 H% }* _
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, w+ p% N1 K& @/ Q! r
- * kind, whether express or implied; without even the implied warranty
5 U; V o# ?% {1 \, K* z& B - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: d \, ^8 s, [6 d0 @
- * GNU General Public License for more details.
! c6 E0 T5 L1 X+ R - */. M7 {3 s2 E7 {1 ]' Q
- 2 i+ [) N; P; j9 i3 F6 C
- #include <linux/module.h>
/ Y! l1 b7 [- T$ Q - #include <linux/init.h>4 v* K5 s7 W5 v2 f/ C
- #include <linux/errno.h>
9 a+ y: J+ R$ D) J Z - #include <linux/types.h>
( r1 u. y2 H+ P5 ?5 g; _ - #include <linux/interrupt.h>+ N2 D1 K0 ]' G" j8 h. c
- #include <asm/io.h>
) `% R6 {; q" \ Q, G# S - #include <linux/moduleparam.h>, O/ z# ? u: F( o$ t
- #include <linux/sysctl.h>2 s$ K+ O; x# X+ Z0 y3 n
- #include <linux/mm.h>( C1 {9 k4 X# B$ z& t/ m
- #include <linux/dma-mapping.h>5 R/ A4 L- l0 ]$ `5 `. w
- / a. n) J; D J0 m5 Z
- #include <mach/memory.h>
& e/ N3 |' a, s& e" I - #include <mach/hardware.h>
* ]" ?( J8 n1 w8 e - #include <mach/irqs.h>" x0 J8 Z: _; b9 @
- #include <asm/hardware/edma.h>
1 T: v6 k' |1 d1 I) @% C( Q% a - n9 P; }8 [; p2 A# M
- #undef EDMA3_DEBUG
+ c9 s( F7 I5 q! F0 L" M! R - /*#define EDMA3_DEBUG*/- R0 H3 w4 A; u3 T2 b0 p
5 f: O) m; p9 N: F, X( r- #ifdef EDMA3_DEBUG
! K. j- `5 X: }0 j% | - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 x' [% _# n g( ~* G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 t4 `( ^4 e0 \6 h& W3 W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! H0 N$ g- B6 ]# I - #else
+ `) W3 t& w' x( V8 F - #define DMA_PRINTK( x... )
7 `5 \( T- V- K6 n7 |) P* h - #define DMA_FN_IN
1 y1 F- E2 h6 c$ {" b - #define DMA_FN_OUT$ Q E/ W) M B/ u+ ?
- #endif
- `8 e: b% S. l, `0 P# k - 8 R b4 \, ]9 h7 W8 C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' X2 k" U. J* e
- #define STATIC_SHIFT 3
3 H" x" y$ K }( v9 x: q - #define TCINTEN_SHIFT 20
" I" W5 J( @: D2 a: D) Y2 { - #define ITCINTEN_SHIFT 216 q2 I; Z$ A7 {# Q z4 s
- #define TCCHEN_SHIFT 22# Q8 [ K2 M# X2 h6 l. A
- #define ITCCHEN_SHIFT 23
( e+ E" D0 N- }/ ?% u$ G - 1 T1 V! d" M- o% ], u& A% V
- static volatile int irqraised1 = 0;
) Y4 _# q. ~; v) E; Z( g - static volatile int irqraised2 = 0;/ ~" @* S" j! c! Z; b
- 8 J1 }' z3 E5 `' G
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) j& g) E' G' N" b5 D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ T* ?! T7 j+ y4 S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- T; C, S+ U' @: s7 P- b
/ d' v8 g$ A; b: y5 @- dma_addr_t dmaphyssrc1 = 0;
% V: ]0 ]- G! S; Y) } - dma_addr_t dmaphyssrc2 = 0;
8 t2 w( K' `7 j" k2 }! U - dma_addr_t dmaphysdest1 = 0;
7 P' B, S9 f9 g, s' L0 Q; c - dma_addr_t dmaphysdest2 = 0;
; b% ^& A/ ^2 x& H5 L5 U1 b - 2 @9 N2 \ S+ k+ e7 q7 Q' g
- char *dmabufsrc1 = NULL; h* N% R) V- p# _: O. {* e+ P; x
- char *dmabufsrc2 = NULL;; n2 g* H% V( q/ X5 a, B$ h
- char *dmabufdest1 = NULL;# @6 U2 n) O+ U0 e# @5 G2 ^ i+ h
- char *dmabufdest2 = NULL;1 l# w; C0 W4 l+ N, f5 W. {% j
- 1 B6 m/ B0 n. Z# R
- static int acnt = 512;( P' n* x( L, R
- static int bcnt = 8;6 S9 t% g& Q1 C7 ]
- static int ccnt = 8;8 b) o3 \! r+ o; O% G: {+ r9 I
9 ^# u& A. S6 `3 d# i- module_param(acnt, int, S_IRUGO);* \0 |+ k% |, u4 P7 w- R( L
- module_param(bcnt, int, S_IRUGO);
" f" Z6 v+ L& W1 u; ` - module_param(ccnt, int, S_IRUGO);
复制代码
. v! i) P( C2 f' e9 M! }- ~7 J% G$ B1 V4 t" I; `
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' m; ?0 A* @# M8 Z* Q3 \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 J& C# G& Z* k) k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# ^8 E/ j6 G7 }) f! _. j" I" o4 I$ b, s& H) E y$ X
$ a" X \) s4 r' b$ ?4 B |
|