1 /* scp.h: simulator control program headers 2 3 Copyright (c) 1993-2009 Robert M Supnik 4 Copyright (c) 2021 Jeffrey H. Johnson <trnsz@pobox.com> 5 Copyright (c) 2021 The DPS8M Development Team 6 7 Permission is hereby granted, free of charge, to any person obtaining a 8 copy of this software and associated documentation files (the "Software"), 9 to deal in the Software without restriction, including without limitation 10 the rights to use, copy, modify, merge, publish, distribute, sublicense, 11 and/or sell copies of the Software, and to permit persons to whom the 12 Software is furnished to do so, subject to the following conditions: 13 14 The above copyright notice and this permission notice shall be included in 15 all copies or substantial portions of the Software. 16 17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 ROBERT M SUPNIK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 24 Except as contained in this notice, the name of Robert M Supnik shall not 25 be used in advertising or otherwise to promote the sale, use or other dealings 26 in this Software without prior written authorization from Robert M Supnik. 27 */ 28 29 #ifndef SIM_SCP_H_ 30 # define SIM_SCP_H_ 0 31 32 /* run_cmd parameters */ 33 34 # define RU_RUN 0 /* run */ 35 # define RU_GO 1 /* go */ 36 # define RU_STEP 2 /* step */ 37 # define RU_NEXT 3 /* step or step/over */ 38 # define RU_CONT 4 /* continue */ 39 # define RU_BOOT 5 /* boot */ 40 41 /* exdep_cmd parameters */ 42 43 # define EX_D 0 /* deposit */ 44 # define EX_E 1 /* examine */ 45 # define EX_I 2 /* interactive */ 46 47 /* brk_cmd parameters */ 48 49 # define SSH_ST 0 /* set */ 50 # define SSH_SH 1 /* show */ 51 # define SSH_CL 2 /* clear */ 52 53 /* get_sim_opt parameters */ 54 55 # define CMD_OPT_SW 001 /* switches */ 56 # define CMD_OPT_OF 002 /* output file */ 57 # define CMD_OPT_SCH 004 /* search */ 58 # define CMD_OPT_DFT 010 /* defaults */ 59 60 /* Command processors */ 61 62 t_stat reset_cmd (int32 flag, CONST char *ptr); 63 t_stat exdep_cmd (int32 flag, CONST char *ptr); 64 t_stat eval_cmd (int32 flag, CONST char *ptr); 65 t_stat load_cmd (int32 flag, CONST char *ptr); 66 t_stat run_cmd (int32 flag, CONST char *ptr); 67 void run_cmd_message (const char *unechod_cmdline, t_stat r); 68 t_stat attach_cmd (int32 flag, CONST char *ptr); 69 t_stat detach_cmd (int32 flag, CONST char *ptr); 70 t_stat assign_cmd (int32 flag, CONST char *ptr); 71 t_stat deassign_cmd (int32 flag, CONST char *ptr); 72 t_stat save_cmd (int32 flag, CONST char *ptr); 73 t_stat restore_cmd (int32 flag, CONST char *ptr); 74 t_stat exit_cmd (int32 flag, CONST char *ptr); 75 t_stat set_cmd (int32 flag, CONST char *ptr); 76 t_stat show_cmd (int32 flag, CONST char *ptr); 77 t_stat brk_cmd (int32 flag, CONST char *ptr); 78 t_stat do_cmd (int32 flag, CONST char *ptr); 79 t_stat goto_cmd (int32 flag, CONST char *ptr); 80 t_stat return_cmd (int32 flag, CONST char *ptr); 81 t_stat shift_cmd (int32 flag, CONST char *ptr); 82 t_stat call_cmd (int32 flag, CONST char *ptr); 83 t_stat on_cmd (int32 flag, CONST char *ptr); 84 t_stat noop_cmd (int32 flag, CONST char *ptr); 85 t_stat assert_cmd (int32 flag, CONST char *ptr); 86 t_stat send_cmd (int32 flag, CONST char *ptr); 87 t_stat expect_cmd (int32 flag, CONST char *ptr); 88 t_stat help_cmd (int32 flag, CONST char *ptr); 89 t_stat screenshot_cmd (int32 flag, CONST char *ptr); 90 t_stat spawn_cmd (int32 flag, CONST char *ptr); 91 t_stat echo_cmd (int32 flag, CONST char *ptr); 92 93 /* Allow compiler to help validate printf style format arguments */ 94 # if !defined __GNUC__ 95 # define GCC_FMT_ATTR(n, m) 96 # endif 97 # if !defined(GCC_FMT_ATTR) 98 # define GCC_FMT_ATTR(n, m) __attribute__ ((format (__printf__, n, m))) 99 # endif 100 101 /* Utility routines */ 102 103 t_stat sim_process_event (void); 104 t_stat sim_activate (UNIT *uptr, int32 interval); 105 t_stat _sim_activate (UNIT *uptr, int32 interval); 106 t_stat sim_activate_abs (UNIT *uptr, int32 interval); 107 t_stat sim_activate_after (UNIT *uptr, uint32 usecs_walltime); 108 t_stat _sim_activate_after (UNIT *uptr, uint32 usecs_walltime); 109 t_stat sim_cancel (UNIT *uptr); 110 t_bool sim_is_active (UNIT *uptr); 111 int32 sim_activate_time (UNIT *uptr); 112 t_stat sim_run_boot_prep (int32 flag); 113 double sim_gtime (void); 114 uint32 sim_grtime (void); 115 int32 sim_qcount (void); 116 t_stat attach_unit (UNIT *uptr, CONST char *cptr); 117 t_stat detach_unit (UNIT *uptr); 118 t_stat assign_device (DEVICE *dptr, const char *cptr); 119 t_stat deassign_device (DEVICE *dptr); 120 t_stat reset_all (uint32 start_device); 121 t_stat reset_all_p (uint32 start_device); 122 const char *sim_dname (DEVICE *dptr); 123 const char *sim_uname (UNIT *dptr); 124 int sim_isspace (char c); 125 int sim_islower (char c); 126 int sim_isalpha (char c); 127 int sim_isprint (char c); 128 int sim_isdigit (char c); 129 int sim_isgraph (char c); 130 int sim_isalnum (char c); 131 CONST char *get_sim_opt (int32 opt, CONST char *cptr, t_stat *st); 132 const char *put_switches (char *buf, size_t bufsize, uint32 sw); 133 CONST char *get_glyph (const char *iptr, char *optr, char mchar); 134 CONST char *get_glyph_nc (const char *iptr, char *optr, char mchar); 135 CONST char *get_glyph_quoted (const char *iptr, char *optr, char mchar); 136 CONST char *get_glyph_cmd (const char *iptr, char *optr); 137 t_value get_uint (const char *cptr, uint32 radix, t_value max, t_stat *status); 138 CONST char *get_range (DEVICE *dptr, CONST char *cptr, t_addr *lo, t_addr *hi, 139 uint32 rdx, t_addr max, char term); 140 t_stat sim_decode_quoted_string (const char *iptr, uint8 *optr, uint32 *osize); 141 char *sim_encode_quoted_string (const uint8 *iptr, uint32 size); 142 void fprint_buffer_string (FILE *st, const uint8 *buf, uint32 size); 143 t_value strtotv (CONST char *cptr, CONST char **endptr, uint32 radix); 144 int Fprintf (FILE *f, const char *fmt, ...) GCC_FMT_ATTR(2, 3); 145 t_stat fprint_val (FILE *stream, t_value val, uint32 rdx, uint32 wid, uint32 fmt); 146 t_stat sprint_val (char *buf, t_value val, uint32 rdx, uint32 wid, uint32 fmt); 147 const char *sim_fmt_secs (double seconds); 148 const char *sprint_capac (DEVICE *dptr, UNIT *uptr); 149 char *read_line (char *cptr, int32 size, FILE *stream); 150 void fprint_reg_help (FILE *st, DEVICE *dptr); 151 void fprint_set_help (FILE *st, DEVICE *dptr); 152 void fprint_show_help (FILE *st, DEVICE *dptr); 153 CTAB *find_cmd (const char *gbuf); 154 DEVICE *find_dev (const char *ptr); 155 DEVICE *find_unit (const char *ptr, UNIT **uptr); 156 DEVICE *find_dev_from_unit (UNIT *uptr); 157 t_stat sim_register_internal_device (DEVICE *dptr); 158 void sim_sub_args (char *in_str, size_t in_str_size, char *do_arg[]); 159 REG *find_reg (CONST char *ptr, CONST char **optr, DEVICE *dptr); 160 CTAB *find_ctab (CTAB *tab, const char *gbuf); 161 C1TAB *find_c1tab (C1TAB *tab, const char *gbuf); 162 SHTAB *find_shtab (SHTAB *tab, const char *gbuf); 163 t_stat get_aval (t_addr addr, DEVICE *dptr, UNIT *uptr); 164 BRKTAB *sim_brk_fnd (t_addr loc); 165 uint32 sim_brk_test (t_addr bloc, uint32 btyp); 166 void sim_brk_clrspc (uint32 spc, uint32 btyp); 167 void sim_brk_npc (uint32 cnt); 168 void sim_brk_setact (const char *action); 169 const char *sim_brk_message(void); 170 t_stat sim_send_input (SEND *snd, uint8 *data, size_t size, uint32 after, uint32 delay); 171 t_stat sim_show_send_input (FILE *st, const SEND *snd); 172 t_bool sim_send_poll_data (SEND *snd, t_stat *stat); 173 t_stat sim_send_clear (SEND *snd); 174 t_stat sim_set_expect (EXPECT *exp, CONST char *cptr); 175 t_stat sim_set_noexpect (EXPECT *exp, const char *cptr); 176 t_stat sim_exp_set (EXPECT *exp, const char *match, int32 cnt, uint32 after, int32 switches, const char *act); 177 t_stat sim_exp_clr (EXPECT *exp, const char *match); 178 t_stat sim_exp_clrall (EXPECT *exp); 179 t_stat sim_exp_show (FILE *st, CONST EXPECT *exp, const char *match); 180 t_stat sim_exp_showall (FILE *st, const EXPECT *exp); 181 t_stat sim_exp_check (EXPECT *exp, uint8 data); 182 t_stat show_version (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr); 183 t_stat set_dev_debug (DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr); 184 t_stat show_dev_debug (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, CONST char *cptr); 185 const char *sim_error_text (t_stat stat); 186 t_stat sim_string_to_stat (const char *cptr, t_stat *cond); 187 void sim_printf (const char *fmt, ...) GCC_FMT_ATTR(1, 2); 188 void _sim_err (const char* fmt, ...); 189 t_stat sim_messagef (t_stat stat, const char *fmt, ...) GCC_FMT_ATTR(2, 3); 190 void sim_data_trace(DEVICE *dptr, UNIT *uptr, const uint8 *data, const char *position, size_t len, const char *txt, uint32 reason); 191 void sim_debug_bits_hdr (uint32 dbits, DEVICE* dptr, const char *header, 192 BITFIELD* bitdefs, uint32 before, uint32 after, int terminate); 193 void sim_debug_bits (uint32 dbits, DEVICE* dptr, BITFIELD* bitdefs, 194 uint32 before, uint32 after, int terminate); 195 void _sim_debug (uint32 dbits, DEVICE* dptr, const char *fmt, ...) GCC_FMT_ATTR(3, 4); 196 # define sim_debug(dbits, dptr, ...) do { if ((sim_deb != NULL) && ((dptr != NULL) && ((dptr)->dctrl & dbits))) _sim_debug (dbits, dptr, __VA_ARGS__);} while (0) 197 void fprint_stopped_gen (FILE *st, t_stat v, REG *pc, DEVICE *dptr); 198 # define SCP_HELP_FLAT (1u << 31) /* Force flat help when prompting is not possible */ 199 # define SCP_HELP_ONECMD (1u << 30) /* Display one topic, do not prompt */ 200 # define SCP_HELP_ATTACH (1u << 29) /* Top level topic is ATTACH help */ 201 t_stat scp_help (FILE *st, DEVICE *dptr, 202 UNIT *uptr, int32 flag, const char *help, const char *cptr, ...); 203 t_stat scp_vhelp (FILE *st, DEVICE *dptr, 204 UNIT *uptr, int32 flag, const char *help, const char *cptr, va_list ap); 205 t_stat scp_helpFromFile (FILE *st, DEVICE *dptr, 206 UNIT *uptr, int32 flag, const char *help, const char *cptr, ...); 207 t_stat scp_vhelpFromFile (FILE *st, DEVICE *dptr, 208 UNIT *uptr, int32 flag, const char *help, const char *cptr, va_list ap); 209 210 /* Global data */ 211 212 extern DEVICE *sim_dflt_dev; 213 extern int32 sim_interval; 214 extern int32 sim_switches; 215 extern int32 sim_iglock; 216 extern int32 sim_nolock; 217 extern int32 sim_randompst; 218 extern int32 sim_quiet; 219 extern int32 sim_randstate; 220 extern int32 sim_step; 221 extern t_stat sim_last_cmd_stat; /* Command Status */ 222 extern FILE *sim_log; /* log file */ 223 extern FILEREF *sim_log_ref; /* log file file reference */ 224 extern FILE *sim_deb; /* debug file */ 225 extern FILEREF *sim_deb_ref; /* debug file file reference */ 226 extern int32 sim_deb_switches; /* debug display flags */ 227 extern struct timespec sim_deb_basetime; /* debug base time for relative time output */ 228 extern DEVICE **sim_internal_devices; 229 extern uint32 sim_internal_device_count; 230 extern UNIT *sim_clock_queue; 231 extern int32 sim_is_running; 232 extern t_bool sim_processing_event; /* Called from sim_process_event */ 233 extern char *sim_prompt; /* prompt string */ 234 extern const char *sim_savename; /* Simulator Name used in Save/Restore files */ 235 extern t_value *sim_eval; 236 extern volatile int32 stop_cpu; 237 extern uint32 sim_brk_types; /* breakpoint info */ 238 extern uint32 sim_brk_dflt; 239 extern uint32 sim_brk_summ; 240 extern uint32 sim_brk_match_type; 241 extern t_addr sim_brk_match_addr; 242 extern BRKTYPTAB *sim_brk_type_desc; /* type descriptions */ 243 extern FILE *stdnul; 244 extern t_bool sim_asynch_enabled; 245 246 /* VM interface */ 247 248 extern char sim_name[]; 249 extern DEVICE *sim_devices[]; 250 extern REG *sim_PC; 251 extern const char *sim_stop_messages[]; 252 extern t_stat sim_instr (void); 253 extern int32 sim_emax; 254 extern t_stat fprint_sym (FILE *ofile, t_addr addr, t_value *val, 255 UNIT *uptr, int32 sw); 256 extern t_stat parse_sym (CONST char *cptr, t_addr addr, UNIT *uptr, t_value *val, 257 int32 sw); 258 259 /* The per-simulator init routine is a weak global that defaults to NULL 260 The other per-simulator pointers can be overrriden by the init routine */ 261 262 extern void (*sim_vm_init) (void); 263 extern char *(*sim_vm_read) (char *ptr, int32 size, FILE *stream); 264 extern void (*sim_vm_post) (t_bool from_scp); 265 extern CTAB *sim_vm_cmd; 266 extern void (*sim_vm_sprint_addr) (char *buf, DEVICE *dptr, t_addr addr); 267 extern void (*sim_vm_fprint_addr) (FILE *st, DEVICE *dptr, t_addr addr); 268 extern t_addr (*sim_vm_parse_addr) (DEVICE *dptr, CONST char *cptr, CONST char **tptr); 269 extern t_bool (*sim_vm_fprint_stopped) (FILE *st, t_stat reason); 270 extern t_value (*sim_vm_pc_value) (void); 271 extern t_bool (*sim_vm_is_subroutine_call) (t_addr **ret_addrs); 272 273 # define SIM_FRONTPANEL_VERSION 2 274 275 /** 276 277 sim_panel_start_simulator A starts a simulator with a particular 278 configuration 279 280 sim_path the path to the simulator binary 281 sim_config the configuration to run the simulator with 282 device_panel_count the number of sub panels for connected devices 283 284 Note 1: - The path specified must be either a fully specified path or 285 it could be merey the simulator name if the simulator binary 286 is located in the current PATH. 287 - The simulator binary must be built from the same version 288 simh source code that the frontpanel API was acquired fron 289 (the API and the simh framework must speak the same language) 290 291 Note 2: - Configuration file specified should contain device setup 292 statements (enable, disable, CPU types and attach commands). 293 It should not start a simulator running. 294 295 */ 296 297 typedef struct PANEL PANEL; 298 299 PANEL * 300 sim_panel_start_simulator (const char *sim_path, 301 const char *sim_config, 302 size_t device_panel_count); 303 304 PANEL * 305 sim_panel_start_simulator_debug (const char *sim_path, 306 const char *sim_config, 307 size_t device_panel_count, 308 const char *debug_file); 309 310 /** 311 312 sim_panel_add_device_panel - creates a sub panel associated 313 with a specific simulator panel 314 315 simulator_panel the simulator panel to connect to 316 device_name the simulator's name for the device 317 318 */ 319 PANEL * 320 sim_panel_add_device_panel (PANEL *simulator_panel, 321 const char *device_name); 322 323 /** 324 325 sim_panel_destroy to shutdown a panel or sub panel. 326 327 Note: destroying a simulator panel will also destroy any 328 related sub panels 329 330 */ 331 int 332 sim_panel_destroy (PANEL *panel); 333 334 /** 335 336 The frontpanel API exposes the state of a simulator via access to 337 simh register variables that the simulator and its devices define. 338 These registers certainly include any architecturally described 339 registers (PC, PSL, SP, etc.), but also include anything else 340 the simulator uses as internal state to implement the running 341 simulator. 342 343 The registers that a particular frontpanel application mught need 344 access to are described by the application by calling: 345 346 sim_panel_add_register 347 sim_panel_add_register_array 348 and 349 sim_panel_add_register_indirect 350 351 name the name the simulator knows this register by 352 device_name the device this register is part of. Defaults to 353 the device of the panel (in a device panel) or the 354 default device in the simulator (usually the CPU). 355 element_count number of elements in the register array 356 size the size (in local storage) of the buffer which will 357 receive the data in the simulator's register 358 addr a pointer to the location of the buffer which will 359 be loaded with the data in the simulator's register 360 361 */ 362 int 363 sim_panel_add_register (PANEL *panel, 364 const char *name, 365 const char *device_name, 366 size_t size, 367 void *addr); 368 369 int 370 sim_panel_add_register_array (PANEL *panel, 371 const char *name, 372 const char *device_name, 373 size_t element_count, 374 size_t size, 375 void *addr); 376 377 int 378 sim_panel_add_register_indirect (PANEL *panel, 379 const char *name, 380 const char *device_name, 381 size_t size, 382 void *addr); 383 /** 384 385 A panel application has a choice of two different methods of getting 386 the values contained in the set of registers it has declared interest in via 387 the sim_panel_add_register API. 388 389 1) The values can be polled (when ever it is desired) by calling 390 sim_panel_get_registers(). 391 2) The panel can call sim_panel_set_display_callback() to specify a 392 callback routine and a periodic rate that the callback routine 393 should be called. The panel API will make a best effort to deliver 394 the current register state at the desired rate. 395 396 397 Note 1: The buffers described in a panel's register set will be 398 dynamically revised as soon as data is available from the 399 simulator. The callback routine merely serves as a notification 400 that a complete register set has arrived. 401 Note 2: The callback routine should, in general, not run for a long time 402 or frontpanel interactions with the simulator may be disrupted. 403 Setting a flag, signaling an event or posting a message are 404 reasonable activities to perform in a callback routine. 405 406 */ 407 int 408 sim_panel_get_registers (PANEL *panel, unsigned long long *simulation_time); 409 410 /** 411 412 413 */ 414 typedef void (*PANEL_DISPLAY_PCALLBACK)(PANEL *panel, 415 unsigned long long simulation_time, 416 void *context); 417 418 int 419 sim_panel_set_display_callback (PANEL *panel, 420 PANEL_DISPLAY_PCALLBACK callback, 421 void *context, 422 int callbacks_per_second); 423 424 /** 425 426 When a front panel application needs to change the running 427 state of a simulator one of the following routines should 428 be called: 429 430 sim_panel_exec_halt - Stop instruction execution 431 sim_panel_exec_boot - Boot a simulator from a specific device 432 sim_panel_exec_run - Start/Resume a simulator running instructions 433 sim_panel_exec_step - Have a simulator execute a single step 434 435 */ 436 int 437 sim_panel_exec_halt (PANEL *panel); 438 439 int 440 sim_panel_exec_boot (PANEL *panel, const char *device); 441 442 int 443 sim_panel_exec_run (PANEL *panel); 444 445 int 446 sim_panel_exec_step (PANEL *panel); 447 448 /** 449 450 When a front panel application wants to describe conditions that 451 should stop instruction execution an execution or an output 452 should be used. To established or clear a breakpoint, one of 453 the following routines should be called: 454 455 sim_panel_break_set - Establish a simulation breakpoint 456 sim_panel_break_clear - Cancel/Delete a previously defined 457 breakpoint 458 sim_panel_break_output_set - Establish a simulator output 459 breakpoint 460 sim_panel_break_output_clear - Cancel/Delete a previously defined 461 output breakpoint 462 463 Note: Any breakpoint switches/flags must be located at the 464 beginning of the condition string 465 466 */ 467 468 int 469 sim_panel_break_set (PANEL *panel, const char *condition); 470 471 int 472 sim_panel_break_clear (PANEL *panel, const char *condition); 473 474 int 475 sim_panel_break_output_set (PANEL *panel, const char *condition); 476 477 int 478 sim_panel_break_output_clear (PANEL *panel, const char *condition); 479 480 481 /** 482 483 When a front panel application needs to change or access 484 memory or a register one of the following routines should 485 be called: 486 487 sim_panel_gen_examine - Examine register or memory 488 sim_panel_gen_deposit - Deposit to register or memory 489 sim_panel_mem_examine - Examine memory location 490 sim_panel_mem_deposit - Deposit to memory location 491 sim_panel_set_register_value - Deposit to a register or memory 492 location 493 494 */ 495 496 497 /** 498 499 sim_panel_gen_examine 500 501 name_or_addr the name the simulator knows this register by 502 size the size (in local storage) of the buffer which will 503 receive the data returned when examining the simulator 504 value a pointer to the buffer which will be loaded with the 505 data returned when examining the simulator 506 */ 507 508 int 509 sim_panel_gen_examine (PANEL *panel, 510 const char *name_or_addr, 511 size_t size, 512 void *value); 513 /** 514 515 sim_panel_gen_deposit 516 517 name_or_addr the name the simulator knows this register by 518 size the size (in local storage) of the buffer which 519 contains the data to be deposited into the simulator 520 value a pointer to the buffer which contains the data to 521 be deposited into the simulator 522 */ 523 524 int 525 sim_panel_gen_deposit (PANEL *panel, 526 const char *name_or_addr, 527 size_t size, 528 const void *value); 529 530 /** 531 532 sim_panel_mem_examine 533 534 addr_size the size (in local storage) of the buffer which 535 contains the memory address of the data to be examined 536 in the simulator 537 addr a pointer to the buffer containing the memory address 538 of the data to be examined in the simulator 539 value_size the size (in local storage) of the buffer which will 540 receive the data returned when examining the simulator 541 value a pointer to the buffer which will be loaded with the 542 data returned when examining the simulator 543 */ 544 545 int 546 sim_panel_mem_examine (PANEL *panel, 547 size_t addr_size, 548 const void *addr, 549 size_t value_size, 550 void *value); 551 552 /** 553 554 sim_panel_mem_deposit 555 556 addr_size the size (in local storage) of the buffer which 557 contains the memory address of the data to be deposited 558 into the simulator 559 addr a pointer to the buffer containing the memory address 560 of the data to be deposited into the simulator 561 value_size the size (in local storage) of the buffer which will 562 contains the data to be deposited into the simulator 563 value a pointer to the buffer which contains the data to be 564 deposited into the simulator 565 */ 566 567 int 568 sim_panel_mem_deposit (PANEL *panel, 569 size_t addr_size, 570 const void *addr, 571 size_t value_size, 572 const void *value); 573 574 /** 575 sim_panel_set_register_value 576 577 name the name of a simulator register or a memory address 578 which is to receive a new value 579 value the new value in character string form. The string 580 must be in the native/natural radix that the simulator 581 uses when referencing that register 582 583 */ 584 int 585 sim_panel_set_register_value (PANEL *panel, 586 const char *name, 587 const char *value); 588 589 /** 590 591 When a front panel application may needs to change the media 592 in a simulated removable media device one of the following 593 routines should be called: 594 595 sim_panel_mount - mounts the indicated media file on a device 596 sim_panel_dismount - dismounts the currently mounted media file 597 from a device 598 599 */ 600 601 /** 602 sim_panel_mount 603 604 device the name of a simulator device/unit 605 switches any switches appropriate for the desire attach 606 path the path on the local system to be attached 607 608 */ 609 int 610 sim_panel_mount (PANEL *panel, 611 const char *device, 612 const char *switches, 613 const char *path); 614 615 /** 616 sim_panel_dismount 617 618 device the name of a simulator device/unit 619 620 */ 621 int 622 sim_panel_dismount (PANEL *panel, 623 const char *device); 624 625 626 typedef enum { 627 Halt, /* Simulation is halted (instructions not being executed) */ 628 Run, /* Simulation is executing instructions */ 629 Error /* Panel simulator is in an error state and should be */ 630 /* closed (destroyed). sim_panel_get_error might help */ 631 /* explain why */ 632 } OperationalState; 633 634 OperationalState 635 sim_panel_get_state (PANEL *panel); 636 637 /** 638 639 All APIs routines which return an int return 0 for 640 success and -1 for an error. 641 642 An API which returns an error (-1), will not change the panel state. 643 644 sim_panel_get_error - the details of the most recent error 645 sim_panel_clear_error - clears the error buffer 646 647 */ 648 649 const char *sim_panel_get_error (void); 650 void sim_panel_clear_error (void); 651 652 /** 653 654 The panek<->simulator wire protocol can be traced if protocol problems arise. 655 656 sim_panel_set_debug_file - Specifies the log file to record debug traffic 657 sim_panel_set_debug_mode - Specifies the debug detail to be recorded 658 sim_panel_flush_debug - Flushes debug output to disk 659 660 */ 661 void 662 sim_panel_set_debug_file (PANEL *panel, const char *debug_file); 663 664 void 665 sim_panel_set_debug_mode (PANEL *panel, int debug_bits); 666 667 void 668 sim_panel_flush_debug (PANEL *panel); 669 670 #endif 671