root/src/simh/sim_timer.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*
   2  * sim_timer.h: simulator timer library headers
   3  *
   4  * vim: filetype=c:tabstop=4:ai:expandtab
   5  * SPDX-License-Identifier: MIT
   6  * scspell-id: e3417ba7-f62a-11ec-b5c5-80ee73e9b8e7
   7  *
   8  * ---------------------------------------------------------------------------
   9  *
  10  * Copyright (c) 1993-2008 Robert M. Supnik
  11  * Copyright (c) 2021-2023 The DPS8M Development Team
  12  *
  13  * Permission is hereby granted, free of charge, to any person obtaining a
  14  * copy of this software and associated documentation files (the "Software"),
  15  * to deal in the Software without restriction, including without limitation
  16  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  17  * and/or sell copies of the Software, and to permit persons to whom the
  18  * Software is furnished to do so, subject to the following conditions:
  19  *
  20  * The above copyright notice and this permission notice shall be included
  21  * in all copies or substantial portions of the Software.
  22  *
  23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  24  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  26  * IN NO EVENT SHALL ROBERT M SUPNIK BE LIABLE FOR ANY CLAIM, DAMAGES OR
  27  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  28  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  29  * OTHER DEALINGS IN THE SOFTWARE.
  30  *
  31  * Except as contained in this notice, the name of Robert M. Supnik shall
  32  * not be used in advertising or otherwise to promote the sale, use or
  33  * other dealings in this Software without prior written authorization from
  34  * Robert M. Supnik.
  35  *
  36  * ---------------------------------------------------------------------------
  37  */
  38 
  39 #ifndef SIM_TIMER_H_
  40 # define SIM_TIMER_H_   0
  41 
  42 # include <time.h>
  43 # include <sys/types.h>
  44 # include <pthread.h>
  45 
  46 # define SIM_NTIMERS     8                           /* # timers */
  47 # define SIM_TMAX        500                         /* max timer makeup */
  48 # define SIM_INITIAL_IPS 500000                      /* uncalibrated assumption */
  49 
  50 # ifndef PRIORITY_BELOW_NORMAL
  51 #  define PRIORITY_BELOW_NORMAL  -1
  52 # endif
  53 # ifndef PRIORITY_NORMAL
  54 #  define PRIORITY_NORMAL         0
  55 # endif
  56 # ifndef PRIORITY_ABOVE_NORMAL
  57 #  define PRIORITY_ABOVE_NORMAL   1
  58 # endif
  59 
  60 t_bool sim_timer_init (void);
  61 void sim_timespec_diff (struct timespec *diff, const struct timespec *min, struct timespec *sub);
  62 int32 sim_rtcn_init (int32 time, int32 tmr);
  63 int32 sim_rtcn_init_unit (UNIT *uptr, int32 time, int32 tmr);
  64 int sim_usleep(useconds_t tusleep);
  65 void sim_rtcn_init_all (void);
  66 int32 sim_rtcn_calb (uint32 ticksper, int32 tmr);
  67 t_stat sim_show_timers (FILE* st, DEVICE *dptr, UNIT* uptr, int32 val, CONST char* desc);
  68 t_stat sim_show_clock_queues (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr);
  69 uint32 sim_os_msec (void);
  70 void sim_os_sleep (unsigned int sec);
  71 uint32 sim_os_ms_sleep (unsigned int msec);
  72 uint32 sim_os_ms_sleep_init (void);
  73 void sim_start_timer_services (void);
  74 void sim_stop_timer_services (void);
  75 t_stat sim_timer_change_asynch (void);
  76 t_stat sim_timer_activate (UNIT *uptr, int32 interval);
  77 t_stat sim_timer_activate_after (UNIT *uptr, uint32 usec_delay);
  78 int32 sim_timer_activate_time (UNIT *uptr);
  79 t_stat sim_register_clock_unit_tmr (UNIT *uptr, int32 tmr);
  80 double sim_timer_inst_per_sec (void);
  81 t_stat sim_os_set_thread_priority (int below_normal_above);
  82 extern t_bool sim_asynch_timer;
  83 extern DEVICE sim_timer_dev;
  84 extern UNIT * volatile sim_clock_cosched_queue[SIM_NTIMERS+1];
  85 extern const t_bool rtc_avail;
  86 #endif

/* [previous][next][first][last][top][bottom][index][help] */