root/src/simh/scp.h

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

INCLUDED FROM


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

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