summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/megadrive/stm95.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/bus/megadrive/stm95.h')
-rw-r--r--src/devices/bus/megadrive/stm95.h86
1 files changed, 86 insertions, 0 deletions
diff --git a/src/devices/bus/megadrive/stm95.h b/src/devices/bus/megadrive/stm95.h
new file mode 100644
index 00000000000..39e40770019
--- /dev/null
+++ b/src/devices/bus/megadrive/stm95.h
@@ -0,0 +1,86 @@
+// license:BSD-3-Clause
+// copyright-holders:Fabio Priuli, MetalliC
+#ifndef __MD_STM95_H
+#define __MD_STM95_H
+
+#include "md_slot.h"
+
+//**************************************************************************
+// TYPE DEFINITIONS
+//**************************************************************************
+
+/* ST M95320 32Kbit serial EEPROM implementation */
+// TO DO: STM95 should be made a separate EEPROM device and this should be merged with md_eeprom.c!
+
+#define M95320_SIZE 0x1000
+
+enum STMSTATE
+{
+ IDLE = 0,
+ CMD_WRSR,
+ CMD_RDSR,
+ M95320_CMD_READ,
+ CMD_WRITE,
+ READING,
+ WRITING
+};
+
+class stm95_eeprom_device
+{
+public:
+ stm95_eeprom_device(running_machine &machine, UINT8 *eeprom);
+ running_machine &machine() const { return m_machine; }
+
+ UINT8 *eeprom_data;
+ void set_cs_line(int);
+ void set_halt_line(int state) {}; // not implemented
+ void set_si_line(int);
+ void set_sck_line(int state);
+ int get_so_line(void);
+
+protected:
+ int latch;
+ int reset_line;
+ int sck_line;
+ int WEL;
+
+ STMSTATE stm_state;
+ int stream_pos;
+ int stream_data;
+ int eeprom_addr;
+
+ running_machine& m_machine;
+};
+
+
+// ======================> md_eeprom_stm95_device
+
+class md_eeprom_stm95_device : public device_t,
+ public device_md_cart_interface
+{
+public:
+ // construction/destruction
+ md_eeprom_stm95_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
+ md_eeprom_stm95_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
+
+ // device-level overrides
+ virtual void device_start();
+ virtual void device_reset();
+
+ // reading and writing
+ virtual DECLARE_READ16_MEMBER(read);
+ virtual DECLARE_READ16_MEMBER(read_a13);
+ virtual DECLARE_WRITE16_MEMBER(write_a13);
+
+private:
+ UINT8 m_bank[3];
+ int m_rdcnt;
+
+ auto_pointer<stm95_eeprom_device> m_stm95;
+};
+
+
+// device type definition
+extern const device_type MD_EEPROM_STM95;
+
+#endif