diff romdb.h @ 803:236a184bf6f0

Merge
author Michael Pavone <pavone@retrodev.com>
date Sun, 26 Jul 2015 16:51:03 -0700
parents cbf97d335444
children a5a51465f8b0
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/romdb.h	Sun Jul 26 16:51:03 2015 -0700
@@ -0,0 +1,58 @@
+#ifndef ROMDB_H_
+#define ROMDB_H_
+
+#define REGION_J 1
+#define REGION_U 2
+#define REGION_E 4
+
+#define RAM_FLAG_ODD  0x18
+#define RAM_FLAG_EVEN 0x10
+#define RAM_FLAG_BOTH 0x00
+#define RAM_FLAG_MASK RAM_FLAG_ODD
+#define SAVE_I2C      0x01
+#define SAVE_NONE     0xFF
+
+#include "tern.h"
+#include "backend.h"
+
+typedef struct {
+	uint32_t     start;
+	uint32_t     end;
+	uint16_t     sda_write_mask;
+	uint16_t     scl_mask;
+	uint8_t      sda_read_bit;
+} eeprom_map;
+
+typedef struct {
+	char        *buffer;
+	uint32_t    size;
+	uint16_t    address;
+	uint8_t     host_sda;
+	uint8_t     slave_sda;
+	uint8_t     scl;
+	uint8_t     state;
+	uint8_t     counter;
+	uint8_t     latch;
+} eeprom_state;
+
+typedef struct {
+	char          *name;
+	memmap_chunk  *map;
+	uint8_t       *save_buffer;
+	eeprom_map    *eeprom_map;
+	uint32_t      num_eeprom;
+	uint32_t      map_chunks;
+	uint32_t      save_size;
+	uint32_t      save_mask;
+	uint16_t      mapper_start_index;
+	uint8_t       save_type;
+	uint8_t       regions;
+} rom_info;
+
+tern_node *load_rom_db();
+rom_info configure_rom(tern_node *rom_db, void *vrom, uint32_t rom_size, memmap_chunk const *base_map, uint32_t base_chunks);
+rom_info configure_rom_heuristics(uint8_t *rom, uint32_t rom_size, memmap_chunk const *base_map, uint32_t base_chunks);
+uint8_t translate_region_char(uint8_t c);
+void eeprom_init(eeprom_state *state, uint8_t *buffer, uint32_t size);
+
+#endif //ROMDB_H_