Home | History | Annotate | Line # | Download | only in gemini
      1 /*	$NetBSD: gemini_timervar.h,v 1.4 2025/12/19 13:03:51 nia 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  *
     22  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
     23  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     24  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     25  * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTERS BE LIABLE FOR ANY DIRECT,
     26  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     27  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     28  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     32  * SUCH DAMAGE.
     33  */
     34 #ifndef _GEMINI_TIMER_H
     35 #define _GEMINI_TIMER_H
     36 
     37 #ifndef STATHZ
     38 # define STATHZ	HZ
     39 #endif
     40 
     41 typedef struct timer_factors {
     42 	uint32_t tf_counts_per_usec;
     43 	uint32_t tf_tmcr;
     44 	uint32_t tf_counter;
     45 	uint32_t tf_reload;
     46 	uint32_t tf_match1;
     47 	uint32_t tf_match2;
     48 } timer_factors_t;
     49 
     50 typedef struct geminitmr_softc {
     51 	uint			sc_timerno;
     52 	bus_space_tag_t		sc_iot;
     53 	bus_space_handle_t	sc_ioh;
     54 	bus_addr_t		sc_addr;
     55 	size_t			sc_size;
     56 	int			sc_intr;
     57 	timer_factors_t		sc_tf;
     58 } geminitmr_softc_t;
     59 
     60 
     61 
     62 extern uint32_t hardref;
     63 extern struct timeval hardtime;
     64 extern struct geminitmr_softc *clock_sc;
     65 extern struct geminitmr_softc *stat_sc;
     66 extern struct geminitmr_softc *ref_sc;
     67 
     68 extern void gemini_microtime_init(void);
     69 
     70 extern int	clockintr(void *);
     71 extern int	statintr(void *);
     72 extern void	rtcinit(void);
     73 
     74 #endif	/* _GEMINI_TIMER_H */
     75