|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* d" O i9 X6 f2 W' s4 |- [code]EDMA sample test application
8 N- W0 a" }7 r - /*; J, W/ H: \) t; a: B# U
- * edma_test.c
1 r& J) @. [. U0 I7 K! \# I( ~7 y9 r - *! ?8 z7 X# ^$ P6 T+ T
- * brief EDMA3 Test Application
# _" ^; t2 L$ ?) K: g" U1 u' X6 |2 ~ - *' a& d9 d! W- w' Z- X& D
- * This file contains EDMA3 Test code. G, m3 f! d* Y1 ]# q$ ~
- *
4 q. i. t9 ^9 C1 x! Q& O- B* x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: k' k7 J2 |' O1 P% p - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 T H. H5 O9 Y% ?# p5 e - * TO CHANGE.4 @* m& w) z/ f. R. w# c' a ?2 l
- *
9 T2 a0 a# ?: k# H- i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, t+ c# w/ P; N3 z" ]
- *4 A) C, x+ z4 O( C) ` j6 V N6 a
- * This program is free software; you can redistribute it and/or
( u5 r5 e2 S5 } q' }9 y$ ` - * modify it under the terms of the GNU General Public License as
0 q( n; }3 m0 G: F, y - * published by the Free Software Foundation version 2.
( H0 T- o. F# r4 O& u1 `* v - *) j# c( l" R! p( o4 H( T* l
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 }6 \' Q" { k# v) y4 ^ - * kind, whether express or implied; without even the implied warranty
" ~0 _4 ?$ S2 U) O+ s& [' s - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' K2 m: O: v: F4 E* K5 Z2 F5 H - * GNU General Public License for more details.8 N& v) \0 w4 h. }
- */3 P# _' K! h$ [5 ^7 ?4 }
8 s, X) w2 r7 E- C; k( Z# J3 Z' ~- #include <linux/module.h>
4 q+ v. F# e. a, m - #include <linux/init.h>9 A! {0 Y8 T$ V( u( [
- #include <linux/errno.h>% c2 R( [: M5 W4 N9 t
- #include <linux/types.h>" s; o) S1 C, J- |' H3 L* I
- #include <linux/interrupt.h>: J( _9 s3 c1 ?
- #include <asm/io.h>; W4 }9 q5 K& u2 t3 S" R+ |+ x7 c
- #include <linux/moduleparam.h>
3 J" A, z5 \5 _7 x - #include <linux/sysctl.h>- @# o' p- L: Z* n" p! K5 u
- #include <linux/mm.h>9 W! u' e1 V" Z3 c4 @/ d p y0 G
- #include <linux/dma-mapping.h>+ Q- i. ?! `% I& F* [% \
0 p* [' }9 u9 A! x0 W- #include <mach/memory.h>
' k6 v Q) ]' W9 Z% } - #include <mach/hardware.h>
! _' }7 j: z1 Q& P" Z - #include <mach/irqs.h>1 v5 Q6 E% ^. }* _; H, N
- #include <asm/hardware/edma.h>
! M8 {, @8 h; I8 o - / L2 x% \$ h- D5 E, q
- #undef EDMA3_DEBUG6 R0 z6 E% ^7 E0 f5 q4 }, V8 t% M) _
- /*#define EDMA3_DEBUG*/
; w1 l! M" w& W* E - ) _0 z. p8 Q7 T9 f, l; L
- #ifdef EDMA3_DEBUG- p6 N7 t4 L7 B* t8 N4 Z2 l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* b- B3 M, Y( ^& A" D+ c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 T+ E6 n0 H4 k/ ?) w7 ^4 B
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 |$ J. l( d7 e+ i& s8 W - #else
) p q! d) M+ K7 P: \9 ^5 r! s - #define DMA_PRINTK( x... )
, Q! Z7 [2 _6 ]) j* a; _4 Q - #define DMA_FN_IN& p% l% J2 t, I/ G) S
- #define DMA_FN_OUT
* z. }" Z" J; q& ~! |- R. G - #endif* q& x: r. O% C
- % k0 B3 V7 F1 f- D# [' N
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% m6 h J; |2 i, X$ D/ G
- #define STATIC_SHIFT 3
( m4 w; Y2 d4 c0 I9 ]* l, U/ g; J - #define TCINTEN_SHIFT 206 Y8 ]! |! s' Z! C0 ]! ]
- #define ITCINTEN_SHIFT 21# k8 ~3 Y Q) R- d: k
- #define TCCHEN_SHIFT 22# Z3 C y& ]/ ?8 h+ L% U& o
- #define ITCCHEN_SHIFT 23" o5 T- `7 i( c0 q H( ]
, x% Y5 `6 Z* v9 _- static volatile int irqraised1 = 0;3 U7 X& G; o/ y" T" |( |
- static volatile int irqraised2 = 0;
! }8 ?- I- @8 y$ F4 p, _4 J
# L' d# ?- T( q6 i8 i- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' A2 u6 U9 T/ o k, ?; E, p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 \* A6 a Y5 ~' q: E7 [' k2 u) {9 {# D
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! a! d2 ~/ t& x/ H: P - B: L7 c1 N8 P( b
- dma_addr_t dmaphyssrc1 = 0;! G0 [- f& o9 l
- dma_addr_t dmaphyssrc2 = 0;+ r. d! {( I! x( O: c1 H- k
- dma_addr_t dmaphysdest1 = 0;! J: S3 |9 @6 b- ]% f
- dma_addr_t dmaphysdest2 = 0;
( S3 O! P+ @7 y
! v: D5 F1 B/ B* Z- k) l2 ^) l- char *dmabufsrc1 = NULL;
6 c$ j7 A, x, V2 V( M8 R { - char *dmabufsrc2 = NULL;
6 Z$ e. k4 q. g! i - char *dmabufdest1 = NULL;& ]2 s$ `6 a; U5 u, \, F
- char *dmabufdest2 = NULL;) e# q9 X3 [1 R9 a
1 F+ i% W/ [& I3 |0 H* S- static int acnt = 512;0 o* u8 _4 d) c$ p5 D
- static int bcnt = 8;
: _9 z; p/ [6 _4 a0 T - static int ccnt = 8;
5 M# _/ e2 s; `# ]" A' Y - & m, P* A/ w% X3 {2 ?: m
- module_param(acnt, int, S_IRUGO);. I- @4 l: \/ ]8 r1 @. E4 R
- module_param(bcnt, int, S_IRUGO);$ x. P" ]/ O6 j: v+ o+ k6 E
- module_param(ccnt, int, S_IRUGO);
复制代码 0 B6 C, p% F/ k7 R, D
5 \# p9 u# x, M9 d( V; O. E; o 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ m/ v+ ]5 t! ^8 \" \6 Marm-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 D" ?0 w( ]8 Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ L7 o0 q+ N1 L. p: m. n. Y# A; C& q. ?
, Q5 b3 x/ ^: B9 e3 H# L- z5 X
|
|