|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 b- ~; H# G3 l8 ^& l- r- [code]EDMA sample test application% a ?3 p: t u- J3 {
- /*
8 S3 n6 e- Z2 q, d - * edma_test.c
; ^& _/ K' g' Z, A" T - *% W, |) [: c' }' Q- ^0 E/ g
- * brief EDMA3 Test Application
" B! z' v- _' K) h - *9 w2 k( i) \9 V+ J4 X5 X# s9 f
- * This file contains EDMA3 Test code.' ]9 F# b/ n2 \( j- w
- *% Y/ h J0 p2 S; D ?
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ m: s1 F" x7 n8 w' c" t, s - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 B1 z2 p/ L8 r
- * TO CHANGE.& a: Y2 Y* }6 @* g T6 Q' Y: O
- *
, T D* d. k1 f) Z0 W( a! j - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ P& u1 c2 W" I( f4 `
- *
/ G& H3 y8 S8 Z% m g6 z! O - * This program is free software; you can redistribute it and/or* G. w( ]8 z% C) K+ u
- * modify it under the terms of the GNU General Public License as! N( X# e! u, n
- * published by the Free Software Foundation version 2.
$ h6 Y3 ]/ `0 h% P! w( u3 L) [# S8 u. u - *! B ~& P2 b: H; w4 S& D& c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any# q, P0 [- N9 I! k) d
- * kind, whether express or implied; without even the implied warranty7 m( r) {8 R7 q0 J6 t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 Z6 q6 }6 a% j3 x. h X$ W - * GNU General Public License for more details.
' v" O% x) K' F0 W. u8 T# I - */
! \1 l8 k# E8 Y8 O. b) R& N - " L6 h( f% _2 B
- #include <linux/module.h>
6 n- {5 w# z7 a" ^$ v: N' y7 I - #include <linux/init.h>: E0 p j- B6 v: p
- #include <linux/errno.h>
4 L7 p& A4 @/ o/ K9 B1 N1 W - #include <linux/types.h>
7 C. O5 v0 e5 {- [ - #include <linux/interrupt.h>
) }4 Y2 X+ h) e0 W( B! H8 b0 N `7 m - #include <asm/io.h>6 X: K, x) e) H1 m+ K
- #include <linux/moduleparam.h>
2 A7 N2 p8 i$ ^/ u - #include <linux/sysctl.h>* l3 z! M% b- X" c$ z( [ m
- #include <linux/mm.h>
" N4 `# b4 U9 u2 ~8 p8 s - #include <linux/dma-mapping.h>& a/ m1 o- M) {' p7 R# N
- 1 l. \9 v6 \" u
- #include <mach/memory.h>. ]) M, H( n% h/ [+ y; P2 S3 o
- #include <mach/hardware.h>* A, t9 Y; q) y9 r: R8 K* S- T
- #include <mach/irqs.h>% B% L( L' j& X9 I3 W0 q) |
- #include <asm/hardware/edma.h>. S1 \' J. b K8 W0 X/ |' B
- , M5 K+ J: p7 t6 S1 t0 y
- #undef EDMA3_DEBUG) H% ?8 w: D" |
- /*#define EDMA3_DEBUG*/
+ U9 B2 `* [5 l" c' E* V; n: o - 1 w r b6 ]0 r8 s0 `8 u, { b
- #ifdef EDMA3_DEBUG
8 E/ [6 q- z7 Y9 A$ |/ t2 n - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 Y5 W9 {, L+ [3 T+ w0 P$ s
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 x+ v0 K e" I9 G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ f! |$ S5 x, i5 p% {
- #else
" ^* B) J' L; X) R% Y - #define DMA_PRINTK( x... ), H' L$ b, ~0 X, J6 Y8 Y
- #define DMA_FN_IN. i" I' E; j. e4 x
- #define DMA_FN_OUT$ s. @ S2 a2 {5 Z
- #endif
9 L; o2 k3 I( r
8 w$ A( I; Y: l3 |% K7 m5 L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 @$ j( v: S2 @1 B; }" m# w# _
- #define STATIC_SHIFT 38 N5 l9 a9 L x4 w
- #define TCINTEN_SHIFT 20
9 m5 u2 }$ g" {+ `) q6 K - #define ITCINTEN_SHIFT 21 z8 L, J2 ~5 Q$ V$ ?
- #define TCCHEN_SHIFT 22
3 a5 G8 E4 d: n' c8 N N9 ] - #define ITCCHEN_SHIFT 23
- v" b& T9 T+ h1 O* z - ( q+ R! e# U* D( M$ F* u
- static volatile int irqraised1 = 0;
: b3 m1 ^; p* Z' {* [ - static volatile int irqraised2 = 0;
8 P+ f( i9 y! w- D - " j, S9 d8 h! S0 }8 w, ?# o0 H
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! G, w- {! h; B2 ~4 u2 K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' |2 q a# t# F* w - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ^$ v0 l, ]; R, t7 X
- 4 m2 j6 ]' I* ^8 p1 `! s. h" H, G. Q
- dma_addr_t dmaphyssrc1 = 0;9 z) R# D2 ~, z( y
- dma_addr_t dmaphyssrc2 = 0;0 v+ }2 x: b2 w0 ]/ ]. I
- dma_addr_t dmaphysdest1 = 0;+ B+ v1 {+ t7 l) j' n" s
- dma_addr_t dmaphysdest2 = 0;* F0 k ]) }1 F
. b; v5 H6 h2 i- char *dmabufsrc1 = NULL;
6 V; b% I8 X# B* s6 x' E6 L8 g - char *dmabufsrc2 = NULL;0 j6 Z f3 [+ y
- char *dmabufdest1 = NULL;
6 e+ I9 i9 o$ b5 p0 u! P - char *dmabufdest2 = NULL;
; i6 d' [: f" z1 [
+ n4 o2 \! p+ }, `' T7 R( i5 B; T& L- static int acnt = 512;
; W- b+ l+ R9 L3 T( |. I - static int bcnt = 8;7 g1 U4 Z. [% t4 c! D" }) C
- static int ccnt = 8;4 t) G6 M& P. W1 D! I
- 6 X/ s) d7 p7 t1 J( w2 Y0 q
- module_param(acnt, int, S_IRUGO);. y) a8 ]( X! ~* z: h8 }
- module_param(bcnt, int, S_IRUGO);" B2 _; N$ U% @8 b+ W$ ]
- module_param(ccnt, int, S_IRUGO);
复制代码
# B) Q9 R- n1 X; }, H/ u& k, M
& J( l( T: L/ [ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 }$ x" m/ n5 L* u5 D) M; jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% T% e9 ^8 K! m# k0 ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 l2 w0 |! r: J( f' t# d9 O7 L n0 W9 \: p2 b
5 r. l- p. }: A& b# y
|
|