|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " M/ I5 A- c7 G3 v3 l( i
- [code]EDMA sample test application
1 I+ ^* o* O- g8 g' z6 N8 S/ z; n - /*2 R( Z# l- j0 S) z
- * edma_test.c' M$ t* t' _. F
- *( H# B4 g4 V8 _% e3 o( U
- * brief EDMA3 Test Application
+ V1 h, x6 c$ c3 o8 W. L" x, b5 y* g - *
3 M- }! g, E, p: `. u - * This file contains EDMA3 Test code.1 }) w9 h! H% u
- *& H$ D5 G4 y% q3 o6 l5 J U) L
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
K5 O' Y5 n/ L- \2 k - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& V9 h1 [7 ]0 H, s1 w! K - * TO CHANGE.2 v6 m. o7 o8 F+ H% Y0 O f
- *
: e. O. b! U( g7 y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' B& ?1 |- R1 L - *
, e; z1 q, u9 [7 K! i - * This program is free software; you can redistribute it and/or
* y, ~8 [" `0 n1 K3 U - * modify it under the terms of the GNU General Public License as
+ p. a* M+ V L" B' V; S& | - * published by the Free Software Foundation version 2.6 @* A1 m+ Q' I/ P1 Z9 y
- *
0 H v$ s* {( X! @& S) g ^6 T - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' a+ a# s0 ]7 t - * kind, whether express or implied; without even the implied warranty* p8 e* n( I8 w5 |' G' Z; ]2 b
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: c6 D6 J$ ?) C' i
- * GNU General Public License for more details.4 u/ e% z) h$ T2 K- N
- */
1 F/ }8 T& E& [4 }' c# E. l
]9 ~8 a5 c4 O- #include <linux/module.h>
, c9 J' G; i/ e( y - #include <linux/init.h>
: s* d/ m& w U: J" S$ ? - #include <linux/errno.h>
: x, K q: s: e2 E - #include <linux/types.h>2 `" b/ p* L8 O6 m3 {" @ f
- #include <linux/interrupt.h>8 p* p6 t! u, ]% u- A
- #include <asm/io.h>7 M8 }# @$ \4 c0 j
- #include <linux/moduleparam.h>) _( }' E3 K/ f2 n$ `: M: h% G
- #include <linux/sysctl.h>
8 ]* o( k7 N" P% A - #include <linux/mm.h>2 V+ U8 l9 V- y" l! P
- #include <linux/dma-mapping.h>
! \5 V) F# J0 |. u+ H" V. m9 E& x
- t1 B, g# B, B6 i- N- #include <mach/memory.h>0 S& L- o2 V( r) U+ z0 q
- #include <mach/hardware.h>! B: U) `) t1 O8 A- C' L
- #include <mach/irqs.h>
% ?8 n! N% o! U2 \, g- } - #include <asm/hardware/edma.h>
* t p" \& |* r6 R+ D- E" r3 b
2 J1 H) u: S8 c! m. Z- f- #undef EDMA3_DEBUG o6 R2 k1 S1 F4 `8 ?2 D& n- C I
- /*#define EDMA3_DEBUG*/9 c" N9 n ]0 R( c
- , c: r$ n7 X o. J
- #ifdef EDMA3_DEBUG
& z# `5 o5 t9 S! R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 e) h+ _4 D$ o6 S: @5 F7 D
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) U$ N1 O" Y) V2 C, }; Q8 c" [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# R+ z: @6 e6 Y2 I, a
- #else1 Y1 j4 }1 a+ E6 r
- #define DMA_PRINTK( x... )# w$ Q) i3 L, P' ~# y Y3 k: h) Y
- #define DMA_FN_IN3 U1 `! |& w! T7 g8 O# j0 t1 K! G/ X
- #define DMA_FN_OUT
5 s) \5 r4 k- n( F - #endif
T) _, {. N+ y" F# A3 \
9 S# ~: ?- Z) E+ `# m" v5 o+ U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 A) W, n W- t6 b9 ^5 l; h
- #define STATIC_SHIFT 3/ F0 F( D, b% F, ]1 C: N
- #define TCINTEN_SHIFT 20; ^% G/ T2 V9 v
- #define ITCINTEN_SHIFT 21
# @! j, W Y% h& C2 Y- i9 Z# y - #define TCCHEN_SHIFT 227 k9 W7 N% O* D) r7 o
- #define ITCCHEN_SHIFT 23% d9 Q2 g& Z! Q4 E" u* ^) G
/ W& j. z& J) \. z* e7 C' k- static volatile int irqraised1 = 0; M. ]% J7 P+ o2 I5 w& N
- static volatile int irqraised2 = 0;
' Z, Y" m/ R1 V4 { - 6 u; B5 z& o8 U0 k ~) t/ G L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) X) m9 }' x* X# D+ F
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. c: ?& W2 f: k! `4 _: @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 j. q* t4 T7 f' M
- 2 T' {2 F5 ?$ d" ~. \- n
- dma_addr_t dmaphyssrc1 = 0;
; L6 a+ ?1 m7 c8 S - dma_addr_t dmaphyssrc2 = 0;
" P* G- M7 s1 G - dma_addr_t dmaphysdest1 = 0;
+ x" S- i m% }+ Z+ C - dma_addr_t dmaphysdest2 = 0;
6 E& z& ~1 F$ F4 N
7 H) I: `' Z+ y7 g- char *dmabufsrc1 = NULL;2 \7 l! |8 r! |1 M3 U5 M
- char *dmabufsrc2 = NULL;7 i" J& ^5 i' c; ]0 I
- char *dmabufdest1 = NULL;
0 o8 y; l1 U" J* w& o7 t - char *dmabufdest2 = NULL;9 H3 `( ^0 V* ] }
W) |& m, v, l4 |! a- static int acnt = 512;& t" j- p, a7 t9 }' A6 W. X
- static int bcnt = 8;
" c& p5 }. j8 J/ x2 X - static int ccnt = 8;) e9 j( ?# l1 k: A2 x
/ X4 D# p1 E% I. ? g* _, b- module_param(acnt, int, S_IRUGO);* m9 i2 W. j6 l: S7 v$ N) R. Q
- module_param(bcnt, int, S_IRUGO);1 N* ]/ g/ m! V
- module_param(ccnt, int, S_IRUGO);
复制代码
6 \! l! _4 X" L4 u7 p9 k
) d( Z9 U8 _! S* h! Z. D* m4 k* H5 I3 k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ v/ M/ U% b9 f/ g2 `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' K0 w" R0 h+ \; [- ?6 n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) _+ S8 J1 z3 J8 M
; u; M+ B/ S, e8 i; v! S
8 d/ f/ q: G; K0 {0 }6 s5 x+ p8 } |
|