First Commit of my working state
[simh.git] / sim_timer.h
CommitLineData
196ba1fc
PH
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
50t_bool sim_timer_init (void);\r
51int32 sim_rtcn_init (int32 time, int32 tmr);\r
52void sim_rtcn_init_all (void);\r
53int32 sim_rtcn_calb (int32 ticksper, int32 tmr);\r
54int32 sim_rtc_init (int32 time);\r
55int32 sim_rtc_calb (int32 ticksper);\r
56t_bool sim_idle (uint32 tmr, t_bool sin_cyc);\r
57t_stat sim_set_throt (int32 arg, char *cptr);\r
58t_stat sim_show_throt (FILE *st, DEVICE *dnotused, UNIT *unotused, int32 flag, char *cptr);\r
59t_stat sim_set_idle (UNIT *uptr, int32 val, char *cptr, void *desc);\r
60t_stat sim_clr_idle (UNIT *uptr, int32 val, char *cptr, void *desc);\r
61t_stat sim_show_idle (FILE *st, UNIT *uptr, int32 val, void *desc);\r
62void sim_throt_sched (void);\r
63void sim_throt_cancel (void);\r
64uint32 sim_os_msec (void);\r
65void sim_os_sleep (unsigned int sec);\r
66uint32 sim_os_ms_sleep (unsigned int msec);\r
67uint32 sim_os_ms_sleep_init (void);\r
68\r
69#endif\r