|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 ~3 @% I$ v, f: D( A7 Z0 m- [code]EDMA sample test application
+ D; o- E3 Y3 x3 m0 Y4 G2 S) q - /*
+ ]+ r6 S6 [! U2 l7 f: ` - * edma_test.c4 l% c& [: T, D! y8 l: N. b7 S& f
- *
2 z# g5 H& {% i& {3 t - * brief EDMA3 Test Application
7 [, d/ i" F& ] - *
4 ~8 Q% a+ q. N, b3 r c - * This file contains EDMA3 Test code.
" I3 A% O6 Q m - *
2 ~2 o7 _) p; X# r' E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! V: R1 j1 R8 U8 {% }. b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 x) ^9 x) Q5 I! t" F
- * TO CHANGE.
9 |0 ^ X, r- u$ O. W2 s6 \ - */ P7 C/ E ~% A, r0 H* ~! b
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
- ?/ K. X" U+ k+ g* J* { - *0 H0 S* F5 q3 C& t' j5 o& t7 W) Z3 d
- * This program is free software; you can redistribute it and/or
6 J3 n0 Z+ I9 [# D3 H - * modify it under the terms of the GNU General Public License as
$ p; S( s0 y. {; I - * published by the Free Software Foundation version 2.0 y9 V+ Z3 q8 Q
- *
$ b6 I: e u. R9 ^$ K' V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 V2 n" ~) _ A% F - * kind, whether express or implied; without even the implied warranty
, Z# N ?' o, N: F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 s6 U7 L; P9 b2 J: m$ I' L# F - * GNU General Public License for more details.+ v% g( T9 u" y) |$ V
- */
# M) N: g4 ^ h0 T; T - * M( A4 P m1 X \) O. W; ?# Y4 W
- #include <linux/module.h>
5 j; C4 G8 O; a! ]8 d% M0 h - #include <linux/init.h>
: H8 u! H6 P0 ?& Z% G& J4 V! W - #include <linux/errno.h>
: ~5 j! m0 u9 k8 U. K/ H/ m - #include <linux/types.h>3 d3 i6 w' g" Y) Y; i. I& i1 V* A
- #include <linux/interrupt.h>* Y0 ?4 k. C5 T0 I9 l
- #include <asm/io.h>
# ^* l$ i9 p! F3 g$ _0 m - #include <linux/moduleparam.h>
/ X& z# z' L9 L - #include <linux/sysctl.h>+ c6 g/ F9 G- N; u& F' J4 {0 i [8 T
- #include <linux/mm.h>
4 q! y1 {5 W5 p( X2 m - #include <linux/dma-mapping.h>
/ L% M4 G- L. D: u: j - ; {; u2 J% [" \8 D- y
- #include <mach/memory.h>1 J0 n/ I3 G, S
- #include <mach/hardware.h>9 w8 t/ l5 w0 o( O
- #include <mach/irqs.h>
! n/ M9 b4 v F6 N& `9 ? - #include <asm/hardware/edma.h>
f1 j1 t; v- w
' z6 T6 h) \3 W' d9 ^- #undef EDMA3_DEBUG
h h# N: X- t" `) T0 a - /*#define EDMA3_DEBUG*/9 y; \) }& U3 n& T
% d- L4 U4 Q7 s; B9 M- #ifdef EDMA3_DEBUG. t L# g' }* ]6 i. B1 |1 g) N3 _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# w; \& }% q& \) N - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( |4 G' M3 g& r7 \; W4 ]0 X/ w& W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: [0 G! } @( w8 O& [& W1 }% P! s - #else! c9 W. v) Y1 Y' `9 o) L. `% P# k
- #define DMA_PRINTK( x... )0 V; Z/ D) N" g0 j( m4 T' }( n9 O, `
- #define DMA_FN_IN
\* M3 g5 m. Z" {9 G2 X - #define DMA_FN_OUT4 W+ i' W* E8 |5 C4 t
- #endif) _, F3 u) E: v
- 5 U1 H+ [7 {% [) U/ E7 ~, e" f. g# @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768); `& H+ p# P& N1 r
- #define STATIC_SHIFT 3% ]- p/ }" L1 ^: V3 V
- #define TCINTEN_SHIFT 20: [1 Q$ x; R( O& c
- #define ITCINTEN_SHIFT 21
$ [ s" Y6 ]( u# ~, b& q/ Q! J( h - #define TCCHEN_SHIFT 22
( |7 x- Z# U% ]' R9 e1 {$ w7 N - #define ITCCHEN_SHIFT 23
6 L1 X4 w2 `! o3 }- U - / a2 t5 E- G9 a! l `3 c) {
- static volatile int irqraised1 = 0;
- J8 ~5 E/ X- P1 m5 h - static volatile int irqraised2 = 0;
) Q: a3 Z+ G% A2 v6 N: B+ s% d
V O) |) G8 [; F9 o# o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 D9 L5 a/ B; T. i
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 i- x3 _6 v# Y6 }8 I4 y1 r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 S# g9 f( z; I4 h3 p9 U, B' y
) e7 _) ?% F' D/ S4 v# q- dma_addr_t dmaphyssrc1 = 0;
# g7 Z4 [* f" K4 L - dma_addr_t dmaphyssrc2 = 0;/ F# \% `& |+ }( c$ U0 `
- dma_addr_t dmaphysdest1 = 0;/ P3 B2 e' V# L; r- o/ D! E! X6 ?
- dma_addr_t dmaphysdest2 = 0;: X8 O: S1 w% k
$ N. E9 O1 T) w7 ]- m3 j; C" b' N- char *dmabufsrc1 = NULL;' K3 g3 ]7 @- X2 F& I$ d: v$ q) X7 l
- char *dmabufsrc2 = NULL;
+ G. n, d. g: ?" D }& U! E - char *dmabufdest1 = NULL;
2 L2 b7 F$ G1 Q4 V3 [! o* y. J - char *dmabufdest2 = NULL;
* @% g) w9 S. U' v( U8 c" P4 _ - 3 y+ ]; P7 G+ J, j; v' X$ q
- static int acnt = 512;
. r. H, g/ J% q3 T# c4 B - static int bcnt = 8;( L3 C. t0 p Q
- static int ccnt = 8;2 S) |6 W5 s- N5 X: k# r
- & T$ g- A |+ D; ?8 r- }' Q
- module_param(acnt, int, S_IRUGO);) D3 \3 I3 D& x1 d4 i. C1 D1 g: H
- module_param(bcnt, int, S_IRUGO);/ J; {3 y9 ^2 |& ~ C; ~
- module_param(ccnt, int, S_IRUGO);
复制代码 $ T: F7 o" |/ ]) ^; k1 C
+ D- D N8 K* ~; c1 J9 t' i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! U/ T- q4 ^6 o6 m. Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 h3 ^# M8 B# Y/ r; F6 T9 ~ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& [. c1 V# g6 G3 q: g [! t
7 o/ v/ B+ [ Z' E+ X
9 v0 }3 D: A" L8 G/ T6 i |
|