blob: 0e03a88204c49e9992a46c7e3da30a15d68c6b44 [file] [log] [blame] [raw]
Mark Pizzolatob198e132015-01-15 12:37:30 -08001/* sim_frontpanel.h: simulator frontpanel API definitions
2
3 Copyright (c) 2015, Mark Pizzolato
4
5 Permission is hereby granted, free of charge, to any person obtaining a
6 copy of this software and associated documentation files (the "Software"),
7 to deal in the Software without restriction, including without limitation
8 the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 and/or sell copies of the Software, and to permit persons to whom the
10 Software is furnished to do so, subject to the following conditions:
11
12 The above copyright notice and this permission notice shall be included in
13 all copies or substantial portions of the Software.
14
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
Mark Pizzolato5a472f82015-02-11 11:16:07 -080018 MARK PIZZOLATO BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
Mark Pizzolatob198e132015-01-15 12:37:30 -080019 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22 Except as contained in this notice, the name of Mark Pizzolato shall not be
23 used in advertising or otherwise to promote the sale, use or other dealings
Mark Pizzolato5a472f82015-02-11 11:16:07 -080024 in this Software without prior written authorization from Mark Pizzolato.
Mark Pizzolatob198e132015-01-15 12:37:30 -080025
26 15-Jan-15 MP Initial implementation
Mark Pizzolatobccf98e2015-04-03 04:44:09 -070027 01-Apr-15 MP Added register indirect, mem_examine and mem_deposit
Mark Pizzolato9d478912015-04-04 09:18:02 -070028 03-Apr-15 MP Added logic to pass simulator startup messages in
29 panel error text if the connection to the simulator
30 shuts down while it is starting.
Mark Pizzolato325e3692015-04-04 16:37:43 -070031 04-Apr-15 MP Added mount and dismount routines to connect and
32 disconnect removable media
Mark Pizzolatob198e132015-01-15 12:37:30 -080033
34 This module defines interface between a front panel application and a simh
35 simulator. Facilities provide ways to gather information from and to
36 observe and control the state of a simulator.
37
Mark Pizzolatoce3e6352015-02-17 16:36:23 -080038 Any application which wants to use this API needs to:
39 1) include this file in the application code
40 2) compile sim_frontpanel.c and sim_sock.c from the top level directory
41 of the simh source.
42 3) link the sim_frontpanel and sim_sock object modules and libpthreads
43 into the application.
44 4) Use a simh simulator built from the same version of simh that the
45 sim_frontpanel and sim_sock modules came from.
Mark Pizzolatob198e132015-01-15 12:37:30 -080046*/
47
48#ifndef SIM_FRONTPANEL_H_
49#define SIM_FRONTPANEL_H_ 0
50
51#ifdef __cplusplus
52extern "C" {
53#endif
54
Mark Pizzolato5a472f82015-02-11 11:16:07 -080055#include <stdlib.h>
56
Mark Pizzolato3719a072015-04-13 15:48:53 -070057#if !defined(__VAX) /* Unsupported platform */
Mark Pizzolato059a5412015-02-24 19:49:09 -080058
Mark Pizzolato2efc3a12018-01-12 10:07:15 -080059#define SIM_FRONTPANEL_VERSION 12
Mark Pizzolato059a5412015-02-24 19:49:09 -080060
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -080061/**
62
Mark Pizzolato059a5412015-02-24 19:49:09 -080063 sim_panel_start_simulator A starts a simulator with a particular
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -080064 configuration
65
66 sim_path the path to the simulator binary
67 sim_config the configuration to run the simulator with
68 device_panel_count the number of sub panels for connected devices
69
70 Note 1: - The path specified must be either a fully specified path or
Mark Pizzolato8551a2d2017-11-09 23:02:39 -080071 it could be merely the simulator name if the simulator binary
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -080072 is located in the current PATH.
73 - The simulator binary must be built from the same version
74 simh source code that the frontpanel API was acquired fron
75 (the API and the simh framework must speak the same language)
76
77 Note 2: - Configuration file specified should contain device setup
78 statements (enable, disable, CPU types and attach commands).
79 It should not start a simulator running.
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -080080 */
81
Mark Pizzolato4c8e1632015-02-12 14:59:24 -080082typedef struct PANEL PANEL;
Mark Pizzolatob198e132015-01-15 12:37:30 -080083
84PANEL *
85sim_panel_start_simulator (const char *sim_path,
Mark Pizzolato4c8e1632015-02-12 14:59:24 -080086 const char *sim_config,
87 size_t device_panel_count);
88
Mark Pizzolato71fe58b2015-02-26 11:28:08 -080089PANEL *
90sim_panel_start_simulator_debug (const char *sim_path,
91 const char *sim_config,
92 size_t device_panel_count,
93 const char *debug_file);
94
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -080095/**
96
97 sim_panel_add_device_panel - creates a sub panel associated
98 with a specific simulator panel
99
100 simulator_panel the simulator panel to connect to
101 device_name the simulator's name for the device
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -0800102 */
Mark Pizzolato665ebf02017-02-04 10:48:13 -0800103
Mark Pizzolato4c8e1632015-02-12 14:59:24 -0800104PANEL *
105sim_panel_add_device_panel (PANEL *simulator_panel,
106 const char *device_name);
Mark Pizzolatob198e132015-01-15 12:37:30 -0800107
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -0800108/**
109
110 sim_panel_destroy to shutdown a panel or sub panel.
111
112 Note: destroying a simulator panel will also destroy any
113 related sub panels
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -0800114 */
Mark Pizzolato665ebf02017-02-04 10:48:13 -0800115
Mark Pizzolatob198e132015-01-15 12:37:30 -0800116int
Mark Pizzolato4c8e1632015-02-12 14:59:24 -0800117sim_panel_destroy (PANEL *panel);
Mark Pizzolatob198e132015-01-15 12:37:30 -0800118
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -0800119/**
120
121 The frontpanel API exposes the state of a simulator via access to
122 simh register variables that the simulator and its devices define.
123 These registers certainly include any architecturally described
124 registers (PC, PSL, SP, etc.), but also include anything else
125 the simulator uses as internal state to implement the running
126 simulator.
127
128 The registers that a particular frontpanel application mught need
Mark Pizzolato665ebf02017-02-04 10:48:13 -0800129 access to are specified by the application when it calls:
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -0800130
Mark Pizzolato059a5412015-02-24 19:49:09 -0800131 sim_panel_add_register
Mark Pizzolato665ebf02017-02-04 10:48:13 -0800132 sim_panel_add_register_bits
Mark Pizzolatod75ec662015-04-17 14:46:06 -0700133 sim_panel_add_register_array
Mark Pizzolatobccf98e2015-04-03 04:44:09 -0700134and
135 sim_panel_add_register_indirect
Mark Pizzolato665ebf02017-02-04 10:48:13 -0800136 sim_panel_add_register_indirect_bits
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -0800137
Mark Pizzolato059a5412015-02-24 19:49:09 -0800138 name the name the simulator knows this register by
139 device_name the device this register is part of. Defaults to
140 the device of the panel (in a device panel) or the
141 default device in the simulator (usually the CPU).
Mark Pizzolatod75ec662015-04-17 14:46:06 -0700142 element_count number of elements in the register array
Mark Pizzolato059a5412015-02-24 19:49:09 -0800143 size the size (in local storage) of the buffer which will
144 receive the data in the simulator's register
145 addr a pointer to the location of the buffer which will
146 be loaded with the data in the simulator's register
Mark Pizzolato665ebf02017-02-04 10:48:13 -0800147 bit_width the number of values to populate in the bits array
148 bits an array of integers which is bit_width long that
149 will receive each bit's current accumulated value.
150 The accumulated value will range from 0 thru the
151 the sample_depth specified when calling
152 sim_panel_set_sampling_parameters().
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -0800153 */
Mark Pizzolato665ebf02017-02-04 10:48:13 -0800154
Mark Pizzolatob198e132015-01-15 12:37:30 -0800155int
156sim_panel_add_register (PANEL *panel,
157 const char *name,
Mark Pizzolato059a5412015-02-24 19:49:09 -0800158 const char *device_name,
Mark Pizzolatob198e132015-01-15 12:37:30 -0800159 size_t size,
160 void *addr);
Mark Pizzolato665ebf02017-02-04 10:48:13 -0800161
162int
163sim_panel_add_register_bits (PANEL *panel,
164 const char *name,
165 const char *device_name,
166 size_t bit_width,
167 int *bits);
Mark Pizzolatob198e132015-01-15 12:37:30 -0800168
Mark Pizzolatobccf98e2015-04-03 04:44:09 -0700169int
Mark Pizzolatod75ec662015-04-17 14:46:06 -0700170sim_panel_add_register_array (PANEL *panel,
171 const char *name,
172 const char *device_name,
173 size_t element_count,
174 size_t size,
175 void *addr);
176
177int
Mark Pizzolatobccf98e2015-04-03 04:44:09 -0700178sim_panel_add_register_indirect (PANEL *panel,
179 const char *name,
180 const char *device_name,
181 size_t size,
182 void *addr);
Mark Pizzolato665ebf02017-02-04 10:48:13 -0800183
184int
185sim_panel_add_register_indirect_bits (PANEL *panel,
186 const char *name,
187 const char *device_name,
188 size_t bit_width,
189 int *bits);
190
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -0800191/**
192
193 A panel application has a choice of two different methods of getting
194 the values contained in the set of registers it has declared interest in via
Mark Pizzolato665ebf02017-02-04 10:48:13 -0800195 the sim_panel_add_register APIs.
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -0800196
Mark Pizzolatoe73d45e2017-11-04 10:28:00 -0700197 1) The values can be polled (whenever it is desired) by calling
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -0800198 sim_panel_get_registers().
Mark Pizzolato110ded62017-01-27 23:06:30 -0800199 2) The panel can call sim_panel_set_display_callback_interval() to
200 specify a callback routine and a periodic rate that the callback
201 routine should be called. The panel API will make a best effort
202 to deliver the current register state at the desired rate.
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -0800203
204
Mark Pizzolato3719a072015-04-13 15:48:53 -0700205 Note 1: The buffers described in a panel's register set will be
206 dynamically revised as soon as data is available from the
207 simulator. The callback routine merely serves as a notification
208 that a complete register set has arrived.
209 Note 2: The callback routine should, in general, not run for a long time
210 or frontpanel interactions with the simulator may be disrupted.
211 Setting a flag, signaling an event or posting a message are
212 reasonable activities to perform in a callback routine.
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -0800213 */
Mark Pizzolato665ebf02017-02-04 10:48:13 -0800214
Mark Pizzolatob198e132015-01-15 12:37:30 -0800215int
Mark Pizzolato059a5412015-02-24 19:49:09 -0800216sim_panel_get_registers (PANEL *panel, unsigned long long *simulation_time);
Mark Pizzolato4c8e1632015-02-12 14:59:24 -0800217
218typedef void (*PANEL_DISPLAY_PCALLBACK)(PANEL *panel,
Mark Pizzolato059a5412015-02-24 19:49:09 -0800219 unsigned long long simulation_time,
Mark Pizzolato4c8e1632015-02-12 14:59:24 -0800220 void *context);
Mark Pizzolatob198e132015-01-15 12:37:30 -0800221
222int
Mark Pizzolato110ded62017-01-27 23:06:30 -0800223sim_panel_set_display_callback_interval (PANEL *panel,
224 PANEL_DISPLAY_PCALLBACK callback,
225 void *context,
226 int usecs_between_callbacks);
Mark Pizzolatob198e132015-01-15 12:37:30 -0800227
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -0800228/**
229
Mark Pizzolato665ebf02017-02-04 10:48:13 -0800230 When a front panel application wants to get averaged bit sample
231 values, it must first declare the sampling parameters that will
Mark Pizzolato8551a2d2017-11-09 23:02:39 -0800232 be used while collecting the bit values. The dithering
233 percentage must be 25% or less and when non 0 causes the sample
234 frequency to vary by plus or minus a random percentage value up
235 to the specified value.
Mark Pizzolato665ebf02017-02-04 10:48:13 -0800236
237 sim_panel_set_sampling_parameters
Mark Pizzolato8551a2d2017-11-09 23:02:39 -0800238 sim_panel_set_sampling_parameters_ex
Mark Pizzolato665ebf02017-02-04 10:48:13 -0800239
240 sample_frequency cycles/instructions between sample captures
Mark Pizzolato8551a2d2017-11-09 23:02:39 -0800241 sample_dither_pct percentage of sample_frequency to vary randomly
Mark Pizzolato665ebf02017-02-04 10:48:13 -0800242 sample_depth how many samples to accumulate in the rolling
243 average for each bit sample. Returned bit
244 sample values will range from 0 thru this
245 value.
246 */
247
248int
Mark Pizzolato8551a2d2017-11-09 23:02:39 -0800249sim_panel_set_sampling_parameters_ex (PANEL *panel,
250 unsigned int sample_frequency,
251 unsigned int sample_dither_pct,
252 unsigned int sample_depth);
253
254int
Mark Pizzolato665ebf02017-02-04 10:48:13 -0800255sim_panel_set_sampling_parameters (PANEL *panel,
256 unsigned int sample_frequency,
257 unsigned int sample_depth);
Mark Pizzolato665ebf02017-02-04 10:48:13 -0800258/**
259
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -0800260 When a front panel application needs to change the running
261 state of a simulator one of the following routines should
262 be called:
263
264 sim_panel_exec_halt - Stop instruction execution
265 sim_panel_exec_boot - Boot a simulator from a specific device
266 sim_panel_exec_run - Start/Resume a simulator running instructions
Mark Pizzolatoe73d45e2017-11-04 10:28:00 -0700267 sim_panel_exec_start - Start a simulator running instructions
268 after resetting all devices
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -0800269 sim_panel_exec_step - Have a simulator execute a single step
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -0800270 */
Mark Pizzolato665ebf02017-02-04 10:48:13 -0800271
Mark Pizzolatob198e132015-01-15 12:37:30 -0800272int
273sim_panel_exec_halt (PANEL *panel);
274
275int
Mark Pizzolato5a472f82015-02-11 11:16:07 -0800276sim_panel_exec_boot (PANEL *panel, const char *device);
Mark Pizzolatoe73d45e2017-11-04 10:28:00 -0700277
278int
279sim_panel_exec_start (PANEL *panel);
Mark Pizzolato5a472f82015-02-11 11:16:07 -0800280
281int
Mark Pizzolatob198e132015-01-15 12:37:30 -0800282sim_panel_exec_run (PANEL *panel);
283
284int
285sim_panel_exec_step (PANEL *panel);
286
Mark Pizzolato2efc3a12018-01-12 10:07:15 -0800287
288
289/**
290 A simulator often displays some useful information as it stops
291 executing instructions.
292
293 sim_panel_halt_text - Returns the simulator output immediately prior
294 to the most recent transition to the Halt state.
295 */
296
297const char *
298sim_panel_halt_text (PANEL *panel);
299
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -0800300/**
Mark Pizzolatobccf98e2015-04-03 04:44:09 -0700301
Mark Pizzolatod497aea2016-02-11 16:42:25 -0800302 When a front panel application wants to describe conditions that
303 should stop instruction execution an execution or an output
Mark Pizzolato43dc5fd2016-12-17 03:44:45 -0800304 breakpoint should be used. To established or clear a breakpoint,
305 one of the following routines should be called:
Mark Pizzolatod497aea2016-02-11 16:42:25 -0800306
307 sim_panel_break_set - Establish a simulation breakpoint
308 sim_panel_break_clear - Cancel/Delete a previously defined
309 breakpoint
310 sim_panel_break_output_set - Establish a simulator output
311 breakpoint
312 sim_panel_break_output_clear - Cancel/Delete a previously defined
313 output breakpoint
314
315 Note: Any breakpoint switches/flags must be located at the
316 beginning of the condition string
Mark Pizzolatod497aea2016-02-11 16:42:25 -0800317 */
318
319int
320sim_panel_break_set (PANEL *panel, const char *condition);
321
322int
323sim_panel_break_clear (PANEL *panel, const char *condition);
324
325int
326sim_panel_break_output_set (PANEL *panel, const char *condition);
327
328int
329sim_panel_break_output_clear (PANEL *panel, const char *condition);
330
331
332/**
333
Mark Pizzolatobccf98e2015-04-03 04:44:09 -0700334 When a front panel application needs to change or access
335 memory or a register one of the following routines should
336 be called:
337
Mark Pizzolato8cc11fa2017-12-13 05:44:43 -0800338 sim_panel_gen_examine - Examine register or memory
339 sim_panel_gen_deposit - Deposit to register or memory
340 sim_panel_mem_examine - Examine memory location
341 sim_panel_mem_deposit - Deposit to memory location
342 sim_panel_mem_deposit_instruction - Deposit instruction to memory
343 location
344 sim_panel_set_register_value - Deposit to a register or memory
345 location
Mark Pizzolatobccf98e2015-04-03 04:44:09 -0700346 */
347
348
349/**
350
351 sim_panel_gen_examine
352
353 name_or_addr the name the simulator knows this register by
354 size the size (in local storage) of the buffer which will
355 receive the data returned when examining the simulator
356 value a pointer to the buffer which will be loaded with the
357 data returned when examining the simulator
358 */
359
360int
361sim_panel_gen_examine (PANEL *panel,
362 const char *name_or_addr,
363 size_t size,
364 void *value);
Mark Pizzolato33fc5c42017-12-18 15:05:58 -0800365
Mark Pizzolatobccf98e2015-04-03 04:44:09 -0700366/**
367
368 sim_panel_gen_deposit
369
370 name_or_addr the name the simulator knows this register by
371 size the size (in local storage) of the buffer which
372 contains the data to be deposited into the simulator
373 value a pointer to the buffer which contains the data to
374 be deposited into the simulator
375 */
376
377int
378sim_panel_gen_deposit (PANEL *panel,
379 const char *name_or_addr,
380 size_t size,
381 const void *value);
382
383/**
384
385 sim_panel_mem_examine
386
387 addr_size the size (in local storage) of the buffer which
388 contains the memory address of the data to be examined
389 in the simulator
390 addr a pointer to the buffer containing the memory address
391 of the data to be examined in the simulator
392 value_size the size (in local storage) of the buffer which will
393 receive the data returned when examining the simulator
394 value a pointer to the buffer which will be loaded with the
395 data returned when examining the simulator
396 */
397
398int
399sim_panel_mem_examine (PANEL *panel,
400 size_t addr_size,
401 const void *addr,
402 size_t value_size,
403 void *value);
404
405/**
406
407 sim_panel_mem_deposit
408
409 addr_size the size (in local storage) of the buffer which
410 contains the memory address of the data to be deposited
411 into the simulator
412 addr a pointer to the buffer containing the memory address
413 of the data to be deposited into the simulator
414 value_size the size (in local storage) of the buffer which will
415 contains the data to be deposited into the simulator
416 value a pointer to the buffer which contains the data to be
417 deposited into the simulator
418 */
419
420int
421sim_panel_mem_deposit (PANEL *panel,
422 size_t addr_size,
423 const void *addr,
424 size_t value_size,
425 const void *value);
426
427/**
Mark Pizzolato665ebf02017-02-04 10:48:13 -0800428
Mark Pizzolato8cc11fa2017-12-13 05:44:43 -0800429 sim_panel_mem_deposit_instruction
430
431 addr_size the size (in local storage) of the buffer which
432 contains the memory address of the data to be deposited
433 into the simulator
434 addr a pointer to the buffer containing the memory address
435 of the data to be deposited into the simulator
436 instruction a pointer to the buffer that contains the mnemonic
437 instruction to be deposited at the indicated address
438 */
439
440int
441sim_panel_mem_deposit_instruction (PANEL *panel,
442 size_t addr_size,
443 const void *addr,
444 const char *instruction);
445
446/**
447
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -0800448 sim_panel_set_register_value
449
Mark Pizzolatobccf98e2015-04-03 04:44:09 -0700450 name the name of a simulator register or a memory address
451 which is to receive a new value
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -0800452 value the new value in character string form. The string
453 must be in the native/natural radix that the simulator
454 uses when referencing that register
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -0800455 */
Mark Pizzolato4c8e1632015-02-12 14:59:24 -0800456int
457sim_panel_set_register_value (PANEL *panel,
458 const char *name,
459 const char *value);
460
Mark Pizzolato325e3692015-04-04 16:37:43 -0700461/**
462
Mark Pizzolato33fc5c42017-12-18 15:05:58 -0800463 A front panel application might want to have access to the
464 instruction execution history that a simulator may be capable
465 of providing. If this functionality is desired, enabling of
466 recording instruction history should be explicitly enabled
467 in the sim_config file that the simulator is started with.
468 */
469
470/**
471
472 sim_panel_get_history
473
474 count the number of instructions to return
475 size the size (in local storage) of the buffer which will
476 receive the data returned when examining the simulator
477 buffer a pointer to the buffer which will be loaded with the
478 instruction history returned from the simulator
479 */
480
481int
482sim_panel_get_history (PANEL *panel,
483 int count,
484 size_t size,
485 char *buffer);
486
487
488/**
489
Mark Pizzolato2efc3a12018-01-12 10:07:15 -0800490 A front panel application might want some details of simulator
491 and/or device behavior that is provided by a particular simulator
492 via debug information. Debugging for particular device(s)
493 and/or simulator debug settings can be controlled via the
494 sim_panel_device_debug_mode API.
495 */
496
497/**
498
499 sim_panel_device_debug_mode
500
501 device the device whose debug mode is to change
502 set_untset 1 to set debug flags, 0 to clear debug flags
503 mode_bits character string with different debug mode bits
504 to enable or disable. An empty string will
505 enable or disable all mode bits for the specified
506 device
507 */
508
509int
510sim_panel_device_debug_mode (PANEL *panel,
511 const char *device,
512 int set_unset,
513 const char *mode_bits);
514
515
516/**
517
Mark Pizzolato665ebf02017-02-04 10:48:13 -0800518 When a front panel application needs to change the media
Mark Pizzolato325e3692015-04-04 16:37:43 -0700519 in a simulated removable media device one of the following
520 routines should be called:
521
522 sim_panel_mount - mounts the indicated media file on a device
523 sim_panel_dismount - dismounts the currently mounted media file
524 from a device
Mark Pizzolato325e3692015-04-04 16:37:43 -0700525 */
526
527/**
Mark Pizzolato665ebf02017-02-04 10:48:13 -0800528
Mark Pizzolato325e3692015-04-04 16:37:43 -0700529 sim_panel_mount
530
531 device the name of a simulator device/unit
532 switches any switches appropriate for the desire attach
533 path the path on the local system to be attached
Mark Pizzolato325e3692015-04-04 16:37:43 -0700534 */
Mark Pizzolato665ebf02017-02-04 10:48:13 -0800535
Mark Pizzolato325e3692015-04-04 16:37:43 -0700536int
537sim_panel_mount (PANEL *panel,
538 const char *device,
539 const char *switches,
540 const char *path);
541
542/**
Mark Pizzolato665ebf02017-02-04 10:48:13 -0800543
Mark Pizzolato325e3692015-04-04 16:37:43 -0700544 sim_panel_dismount
545
546 device the name of a simulator device/unit
Mark Pizzolato325e3692015-04-04 16:37:43 -0700547 */
Mark Pizzolato665ebf02017-02-04 10:48:13 -0800548
Mark Pizzolato325e3692015-04-04 16:37:43 -0700549int
550sim_panel_dismount (PANEL *panel,
551 const char *device);
552
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -0800553
Mark Pizzolato4c8e1632015-02-12 14:59:24 -0800554typedef enum {
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -0800555 Halt, /* Simulation is halted (instructions not being executed) */
556 Run, /* Simulation is executing instructions */
557 Error /* Panel simulator is in an error state and should be */
558 /* closed (destroyed). sim_panel_get_error might help */
559 /* explain why */
Mark Pizzolato4c8e1632015-02-12 14:59:24 -0800560 } OperationalState;
561
Mark Pizzolato5a472f82015-02-11 11:16:07 -0800562OperationalState
563sim_panel_get_state (PANEL *panel);
564
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -0800565/**
566
Mark Pizzolato33fc5c42017-12-18 15:05:58 -0800567 All API routines which return an int return 0 for
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -0800568 success and -1 for an error.
Mark Pizzolato3719a072015-04-13 15:48:53 -0700569
Mark Pizzolato2292f2c2017-12-10 04:14:36 -0800570 An API which returns an error (-1), will not change the panel state
571 except to possibly set the panel state to Error if the panel
572 condition is no longer useful.
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -0800573
574 sim_panel_get_error - the details of the most recent error
575 sim_panel_clear_error - clears the error buffer
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -0800576 */
577
Mark Pizzolatob198e132015-01-15 12:37:30 -0800578const char *sim_panel_get_error (void);
579void sim_panel_clear_error (void);
Mark Pizzolatob198e132015-01-15 12:37:30 -0800580
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -0800581/**
582
583 The panek<->simulator wire protocol can be traced if protocol problems arise.
584
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -0800585 sim_panel_set_debug_mode - Specifies the debug detail to be recorded
586 sim_panel_flush_debug - Flushes debug output to disk
Mark Pizzolato2292f2c2017-12-10 04:14:36 -0800587 sim_panel_debug - Write message to the debug file
Mark Pizzolatoe1b7bb32015-02-17 07:58:21 -0800588
589 */
Mark Pizzolato335def02015-02-15 11:04:18 -0800590#define DBG_XMT 1 /* Transmit Data */
591#define DBG_RCV 2 /* Receive Data */
Mark Pizzolato110ded62017-01-27 23:06:30 -0800592#define DBG_REQ 4 /* Request Data */
593#define DBG_RSP 8 /* Response Data */
Mark Pizzolatoe73d45e2017-11-04 10:28:00 -0700594#define DBG_THR 16 /* Thread Activities */
Mark Pizzolato2292f2c2017-12-10 04:14:36 -0800595#define DBG_APP 32 /* Application Activities */
Mark Pizzolato335def02015-02-15 11:04:18 -0800596
597void
598sim_panel_set_debug_mode (PANEL *panel, int debug_bits);
599
600void
Mark Pizzolato2292f2c2017-12-10 04:14:36 -0800601sim_panel_debug (PANEL *panel, const char *fmt, ...);
602
603void
Mark Pizzolato335def02015-02-15 11:04:18 -0800604sim_panel_flush_debug (PANEL *panel);
Mark Pizzolatob198e132015-01-15 12:37:30 -0800605
Mark Pizzolato059a5412015-02-24 19:49:09 -0800606#endif /* !defined(__VAX) */
607
Mark Pizzolatob198e132015-01-15 12:37:30 -0800608#ifdef __cplusplus
609}
610#endif
611
Mark Pizzolato71fe58b2015-02-26 11:28:08 -0800612#endif /* SIM_FRONTPANEL_H_ */