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