|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 q0 Y2 m2 C: e+ C
- [code]EDMA sample test application( a: m' P$ M5 d" d" X$ n+ y3 m
- /*, _" @: o; `# {) j/ T. V* t. Y% }
- * edma_test.c
% W1 e& ~) n5 W% h - *
9 ^# m7 E) D3 L, f - * brief EDMA3 Test Application
A j1 O/ R9 p - *; }) f' f$ J$ R( F. P+ b3 T( X9 V
- * This file contains EDMA3 Test code.
) }+ T. y' j/ f2 p, ] - *0 }. s, t; ] F
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# f9 i- b) k) v% B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! P1 y, b- S1 r: u
- * TO CHANGE.5 q7 g2 S( R. Y
- *
1 M( @' e0 o3 s/ ~' U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 R- G5 |( s r5 `6 x - *
# q. Z/ h z: K - * This program is free software; you can redistribute it and/or+ \% o2 N% C @. ?3 }7 T4 K1 t
- * modify it under the terms of the GNU General Public License as2 e& p' @" S' m" M9 `
- * published by the Free Software Foundation version 2.
2 {/ @3 v4 w; C4 r1 ? - *
' r9 [4 u# H0 @1 Y. A! k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 \" c( h/ ?2 `
- * kind, whether express or implied; without even the implied warranty U7 p5 O0 ]! ]4 a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ k# ?# H% u9 ^+ C- A1 Y- d& ^
- * GNU General Public License for more details.
% F( c5 b& T+ ~- @, \: ~) J - */
9 {) Z: k8 j( X: P3 H% X- X5 H$ H - 1 j' s6 ]. p# _$ X
- #include <linux/module.h>
7 ?7 B9 ~$ C3 \7 X9 D* ] - #include <linux/init.h>* ?2 D! ]/ r# z3 J- H. A: a0 g
- #include <linux/errno.h>
( m" |1 `# b+ l( T9 ^9 p) T% { - #include <linux/types.h>5 {+ Y: T5 q6 Y! p* s% h
- #include <linux/interrupt.h>
2 c$ R, t' @: b K, n! b - #include <asm/io.h>
* ^) G, g( [8 I. W5 r - #include <linux/moduleparam.h>) Y! i2 m6 @( K3 v8 N5 Y) v6 t7 M- `
- #include <linux/sysctl.h>; c7 h. g, q' D% Y( v
- #include <linux/mm.h>8 S* ?* v+ j1 z2 K8 P
- #include <linux/dma-mapping.h>
/ `+ R4 E" T8 }, q - 1 K% E2 z' `9 a4 d
- #include <mach/memory.h>4 Z8 B2 C6 q. q8 }
- #include <mach/hardware.h>
0 m* w# z5 c9 ]6 @ - #include <mach/irqs.h>
1 o- y8 j; t7 y; j" t - #include <asm/hardware/edma.h>. X0 f, W! K2 V. `
% _, u( v) M% A9 g$ ?- #undef EDMA3_DEBUG
! C3 J* }# b6 ~2 v0 I/ N. g- ~ - /*#define EDMA3_DEBUG*/3 ^. E# Y# N6 U& }
3 T2 [# [0 Z# {3 d- #ifdef EDMA3_DEBUG
8 M) U3 e4 C+ z3 r0 T( g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 a$ E# k6 x l! K0 V7 q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 P' P# C" }# w0 `5 p$ ] r - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( H* Q( v- r$ _/ O, u
- #else
) y4 ^ ^1 e: T* O6 d$ \ - #define DMA_PRINTK( x... )$ a8 S# a: J2 A" f- X6 X
- #define DMA_FN_IN7 h, ?+ C, } F. S4 T/ A
- #define DMA_FN_OUT
8 R0 W9 L0 t; \% F; ` - #endif/ W) r, T5 \1 V* [( [, ^
- ) E- N% d5 ]- [5 |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) Z$ s4 U$ y# P8 L
- #define STATIC_SHIFT 3
0 y) Q$ y$ ]7 f* s+ L4 B4 e' O. K3 i d - #define TCINTEN_SHIFT 20
% }& o- k3 b! f* ~) K; W - #define ITCINTEN_SHIFT 21
: D- @6 W. l8 z: z- B - #define TCCHEN_SHIFT 227 ]3 i3 B1 \. W) ]% ~; x
- #define ITCCHEN_SHIFT 23
$ e, G* Y" l( R: c
% W% C. y8 R5 D, N* T3 t$ T( g, t- static volatile int irqraised1 = 0;; t& k3 r/ c" Z8 H7 u0 Z1 M/ L
- static volatile int irqraised2 = 0;
9 V/ W0 X6 i1 X) N# V6 b - * w% J% V0 j# |. D/ s
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 V2 I+ y; k. H: X. E! r
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. D, Y$ V9 g6 N9 o5 g4 ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 O% g8 k T2 y9 t& C O
, k6 V1 X9 T0 ~7 Y4 H- dma_addr_t dmaphyssrc1 = 0;! c% v% L0 B: O: x! P4 U; |% B5 x4 C
- dma_addr_t dmaphyssrc2 = 0;
' r' |' z+ L9 B( x) H - dma_addr_t dmaphysdest1 = 0;
. p% {. @) G6 T2 E$ |; ~ - dma_addr_t dmaphysdest2 = 0;$ _) @6 r# [( k4 S
- ! d8 `% f# ~& d
- char *dmabufsrc1 = NULL;
4 ?( X) u- A' U: H - char *dmabufsrc2 = NULL;
9 M' H4 T- E3 n7 U% E - char *dmabufdest1 = NULL;( @7 x& J8 B# d0 S" H$ u( ]
- char *dmabufdest2 = NULL;
( r# A; y3 h7 ?6 d( A/ s - # m0 S" k9 P7 g4 a
- static int acnt = 512;* Y8 w+ I9 u \% X0 V
- static int bcnt = 8;9 _% G, D9 z8 F9 h
- static int ccnt = 8;' ]3 |2 m1 @ N* E
- ! ]0 ^4 G- @# G3 s3 A0 {
- module_param(acnt, int, S_IRUGO);
. }( Z% t2 v* Q. |, P - module_param(bcnt, int, S_IRUGO);; \; S o) y/ g1 w% J! U) n
- module_param(ccnt, int, S_IRUGO);
复制代码 8 N: f6 e/ b# c% ~1 c
+ X2 u' ~1 b* @0 [% M0 |: k
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 C/ L5 G0 l% O' G% X c" T' k# Z+ T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ K- G( ?, P" i) S, S, f
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. Q+ n! |$ K/ i+ Y
! P2 R& f/ ~' T% Z& e, q9 n( \: U7 b+ K: M; v+ `' j/ z
|
|