|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' x3 k/ ^- S! z t! c5 L
- [code]EDMA sample test application. V1 i% l, V s* [
- /*) U/ T6 M* N n- _
- * edma_test.c) E6 H0 p! Y5 d. B3 ]
- *
2 e4 x! J( ^: _1 @0 [ - * brief EDMA3 Test Application W+ [" A. p0 @' u: `
- *% R, D0 X. W: ^4 j" U5 \7 N w
- * This file contains EDMA3 Test code. N6 ]( h% q; X
- *
2 x. P# D/ }0 E/ A; [4 L - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- p3 S2 u% `3 [+ A" N! C* \* \2 F. k
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 R" I( O2 x& r& Z: _% J - * TO CHANGE.9 }+ V' R9 m7 `4 ^: p
- *
9 w" r# H8 x$ X' N/ t' Y: ~, J - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 A. m& g5 f3 Q# H7 P$ X/ L
- *
# `5 a, ~5 x( I3 N1 T& u/ X" }1 q8 G - * This program is free software; you can redistribute it and/or8 ]9 Z! h) X2 [, q
- * modify it under the terms of the GNU General Public License as
. Y$ Z/ ~( h4 k* x5 [( p - * published by the Free Software Foundation version 2.( l9 n2 |2 c# f& O
- *5 `, N" b) g) v
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 R+ Z5 c" S5 {5 F: V
- * kind, whether express or implied; without even the implied warranty+ U' {6 p* o1 `* e
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: b' A# |/ [/ l - * GNU General Public License for more details./ T# I; U( x# E, [% r& d! n& F
- */
' n+ K6 K7 B4 m
' Z0 k+ x1 l' A" b- C7 \/ H. _0 J- #include <linux/module.h>
2 S( f' M) ]; d3 s" m' x# i5 i - #include <linux/init.h>4 H6 C1 M; r$ m5 v4 ]& {
- #include <linux/errno.h>
, E+ L- C+ r1 T/ I) e - #include <linux/types.h>
, Z& x; G' Q7 y# {% b; r - #include <linux/interrupt.h> F0 l1 _, I5 Q0 l- @6 R% R
- #include <asm/io.h>
( X& x+ R. w1 s - #include <linux/moduleparam.h>3 x/ {) t. f |, M- h
- #include <linux/sysctl.h>
8 a/ m* I- @& X1 m. Q - #include <linux/mm.h>
x6 ~( `& Y% n" e, E0 z- P - #include <linux/dma-mapping.h>' P) p0 c9 z- I& D( B, W: b
- 2 [; R: J& _0 X4 C. o0 h8 s/ q( I
- #include <mach/memory.h>
8 J& y! S- B" e8 A' X2 R - #include <mach/hardware.h>7 b0 |& ~7 C9 l* V' E% `3 i
- #include <mach/irqs.h>' Z- U% S3 c" i9 r+ h! u; e* x: `' O
- #include <asm/hardware/edma.h>, a9 d6 B: w/ ]* n1 g
4 J9 ^. u% A* H0 E- #undef EDMA3_DEBUG( P+ }$ R5 w# N
- /*#define EDMA3_DEBUG*/' \( J& k% k9 I; U" m5 Q
- 0 y+ D0 B* k4 W4 }) `
- #ifdef EDMA3_DEBUG' }/ {, m3 S* y! q7 `
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& D0 q( c2 t' c& e" a" M6 H( L' b
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 v& V: v4 b8 b$ u% _) N - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ v% T! f. F; W' m
- #else2 l4 {, P# _+ h+ ?
- #define DMA_PRINTK( x... )0 ~. z# H4 k( `- z1 K5 n; S
- #define DMA_FN_IN5 Y8 F; r c% i# m
- #define DMA_FN_OUT
) y- h4 M) Q: X4 A9 F - #endif Y8 z5 b( c& X( Q: p0 g
, a4 }6 F$ p* K, o& u- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ j- ^# _9 g$ |9 j - #define STATIC_SHIFT 3
- t j2 A& Z$ _; `8 Q* g7 r" X - #define TCINTEN_SHIFT 20
+ n0 ? Q1 S) O" t/ ] - #define ITCINTEN_SHIFT 21
) Q2 }8 T; j; `: _$ |, m - #define TCCHEN_SHIFT 22
, C) ?3 {' q8 F! `+ {5 i - #define ITCCHEN_SHIFT 23
7 D- a/ F* M$ a$ u: d' b
2 P% J+ M6 p9 W; ?2 I* h- static volatile int irqraised1 = 0;" i( h& n H% S& |1 k4 V$ y
- static volatile int irqraised2 = 0;
/ T& F2 j3 S& Q. i, s - 1 J6 G, K/ S$ p) ~8 z0 [# C& L
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ Z/ z) ]" D. r% k! G7 Z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 P" \) o# \8 I" f0 X6 ?) p I - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* y8 n+ ^) N* A) V; P - " U2 U. J, `4 n
- dma_addr_t dmaphyssrc1 = 0;
+ L7 p& D; p4 C3 j - dma_addr_t dmaphyssrc2 = 0;
* g# z9 a F8 C+ j) u1 N& c - dma_addr_t dmaphysdest1 = 0;- B- R( V' |* P& Y6 h+ p
- dma_addr_t dmaphysdest2 = 0;
" d6 m4 i4 a' D3 o9 ?3 \7 U
/ K0 n) z( ^/ `6 N- k' q* R- char *dmabufsrc1 = NULL;
$ ~2 `" I' p8 C" l! W8 W - char *dmabufsrc2 = NULL;4 ] x. r3 k% K9 ]; f) Y5 t
- char *dmabufdest1 = NULL;
- o* g* k! q) q- x - char *dmabufdest2 = NULL;
* s0 R6 C) t) X: q' O7 Q* V - * Z+ E, w" y! b5 m" Y1 x
- static int acnt = 512;( ^6 X3 S( ~$ [; i+ e9 ?- d
- static int bcnt = 8;* w2 ^8 l* Z: P* h4 O& ~9 L: y
- static int ccnt = 8;
' j! d1 M5 V5 e; x - + p$ I( M" f3 h2 a; }% ?4 j5 d6 z, y! A/ }
- module_param(acnt, int, S_IRUGO);7 \4 y/ N$ U* A( D
- module_param(bcnt, int, S_IRUGO);
9 x) P, G$ Y+ _) x - module_param(ccnt, int, S_IRUGO);
复制代码
+ }( W( S, x4 w6 P9 x z% {5 z1 Z' d5 k4 {5 ]& [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 W; e8 b5 p: \4 u+ X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( ], s/ F9 l2 [3 ]
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
c" D% Z r3 T- G0 U3 ^6 `% z0 t
+ J7 }2 h6 O2 W' s
( G" n5 _% i0 Y+ _- v8 }; w9 y |
|