1
0
mirror of https://github.com/rcornwell/sims.git synced 2026-01-18 09:03:11 +00:00

IBM360: Redid channel I/O to support changing channel type.

This commit is contained in:
Richard Cornwell 2020-10-22 17:17:00 -04:00
parent 37a64c5a2c
commit e7a7f73554
13 changed files with 940 additions and 614 deletions

View File

@ -77,7 +77,7 @@
cdp_mod Card Punch modifiers list
*/
uint8 cdp_startcmd(UNIT *, uint16, uint8);
uint8 cdp_startcmd(UNIT *, uint8);
void cdp_ini(UNIT *, t_bool);
t_stat cdp_srv(UNIT *);
t_stat cdp_reset(DEVICE *);
@ -125,7 +125,7 @@ DEVICE cdp_dev = {
* Start the card punch to punch one card.
*/
uint8 cdp_startcmd(UNIT *uptr, uint16 chan, uint8 cmd) {
uint8 cdp_startcmd(UNIT *uptr, uint8 cmd) {
DEVICE *dptr = find_dev_from_unit(uptr);
int unit = (uptr - dptr->units);

View File

@ -77,7 +77,7 @@
*/
uint8 cdr_startcmd(UNIT *, uint16, uint8);
uint8 cdr_startcmd(UNIT *, uint8);
t_stat cdr_boot(int32, DEVICE *);
t_stat cdr_srv(UNIT *);
t_stat cdr_reset(DEVICE *);
@ -121,7 +121,7 @@ DEVICE cdr_dev = {
/*
* Start card reader to read in one card.
*/
uint8 cdr_startcmd(UNIT *uptr, uint16 chan, uint8 cmd) {
uint8 cdr_startcmd(UNIT *uptr, uint8 cmd) {
DEVICE *dptr = find_dev_from_unit(uptr);
int unit = (uptr - dptr->units);

File diff suppressed because it is too large Load Diff

View File

@ -81,7 +81,7 @@
#define SNS u5
#define BPTR u6
uint8 coml_startcmd(UNIT *uptr, uint16 chan, uint8 cmd) ;
uint8 coml_startcmd(UNIT *uptr, uint8 cmd) ;
uint8 coml_haltio(UNIT *uptr);
t_stat coml_srv(UNIT *uptr);
t_stat com_reset(DEVICE *dptr);
@ -164,7 +164,7 @@ static const uint8 com_2741_in[128] = {
/*CAN EM SUB ESC FS GS RS US */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* sp ! " # $ % & ' */
0x81, 0xD7, 0x00, 0x16, 0x57, 0x8B, 0x61, 0x8D, /* 40 - 77 */
0x81, 0xD7, 0x96, 0x16, 0x57, 0x8B, 0x61, 0x8D, /* 40 - 77 */
/* ( ) * + , - . / */
0x93, 0x95, 0x90, 0xE1, 0x37, 0xC0, 0x76, 0x23,
/* 0 1 2 3 4 5 6 7 */
@ -259,7 +259,7 @@ static const uint8 com_2741_out[256] = {
/*
* Issue a command to the 2701 controller.
*/
uint8 coml_startcmd(UNIT *uptr, uint16 chan, uint8 cmd) {
uint8 coml_startcmd(UNIT *uptr, uint8 cmd) {
DEVICE *dptr = find_dev_from_unit(uptr);
int unit = (uptr - dptr->units);
@ -397,7 +397,7 @@ t_stat coml_srv(UNIT * uptr)
uptr->SNS = SNS_INTVENT;
uptr->BPTR = 0;
uptr->IPTR = 0;
chan_end(addr, SNS_CHNEND|SNS_DEVEND|SNS_UNITEXP);
chan_end(addr, SNS_CHNEND|SNS_DEVEND|SNS_UNITCHK|SNS_UNITEXP);
return SCPE_OK;
} else if (uptr->CMD & INPUT) {
if (uptr->BPTR == uptr->IPTR) {
@ -407,8 +407,6 @@ t_stat coml_srv(UNIT * uptr)
chan_end(addr, SNS_CHNEND|SNS_DEVEND);
return SCPE_OK;
}
// if (ch == 0x1f)
// uptr->CMD |= ADDR;
ch = com_buf[unit][uptr->IPTR++];
if (chan_write_byte( addr, &ch)) {
uptr->CMD &= ~(0xff|INPUT|RECV);

View File

@ -78,7 +78,7 @@ struct _con_data
}
con_data[NUM_DEVS_CON];
uint8 con_startcmd(UNIT *, uint16, uint8);
uint8 con_startcmd(UNIT *, uint8);
uint8 con_haltio(UNIT *);
void con_ini(UNIT *, t_bool);
t_stat con_srv(UNIT *);
@ -122,7 +122,7 @@ con_ini(UNIT *uptr, t_bool f) {
sim_activate(uptr, 1000);
}
uint8 con_startcmd(UNIT *uptr, uint16 chan, uint8 cmd) {
uint8 con_startcmd(UNIT *uptr, uint8 cmd) {
int u = (uptr - con_unit);
if ((uptr->CMD & CON_MSK) != 0)

View File

@ -1135,7 +1135,7 @@ wait_loop:
/* Check if we should see if an IRQ is pending */
irq = scan_chan(sysmsk, irq_en);
if (irq != 0) {
if (irq != NO_DEV) {
ilc = 0;
sim_debug(DEBUG_DETAIL, &cpu_dev, "IRQ=%04x %08x\n", irq, PC);
if (loading) {
@ -5796,6 +5796,7 @@ t_stat cpu_reset (DEVICE *dptr)
}
/* Set up channels */
chan_set_devs();
sysmsk = irqcode = irqaddr = loading = 0;
st_key = cc = pmsk = ec_mode = interval_irq = flags = 0;
dat_en = irq_en = ext_en = per_en = 0;

View File

@ -240,8 +240,8 @@ struct dasd_header
uint8 resv[492]; /* pad to 512 byte block */
};
uint8 dasd_startio(UNIT *uptr, uint16 chan) ;
uint8 dasd_startcmd(UNIT *uptr, uint16 chan, uint8 cmd) ;
uint8 dasd_startio(UNIT *uptr) ;
uint8 dasd_startcmd(UNIT *uptr, uint8 cmd) ;
uint8 dasd_haltio(uint16 addr);
t_stat dasd_srv(UNIT *);
t_stat dasd_boot(int32, DEVICE *);
@ -365,13 +365,19 @@ DEVICE ddd_dev = {
#endif
#endif
uint8 dasd_startio(UNIT *uptr, uint16 chan) {
uint8 dasd_startio(UNIT *uptr) {
DEVICE *dptr = find_dev_from_unit(uptr);
int unit = (uptr - dptr->units);
unsigned int i;
if ((uptr->CMD & 0xff) != 0) {
return SNS_BSY;
#if 0
/* Check if controller is free */
for (i = 0; i < dptr->numunits; i++) {
int cmd = (dptr->units[i].CMD) & 0xff;
if (cmd != 0 && cmd != DK_SEEK)
return SNS_BSY;
}
#endif
uptr->CMD &= ~(DK_INDEX|DK_NOEQ|DK_HIGH|DK_PARAM|DK_MSET|DK_DONE|DK_INDEX2);
if ((uptr->flags & UNIT_ATT) != 0) {
struct dasd_t *data = (struct dasd_t *)(uptr->up7);
@ -381,7 +387,7 @@ uint8 dasd_startio(UNIT *uptr, uint16 chan) {
return 0;
}
uint8 dasd_startcmd(UNIT *uptr, uint16 chan, uint8 cmd) {
uint8 dasd_startcmd(UNIT *uptr, uint8 cmd) {
uint16 addr = GET_UADDR(uptr->CMD);
DEVICE *dptr = find_dev_from_unit(uptr);
int unit = (uptr - dptr->units);

View File

@ -55,9 +55,8 @@
Channels 1-n run on channels virtual channels above subchannels.
*/
#define MAX_CHAN 6
#define SUB_CHANS 192
#define MAX_MUX 2
#define MAX_CHAN 12
#define SUB_CHANS 128
/* Define number of supported units for each device type */
#define NUM_DEVS_CDP 4
@ -78,9 +77,9 @@ typedef struct dib {
uint8 mask; /* Device mask */
uint8 numunits; /* Number of units */
/* Start I/O */
uint8 (*start_io)(UNIT *uptr, uint16 chan);
uint8 (*start_io)(UNIT *uptr);
/* Start a command */
uint8 (*start_cmd)(UNIT *uptr, uint16 chan, uint8 cmd);
uint8 (*start_cmd)(UNIT *uptr, uint8 cmd);
/* Stop I/O */
uint8 (*halt_io)(UNIT *uptr);
UNIT *units; /* Pointer to units structure */
@ -334,14 +333,15 @@ typedef struct dib {
#define STATUS_INTER 0x0002 /* Channel interface check */
#define STATUS_CHAIN 0x0001 /* Channel chain check */
#define NO_DEV 0xffff /* Code for no device */
void post_extirq();
/* look up device to find subchannel device is on */
int find_subchan(uint16 device);
int chan_read_byte(uint16 chan, uint8 *data);
int chan_write_byte(uint16 chan, uint8 *data);
int chan_read_byte(uint16 addr, uint8 *data);
int chan_write_byte(uint16 addr, uint8 *data);
void set_devattn(uint16 addr, uint8 flags);
void chan_end(uint16 chan, uint8 flags);
void chan_end(uint16 addr, uint8 flags);
int startio(uint16 addr) ;
int testio(uint16 addr);
int haltio(uint16 addr);
@ -371,6 +371,7 @@ extern DEBTAB dev_debug[];
extern DEBTAB crd_debug[];
extern DEVICE cpu_dev;
extern DEVICE chan_dev;
extern DEVICE cdp_dev;
extern DEVICE cdr_dev;
extern DEVICE lpr_dev;

View File

@ -88,7 +88,8 @@ struct _lpr_data
}
lpr_data[NUM_DEVS_LPR];
uint8 lpr_startcmd(UNIT *, uint16, uint8);
uint8 lpr_startio(UNIT *uptr);
uint8 lpr_startcmd(UNIT *, uint8);
void lpr_ini(UNIT *, t_bool);
t_stat lpr_srv(UNIT *);
t_stat lpr_reset(DEVICE *);
@ -120,7 +121,7 @@ MTAB lpr_mod[] = {
{0}
};
struct dib lpr_dib = { 0xFF, 1, NULL, lpr_startcmd, NULL, lpr_unit, lpr_ini};
struct dib lpr_dib = { 0xFF, 1, lpr_startio, lpr_startcmd, NULL, lpr_unit, lpr_ini};
DEVICE lpr_dev = {
"LPR", lpr_unit, NULL, lpr_mod,
@ -291,7 +292,19 @@ print_line(UNIT * uptr)
}
uint8 lpr_startcmd(UNIT * uptr, uint16 chan, uint8 cmd)
uint8 lpr_startio(UNIT *uptr) {
if ((uptr->CMD & LPR_CMDMSK) != 0) {
if ((uptr->flags & UNIT_ATT) != 0)
return SNS_BSY;
return SNS_CHNEND|SNS_DEVEND|SNS_UNITCHK;
}
sim_debug(DEBUG_CMD, &lpr_dev, "start io unit\n");
return 0;
}
uint8 lpr_startcmd(UNIT * uptr, uint8 cmd)
{
if ((uptr->CMD & LPR_CMDMSK) != 0) {
if ((uptr->flags & UNIT_ATT) != 0)
@ -316,6 +329,9 @@ uint8 lpr_startcmd(UNIT * uptr, uint16 chan, uint8 cmd)
sim_activate(uptr, 10); /* Start unit off */
uptr->SNS = 0;
uptr->POS = 0;
/* Motion and not load UCS */
if ((cmd & 0x77) != 0x73 && (cmd & 07) == 3)
return SNS_CHNEND;
return 0;
case 0: /* Status */
@ -390,7 +406,10 @@ lpr_srv(UNIT *uptr) {
uptr->SNS = SNS_CMDREJ;
uptr->CMD &= ~(LPR_CMDMSK);
sim_debug(DEBUG_DETAIL, &lpr_dev, "%d Invalid skip %x %d", u, l, l);
chan_end(addr, SNS_CHNEND|SNS_DEVEND|SNS_UNITCHK);
if (cmd == 3)
set_devattn(addr, SNS_DEVEND|SNS_UNITCHK);
else
chan_end(addr, SNS_CHNEND|SNS_DEVEND|SNS_UNITCHK);
return SCPE_OK;
}
@ -400,10 +419,10 @@ lpr_srv(UNIT *uptr) {
uptr->CMD &= ~(LPR_FULL|LPR_CMDMSK);
uptr->POS = 0;
if (uptr->SNS & SNS_CHN12) {
chan_end(addr, SNS_CHNEND|SNS_DEVEND|SNS_UNITEXP);
set_devattn(addr, SNS_DEVEND|SNS_UNITEXP);
uptr->SNS &= 0xff;
} else {
chan_end(addr, SNS_CHNEND|SNS_DEVEND);
set_devattn(addr, SNS_DEVEND);
}
return SCPE_OK;
}

View File

@ -140,7 +140,8 @@
#define SNS u5
#define CPOS u6
uint8 mt_startcmd(UNIT *uptr, uint16 chan, uint8 cmd) ;
uint8 mt_startio(UNIT *uptr);
uint8 mt_startcmd(UNIT *uptr, uint8 cmd);
t_stat mt_srv(UNIT *);
t_stat mt_boot(int32, DEVICE *);
void mt_ini(UNIT *, t_bool);
@ -178,7 +179,7 @@ UNIT mta_unit[] = {
{UDATA(&mt_srv, UNIT_MT(0), 0), 0, UNIT_ADDR(0x187)}, /* 7 */
};
struct dib mta_dib = { 0xF8, NUM_UNITS_MT, NULL, mt_startcmd, NULL, mta_unit, mt_ini};
struct dib mta_dib = { 0xF8, NUM_UNITS_MT, mt_startio, mt_startcmd, NULL, mta_unit, mt_ini};
DEVICE mta_dev = {
"MTA", mta_unit, NULL, mt_mod,
@ -200,7 +201,7 @@ UNIT mtb_unit[] = {
{UDATA(&mt_srv, UNIT_MT(1), 0), 0, UNIT_ADDR(0x287)}, /* 7 */
};
struct dib mtb_dib = { 0xF8, NUM_UNITS_MT, NULL, mt_startcmd, NULL, mtb_unit, mt_ini};
struct dib mtb_dib = { 0xF8, NUM_UNITS_MT, mt_startio, mt_startcmd, NULL, mtb_unit, mt_ini};
DEVICE mtb_dev = {
"MTB", mtb_unit, NULL, mt_mod,
@ -233,8 +234,29 @@ uint8 bcd_to_ebcdic[64] = {
0x50, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
0xc8, 0xc9, 0xc0, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f};
uint8 mt_startio(UNIT *uptr) {
DEVICE *dptr = find_dev_from_unit(uptr);
unsigned int i;
uint8 mt_startcmd(UNIT *uptr, uint16 chan, uint8 cmd) {
#if 0
if (mt_busy[GET_DEV_BUF(dptr->flags)] != 0) {
sim_debug(DEBUG_CMD, dptr, "busy\n");
uptr->flags |= MT_BUSY; /* Flag we need to send CUE */
return SNS_BSY;
}
/* Check if controller is free */
for (i = 0; i < dptr->numunits; i++) {
if ((dptr->units[i].CMD & MT_CMDMSK) != 0) {
uptr->flags |= MT_BUSY; /* Flag we need to send CUE */
return SNS_BSY;
}
}
sim_debug(DEBUG_CMD, dptr, "start io\n");
#endif
return 0;
}
uint8 mt_startcmd(UNIT *uptr, uint8 cmd) {
DEVICE *dptr = find_dev_from_unit(uptr);
int unit = (uptr - dptr->units);

View File

@ -116,7 +116,7 @@ struct _line {
extern int32 tmxr_poll;
uint8 scoml_startcmd(UNIT *uptr, uint16 chan, uint8 cmd) ;
uint8 scoml_startcmd(UNIT *uptr, uint8 cmd) ;
uint8 scoml_haltio(UNIT *uptr);
t_stat scoml_srv(UNIT *uptr);
t_stat scom_reset(DEVICE *dptr);
@ -188,7 +188,7 @@ DEVICE scoml_dev = {
/*
* Issue a scommand to the 2701 controller.
*/
uint8 scoml_startcmd(UNIT *uptr, uint16 chan, uint8 cmd) {
uint8 scoml_startcmd(UNIT *uptr, uint8 cmd) {
DEVICE *dptr = find_dev_from_unit(uptr);
int unit = (uptr - dptr->units);

View File

@ -47,43 +47,44 @@ int32 sim_emax = 16;
DEVICE *sim_devices[] = {
&cpu_dev,
&chan_dev,
#ifdef NUM_DEVS_CON
&con_dev,
&con_dev,
#endif
#ifdef NUM_DEVS_CDR
&cdr_dev,
&cdr_dev,
#endif
#ifdef NUM_DEVS_CDP
&cdp_dev,
&cdp_dev,
#endif
#ifdef NUM_DEVS_LPR
&lpr_dev,
&lpr_dev,
#endif
#ifdef NUM_DEVS_MT
&mta_dev,
&mta_dev,
#if NUM_DEVS_MT > 1
&mtb_dev,
&mtb_dev,
#endif
#endif
#ifdef NUM_DEVS_DASD
&dda_dev,
&dda_dev,
#if NUM_DEVS_DASD > 1
&ddb_dev,
&ddb_dev,
#if NUM_DEVS_DASD > 2
&ddc_dev,
&ddc_dev,
#if NUM_DEVS_DASD > 3
&ddd_dev,
&ddd_dev,
#endif
#endif
#endif
#endif
#ifdef NUM_DEVS_COM
&coml_dev,
&com_dev,
&coml_dev,
&com_dev,
#endif
#ifdef NUM_DEVS_SCOM
&scoml_dev,
&scom_dev,
&scoml_dev,
&scom_dev,
#endif
NULL };

Binary file not shown.