|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * m8 J* O- P5 Y0 p+ t, N
- [code]EDMA sample test application( v4 ~. _+ l! X# l! U2 ^& n
- /*- w5 j. x" p& Q% q7 K
- * edma_test.c$ o8 ]* x. e" e
- *
( }" ]5 `" t; B. ^ - * brief EDMA3 Test Application; h" C4 B: M, X" I! W! r+ J5 s
- *
% q7 u3 ]1 a4 ~0 Z - * This file contains EDMA3 Test code.
! e; q4 @9 L) ]" D! ? - *; j; z0 A! [. J9 t( s1 `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 |8 ~+ t& e& R
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ R+ N5 r; T* j7 V* i( X - * TO CHANGE.9 E9 A5 x/ n( i& g8 {0 _% t$ l# |
- *' e7 o/ k n, A# x5 U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 g- ?+ V- ^* h2 w m9 D
- *
- C" m7 ~0 f9 g- u5 _ - * This program is free software; you can redistribute it and/or+ A8 y6 H1 g; }: \
- * modify it under the terms of the GNU General Public License as, J2 I; e3 s+ _' {: X
- * published by the Free Software Foundation version 2.
# a2 q4 d6 L H$ f$ i - *1 b) H. q2 M# w% d
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any& Q" n2 e' Y6 L% Z9 S4 Z4 |
- * kind, whether express or implied; without even the implied warranty- o U( l; H8 T4 I7 d- K
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 D! d) {, C2 A T3 Z2 B - * GNU General Public License for more details.
' m* M8 @5 f, Z5 ~$ l7 g - */5 v+ w7 `- k/ f- A5 e: O( I2 @
- , v6 p( V) L% \- m1 D
- #include <linux/module.h>3 M0 ^9 f" o* q3 Q" @: {; i P
- #include <linux/init.h>/ w) T& n. `+ G4 p" n
- #include <linux/errno.h>3 C2 ~! L: ^* S% @ Z# s' _2 }
- #include <linux/types.h>" U2 B$ N+ x1 ~( U1 }
- #include <linux/interrupt.h>8 X. c- Z$ B& b) U, m' W$ m! q
- #include <asm/io.h>
" g7 D- u& c8 r5 o/ K% A6 M - #include <linux/moduleparam.h>4 S) L" c; x8 u# _$ T, c
- #include <linux/sysctl.h>
: R/ \# Z% O+ n' j# r% L, s - #include <linux/mm.h>7 `0 G. O0 V. x
- #include <linux/dma-mapping.h>
- G/ A% j" y/ v! b9 p$ R
5 @9 P% D9 U) P1 t7 o* P- #include <mach/memory.h>
3 Y/ i/ k3 j% `2 z; j V" @: X - #include <mach/hardware.h>
9 P% f/ c7 ?' M( E, u/ z$ W" q! I - #include <mach/irqs.h>
]0 W% q g. u9 y" B( D - #include <asm/hardware/edma.h>
7 Q- x1 O3 T5 \1 ` - # u1 g. `! O' W7 c$ O; N, Q8 ^
- #undef EDMA3_DEBUG
+ z; G2 j/ T' I; Y1 | - /*#define EDMA3_DEBUG*/" S/ _ M2 t$ T& C
4 P3 V. @7 \/ e5 R- #ifdef EDMA3_DEBUG
9 ~; s) }& F0 h0 b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# Y# [4 e8 E! V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ T+ H3 k% k7 {+ f0 S
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ I5 t# Q7 E+ t9 G" B3 J9 _ - #else* @9 ] Z7 ^0 t: W: y
- #define DMA_PRINTK( x... )
* L% j2 B6 A1 j/ r; M - #define DMA_FN_IN4 T; K2 c" T7 C3 m& T' _
- #define DMA_FN_OUT
3 b0 Q# C8 W* v( ? n8 H0 _ R" J - #endif
1 [# j+ ?3 i9 j: [) _: S - 0 u; n0 U4 }8 }0 I) M+ D7 N
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: v! y9 a5 e& b8 M - #define STATIC_SHIFT 3
9 d0 u. `3 I q3 C) |9 T* ]$ s - #define TCINTEN_SHIFT 20' s0 H8 z& H7 m7 v, s7 @5 d
- #define ITCINTEN_SHIFT 21( O* ?) M4 ~# Y. x5 R
- #define TCCHEN_SHIFT 22) a, C# D% }$ L3 p3 `5 P
- #define ITCCHEN_SHIFT 23
( E; \; n, f1 | V8 _. s) g - 6 T* Y8 X+ `0 O8 v" h& w$ t- s
- static volatile int irqraised1 = 0;6 E) T: u! a# V( j! G* G
- static volatile int irqraised2 = 0;( j8 I% ?+ g* D
- 8 |, Q3 ?7 I! |3 J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* Z2 P( @1 j6 v- w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" G h2 M+ p4 `" s" {) w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- }3 l7 j8 O/ O
' E" i( C5 F# x5 {- dma_addr_t dmaphyssrc1 = 0;% _! q4 p* ` K9 m0 T( K
- dma_addr_t dmaphyssrc2 = 0;
0 e" ]& Y$ _: a" a: s - dma_addr_t dmaphysdest1 = 0;
A; A; h4 |7 p: U; z0 ^' ? - dma_addr_t dmaphysdest2 = 0;3 X! B- E! l* m$ d' n) v
7 N2 B/ G. e% n7 t+ C- char *dmabufsrc1 = NULL;
3 {1 [: K" i6 t% U1 {. b - char *dmabufsrc2 = NULL;$ j/ ?% h: T/ L7 P7 _1 E4 N1 u
- char *dmabufdest1 = NULL;* S1 ~$ I |* r5 ]
- char *dmabufdest2 = NULL;! Z" i: O4 c: l! s, p
- * {: I6 a1 S# t. I% C4 d
- static int acnt = 512;4 @- U+ O( d7 P4 B0 g. `
- static int bcnt = 8;
3 n: m4 P1 h5 \/ @) j) U# _' } - static int ccnt = 8;
8 l! i- P0 I* F
! L* h: G2 O9 Y) l* `- module_param(acnt, int, S_IRUGO);
! {/ D, M3 j# N0 a7 D - module_param(bcnt, int, S_IRUGO);9 {* l3 C- _4 S/ Q7 m {( s
- module_param(ccnt, int, S_IRUGO);
复制代码 5 u$ R5 c1 i. r) e5 j/ }
1 ?9 D F( X0 k7 Q9 B
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 t+ F0 f! s# d$ U9 \9 varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 @6 H7 x0 }0 j$ ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' t {7 U# ^2 O/ _) ~, r
4 b: _! {$ i2 L8 m5 y
3 m( k$ _4 H, @& ?: ^" ` |
|