HP2100 fixes to avoid potential namespace clashes with names defined in unistd.h. (Dave Bryan)

This commit is contained in:
Mark Pizzolato 2012-10-24 12:57:37 -07:00
parent 99f042f7dc
commit ef147d2058
4 changed files with 144 additions and 140 deletions

View file

@ -25,6 +25,7 @@
DA 12821A Disc Interface with Amigo disc drives
24-Oct-12 JDB Changed CNTLR_OPCODE to title case to avoid name clash
07-May-12 JDB Cancel the intersector delay if an untalk is received
29-Mar-12 JDB First release
04-Nov-11 JDB Created DA device
@ -757,7 +758,7 @@ switch (if_state [unit]) { /* dispatch the inte
case disc_command: /* execute a disc command */
result = dl_service_drive (cvptr, uptr); /* service the disc unit */
if (cvptr->opcode == clear) /* is this a Clear command? */
if (cvptr->opcode == Clear) /* is this a Clear command? */
if_dsj [unit] = 2; /* indicate that the self test is complete */
if (cvptr->state != cntlr_busy) { /* has the controller stopped? */
@ -857,7 +858,7 @@ switch (if_state [unit]) { /* dispatch the inte
if (cvptr->length == 0 || cvptr->eod == SET) { /* is the data phase complete? */
uptr->PHASE = end_phase; /* set the end phase */
if (cvptr->opcode == request_status) /* is it a Request Status command? */
if (cvptr->opcode == Request_Status) /* is it a Request Status command? */
if_dsj [unit] = 0; /* clear the DSJ value */
if_state [unit] = command_exec; /* set to execute the command */
@ -981,7 +982,7 @@ if (result == SCPE_IERR && DEBUG_PRI (da_dev, DEB_RWSC)) { /* did an internal e
if (if_state [unit] == idle) { /* is the command now complete? */
if (if_command [unit] == disc_command) { /* did a disc command complete? */
if (cvptr->opcode != end) /* yes; if the command was not End, */
if (cvptr->opcode != End) /* yes; if the command was not End, */
di_poll_response (da, unit, SET); /* then enable PPR */
if (DEBUG_PRI (da_dev, DEB_RWSC))
@ -1267,7 +1268,7 @@ result = dl_load_unload (&icd_cntlr [unit], uptr, load); /* load or unload th
if (result == SCPE_OK && ! load) { /* was the unload successful? */
icd_cntlr [unit].status = drive_attention; /* set Drive Attention status */
if (uptr->OP == end) /* is the controller in idle state 2? */
if (uptr->OP == End) /* is the controller in idle state 2? */
di_poll_response (da, unit, SET); /* enable PPR */
}

View file

@ -26,6 +26,7 @@
DS 13037D/13175D disc controller/interface
24-Oct-12 JDB Changed CNTLR_OPCODE to title case to avoid name clash
29-Mar-12 JDB Rewritten to use the MAC/ICD disc controller library
ioIOO now notifies controller service of parameter output
14-Feb-12 JDB Corrected SRQ generation and FIFO under/overrun detection
@ -705,10 +706,10 @@ result = dl_service_drive (&mac_cntlr, uptr); /* service the drive */
if ((CNTLR_PHASE) uptr->PHASE == data_phase) /* is the drive in the data phase? */
switch ((CNTLR_OPCODE) uptr->OP) { /* dispatch the current operation */
case read: /* read operations */
case read_full_sector:
case read_with_offset:
case read_without_verify:
case Read: /* read operations */
case Read_Full_Sector:
case Read_With_Offset:
case Read_Without_Verify:
if (mac_cntlr.length == 0 || ds.edt == SET) { /* is the data phase complete? */
mac_cntlr.eod = ds.edt; /* set EOD if DCPC is done */
uptr->PHASE = end_phase; /* set the end phase */
@ -729,9 +730,9 @@ if ((CNTLR_PHASE) uptr->PHASE == data_phase) /* is the drive in the d
break;
case write: /* write operations */
case write_full_sector:
case initialize:
case Write: /* write operations */
case Write_Full_Sector:
case Initialize:
if (entry_phase == start_phase) { /* is this the phase transition? */
ds.srq = SET; /* start the DCPC transfer */
ds_io (&ds_dib, ioSIR, 0); /* and recalculate the interrupts */
@ -850,19 +851,19 @@ switch ((CNTLR_PHASE) uptr->PHASE) { /* dispatch the current
case end_phase: /* start and end on the same phase */
switch (opcode) { /* dispatch the current operation */
case request_status:
case request_sector_address:
case address_record:
case request_syndrome:
case load_tio_register:
case request_disc_address:
case end:
case Request_Status:
case Request_Sector_Address:
case Address_Record:
case Request_Syndrome:
case Load_TIO_Register:
case Request_Disc_Address:
case End:
break; /* complete the operation without setting the flag */
case clear:
case set_file_mask:
case wakeup:
case Clear:
case Set_File_Mask:
case Wakeup:
ds_io (&ds_dib, ioENF, 0); /* complete the operation and set the flag */
break;
@ -877,11 +878,11 @@ switch ((CNTLR_PHASE) uptr->PHASE) { /* dispatch the current
case data_phase:
switch (opcode) { /* dispatch the current operation */
case seek: /* operations that accept parameters */
case verify:
case address_record:
case read_with_offset:
case load_tio_register:
case Seek: /* operations that accept parameters */
case Verify:
case Address_Record:
case Read_With_Offset:
case Load_TIO_Register:
buffer [mac_cntlr.index++] = fifo_unload (); /* unload the next word from the FIFO */
mac_cntlr.length--; /* count it */
@ -891,7 +892,7 @@ switch ((CNTLR_PHASE) uptr->PHASE) { /* dispatch the current
else { /* all parameters have been received */
uptr->PHASE = end_phase; /* set the end phase */
if (opcode == read_with_offset) /* a Read With Offset command sets the flag */
if (opcode == Read_With_Offset) /* a Read With Offset command sets the flag */
ds_io (&ds_dib, ioENF, 0); /* to indicate that offsetting is complete */
start_command (); /* the command is now ready to execute */
@ -899,10 +900,10 @@ switch ((CNTLR_PHASE) uptr->PHASE) { /* dispatch the current
break;
case request_status: /* operations that supply parameters */
case request_sector_address:
case request_syndrome:
case request_disc_address:
case Request_Status: /* operations that supply parameters */
case Request_Sector_Address:
case Request_Syndrome:
case Request_Disc_Address:
if (mac_cntlr.length) { /* are there more words to return? */
fifo_load (buffer [mac_cntlr.index++]); /* load the next word into the FIFO */
mac_cntlr.length--; /* count it */
@ -1258,7 +1259,7 @@ unit = GET_S1UNIT (mac_cntlr.spd_unit); /* get the (prepared) un
if (unit <= DL_MAXDRIVE) /* is the unit number valid? */
drive_command = (CNTLR_OPCODE) ds_unit [unit].OP; /* get the opcode from the unit that will be used */
else /* the unit is invalid, so the command will not start */
drive_command = end; /* but the compiler doesn't know this! */
drive_command = End; /* but the compiler doesn't know this! */
uptr = dl_start_command (&mac_cntlr, ds_unit, DL_MAXDRIVE); /* ask the controller to start the command */

View file

@ -24,6 +24,7 @@
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the authors.
24-Oct-12 JDB Changed CNTLR_OPCODE to title case to avoid name clash
07-May-12 JDB Corrected end-of-track delay time logic
02-May-12 JDB First release
09-Nov-11 JDB Created disc controller common library from DS simulator
@ -594,8 +595,8 @@ set_timer (cvptr, CLEAR); /* stop the command wait
opcode = GET_OPCODE (cvptr->buffer [0]); /* get the opcode from the command */
if (opcode > last_opcode) /* is the opcode invalid? */
props = &cmd_props [invalid_opcode]; /* undefined commands clear prior status */
if (opcode > Last_Opcode) /* is the opcode invalid? */
props = &cmd_props [Invalid_Opcode]; /* undefined commands clear prior status */
else /* the opcode is potentially valid */
props = &cmd_props [opcode]; /* get the command properties */
@ -794,7 +795,7 @@ cvptr->eod = CLEAR; /* clear the end of data
switch (cvptr->opcode) { /* dispatch the command */
case cold_load_read:
case Cold_Load_Read:
cvptr->cylinder = 0; /* set the cylinder address to 0 */
cvptr->head = GET_CHEAD (cvptr->buffer [0]); /* set the head */
cvptr->sector = GET_CSECT (cvptr->buffer [0]); /* and sector from the command */
@ -802,7 +803,7 @@ switch (cvptr->opcode) { /* dispatch the command
if (is_seeking) { /* if a seek is in progress, */
uptr->STAT |= DL_S2SC; /* a Seek Check occurs */
cvptr->file_mask = DL_FSPEN; /* enable sparing */
uptr->OP = read; /* start the read on the seek completion */
uptr->OP = Read; /* start the read on the seek completion */
uptr->PHASE = start_phase; /* and reset the command phase */
return uptr; /* to allow the seek to complete normally */
}
@ -813,7 +814,7 @@ switch (cvptr->opcode) { /* dispatch the command
break;
case seek:
case Seek:
cvptr->cylinder = cvptr->buffer [1]; /* get the supplied cylinder */
cvptr->head = GET_HEAD (cvptr->buffer [2]); /* and head */
cvptr->sector = GET_SECTOR (cvptr->buffer [2]); /* and sector addresses */
@ -827,7 +828,7 @@ switch (cvptr->opcode) { /* dispatch the command
break;
case request_status:
case Request_Status:
cvptr->buffer [0] = /* set the Status-1 value */
cvptr->spd_unit | SET_S1STAT (cvptr->status); /* into the buffer */
@ -854,12 +855,12 @@ switch (cvptr->opcode) { /* dispatch the command
break;
case request_disc_address:
case Request_Disc_Address:
set_address (cvptr, 0); /* return the CHS values in buffer 0-1 */
break;
case request_sector_address:
case Request_Sector_Address:
if (unit > unit_limit) /* if the unit number is invalid */
rptr = NULL; /* it does not correspond to a unit */
else /* otherwise, the unit is valid */
@ -872,7 +873,7 @@ switch (cvptr->opcode) { /* dispatch the command
break;
case request_syndrome:
case Request_Syndrome:
cvptr->buffer [0] = /* return the Status-1 value in buffer 0 */
cvptr->spd_unit | SET_S1STAT (cvptr->status);
@ -885,7 +886,7 @@ switch (cvptr->opcode) { /* dispatch the command
break;
case address_record:
case Address_Record:
cvptr->cylinder = cvptr->buffer [1]; /* get the supplied cylinder */
cvptr->head = GET_HEAD (cvptr->buffer [2]); /* and head */
cvptr->sector = GET_SECTOR (cvptr->buffer [2]); /* and sector addresses */
@ -893,7 +894,7 @@ switch (cvptr->opcode) { /* dispatch the command
break;
case set_file_mask:
case Set_File_Mask:
cvptr->file_mask = GET_FMASK (cvptr->buffer [0]); /* get the supplied file mask */
if (cvptr->type == MAC) /* if this is a MAC controller, */
@ -901,14 +902,14 @@ switch (cvptr->opcode) { /* dispatch the command
break;
case initialize:
case Initialize:
if (uptr) /* if the unit is valid, */
cvptr->spd_unit |= /* merge the SPD flags */
SET_S1SPD (GET_SPD (cvptr->buffer [0])); /* from the command word */
break;
case verify:
case Verify:
cvptr->verify_count = cvptr->buffer [1]; /* get the supplied sector count */
break;
@ -1078,35 +1079,35 @@ switch ((CNTLR_PHASE) uptr->PHASE) { /* dispatch the phase */
case start_phase:
switch (opcode) { /* dispatch the current operation */
case recalibrate:
case seek:
case Recalibrate:
case Seek:
if (start_seek (cvptr, uptr, opcode, end_phase) /* start the seek; if it succeeded, */
&& (cvptr->type == MAC)) /* and this a MAC controller, */
dl_idle_controller (cvptr); /* then go idle until it completes */
break;
case cold_load_read:
if (start_seek (cvptr, uptr, read, start_phase)) /* start the seek; did it succeed? */
case Cold_Load_Read:
if (start_seek (cvptr, uptr, Read, start_phase)) /* start the seek; did it succeed? */
cvptr->file_mask = DL_FSPEN; /* set sparing enabled now */
break;
case read:
case read_with_offset:
case read_without_verify:
case Read:
case Read_With_Offset:
case Read_Without_Verify:
cvptr->length = DL_WPSEC; /* transfer just the data */
result = start_read (cvptr, uptr); /* start the sector read */
break;
case read_full_sector:
case Read_Full_Sector:
cvptr->length = DL_WPFSEC; /* transfer the header/data/trailer */
result = start_read (cvptr, uptr); /* start the sector read */
break;
case verify:
case Verify:
cvptr->length = 0; /* no data transfer needed */
result = start_read (cvptr, uptr); /* start the sector read */
@ -1118,29 +1119,29 @@ switch ((CNTLR_PHASE) uptr->PHASE) { /* dispatch the phase */
break;
case write:
case initialize:
case Write:
case Initialize:
cvptr->length = DL_WPSEC; /* transfer just the data */
start_write (cvptr, uptr); /* start the sector write */
break;
case write_full_sector:
case Write_Full_Sector:
cvptr->length = DL_WPFSEC; /* transfer the header/data/trailer */
start_write (cvptr, uptr); /* start the sector write */
break;
case request_status:
case request_sector_address:
case clear:
case address_record:
case request_syndrome:
case set_file_mask:
case load_tio_register:
case request_disc_address:
case end:
case wakeup:
case Request_Status:
case Request_Sector_Address:
case Clear:
case Address_Record:
case Request_Syndrome:
case Set_File_Mask:
case Load_TIO_Register:
case Request_Disc_Address:
case End:
case Wakeup:
dl_service_controller (cvptr, uptr); /* the controller service handles these */
break;
@ -1154,13 +1155,13 @@ switch ((CNTLR_PHASE) uptr->PHASE) { /* dispatch the phase */
case data_phase:
switch (opcode) { /* dispatch the current operation */
case read:
case read_full_sector:
case read_with_offset:
case read_without_verify:
case write:
case write_full_sector:
case initialize:
case Read:
case Read_Full_Sector:
case Read_With_Offset:
case Read_Without_Verify:
case Write:
case Write_Full_Sector:
case Initialize:
break; /* data transfers are handled by the caller */
@ -1174,8 +1175,8 @@ switch ((CNTLR_PHASE) uptr->PHASE) { /* dispatch the phase */
case end_phase:
switch (opcode) { /* dispatch the operation command */
case recalibrate:
case seek:
case Recalibrate:
case Seek:
if (cvptr->type == ICD) /* is this an ICD controller? */
dl_end_command (cvptr, drive_attention); /* seeks end with Drive Attention status */
else /* if not an ICD controller, */
@ -1183,22 +1184,22 @@ switch ((CNTLR_PHASE) uptr->PHASE) { /* dispatch the phase */
break;
case read:
case read_full_sector:
case read_with_offset:
case Read:
case Read_Full_Sector:
case Read_With_Offset:
end_read (cvptr, uptr); /* end the sector read */
break;
case read_without_verify:
case Read_Without_Verify:
if (cvptr->sector == 0) /* have we reached the end of the track? */
uptr->OP = read; /* begin verifying the next time */
uptr->OP = Read; /* begin verifying the next time */
end_read (cvptr, uptr); /* end the sector read */
break;
case verify:
case Verify:
cvptr->verify_count = /* decrement the count */
(cvptr->verify_count - 1) & DMASK; /* modulo 65536 */
@ -1209,16 +1210,16 @@ switch ((CNTLR_PHASE) uptr->PHASE) { /* dispatch the phase */
break;
case write:
case write_full_sector:
case initialize:
case Write:
case Write_Full_Sector:
case Initialize:
result = end_write (cvptr, uptr); /* end the sector write */
break;
case request_status:
case request_sector_address:
case request_disc_address:
case Request_Status:
case Request_Sector_Address:
case Request_Disc_Address:
dl_service_controller (cvptr, uptr); /* the controller service handles these */
break;
@ -1278,33 +1279,33 @@ switch ((CNTLR_PHASE) uptr->PHASE) { /* dispatch the phase */
case start_phase:
case end_phase:
switch (opcode) { /* dispatch the current operation */
case request_status:
case Request_Status:
dl_end_command (cvptr, cvptr->status); /* the command completes with no status change */
break;
case clear:
case Clear:
dl_clear_controller (cvptr, uptr, soft_clear); /* clear the controller */
dl_end_command (cvptr, normal_completion); /* the command is complete */
break;
case request_sector_address:
case address_record:
case request_syndrome:
case set_file_mask:
case load_tio_register:
case request_disc_address:
case Request_Sector_Address:
case Address_Record:
case Request_Syndrome:
case Set_File_Mask:
case Load_TIO_Register:
case Request_Disc_Address:
dl_end_command (cvptr, normal_completion); /* the command is complete */
break;
case end:
case End:
dl_idle_controller (cvptr); /* the command completes with the controller idle */
break;
case wakeup:
case Wakeup:
dl_end_command (cvptr, unit_available); /* the command completes with Unit Available status */
break;
@ -1319,11 +1320,11 @@ switch ((CNTLR_PHASE) uptr->PHASE) { /* dispatch the phase */
case data_phase:
switch (opcode) { /* dispatch the current operation */
case seek:
case verify:
case address_record:
case read_with_offset:
case load_tio_register:
case Seek:
case Verify:
case Address_Record:
case Read_With_Offset:
case Load_TIO_Register:
if (cvptr->length > 1) /* at least one more parameter to input? */
set_timer (cvptr, SET); /* restart the timer for the next parameter */
else /* this is the last one */
@ -1331,10 +1332,10 @@ switch ((CNTLR_PHASE) uptr->PHASE) { /* dispatch the phase */
break;
case request_status:
case request_sector_address:
case request_syndrome:
case request_disc_address:
case Request_Status:
case Request_Sector_Address:
case Request_Syndrome:
case Request_Disc_Address:
if (cvptr->length > 0) /* at least one more to parameter output? */
set_timer (cvptr, SET); /* restart the timer for the next parameter */
else /* this is the last one */
@ -1505,8 +1506,8 @@ for (unit = 0; unit < unit_count; unit++) { /* loop through the unit
if (!(uptr->flags & UNIT_DIS)) { /* is the unit enabled? */
if (clear_type == hard_clear /* a hard clear cancels */
&& uptr->OP != seek /* only if not seeking */
&& uptr->OP != recalibrate) /* or recalibrating */
&& uptr->OP != Seek /* only if not seeking */
&& uptr->OP != Recalibrate) /* or recalibrating */
sim_cancel (uptr); /* cancel the service */
uptr->STAT &= ~DL_S2CPS; /* do "Controller Preset" for the unit */
@ -1597,7 +1598,7 @@ return SCPE_OK;
CNTLR_CLASS dl_classify (CNTLR_VARS cntlr)
{
if (cntlr.type <= last_type /* if the controller type is legal */
&& cntlr.opcode <= last_opcode /* and the opcode is legal */
&& cntlr.opcode <= Last_Opcode /* and the opcode is legal */
&& cmd_props [cntlr.opcode].valid [cntlr.type]) /* and is defined for this controller, */
return cmd_props [cntlr.opcode].classification; /* then return the command classification */
else /* the type or opcode is illegal */
@ -1615,7 +1616,7 @@ else /* the type or opcode is
const char *dl_opcode_name (CNTLR_TYPE controller, CNTLR_OPCODE opcode)
{
if (controller <= last_type /* if the controller type is legal */
&& opcode <= last_opcode /* and the opcode is legal */
&& opcode <= Last_Opcode /* and the opcode is legal */
&& cmd_props [opcode].valid [controller]) /* and is defined for this controller, */
return opcode_name [opcode]; /* then return the opcode name */
else /* the type or opcode is illegal, */
@ -1776,7 +1777,7 @@ if (cvptr->eod == SET) { /* is the end of data in
return SCPE_OK;
}
if (opcode == read_full_sector) { /* are we starting a Read Full Sector command? */
if (opcode == Read_Full_Sector) { /* are we starting a Read Full Sector command? */
if (cvptr->type == ICD) /* is this an ICD controller? */
cvptr->buffer [0] = 0100377; /* ICD does not support ECC */
else
@ -1789,7 +1790,7 @@ if (opcode == read_full_sector) { /* are we starting a Rea
else { /* it's another read command */
offset = 0; /* data starts at the beginning */
verify = (opcode != read_without_verify); /* set for address verification unless it's a RWV */
verify = (opcode != Read_Without_Verify); /* set for address verification unless it's a RWV */
}
if (! position_sector (cvptr, uptr, verify)) /* position the sector */
@ -1911,7 +1912,7 @@ return;
static void start_write (CVPTR cvptr, UNIT *uptr)
{
const t_bool verify = (CNTLR_OPCODE) uptr->OP == write; /* only Write verifies the sector address */
const t_bool verify = (CNTLR_OPCODE) uptr->OP == Write; /* only Write verifies the sector address */
if ((uptr->flags & UNIT_WPROT) /* is the unit write protected, */
|| !verify && !(uptr->flags & UNIT_FMT)) /* or is formatting required but not enabled? */
@ -1959,7 +1960,7 @@ static t_stat end_write (CVPTR cvptr, UNIT *uptr)
uint32 count;
uint16 pad;
const CNTLR_OPCODE opcode = (CNTLR_OPCODE) uptr->OP;
const uint32 offset = (opcode == write_full_sector ? 3 : 0);
const uint32 offset = (opcode == Write_Full_Sector ? 3 : 0);
if (uptr->flags & UNIT_UNLOAD) { /* if the drive is not ready, */
dl_end_command (cvptr, access_not_ready); /* terminate the command with an error */
@ -2200,7 +2201,7 @@ if (uptr->flags & UNIT_UNLOAD) { /* are the heads unloade
return FALSE; /* as the drive was not ready */
}
if ((CNTLR_OPCODE) uptr->OP == recalibrate) /* is the unit recalibrating? */
if ((CNTLR_OPCODE) uptr->OP == Recalibrate) /* is the unit recalibrating? */
target_cylinder = 0; /* seek to cylinder 0 and don't reset the EOC flag */
else { /* it's a Seek command or an auto-seek request */

View file

@ -24,6 +24,7 @@
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the authors.
24-Oct-12 JDB Changed CNTLR_OPCODE to title case to avoid name clash
07-May-12 JDB Added end-of-track delay time as a controller variable
02-May-12 JDB First release
09-Nov-11 JDB Created disc controller common library from DS simulator
@ -206,29 +207,29 @@ typedef enum {
/* Controller opcodes */
typedef enum {
cold_load_read = 000,
recalibrate = 001,
seek = 002,
request_status = 003,
request_sector_address = 004,
read = 005,
read_full_sector = 006,
verify = 007,
write = 010,
write_full_sector = 011,
clear = 012,
initialize = 013,
address_record = 014,
request_syndrome = 015,
read_with_offset = 016,
set_file_mask = 017,
invalid_opcode = 020,
read_without_verify = 022,
load_tio_register = 023,
request_disc_address = 024,
end = 025,
wakeup = 026,
last_opcode = wakeup /* last valid opcode */
Cold_Load_Read = 000,
Recalibrate = 001,
Seek = 002,
Request_Status = 003,
Request_Sector_Address = 004,
Read = 005,
Read_Full_Sector = 006,
Verify = 007,
Write = 010,
Write_Full_Sector = 011,
Clear = 012,
Initialize = 013,
Address_Record = 014,
Request_Syndrome = 015,
Read_With_Offset = 016,
Set_File_Mask = 017,
Invalid_Opcode = 020,
Read_Without_Verify = 022,
Load_TIO_Register = 023,
Request_Disc_Address = 024,
End = 025,
Wakeup = 026,
Last_Opcode = Wakeup /* last valid opcode */
} CNTLR_OPCODE;
#define DL_OPCODE_MASK 037
@ -353,7 +354,7 @@ typedef CNTLR_VARS *CVPTR; /* pointer to controller
*/
#define CNTLR_INIT(ctype,bufptr,auxptr) \
(ctype), cntlr_idle, end, normal_completion, \
(ctype), cntlr_idle, End, normal_completion, \
CLEAR, CLEAR, \
0, 0, 0, 0, 0, 0, 0, 0, \
(bufptr), 0, 0, (auxptr), \