minivmac4ios/Mini vMac/mnvm_core/SCCEMDEV.c

1 line
56 KiB
C
Raw Normal View History

2016-05-01 17:05:36 +00:00
/* SCCEMDEV.c Copyright (C) 2012 Philip Cummins, Weston Pawlowski, Michael Fort, Paul C. Pratt You can redistribute this file and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. You should have received a copy of the license along with this file; see the file COPYING. This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details. */ /* Serial Communications Controller EMulated DEVice additions for LocalTalk networking support Copyright 2011-2012, Michael Fort enabled with "EmLocalTalk" -- original description: -- Emulates the Z8530 SCC found in the Mac Plus. But only the minimum amount needed to emulate normal operation in a Mac Plus with nothing connected to the serial ports. (and not even that much is complete yet) This code adapted from "SCC.c" in vMac by Philip Cummins. With additional code by Weston Pawlowski from the Windows port of vMac. Further information was found in the "Zilog SCC/ESCC User's Manual". */ #ifndef AllFiles #include "SYSDEPNS.h" #include "MYOSGLUE.h" #include "EMCONFIG.h" #include "GLOBGLUE.h" #endif #include "SCCEMDEV.h" #define SCC_dolog (dbglog_HAVE && 0) #define SCC_TrackMore 0 /* Just to make things a little easier */ #define Bit0 1 #define Bit1 2 #define Bit2 4 #define Bit3 8 #define Bit4 16 #define Bit5 32 #define Bit6 64 #define Bit7 128 /* SCC Interrupts */ #define SCC_A_Rx 8 /* Rx Char Available */ #define SCC_A_Rx_Spec 7 /* Rx Special Condition */ #define SCC_A_Tx_Empty 6 /* Tx Buffer Empty */ #define SCC_A_Ext 5 /* External/Status Change */ #define SCC_B_Rx 4 /* Rx Char Available */ #define SCC_B_Rx_Spec 3 /* Rx Special Condition */ #define SCC_B_Tx_Empty 2 /* Tx Buffer Empty */ #define SCC_B_Ext 1 /* External/Status Change */ typedef struct { blnr TxEnable; blnr RxEnable; blnr TxIE; /* Transmit Interrupt Enable */ blnr TxUnderrun; blnr SyncHunt; blnr TxIP; /* Transmit Interrupt Pending */ #if EmLocalTalk ui3r RxBuff; #endif #if EmLocalTalk /* otherwise TxBufferEmpty always true */ /* though should behave as went false for an instant when write to transmit buffer */ blnr TxBufferEmpty; #endif #if EmLocalTalk || SCC_TrackMore blnr ExtIE; #endif #if SCC_TrackMore blnr WaitRqstEnbl; #endif #if SCC_TrackMore blnr WaitRqstSlct; #endif #if SCC_TrackMore blnr WaitRqstRT; #endif #if SCC_TrackMore blnr PrtySpclCond; #endif #if SCC_TrackMore blnr PrtyEnable; #endif #if SCC_TrackMore blnr PrtyEven; #endif #if SCC_TrackMore blnr RxCRCEnbl; #endif #if SCC_TrackMore blnr TxCRCEnbl; #endif #if SCC_TrackMore blnr RTSctrl; #endif #if SCC_TrackMore blnr SndBrkCtrl; #endif #if SCC_TrackMore blnr DTRctrl; #endif #if EmLocalTalk || SCC_TrackMore blnr AddrSrchMd; #endif #if SCC_TrackMore blnr SyncChrLdInhb; #endif #if SCC_TrackMore ui3r ClockRate; #endif #if SCC_TrackMore ui3r DataEncoding; #endif #if SCC_TrackMore ui3r TRxCsrc; #endif #if SCC_TrackMore ui3r TClkSlct; #endif #if SCC_TrackMore ui3r RClkSlct; #endif #if SCC_TrackMore ui3r RBitsPerChar; #endif #if SCC_TrackMore ui3r TBitsPerChar; #endif #if EmLocalTalk || SCC_TrackMore ui3r RxIntMode; #endif #if EmLocalTalk || SCC_TrackMore blnr FirstChar; #endif #if EmLocalTalk || SCC_TrackMore ui3r SyncMode; #endif #if SCC_TrackMore ui3r StopBits; #endif #if 0 /* AllSent always true */ blnr AllSent; #endif #if 0 /* CTS always false */ blnr CTS; /* input pin, unattached, so false? */ #endif #if 0 /* DCD always false */ blnr DCD; /* Data Carrier Detect */ /* input pin for mouse interrupts. but since not emulating mouse this way, leave false. */ #endif #if EmLocalTalk /* otherwise RxChrAvail always false */ blnr RxChrAvail; #endif #if 0 /* RxOverrun always false */ blnr RxOverrun; #endif #if 0 /* CRCFramingErr always false */ blnr CRCFramingErr; #endif #if EmLocalTalk /* otherwise EndOfFrame always false */ bl