|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) r, `: w2 V' x Q0 ]# ?, j8 U: |- [code]EDMA sample test application1 P% C: C. U# N- T
- /*8 E1 G& Z# w ]
- * edma_test.c- y$ s3 K: e( ^6 w9 J; l; v
- *" u+ j$ f/ c5 _0 T0 i
- * brief EDMA3 Test Application. r# s4 U5 R0 {% i6 Z' G4 h
- *: N: h5 z; E; {7 Y, }
- * This file contains EDMA3 Test code.- {) b0 g V7 ]4 N8 z/ Y1 J
- *
* e' b0 Q- B# _% g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 @0 T( _# t+ }
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) Q, s% b6 v8 R: Y+ w
- * TO CHANGE.
. X! S( v. E/ E% M - *: P' N; D- ]- b1 @4 m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 q6 B/ u$ k. l9 q, J' z j' i
- *2 T9 Z6 `3 q. f$ v
- * This program is free software; you can redistribute it and/or
5 i4 V3 R# l6 @+ P2 H z" Z8 u - * modify it under the terms of the GNU General Public License as
- h# X; p; Y5 e! k6 M; z! a - * published by the Free Software Foundation version 2.# E1 X+ w% b( V* H
- *2 W/ m5 b% J# X i+ I* p
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% N. F1 f7 [1 }( J6 z: M9 I - * kind, whether express or implied; without even the implied warranty, C- x* G4 o, a! L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( t) ~. b. B$ e( b* p$ B( T - * GNU General Public License for more details.
2 k- z0 g' e# b% M# ~ - */3 l; @$ Z- d, a+ f
4 z9 x: L$ ?# I$ Z, l; V% F- #include <linux/module.h>+ V, M' u1 A3 ?# Z) ]9 O9 V* E
- #include <linux/init.h>* b5 {+ j- B5 K8 H
- #include <linux/errno.h>/ K+ R9 Q% L) x0 l8 w9 j7 p
- #include <linux/types.h>1 e4 x2 u$ q8 r" I$ R
- #include <linux/interrupt.h>3 h0 K9 S9 L1 g! q( j Y2 r
- #include <asm/io.h>0 y* m6 g& b# O# d) J
- #include <linux/moduleparam.h>
- w% @5 e, ?* Y8 {/ V7 q2 T: A: y - #include <linux/sysctl.h>
8 J3 y) D5 Z& ^' k& n - #include <linux/mm.h>
_' ?& q, E- [% c: _& A5 d! B/ h - #include <linux/dma-mapping.h>
$ g4 a1 h; K6 F. p
9 W9 H! q! `2 O, A' P. A: \* t- #include <mach/memory.h>9 N( @4 O& O; Y! p. ^% g% e- j
- #include <mach/hardware.h>
- {: j) G$ ?$ S$ j - #include <mach/irqs.h>
5 Z8 _3 k. T( O [ Z - #include <asm/hardware/edma.h>
4 U Y4 n0 r# ? V, l- m8 G
; ^; E# H& Y) k! ?) ?- R6 Y- P0 [- #undef EDMA3_DEBUG- v& n) F: r3 L8 R
- /*#define EDMA3_DEBUG*/4 O4 ]0 D; Y! B5 b' h* b9 x* H
- 6 h; H; O9 \: ]6 s' g
- #ifdef EDMA3_DEBUG
- `5 G. e5 [! f# a; i D S- d - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ L* v+ w- Y7 E& D% ~" d) M+ C6 f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 f* @% i4 ~& V& ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ u6 A& Y3 v- q' k6 ^ - #else- y7 t+ I2 b" }8 D7 f6 |% ?- j% O& }, F
- #define DMA_PRINTK( x... )- |4 ^3 w% {! ]6 z
- #define DMA_FN_IN
9 q% Z' K4 I# x$ v" G% S' n - #define DMA_FN_OUT
5 }7 Q7 K- U! I1 ? - #endif
3 _- [% O! |1 B9 O! W/ R' `4 V0 _- k - $ O5 G. m. {- S% m5 b e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 a: }! Y5 P7 u9 M* I& I - #define STATIC_SHIFT 34 W1 V$ i7 K0 K, V
- #define TCINTEN_SHIFT 20( X5 l' {: B3 ~4 z
- #define ITCINTEN_SHIFT 21
4 u. I: y5 ~! ] - #define TCCHEN_SHIFT 22
8 k; `2 w# V- E% L+ c - #define ITCCHEN_SHIFT 23
8 x$ G9 u3 w* s- R - 5 _0 F2 Z+ S; o7 e, [! k2 t0 ?) I k
- static volatile int irqraised1 = 0;& U9 P: y h$ K' C$ @+ U4 B- u
- static volatile int irqraised2 = 0;+ }! W$ F$ i$ A: L) [* G( }
- 6 s% N7 k3 \9 C( ]; L5 O
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 e$ h* s5 _; M3 r! W' X2 U - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( e) N7 C! C2 ^; M2 @) c. v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* r: F! k! U( b) [& x- p3 Z - % `9 t G& _1 c! Q# _- B8 t
- dma_addr_t dmaphyssrc1 = 0;2 |' b2 |3 X. e. S
- dma_addr_t dmaphyssrc2 = 0;; ]7 q0 B+ @% ^9 P! E
- dma_addr_t dmaphysdest1 = 0;- X8 L- z( z' y, w
- dma_addr_t dmaphysdest2 = 0;
& w- A' ~- V) t - 3 g. U; ]* ?* K. _ d
- char *dmabufsrc1 = NULL;: c% ]- A, z% C
- char *dmabufsrc2 = NULL;1 \8 f6 J" K0 k& m
- char *dmabufdest1 = NULL;
# ~9 |' Q# u! \ - char *dmabufdest2 = NULL;: K6 O/ Z, @$ U5 O
- 6 r; n2 N3 M, X# O& N2 f
- static int acnt = 512;
; h7 }% L; s! Z$ F3 V! u8 g1 ` - static int bcnt = 8;
3 a( U/ b6 ^# D3 X |, n% t5 y0 x - static int ccnt = 8;7 g& L0 Y' q* l
- / v: s% A+ w3 s; A
- module_param(acnt, int, S_IRUGO);
6 }7 l0 F; P- R1 N' p4 R7 ~ i! s - module_param(bcnt, int, S_IRUGO);6 z# [" X% O( {& q
- module_param(ccnt, int, S_IRUGO);
复制代码
. W1 A* u5 z7 x& }1 @
4 }; m2 F; c& l/ t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 F' Q' z" Q3 i- D; e) J- n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 D" I+ h3 s1 a8 {% M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 Y# A, l( f: q9 ~$ [' R/ s$ G& z
/ Y! P6 }! p! D0 y" l* S& Y8 d9 n3 l% m
|
|