FRONTPANEL: Added mount and dismount commands for removable media
This commit is contained in:
parent
a7da3c6f54
commit
325e369bfd
7 changed files with 144 additions and 6 deletions
|
@ -309,6 +309,20 @@ if (!sim_panel_get_registers (panel, NULL)) {
|
|||
printf ("Unexpected success getting register data: %s\n", sim_panel_get_error());
|
||||
goto Done;
|
||||
}
|
||||
sim_panel_clear_error ();
|
||||
if (!sim_panel_dismount (panel, "RL0")) {
|
||||
printf ("Unexpected success while dismounting media file from non mounted RL0: %s\n", sim_panel_get_error());
|
||||
goto Done;
|
||||
}
|
||||
if (sim_panel_mount (panel, "RL0", "-N", "TEST-RL.DSK")) {
|
||||
printf ("Error while mounting media file TEST-RL.DSK on RL0: %s\n", sim_panel_get_error());
|
||||
goto Done;
|
||||
}
|
||||
if (sim_panel_dismount (panel, "RL0")) {
|
||||
printf ("Error while dismounting media file from RL0: %s\n", sim_panel_get_error());
|
||||
goto Done;
|
||||
}
|
||||
remove ("TEST-RL.DSK");
|
||||
while (1) {
|
||||
size_t i;
|
||||
char cmd[512];
|
||||
|
|
11
scp.c
11
scp.c
|
@ -490,7 +490,7 @@ static int32 noqueue_time;
|
|||
volatile int32 stop_cpu = 0;
|
||||
static char **sim_argv;
|
||||
t_value *sim_eval = NULL;
|
||||
t_value sim_last_val;
|
||||
static t_value sim_last_val;
|
||||
FILE *sim_log = NULL; /* log file */
|
||||
FILEREF *sim_log_ref = NULL; /* log file file reference */
|
||||
FILE *sim_deb = NULL; /* debug file */
|
||||
|
@ -503,7 +503,7 @@ static int32 sim_goto_line[MAX_DO_NEST_LVL+1]; /* the current line numb
|
|||
static int32 sim_do_echo = 0; /* the echo status of the currently open do file */
|
||||
static int32 sim_show_message = 1; /* the message display status of the currently open do file */
|
||||
static int32 sim_on_inherit = 0; /* the inherit status of on state and conditions when executing do files */
|
||||
int32 sim_do_depth = 0;
|
||||
static int32 sim_do_depth = 0;
|
||||
|
||||
static int32 sim_on_check[MAX_DO_NEST_LVL+1];
|
||||
static char *sim_on_actions[MAX_DO_NEST_LVL+1][SCPE_MAX_ERR+1];
|
||||
|
@ -511,7 +511,7 @@ static char sim_do_filename[MAX_DO_NEST_LVL+1][CBUFSIZE];
|
|||
static char *sim_do_ocptr[MAX_DO_NEST_LVL+1];
|
||||
static char *sim_do_label[MAX_DO_NEST_LVL+1];
|
||||
|
||||
static t_stat sim_last_cmd_stat; /* Command Status */
|
||||
t_stat sim_last_cmd_stat; /* Command Status */
|
||||
|
||||
static SCHTAB sim_stabr; /* Register search specifier */
|
||||
static SCHTAB sim_staba; /* Memory search specifier */
|
||||
|
@ -7026,8 +7026,9 @@ t_stat get_yn (const char *ques, t_stat deflt)
|
|||
{
|
||||
char cbuf[CBUFSIZE], *cptr;
|
||||
|
||||
printf ("%s ", ques);
|
||||
cptr = read_line (cbuf, sizeof(cbuf), stdin);
|
||||
if (sim_rem_cmd_active_line != -1)
|
||||
return deflt;
|
||||
cptr = read_line_p (ques, cbuf, sizeof(cbuf), stdin);
|
||||
if ((cptr == NULL) || (*cptr == 0))
|
||||
return deflt;
|
||||
if ((*cptr == 'Y') || (*cptr == 'y'))
|
||||
|
|
1
scp.h
1
scp.h
|
@ -221,6 +221,7 @@ extern int32 sim_interval;
|
|||
extern int32 sim_switches;
|
||||
extern int32 sim_quiet;
|
||||
extern int32 sim_step;
|
||||
extern t_stat sim_last_cmd_stat; /* Command Status */
|
||||
extern FILE *sim_log; /* log file */
|
||||
extern FILEREF *sim_log_ref; /* log file file reference */
|
||||
extern FILE *sim_deb; /* debug file */
|
||||
|
|
|
@ -411,7 +411,7 @@ static TMXR sim_rem_con_tmxr = { 0, 0, 0, NULL, NULL, &sim_remote_console };/* r
|
|||
static uint32 sim_rem_read_timeout = 30; /* seconds before automatic continue */
|
||||
static uint32 *sim_rem_read_timeouts = NULL;/* per line read timeout (default from sim_rem_read_timeout) */
|
||||
static int32 sim_rem_active_number = -1; /* -1 - not active, >= 0 is index of active console */
|
||||
static int32 sim_rem_cmd_active_line = -1; /* step in progress on line # */
|
||||
int32 sim_rem_cmd_active_line = -1; /* step in progress on line # */
|
||||
static CTAB *sim_rem_active_command = NULL; /* active command */
|
||||
static char *sim_rem_command_buf; /* active command buffer */
|
||||
static t_bool sim_log_temp = FALSE; /* temporary log file active */
|
||||
|
@ -688,6 +688,7 @@ sim_ttcmd (); /* restore console */
|
|||
stat = sim_rem_active_command->action (sim_rem_active_command->arg, cptr);/* execute command */
|
||||
if (stat != SCPE_OK)
|
||||
stat = _sim_rem_message (gbuf, stat); /* display results */
|
||||
sim_last_cmd_stat = SCPE_BARE_STATUS(stat);
|
||||
sim_ttrun (); /* set console mode */
|
||||
sim_cancel (&sim_rem_con_unit[1]); /* force immediate activation of sim_rem_con_data_svc */
|
||||
sim_activate (&sim_rem_con_unit[1], -1);
|
||||
|
|
|
@ -120,6 +120,8 @@ int32 sim_tt_outcvt (int32 c, uint32 mode);
|
|||
t_stat sim_tt_settabs (UNIT *uptr, int32 val, char *cptr, void *desc);
|
||||
t_stat sim_tt_showtabs (FILE *st, UNIT *uptr, int32 val, void *desc);
|
||||
|
||||
extern int32 sim_rem_cmd_active_line; /* command in progress on line # */
|
||||
|
||||
extern int32 sim_int_char; /* interrupt character */
|
||||
extern int32 sim_brk_char; /* break character */
|
||||
extern int32 sim_tt_pchar; /* printable character mask */
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
03-Apr-15 MP Added logic to pass simulator startup messages in
|
||||
panel error text if the connection to the simulator
|
||||
shuts down while it is starting.
|
||||
04-Apr-15 MP Added mount and dismount routines to connect and
|
||||
disconnect removable media
|
||||
|
||||
This module provides interface between a front panel application and a simh
|
||||
simulator. Facilities provide ways to gather information from and to
|
||||
|
@ -1344,6 +1346,83 @@ if (_panel_sendf (panel, 1, NULL, "DEPOSIT %s %s", name, value))
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
sim_panel_mount
|
||||
|
||||
device the name of a simulator device/unit
|
||||
switches any switches appropriate for the desire attach
|
||||
path the path on the local system to be attached
|
||||
|
||||
*/
|
||||
int
|
||||
sim_panel_mount (PANEL *panel,
|
||||
const char *device,
|
||||
const char *switches,
|
||||
const char *path)
|
||||
{
|
||||
char *response = NULL, *status = NULL;
|
||||
|
||||
if (!panel || (panel->State == Error)) {
|
||||
sim_panel_set_error ("Invalid Panel");
|
||||
return -1;
|
||||
}
|
||||
if (_panel_sendf (panel, 1, &response, "ATTACH %s %s %s", switches, device, path)) {
|
||||
free (response);
|
||||
return -1;
|
||||
}
|
||||
if (_panel_sendf (panel, 1, &status, "ECHO %%STATUS%%")) {
|
||||
free (response);
|
||||
free (status);
|
||||
return -1;
|
||||
}
|
||||
if (!status || (strcmp (status, "00000000\r\n"))) {
|
||||
sim_panel_set_error (response);
|
||||
free (response);
|
||||
free (status);
|
||||
return -1;
|
||||
}
|
||||
free (response);
|
||||
free (status);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
sim_panel_dismount
|
||||
|
||||
device the name of a simulator device/unit
|
||||
|
||||
*/
|
||||
int
|
||||
sim_panel_dismount (PANEL *panel,
|
||||
const char *device)
|
||||
{
|
||||
char *response = NULL, *status = NULL;
|
||||
|
||||
if (!panel || (panel->State == Error)) {
|
||||
sim_panel_set_error ("Invalid Panel");
|
||||
return -1;
|
||||
}
|
||||
if (_panel_sendf (panel, 1, &response, "DETACH %s", device)) {
|
||||
free (response);
|
||||
return -1;
|
||||
}
|
||||
if (_panel_sendf (panel, 1, &status, "ECHO %%STATUS%%")) {
|
||||
free (response);
|
||||
free (status);
|
||||
return -1;
|
||||
}
|
||||
if (!status || (strcmp (status, "00000000\r\n"))) {
|
||||
sim_panel_set_error (response);
|
||||
free (response);
|
||||
free (status);
|
||||
return -1;
|
||||
}
|
||||
free (response);
|
||||
free (status);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
_panel_reader(void *arg)
|
||||
{
|
||||
|
@ -1705,6 +1784,7 @@ if (wait_for_completion) {
|
|||
strcat (buf, command_done_echo);
|
||||
strcat (buf, "\r");
|
||||
pthread_mutex_lock (&p->io_lock);
|
||||
p->io_response_data = 0;
|
||||
}
|
||||
|
||||
ret = (strlen (buf) == _panel_send (p, buf, strlen (buf))) ? 0 : -1;
|
||||
|
@ -1723,6 +1803,7 @@ if (wait_for_completion) {
|
|||
memcpy (*response, p->io_response, p->io_response_data + 1);
|
||||
}
|
||||
p->io_response_data = 0;
|
||||
p->io_response[0] = '\0';
|
||||
}
|
||||
pthread_mutex_unlock (&p->io_lock);
|
||||
}
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
03-Apr-15 MP Added logic to pass simulator startup messages in
|
||||
panel error text if the connection to the simulator
|
||||
shuts down while it is starting.
|
||||
04-Apr-15 MP Added mount and dismount routines to connect and
|
||||
disconnect removable media
|
||||
|
||||
This module defines interface between a front panel application and a simh
|
||||
simulator. Facilities provide ways to gather information from and to
|
||||
|
@ -323,6 +325,42 @@ sim_panel_set_register_value (PANEL *panel,
|
|||
const char *name,
|
||||
const char *value);
|
||||
|
||||
/**
|
||||
|
||||
When a front panel application may needs to change the media
|
||||
in a simulated removable media device one of the following
|
||||
routines should be called:
|
||||
|
||||
sim_panel_mount - mounts the indicated media file on a device
|
||||
sim_panel_dismount - dismounts the currently mounted media file
|
||||
from a device
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
sim_panel_mount
|
||||
|
||||
device the name of a simulator device/unit
|
||||
switches any switches appropriate for the desire attach
|
||||
path the path on the local system to be attached
|
||||
|
||||
*/
|
||||
int
|
||||
sim_panel_mount (PANEL *panel,
|
||||
const char *device,
|
||||
const char *switches,
|
||||
const char *path);
|
||||
|
||||
/**
|
||||
sim_panel_dismount
|
||||
|
||||
device the name of a simulator device/unit
|
||||
|
||||
*/
|
||||
int
|
||||
sim_panel_dismount (PANEL *panel,
|
||||
const char *device);
|
||||
|
||||
|
||||
typedef enum {
|
||||
Halt, /* Simulation is halted (instructions not being executed) */
|
||||
|
|
Loading…
Add table
Reference in a new issue