| 1 | /* sim_timer.h: simulator timer library headers\r |
| 2 | \r |
| 3 | Copyright (c) 1993-2007, Robert M Supnik\r |
| 4 | \r |
| 5 | Permission is hereby granted, free of charge, to any person obtaining a\r |
| 6 | copy of this software and associated documentation files (the "Software"),\r |
| 7 | to deal in the Software without restriction, including without limitation\r |
| 8 | the rights to use, copy, modify, merge, publish, distribute, sublicense,\r |
| 9 | and/or sell copies of the Software, and to permit persons to whom the\r |
| 10 | Software is furnished to do so, subject to the following conditions:\r |
| 11 | \r |
| 12 | The above copyright notice and this permission notice shall be included in\r |
| 13 | all copies or substantial portions of the Software.\r |
| 14 | \r |
| 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r |
| 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r |
| 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\r |
| 18 | ROBERT M SUPNIK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r |
| 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r |
| 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r |
| 21 | \r |
| 22 | Except as contained in this notice, the name of Robert M Supnik shall not be\r |
| 23 | used in advertising or otherwise to promote the sale, use or other dealings\r |
| 24 | in this Software without prior written authorization from Robert M Supnik.\r |
| 25 | \r |
| 26 | 28-Apr-07 RMS Added sim_rtc_init_all\r |
| 27 | 17-Oct-06 RMS Added idle support\r |
| 28 | 02-Jan-04 RMS Split out from SCP\r |
| 29 | */\r |
| 30 | \r |
| 31 | #ifndef _SIM_TIMER_H_\r |
| 32 | #define _SIM_TIMER_H_ 0\r |
| 33 | \r |
| 34 | #define SIM_NTIMERS 8 /* # timers */\r |
| 35 | #define SIM_TMAX 500 /* max timer makeup */\r |
| 36 | \r |
| 37 | #define SIM_IDLE_CAL 10 /* ms to calibrate */\r |
| 38 | #define SIM_IDLE_MAX 10 /* max granularity idle */\r |
| 39 | \r |
| 40 | #define SIM_THROT_WINIT 1000 /* cycles to skip */\r |
| 41 | #define SIM_THROT_WST 10000 /* initial wait */\r |
| 42 | #define SIM_THROT_WMUL 4 /* multiplier */\r |
| 43 | #define SIM_THROT_WMIN 100 /* min wait */\r |
| 44 | #define SIM_THROT_MSMIN 10 /* min for measurement */\r |
| 45 | #define SIM_THROT_NONE 0 /* throttle parameters */\r |
| 46 | #define SIM_THROT_MCYC 1\r |
| 47 | #define SIM_THROT_KCYC 2\r |
| 48 | #define SIM_THROT_PCT 3\r |
| 49 | \r |
| 50 | t_bool sim_timer_init (void);\r |
| 51 | int32 sim_rtcn_init (int32 time, int32 tmr);\r |
| 52 | void sim_rtcn_init_all (void);\r |
| 53 | int32 sim_rtcn_calb (int32 ticksper, int32 tmr);\r |
| 54 | int32 sim_rtc_init (int32 time);\r |
| 55 | int32 sim_rtc_calb (int32 ticksper);\r |
| 56 | t_bool sim_idle (uint32 tmr, t_bool sin_cyc);\r |
| 57 | t_stat sim_set_throt (int32 arg, char *cptr);\r |
| 58 | t_stat sim_show_throt (FILE *st, DEVICE *dnotused, UNIT *unotused, int32 flag, char *cptr);\r |
| 59 | t_stat sim_set_idle (UNIT *uptr, int32 val, char *cptr, void *desc);\r |
| 60 | t_stat sim_clr_idle (UNIT *uptr, int32 val, char *cptr, void *desc);\r |
| 61 | t_stat sim_show_idle (FILE *st, UNIT *uptr, int32 val, void *desc);\r |
| 62 | void sim_throt_sched (void);\r |
| 63 | void sim_throt_cancel (void);\r |
| 64 | uint32 sim_os_msec (void);\r |
| 65 | void sim_os_sleep (unsigned int sec);\r |
| 66 | uint32 sim_os_ms_sleep (unsigned int msec);\r |
| 67 | uint32 sim_os_ms_sleep_init (void);\r |
| 68 | \r |
| 69 | #endif\r |