|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- j' \9 `8 v2 U o+ C- [code]EDMA sample test application
) h& W! B( g/ B8 ^ - /*; {3 m; j- v3 E- H+ n5 _
- * edma_test.c
; n, s5 ~0 R6 d1 `5 `: l9 o - *
5 q+ y$ }) s+ A! ?- n$ `- S - * brief EDMA3 Test Application$ t" V& L. | ?) a0 [5 l
- *
; t# h3 B4 w2 _5 `6 ~ - * This file contains EDMA3 Test code.! r0 q8 v) _' D2 k+ _4 s
- *3 n6 m4 q5 M/ {1 |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ {0 N2 o6 T4 c: r: A+ E - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 V# i, s3 [# L - * TO CHANGE.
4 v ~6 V$ _- q0 J4 v* ? - *
' R& m+ V9 _8 x( r9 T* b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 T+ `( `" t$ c7 X
- *! \( S& f7 Z, Y$ f) w
- * This program is free software; you can redistribute it and/or% P8 t9 Z, B( E7 H7 a
- * modify it under the terms of the GNU General Public License as' c- @1 G$ D5 R. v a
- * published by the Free Software Foundation version 2.8 [0 \1 d% r5 P- t& P, f
- *# B# P+ T5 L; M5 X6 K; U
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ g/ i: V8 R" \8 i* q/ k( c - * kind, whether express or implied; without even the implied warranty+ u" {. b/ F- l: Q, r& Q
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: m$ S8 U) M4 t% v, F0 @9 T - * GNU General Public License for more details.$ ?6 i) i1 ^8 a, L" R
- */
* J8 {: K% e5 x; J, k9 G - 7 [7 H ^+ @1 e' c7 i% `, v
- #include <linux/module.h>
$ p3 ?; I) {7 |) H - #include <linux/init.h>
# l8 g- E- k2 b% W6 U - #include <linux/errno.h>
1 ]5 L/ J9 z; g c- z4 r - #include <linux/types.h>9 f: p- H) t. @% W6 X
- #include <linux/interrupt.h>
- J5 x8 J9 d2 u+ Z" x - #include <asm/io.h>
{; w2 _$ b; o, ]: |) L - #include <linux/moduleparam.h>
4 h' z Y% j) ?+ O - #include <linux/sysctl.h>5 E! b2 I! t- \3 h' H* h# d
- #include <linux/mm.h>
6 @7 m' G+ N9 c; h1 T' k) W! @ - #include <linux/dma-mapping.h>& t% R! }2 D/ Q' ?4 _- }% v
* i1 t; H! H; d0 [0 f6 }- #include <mach/memory.h>
# j/ u$ Y* |2 m. p - #include <mach/hardware.h>
) p2 c0 h! \6 z$ R; ~; h7 m+ x - #include <mach/irqs.h>' |; I0 w; H6 o$ `
- #include <asm/hardware/edma.h>
& b* {! x: l" ~- {8 E3 [ - $ X1 V S* K; S B/ J
- #undef EDMA3_DEBUG# b, Y# y' V9 D% I
- /*#define EDMA3_DEBUG*/+ V8 ^0 L7 T' I8 c3 a. d; P
- % N! g, x w7 E. |3 u6 W) @- z
- #ifdef EDMA3_DEBUG* [. H* K7 f& D( y5 g1 {
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ e) f1 s1 F( o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' [9 Z6 v* ?7 Y* I5 [9 [- y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 d4 ^5 v* p0 j. o+ L0 a% }+ o
- #else
5 J* e; |+ o: n5 f! v- b - #define DMA_PRINTK( x... )# i. m' j! E) r" T3 w
- #define DMA_FN_IN& N; G+ r8 c, A
- #define DMA_FN_OUT" l% G4 P w& ^$ W
- #endif' N' X) L% g5 q( k* E- L
$ c) ~3 x+ w% Q% |# A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 v) Y: }$ s7 x6 x1 c) u
- #define STATIC_SHIFT 3! h0 o( f: a7 L. P
- #define TCINTEN_SHIFT 209 [" ^. M- i j$ M% j6 W2 D: D
- #define ITCINTEN_SHIFT 21' Y: R. k, f' _
- #define TCCHEN_SHIFT 220 N$ m$ m# k* n2 u2 p
- #define ITCCHEN_SHIFT 23# g8 o8 O5 ^; q, T! h5 g- R$ t8 |3 b
$ u& d- P, l, m& }6 h& d& B) S- static volatile int irqraised1 = 0;& T$ _& B+ B# a: G$ C; G
- static volatile int irqraised2 = 0;
+ ]8 l. z0 C6 P: _* r; q: z - 6 _% ^% |# G' S6 b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 L* }6 ]; _- K$ i9 ^* t - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: N, G- j4 t- R! X) G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) n- }) ]) U/ w. \9 f: O - 8 q, g' B" D% \/ F
- dma_addr_t dmaphyssrc1 = 0;
9 A4 O* A! o! ?# B, W( s8 m. Y7 b& m - dma_addr_t dmaphyssrc2 = 0;9 | c' n7 U6 d+ l8 U
- dma_addr_t dmaphysdest1 = 0;( z# o0 ]" Z+ u! \) O
- dma_addr_t dmaphysdest2 = 0;7 g0 e3 m( v0 e, ~7 z; `$ I
" ~9 R1 L; q6 I% l$ w- char *dmabufsrc1 = NULL;
- @! H# k2 J& h0 h: P: f - char *dmabufsrc2 = NULL;
5 y$ t( N2 j+ ~- Q& N+ f2 w - char *dmabufdest1 = NULL;1 Z. z3 B+ d; R8 Z- @3 A
- char *dmabufdest2 = NULL;
* d5 p5 S( g) \5 r: @
1 ?) A: E2 d l) ?8 C: C- static int acnt = 512;, m" ?# N- U- T( O
- static int bcnt = 8;
9 J0 L9 _# Q* F( _* F; V - static int ccnt = 8;: F0 E& ^. L2 F* U7 C4 ^
9 \9 B# q' B H' Q- module_param(acnt, int, S_IRUGO);
; T6 R9 \. J% ?$ g" N" b- f/ f - module_param(bcnt, int, S_IRUGO);
% u* i& ?" {1 a s$ b" K - module_param(ccnt, int, S_IRUGO);
复制代码 ; A8 z( D# `( c( N, q
3 z7 s$ p, ?8 Z* |
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 e. Z+ A% T7 i, U3 K# t2 U0 V
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: f5 o+ f Q0 Y- x! [( _2 O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ g h7 Y" W1 @2 ^0 b: _3 I9 p! {) N6 x W; a& [
2 }" d3 {7 ]3 O
|
|