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 00037 #if !defined(INCLUDED_DMA_H) 00038 #define INCLUDED_DMA_H 00039 00040 #include "SystemComponent.h" 00041 00045 class CDMA : public CSystemComponent 00046 { 00047 public: 00048 CDMA(CConfigurator* cfg, CSystem* c); 00049 virtual ~CDMA(); 00050 00051 virtual int DoClock(); 00052 virtual void WriteMem(int index, u64 address, int dsize, u64 data); 00053 virtual u64 ReadMem(int index, u64 address, int dsize); 00054 virtual int SaveState(FILE* f); 00055 virtual int RestoreState(FILE* f); 00056 private: 00057 00059 struct SDMA_state 00060 { 00061 00063 struct SDMA_chan 00064 { 00065 bool a_lobyte; // address lobyte expected 00066 bool c_lobyte; // count lobyte expected 00067 u16 current; 00068 u16 base; 00069 u16 pagebase; 00070 u16 count; 00071 } channel[8]; 00072 00074 struct SDMA_ctrl 00075 { 00076 u8 status; 00077 u8 command; 00078 u8 writereq; 00079 u8 mask; 00080 u8 mode; 00081 } controller[2]; 00082 } 00083 state; 00084 }; 00085 #endif // !defined(INCLUDED_DMA_H)