xref: /netbsd-src/sys/arch/arm/gemini/gemini_timervar.h (revision cbab9cadce21ae72fac13910001079fff214cc29)
1 /*	$NetBSD: gemini_timervar.h,v 1.3 2012/10/27 17:17:38 chs Exp $	*/
2 
3 
4 /*
5  * adapted from:
6  *	NetBSD: omap2_mputmrvar.h,v 1.2 2008/04/27 18:58:45 matt Exp
7  */
8 
9 /*
10  * Copyright (c) 2007 Microsoft
11  * All rights reserved.
12  *
13  * Redistribution and use in source and binary forms, with or without
14  * modification, are permitted provided that the following conditions
15  * are met:
16  * 1. Redistributions of source code must retain the above copyright
17  *    notice, this list of conditions and the following disclaimer.
18  * 2. Redistributions in binary form must reproduce the above copyright
19  *    notice, this list of conditions and the following disclaimer in the
20  *    documentation and/or other materials provided with the distribution.
21  * 3. All advertising materials mentioning features or use of this software
22  *    must display the following acknowledgement:
23  *	This product includes software developed by Microsoft
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
26  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
27  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
28  * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTERS BE LIABLE FOR ANY DIRECT,
29  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35  * SUCH DAMAGE.
36  */
37 #ifndef _GEMINI_TIMER_H
38 #define _GEMINI_TIMER_H
39 
40 #ifndef STATHZ
41 # define STATHZ	HZ
42 #endif
43 
44 typedef struct timer_factors {
45 	uint32_t tf_counts_per_usec;
46 	uint32_t tf_tmcr;
47 	uint32_t tf_counter;
48 	uint32_t tf_reload;
49 	uint32_t tf_match1;
50 	uint32_t tf_match2;
51 } timer_factors_t;
52 
53 typedef struct geminitmr_softc {
54 	uint			sc_timerno;
55 	bus_space_tag_t		sc_iot;
56 	bus_space_handle_t	sc_ioh;
57 	bus_addr_t		sc_addr;
58 	size_t			sc_size;
59 	int			sc_intr;
60 	timer_factors_t		sc_tf;
61 } geminitmr_softc_t;
62 
63 
64 
65 extern uint32_t hardref;
66 extern struct timeval hardtime;
67 extern struct geminitmr_softc *clock_sc;
68 extern struct geminitmr_softc *stat_sc;
69 extern struct geminitmr_softc *ref_sc;
70 
71 extern void gemini_microtime_init(void);
72 
73 extern int	clockintr(void *);
74 extern int	statintr(void *);
75 extern void	rtcinit(void);
76 
77 #endif	/* _GEMINI_TIMER_H */
78