Files
dummy_device_template/inc/mem.h
2026-04-08 23:12:40 +03:00

73 lines
1.4 KiB
C

#ifndef __MEM_H__
#define __MEM_H__
#include <stdint.h>
#include <stdlib.h>
#include "../../../inc/libhmmmm.h"
#ifndef RAM_CELL_WORDS
#define RAM_CELL_WORDS 1
#endif
#if RAM_CELL_WORDS == 1
typedef uint8_t ram_cell_t;
#endif
#if RAM_CELL_WORDS == 2
typedef uint16_t ram_cell_t;
#endif
#if RAM_CELL_WORDS == 3
typedef uint32_t ram_cell_t;
#endif
#if RAM_CELL_WORDS == 4
typedef uint32_t ram_cell_t;
#endif
#ifndef GP_REG_CELL_WORDS
#define GP_REG_CELL_WORDS 1
#endif
#if GP_REG_CELL_WORDS == 1
typedef uint8_t gp_reg_cell_t;
#endif
#if GP_REG_CELL_WORDS == 2
typedef uint16_t gp_reg_cell_t;
#endif
#if GP_REG_CELL_WORDS == 3
typedef uint32_t gp_reg_cell_t;
#endif
#if GP_REG_CELL_WORDS == 4
typedef uint32_t gp_reg_cell_t;
#endif
#ifndef IO_REG_CELL_WORDS
#define IO_REG_CELL_WORDS 1
#endif
#if IO_REG_CELL_WORDS == 1
typedef uint8_t io_reg_cell_t;
#endif
#if IO_REG_CELL_WORDS == 2
typedef uint16_t io_reg_cell_t;
#endif
#if IO_REG_CELL_WORDS == 3
typedef uint32_t io_reg_cell_t;
#endif
#if IO_REG_CELL_WORDS == 4
typedef uint32_t io_reg_cell_t;
#endif
typedef struct
{
uint8_t seg_id;
char* name;
uint8_t word_len;
uint64_t default_size;
uint64_t default_addr;
uint8_t is_executable;
} memseg_metadata_t;
void* default_addr_read_handler(uint64_t ident, uint64_t addr, void* rawCells);
void default_addr_write_handler(uint64_t ident, uint64_t addr, void* rawCells, void* data);
#endif // ifndef __MEM_H__