SCP: Added automatic saving of console WRU, DEL, BRK and PCHAR console variables and provided a way for a simulator to declare that is doesn't have a console port so automatic WRU detection can be performed.

This commit is contained in:
Mark Pizzolato 2015-04-03 16:05:01 -07:00
parent bccf98e979
commit ef6528bf32
5 changed files with 40 additions and 8 deletions

11
scp.c
View file

@ -5402,7 +5402,7 @@ t_stat sim_save (FILE *sfile)
{ {
void *mbuf; void *mbuf;
int32 l, t; int32 l, t;
uint32 i, j; uint32 i, j, device_count;
t_addr k, high; t_addr k, high;
t_value val; t_value val;
t_stat r; t_stat r;
@ -5423,7 +5423,14 @@ fprintf (sfile, "%s\n%s\n%s\n%s\n%s\n%.0f\n",
sim_time); /* [V3.2] sim time */ sim_time); /* [V3.2] sim time */
WRITE_I (sim_rtime); /* [V2.6] sim rel time */ WRITE_I (sim_rtime); /* [V2.6] sim rel time */
for (i = 0; (dptr = sim_devices[i]) != NULL; i++) { /* loop thru devices */ for (device_count = 0; sim_devices[device_count]; device_count++);/* count devices */
for (i = 0; i < (device_count + sim_internal_device_count); i++) {/* loop thru devices */
if (i < device_count)
dptr = sim_devices[i];
else
dptr = sim_internal_devices[i - device_count];
if (dptr->flags & DEV_NOSAVE)
continue;
fputs (dptr->name, sfile); /* device name */ fputs (dptr->name, sfile); /* device name */
fputc ('\n', sfile); fputc ('\n', sfile);
if (dptr->lname) /* [V3.0] logical name */ if (dptr->lname) /* [V3.0] logical name */

View file

@ -194,12 +194,20 @@ static DEBTAB sim_con_debug[] = {
{0} {0}
}; };
static REG sim_con_reg[] = {
{ ORDATAD (WRU, sim_int_char, 8, "interrupt character") },
{ ORDATAD (BRK, sim_brk_char, 8, "break character") },
{ ORDATAD (DEL, sim_del_char, 8, "delete character ") },
{ ORDATAD (PCHAR, sim_tt_pchar, 32, "printable character mask") },
{ 0 },
};
static MTAB sim_con_mod[] = { static MTAB sim_con_mod[] = {
{ 0 }, { 0 },
}; };
DEVICE sim_con_telnet = { DEVICE sim_con_telnet = {
"CON-TEL", &sim_con_unit, NULL, sim_con_mod, "CON-TEL", &sim_con_unit, sim_con_reg, sim_con_mod,
1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
NULL, NULL, sim_con_reset, NULL, NULL, NULL, NULL, NULL, sim_con_reset, NULL, NULL, NULL,
NULL, DEV_DEBUG, 0, sim_con_debug}; NULL, DEV_DEBUG, 0, sim_con_debug};
@ -210,16 +218,29 @@ TMXR sim_con_tmxr = { 1, 0, 0, &sim_con_ldsc, NULL, &sim_con_telnet };/* console
SEND sim_con_send = {SEND_DEFAULT_DELAY, &sim_con_telnet, DBG_SND}; SEND sim_con_send = {SEND_DEFAULT_DELAY, &sim_con_telnet, DBG_SND};
EXPECT sim_con_expect = {&sim_con_telnet, DBG_EXP}; EXPECT sim_con_expect = {&sim_con_telnet, DBG_EXP};
static t_bool sim_con_console_port = TRUE;
/* Enable automatic WRU console polling */
t_stat sim_set_noconsole_port (void)
{
sim_con_console_port = FALSE;
return SCPE_OK;
}
/* Unit service for console connection polling */ /* Unit service for console connection polling */
static t_stat sim_con_poll_svc (UNIT *uptr) static t_stat sim_con_poll_svc (UNIT *uptr)
{ {
if ((sim_con_tmxr.master == 0) && /* not Telnet and not serial? */ if ((sim_con_tmxr.master == 0) && /* not Telnet and not serial and not WRU polling? */
(sim_con_ldsc.serport == 0)) (sim_con_ldsc.serport == 0) &&
(sim_con_console_port))
return SCPE_OK; /* done */ return SCPE_OK; /* done */
if (tmxr_poll_conn (&sim_con_tmxr) >= 0) /* poll connect */ if (tmxr_poll_conn (&sim_con_tmxr) >= 0) /* poll connect */
sim_con_ldsc.rcve = 1; /* rcv enabled */ sim_con_ldsc.rcve = 1; /* rcv enabled */
sim_activate_after(uptr, 1000000); /* check again in 1 second */ sim_activate_after(uptr, 1000000); /* check again in 1 second */
if (!sim_con_console_port) /* WRU poll needed */
sim_poll_kbd(); /* sets global stop_cpu when WRU received */
if (sim_con_ldsc.conn) if (sim_con_ldsc.conn)
tmxr_send_buffered_data (&sim_con_ldsc); /* try to flush any buffered data */ tmxr_send_buffered_data (&sim_con_ldsc); /* try to flush any buffered data */
return SCPE_OK; return SCPE_OK;
@ -380,7 +401,7 @@ DEVICE sim_remote_console = {
"REM-CON", sim_rem_con_unit, NULL, sim_rem_con_mod, "REM-CON", sim_rem_con_unit, NULL, sim_rem_con_mod,
2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0,
NULL, NULL, sim_rem_con_reset, NULL, NULL, NULL, NULL, NULL, sim_rem_con_reset, NULL, NULL, NULL,
NULL, DEV_DEBUG, 0, sim_rem_con_debug}; NULL, DEV_DEBUG | DEV_NOSAVE, 0, sim_rem_con_debug};
#define MAX_REMOTE_SESSIONS 40 /* Arbitrary Session Limit */ #define MAX_REMOTE_SESSIONS 40 /* Arbitrary Session Limit */
static int32 *sim_rem_buf_size = NULL; static int32 *sim_rem_buf_size = NULL;
static int32 *sim_rem_buf_ptr = NULL; static int32 *sim_rem_buf_ptr = NULL;
@ -1206,7 +1227,8 @@ if (sim_rem_master_mode) {
t_stat stat_nomessage; t_stat stat_nomessage;
if ((!sim_con_ldsc.serport) && if ((!sim_con_ldsc.serport) &&
(sim_con_tmxr.master == 0)) { (sim_con_tmxr.master == 0) &&
(sim_con_console_port)) {
sim_printf ("Console port must be Telnet or Serial with Master Remote Console\r\n"); sim_printf ("Console port must be Telnet or Serial with Master Remote Console\r\n");
return SCPE_IERR|SCPE_NOMESSAGE; return SCPE_IERR|SCPE_NOMESSAGE;
} }

View file

@ -106,6 +106,7 @@ const char *sim_logfile_name (FILE *st, FILEREF *ref);
SEND *sim_cons_get_send (void); SEND *sim_cons_get_send (void);
EXPECT *sim_cons_get_expect (void); EXPECT *sim_cons_get_expect (void);
t_stat sim_show_cons_send_input (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, char *cptr); t_stat sim_show_cons_send_input (FILE *st, DEVICE *dptr, UNIT *uptr, int32 flag, char *cptr);
t_stat sim_set_noconsole_port (void);
t_stat sim_poll_kbd (void); t_stat sim_poll_kbd (void);
t_stat sim_putchar (int32 c); t_stat sim_putchar (int32 c);
t_stat sim_putchar_s (int32 c); t_stat sim_putchar_s (int32 c);

View file

@ -426,6 +426,7 @@ struct sim_device {
#define DEV_V_SECTORS 7 /* Unit Capacity is in 512byte sectors */ #define DEV_V_SECTORS 7 /* Unit Capacity is in 512byte sectors */
#define DEV_V_DONTAUTO 8 /* Do not auto detach already attached units */ #define DEV_V_DONTAUTO 8 /* Do not auto detach already attached units */
#define DEV_V_FLATHELP 9 /* Use traditional (unstructured) help */ #define DEV_V_FLATHELP 9 /* Use traditional (unstructured) help */
#define DEV_V_NOSAVE 10 /* Don't save device state */
#define DEV_V_UF_31 12 /* user flags, V3.1 */ #define DEV_V_UF_31 12 /* user flags, V3.1 */
#define DEV_V_UF 16 /* user flags */ #define DEV_V_UF 16 /* user flags */
#define DEV_V_RSV 31 /* reserved */ #define DEV_V_RSV 31 /* reserved */
@ -437,6 +438,7 @@ struct sim_device {
#define DEV_SECTORS (1 << DEV_V_SECTORS) /* capacity is 512 byte sectors */ #define DEV_SECTORS (1 << DEV_V_SECTORS) /* capacity is 512 byte sectors */
#define DEV_DONTAUTO (1 << DEV_V_DONTAUTO) /* Do not auto detach already attached units */ #define DEV_DONTAUTO (1 << DEV_V_DONTAUTO) /* Do not auto detach already attached units */
#define DEV_FLATHELP (1 << DEV_V_FLATHELP) /* Use traditional (unstructured) help */ #define DEV_FLATHELP (1 << DEV_V_FLATHELP) /* Use traditional (unstructured) help */
#define DEV_NOSAVE (1 << DEV_V_NOSAVE) /* Don't save device state */
#define DEV_NET 0 /* Deprecated - meaningless */ #define DEV_NET 0 /* Deprecated - meaningless */

View file

@ -873,7 +873,7 @@ DEVICE sim_timer_dev = {
"TIMER", sim_timer_units, sim_timer_reg, sim_timer_mod, "TIMER", sim_timer_units, sim_timer_reg, sim_timer_mod,
SIM_NTIMERS+1, 0, 0, 0, 0, 0, SIM_NTIMERS+1, 0, 0, 0, 0, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, DEV_DEBUG, 0, sim_timer_debug}; NULL, DEV_DEBUG | DEV_NOSAVE, 0, sim_timer_debug};
/* sim_idle - idle simulator until next event or for specified interval /* sim_idle - idle simulator until next event or for specified interval