DevEEPROM.h revision da7f6376d98136ac8a76f7110a452c6e56508c49
/* $Id$ */
/** @file
* DevEEPROM - Microware-compatible 64x16-bit 93C46 EEPROM Emulation, Header.
*/
/*
* Copyright (C) 2007 Sun Microsystems, Inc.
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 USA or visit http://www.sun.com if you need
* additional information or have any questions.
*/
/* Interface */
/** The current Saved state version. */
#define EEPROM93C46_SAVEDSTATE_VERSION 1
/**
* 93C46-compatible EEPROM device emulation.
*
* @remarks This class is intended to be used in device
* emulation which imposes some restrictions if the
* device supports GC execution. This is why it is a
* plain-old-data structure.
*/
struct EEPROM93C46 {
/** General definitions */
enum {
/** Size of EEPROM in words */
SIZE = 64,
/** Number of bits per word */
WORD_SIZE = 16,
/** Number of address bits */
ADDR_SIZE = 6,
/** Number of bits in opcode */
OPCODE_SIZE = 2,
/** The most significant bit mask in data word */
/** Address mask */
/** The most significant bit mask in op+addr bit sequence */
};
enum OP {
OP_32BIT_HACK = 0x7fffffff
};
/**
* Names of signal wires
*/
enum Wires {
};
/** @todo save and load methods */
/** Actual content of EEPROM */
/** current state.
*
* EEPROM operates as a simple state machine. Events are primarily
* triggered at positive edge of clock signal (SK). Refer to the
* timing diagrams of 93C46 to get better understanding.
*/
enum State {
/** Initial state. Waiting for start condition (CS, SK, DI high). */
/** Reading data in, shifting in the bits into 'word'. */
/** Writing data out, shifting out the bits from 'word'. */
/** Waiting for CS=0 to indicate we are busy (DO=0). */
/** Waiting for CS=1 to indicate we are ready (DO=1). */
/** Make this enum 4-byte */
STATE_MAKE_32BIT_HACK = 0x7fffffff
} m_eState;
/** setting writeEnable to false prevents write and erase operations */
bool m_fWriteEnabled;
/** intermediate storage */
/** currently processed bit in 'word' */
/** decoded address */
/** Data Out, Data In, Chip Select, Clock */
/** Current opcode decoder. When no operation has been decoded yet
* it is set to OP_DECODE.
*/
#if HC_ARCH_BITS == 64
#endif
#ifdef IN_RING3
// Operation handlers
State opWriteAll();
/** Helper method to implement write protection */
#endif /* IN_RING3 */
};