Initial commit
This commit is contained in:
7
inc/addrs.h
Normal file
7
inc/addrs.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#ifndef __ADDRS_H__
|
||||
#define __ADDRS_H__
|
||||
|
||||
#define MEMDATA_IO_REGS 0
|
||||
#define MEMDATA_EXTSTATE 1
|
||||
|
||||
#endif // ifndef __ADDRS_H__
|
||||
52
inc/device.h
Normal file
52
inc/device.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#ifndef __DEVICE_H__
|
||||
#define __DEVICE_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include "runner.h"
|
||||
#include "addrs.h"
|
||||
#include "mem.h"
|
||||
#include "../../../inc/config.h"
|
||||
#include "../../../inc/libhmmmm.h"
|
||||
#include "../../../inc/libdevice.h"
|
||||
|
||||
#define SMART_ADDR_TYPE_GLOBAL 1
|
||||
#define SMART_ADDR_TYPE_SEGMENTED 2
|
||||
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
memseg_spec_t** memSpecs;
|
||||
uint8_t memSpecsCount;
|
||||
uint64_t pcAddr;
|
||||
uint8_t* executableSegments;
|
||||
uint8_t executableSegmentsCount;
|
||||
smart_read_spec_t* smartReadSpecs;
|
||||
uint64_t smartReadSpecsCount;
|
||||
smart_write_spec_t* smartWriteSpecs;
|
||||
uint64_t smartWriteSpecsCount;
|
||||
} device_specs_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
device_mem_t* deviceMem;
|
||||
device_specs_t* specs;
|
||||
} device_info_t;
|
||||
|
||||
|
||||
|
||||
// device_public_context_t* init(device_specs_t* specs, smart_read_spec_t* smartReadSpecs, uint64_t smartReadSpecsCount, smart_write_spec_t* smartWriteSpecs, uint64_t smartWriteSpecsCount);
|
||||
device_public_context_t* init(device_specs_t* specs, char* errbuf);
|
||||
device_public_context_t* initDefault(smart_read_spec_t* smartReadSpecs, uint64_t smartReadSpecsCount, smart_write_spec_t* smartWriteSpecs, uint64_t smartWriteSpecsCount, char* errbuf);
|
||||
uint8_t makeDeviceTick(device_public_context_t* devContext);
|
||||
|
||||
device_mem_t* genDevMem(device_specs_t* devSpec, char* errbuf);
|
||||
|
||||
device_specs_t* parseSpecsFromConfig(const conf_dev_t* devConf, char* errbuf);
|
||||
void fillSmartReadSpecs(device_specs_t* specs, smart_read_spec_t* smartReadSpecs, uint64_t smartReadSpecsCount);
|
||||
void fillSmartWriteSpecs(device_specs_t* specs, smart_write_spec_t* smartWriteSpecs, uint64_t smartWriteSpecsCount);
|
||||
void freeDevSpec(void* specs);
|
||||
void freeDevMem(device_mem_t* devMem);
|
||||
|
||||
#endif // ifndef __DEVICE_H__
|
||||
|
||||
61
inc/mem.h
Normal file
61
inc/mem.h
Normal file
@@ -0,0 +1,61 @@
|
||||
#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
|
||||
|
||||
|
||||
|
||||
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__
|
||||
10
inc/runner.h
Normal file
10
inc/runner.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef __RUNNER_H__
|
||||
#define __RUNNER_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include "mem.h"
|
||||
|
||||
uint8_t makeTick(device_mem_t* devMem);
|
||||
|
||||
|
||||
#endif // ifndef __RUNNER_H__
|
||||
Reference in New Issue
Block a user