00001 /* ES40 emulator. 00002 * Copyright (C) 2007-2008 by the ES40 Emulator Project 00003 * 00004 * WWW : http://sourceforge.net/projects/es40 00005 * E-mail : camiel@camicom.com 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation; either version 2 00010 * of the License, or (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00020 * 00021 * Although this is not required, the author would appreciate being notified of, 00022 * and receiving any modifications you may make to the source code that might serve 00023 * the general public. 00024 */ 00025 00038 #if !defined(__SCSIBUS__H__) 00039 #define __SCSIBUS__H__ 00040 00041 #include "SystemComponent.h" 00042 #include "SCSIDevice.h" 00043 00050 class CSCSIBus : public CSystemComponent 00051 { 00052 public: 00053 CSCSIBus(CConfigurator* cfg, CSystem* c); 00054 ~ CSCSIBus(void); 00055 virtual int SaveState(FILE* f); 00056 virtual int RestoreState(FILE* f); 00057 00058 void scsi_register(CSCSIDevice* dev, int bus, int target); 00059 void scsi_unregister(CSCSIDevice* dev, int target); 00060 00061 bool arbitrate(int initiator); 00062 bool select(int initiator, int target); 00063 void set_phase(int target, int phase); 00064 int get_phase() { return state.phase; }; 00065 00067 void free_bus(int initiator); 00068 00069 CSCSIDevice* targets[16]; 00070 int target_bus_no[16]; 00073 00074 struct SSCSI_state 00075 { 00076 int initiator; 00077 int target; 00078 int phase; 00079 } state; 00080 }; 00081 00082 #define SCSI_PHASE_FREE - 2 00083 #define SCSI_PHASE_ARBITRATION - 1 00084 #define SCSI_PHASE_DATA_OUT 0 00085 #define SCSI_PHASE_DATA_IN 1 00086 #define SCSI_PHASE_COMMAND 2 00087 #define SCSI_PHASE_STATUS 3 00088 #define SCSI_PHASE_MSG_OUT 6 00089 #define SCSI_PHASE_MSG_IN 7 00090 #endif