Sym53C895.h

Go to the documentation of this file.
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 
00086 #if !defined(INCLUDED_SYM53C895_H_)
00087 #define INCLUDED_SYM53C895_H_
00088 
00089 #include "DiskController.h"
00090 #include "SCSIDevice.h"
00091 
00104 class CSym53C895 : public CDiskController, public CSCSIDevice, public Poco::Runnable
00105 {
00106   public:
00107     virtual int   SaveState(FILE* f);
00108     virtual int   RestoreState(FILE* f);
00109     virtual void  check_state();
00110 
00111     virtual void  run();  // Poco Thread entry point
00112     virtual void  init();
00113     virtual void  start_threads();
00114     virtual void  stop_threads();
00115 
00116     virtual void  WriteMem_Bar(int func, int bar, u32 address, int dsize,
00117                                u32 data);
00118     virtual u32   ReadMem_Bar(int func, int bar, u32 address, int dsize);
00119 
00120     virtual u32   config_read_custom(int func, u32 address, int dsize, u32 data);
00121     virtual void  config_write_custom(int func, u32 address, int dsize,
00122                                       u32 old_data, u32 new_data, u32 data);
00123 
00124     virtual void  register_disk(class CDisk* dsk, int bus, int dev);
00125 
00126     CSym53C895(CConfigurator* cfg, class CSystem* c, int pcibus, int pcidev);
00127     virtual       ~CSym53C895();
00128   private:
00129     void  write_b_scntl0(u8 value);
00130     void  write_b_scntl1(u8 value);
00131     void  write_b_scntl3(u8 value);
00132     void  write_b_istat(u8 value);
00133     u8    read_b_ctest2();
00134     void  write_b_ctest3(u8 value);
00135     void  write_b_ctest4(u8 value);
00136     void  write_b_ctest5(u8 value);
00137     void  write_b_stest2(u8 value);
00138     void  write_b_stest3(u8 value);
00139     u8    read_b_dstat();
00140     u8    read_b_sist(int id);
00141     void  write_b_dcntl(u8 value);
00142     u8    read_b_scratcha(int reg);
00143     u8    read_b_scratchb(int reg);
00144 
00145     void  post_dsp_write();
00146 
00147     int check_phase(int chk_phase);
00148     void execute_io_op();
00149     void execute_rw_op();
00150     void execute_ls_op();
00151     void execute_mm_op();
00152     void execute_tc_op();
00153     void execute_bm_op();
00154     void  execute();
00155 
00156     void  eval_interrupts();
00157     void  set_interrupt(int reg, u8 interrupt);
00158     void  chip_reset();
00159 
00160     Poco::Thread * myThread;
00161     Poco::Semaphore mySemaphore;
00162     CMutex*         myRegLock;
00163     bool            StopThread;
00164 
00166     struct SSym_state
00167     {
00168       bool  irq_asserted;
00169 
00170       union USym_regs
00171       {
00172         u8  reg8[128];
00173         u16 reg16[64];
00174         u32 reg32[64];
00175       } regs;
00176 
00177       struct SSym_alu
00178       {
00179         bool  carry;
00180       } alu;
00181 
00182       u8    ram[4096];
00183 
00184       bool  executing;
00185 
00186       bool  wait_reselect;
00187       bool  select_timeout;
00188       int   disconnected;
00189       u32   wait_jump;
00190 
00191       u8    dstat_stack;
00192       u8    sist0_stack;
00193       u8    sist1_stack;
00194 
00195       long  gen_timer;
00196 
00197       //int phase;
00198     } state;
00199 };
00200 #endif // !defined(INCLUDED_SYM_H)

SourceForge.net Logo
Project space on SourceForge.net