shithub: psxe

ref: cb7d802d87208da493cc31a0ea9fab22f4472637
dir: /psx/dev/scratchpad.h/

View raw version
#ifndef PSX_DEV_SCRATCHPAD_H
#define PSX_DEV_SCRATCHPAD_H

#include "p9.h"

#include "dev/mc1.h"

#define PSX_SCRATCHPAD_BEGIN 0x1f800000
#define PSX_SCRATCHPAD_SIZE  0x400
#define PSX_SCRATCHPAD_END   0x1f8003ff

struct psx_scratchpad_t {
    uint32_t bus_delay;
    uint32_t io_base, io_size;

    uint8_t* buf;
};

typedef struct psx_scratchpad_t psx_scratchpad_t;

psx_scratchpad_t* psx_scratchpad_create(void);
void psx_scratchpad_init(psx_scratchpad_t*);
uint32_t psx_scratchpad_read32(psx_scratchpad_t*, uint32_t);
uint16_t psx_scratchpad_read16(psx_scratchpad_t*, uint32_t);
uint8_t psx_scratchpad_read8(psx_scratchpad_t*, uint32_t);
void psx_scratchpad_write32(psx_scratchpad_t*, uint32_t, uint32_t);
void psx_scratchpad_write16(psx_scratchpad_t*, uint32_t, uint16_t);
void psx_scratchpad_write8(psx_scratchpad_t*, uint32_t, uint8_t);
void psx_scratchpad_destroy(psx_scratchpad_t*);

#endif