]> cloudbase.mooo.com Git - z180-stamp.git/blame - include/z80-if.h
z80_toggle_reset(), z80_toggle_busreq()
[z180-stamp.git] / include / z80-if.h
CommitLineData
35edb766
L
1/*
2 * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de>
3 *
a1595a8e 4 * SPDX-License-Identifier: GPL-2.0
35edb766 5 */
a1595a8e 6#include "common.h"
0c5890bb 7
f338df2a
L
8#define ZST_ACQUIRED 0x01
9#define ZST_RUNNING 0x02
10
6035a17b 11typedef enum {
f338df2a
L
12 RESET = 0x00,
13 RESET_AQRD = ZST_ACQUIRED,
62f624d3
L
14 RUNNING = ZST_RUNNING,
15 RUNNING_AQRD = ZST_RUNNING | ZST_ACQUIRED,
f338df2a
L
16} zstate_t;
17
6035a17b 18typedef enum {
62f624d3
L
19 Reset,
20 Request,
21 Release,
22 Run,
23 Restart,
24 M_Cycle
25} bus_cmd_t;
26
0c5890bb
L
27typedef enum {LOW, HIGH} level_t;
28
b35fcb2f
L
29
30void z80_bus_request_or_exit(void);
31
d66348b4 32uint32_t z80_get_busreq_cycles(void);
62f624d3
L
33zstate_t z80_bus_state(void);
34zstate_t z80_bus_cmd(bus_cmd_t cmd);
0c5890bb 35void z80_setup_bus(void);
534e1dfc 36int z80_stat_reset(void);
0c5890bb 37int z80_stat_halt(void);
3ec6fa48
L
38void z80_toggle_reset(void);
39void z80_toggle_busreq(void);
6035a17b 40
0c5890bb 41
1e5609bf 42int32_t z80_memsize_detect(void);
f338df2a
L
43void z80_write(uint32_t addr, uint8_t data);
44uint8_t z80_read(uint32_t addr);
45void z80_memset(uint32_t addr, uint8_t data, uint32_t length);
ea6971b8
L
46void z80_write_block_P(const FLASH uint8_t *src, uint32_t dest, uint32_t length);
47void z80_write_block(const uint8_t *src, uint32_t dest, uint32_t length);
48void z80_read_block (uint8_t *dest, uint32_t src, size_t length);
f338df2a 49
0c5890bb 50
89adce76 51typedef enum fifo_t {
ea6971b8 52 fifo_msgin, fifo_msgout,
ad9bc17c 53 fifo_conin, fifo_conout,
89adce76
L
54 NUM_FIFOS
55 } fifo_t;
0c5890bb
L
56
57void z80_memfifo_init(const fifo_t f, uint32_t adr);
58int z80_memfifo_is_empty(const fifo_t f);
59int z80_memfifo_is_full(const fifo_t f);
89adce76
L
60int z80_memfifo_getc(const fifo_t f);
61uint8_t z80_memfifo_getc_wait(const fifo_t f);
0c5890bb 62void z80_memfifo_putc(fifo_t f, uint8_t val);
226d3221
L
63
64void z80_load_mem(int_fast8_t verbosity, const FLASH unsigned char data[],
65 const FLASH unsigned long *sections,
66 const FLASH unsigned long address[],
67 const FLASH unsigned long length_of_sections[]);