/*-------------------------------------------------------------------------- ** ** Copyright (c) 2003, Tom Hunter (see license.txt) ** ** Name: rtc.c ** ** Description: ** Perform simulation of CDC 6600 real-time clock. ** **-------------------------------------------------------------------------- */ /* ** ------------- ** Include Files ** ------------- */ #include #include #include #include "const.h" #include "types.h" #include "proto.h" /* ** ----------------- ** Private Constants ** ----------------- */ /* ** ----------------------- ** Private Macro Functions ** ----------------------- */ /* ** ----------------------------------------- ** Private Typedef and Structure Definitions ** ----------------------------------------- */ /* ** --------------------------- ** Private Function Prototypes ** --------------------------- */ static FcStatus rtcFunc(PpWord funcCode); static void rtcIo(void); static void rtcActivate(void); static void rtcDisconnect(void); /* ** ---------------- ** Public Variables ** ---------------- */ /* ** ----------------- ** Private Variables ** ----------------- */ static u8 rtcIncrement; static u16 rtcClock = 0; static bool rtcFull; /* **-------------------------------------------------------------------------- ** ** Public Functions ** **-------------------------------------------------------------------------- */ /*-------------------------------------------------------------------------- ** Purpose: Initialise RTC. ** ** Parameters: Name Description. ** model Cyber model number ** increment clock increment per iteration. ** ** Returns: Nothing. ** **------------------------------------------------------------------------*/ void rtcInit(char *model, u8 increment) { DevSlot *dp; dp = channelAttach(014, DtRtc); dp->activate = rtcActivate; dp->disconnect = rtcDisconnect; dp->func = rtcFunc; dp->io = rtcIo; dp->selectedUnit = 0; rtcIncrement = increment; activeChannel->ioDevice = dp; if (strcmp(model, "6600") == 0) { activeChannel->active = TRUE; activeChannel->full = TRUE; rtcFull = TRUE; } else { activeChannel->active = FALSE; activeChannel->full = FALSE; rtcFull = FALSE; } } /*-------------------------------------------------------------------------- ** Purpose: Execute deadstart function. ** ** Parameters: Name Description. ** increment clock increment per iteration. ** ** Returns: Nothing. ** **------------------------------------------------------------------------*/ void rtcTick(void) { rtcClock = (rtcClock + rtcIncrement) & Mask12; } /*-------------------------------------------------------------------------- ** Purpose: Execute function code on RTC pseudo device. ** ** Parameters: Name Description. ** funcCode function code ** ** Returns: Nothing. ** **------------------------------------------------------------------------*/ static FcStatus rtcFunc(PpWord funcCode) { (void)funcCode; return(FcDeclined); } /*-------------------------------------------------------------------------- ** Purpose: Perform I/O. ** ** Parameters: Name Description. ** ** Returns: Nothing. ** **------------------------------------------------------------------------*/ static void rtcIo(void) { activeChannel->full = rtcFull; activeChannel->data = rtcClock; } /*-------------------------------------------------------------------------- ** Purpose: Handle channel activation. ** ** Parameters: Name Description. ** ** Returns: Nothing. ** **------------------------------------------------------------------------*/ static void rtcActivate(void) { } /*-------------------------------------------------------------------------- ** Purpose: Handle disconnecting of channel. ** ** Parameters: Name Description. ** ** Returns: Nothing. ** **------------------------------------------------------------------------*/ static void rtcDisconnect(void) { } /*--------------------------- End Of File ------------------------------*/