|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 F% E2 \8 I& U! E0 i* }- [code]EDMA sample test application
0 e% _) K A' t! f, N# l/ T - /*
. i6 q% X( [% e$ ]+ M! {( v) K - * edma_test.c
6 L' S3 {3 m+ V5 {% } - *
6 f0 H$ x3 e* R, U - * brief EDMA3 Test Application) J! Q% R T" s: h; L
- *4 ]" H. d+ \0 Q9 \7 r
- * This file contains EDMA3 Test code.
1 L/ ^2 _* Z# V3 n* s8 ~4 ` - *
6 H5 G7 a6 _5 L8 I - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ T3 S/ v5 S8 K- |5 k) k% ^
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; R' D' c3 b' a0 A' h Z - * TO CHANGE.9 G4 q4 B+ ?7 W7 e
- *
5 C/ u. a2 K4 {6 `2 w - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 x- U J( Y9 U1 G( ]
- *, {, X" y, j0 q: u
- * This program is free software; you can redistribute it and/or
& p) V/ S; V, _% n9 w, A. s - * modify it under the terms of the GNU General Public License as
" j7 _0 v" `1 K) W8 @ - * published by the Free Software Foundation version 2.- K; k6 U H. p4 g$ E% b3 |0 B' F
- *
7 W4 d- k4 Q3 t7 O. ~% \ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 h" D, ~0 i R9 x0 ], u8 R9 Y. w
- * kind, whether express or implied; without even the implied warranty
4 P8 r3 u3 n @1 ? - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( f1 Z. I+ k$ l0 F+ j# B. Q - * GNU General Public License for more details.
5 P& }. ~: x( } - */& Q( T/ \0 C, L7 S G# S
: v4 W) V* u# U3 p! e8 @% F- #include <linux/module.h>- M9 a1 Z4 m) e O1 j! a/ D3 e
- #include <linux/init.h>$ [0 J2 M) z1 P
- #include <linux/errno.h>
. s0 L2 u9 c* ?* _) l - #include <linux/types.h>
( M7 O2 @6 R g - #include <linux/interrupt.h>( l1 {* E; h9 s2 A4 Z; @2 T' f4 Y
- #include <asm/io.h>
" @; |7 q" O6 c5 w+ f - #include <linux/moduleparam.h>6 w1 X5 {+ f- @
- #include <linux/sysctl.h>, B3 t, Y9 o$ d" z; w
- #include <linux/mm.h>% }/ C% b2 T7 Z7 _
- #include <linux/dma-mapping.h>
: U) D7 g- y3 n1 J6 n* a1 B1 F' ` - 9 c9 S5 z7 N" z C2 x5 C
- #include <mach/memory.h>/ Q5 ^8 K7 c8 a; I, Z/ q( I
- #include <mach/hardware.h>
% x& m5 w( ]7 n$ v - #include <mach/irqs.h>' B# I. y4 z2 @# ` w3 z
- #include <asm/hardware/edma.h>$ d1 O2 t0 H C7 n+ W8 ]% G5 }/ G
- 3 r" U- }2 ?" R1 y- l+ c
- #undef EDMA3_DEBUG$ H4 o! \0 r+ N4 {; V; g. e
- /*#define EDMA3_DEBUG*/4 _) O; C. ~% \* z1 T
- " q) {9 [7 g- W9 M- |
- #ifdef EDMA3_DEBUG
( \! m, E+ A8 ?9 J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ n) } V0 J; S8 }+ j2 s3 h
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 @) Y6 D$ p7 H( K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
# }, a+ s* A W, w5 \, U - #else+ K) g. n7 r N: } g4 Y+ v
- #define DMA_PRINTK( x... )
- b( j. N; |& `* ?9 L. p k - #define DMA_FN_IN+ f; M+ U# b4 }
- #define DMA_FN_OUT
3 W% g' N) E4 c4 h# w9 l - #endif- q4 Q+ q$ P1 ^1 u8 {( J- g0 b. p
- 9 u0 [6 V7 v; e( U) V7 e. V2 i
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; z2 C+ o. Y8 K4 V - #define STATIC_SHIFT 3/ ^- P9 a9 E/ N3 v
- #define TCINTEN_SHIFT 20/ a+ F3 P4 E( @3 A4 d' B6 B, W
- #define ITCINTEN_SHIFT 21
U& e& H3 B7 O - #define TCCHEN_SHIFT 22
2 a, W" ?, j$ o4 g* K - #define ITCCHEN_SHIFT 23
2 [4 L$ k h" O6 r
% c* ~% t {7 ? i* ^7 Y4 l( m- static volatile int irqraised1 = 0;. J7 J& k: ]4 n& A" b
- static volatile int irqraised2 = 0;
* T3 Z0 L. D: [4 I* n - 8 ~3 t* ~- j# i# v0 u
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); k& H, K4 w! o l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) L" [, D" V5 H V* ^' j1 E - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
U4 E3 p+ a6 N+ |0 w% ~ - % D6 X: G5 q( ^# h
- dma_addr_t dmaphyssrc1 = 0;' z5 w( W [9 d$ S! X/ `# h3 L
- dma_addr_t dmaphyssrc2 = 0;
3 }. m2 p9 E3 [9 ? - dma_addr_t dmaphysdest1 = 0;
_ `: x0 t I8 h - dma_addr_t dmaphysdest2 = 0;
% N- m7 e" P7 C: A
! S: t3 r8 s9 N1 q( I- char *dmabufsrc1 = NULL;
3 o9 O4 S: M1 |5 q7 |) b - char *dmabufsrc2 = NULL;6 q+ {' S- r" `! ?6 O2 C: O' U- Y
- char *dmabufdest1 = NULL;6 M. L V+ [( d* V R
- char *dmabufdest2 = NULL;6 V) X! R2 }% Y4 e% n7 [
: u9 Z! B8 q: Y3 q- static int acnt = 512;
* V7 j8 _4 u8 z% O2 d - static int bcnt = 8;
5 C1 @" o5 g5 \% x; N* O2 a - static int ccnt = 8;
: x! T" u, ^2 N5 [, P; ]8 G
- w8 ^0 ~( ?1 ]$ G* G6 L' i- module_param(acnt, int, S_IRUGO);
& g8 j* {: \9 r* N - module_param(bcnt, int, S_IRUGO); _$ C% F; l) \' X6 @. N
- module_param(ccnt, int, S_IRUGO);
复制代码
. F0 V) [/ M7 P4 a- W- ^
( |' u1 T1 |4 `6 x) r0 h1 p1 W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- j* |' b0 z8 y0 o0 W* I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# c% e0 o) a/ B# ^ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' L" m* {9 g. U p" ?2 F, Y
, T% A& }; a& o$ b# B/ ?2 |, P* L1 E! L% W# E5 x: `' S' _( G# N
|
|