]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * (C) Copyright 2014 Leo C. <erbl259-lmu@yahoo.de> | |
3 | * | |
4 | * SPDX-License-Identifier: GPL-2.0 | |
5 | */ | |
6 | #include "common.h" | |
7 | ||
8 | #define ZST_ACQUIRED 0x01 | |
9 | #define ZST_RUNNING 0x02 | |
10 | ||
11 | typedef enum { | |
12 | RESET = 0x00, | |
13 | RESET_AQRD = ZST_ACQUIRED, | |
14 | RUNNING = ZST_RUNNING, | |
15 | RUNNING_AQRD = ZST_RUNNING | ZST_ACQUIRED, | |
16 | } zstate_t; | |
17 | ||
18 | typedef enum { | |
19 | Reset, | |
20 | Request, | |
21 | Release, | |
22 | Run, | |
23 | Restart, | |
24 | M_Cycle | |
25 | } bus_cmd_t; | |
26 | ||
27 | typedef enum {LOW, HIGH} level_t; | |
28 | ||
29 | ||
30 | void z80_bus_request_or_exit(void); | |
31 | ||
32 | uint32_t z80_get_busreq_cycles(void); | |
33 | zstate_t z80_bus_state(void); | |
34 | zstate_t z80_bus_cmd(bus_cmd_t cmd); | |
35 | void z80_setup_bus(void); | |
36 | int z80_stat_reset(void); | |
37 | int z80_stat_halt(void); | |
38 | void z80_toggle_reset(void); | |
39 | void z80_toggle_busreq(void); | |
40 | ||
41 | ||
42 | int32_t z80_memsize_detect(void); | |
43 | void z80_write(uint32_t addr, uint8_t data); | |
44 | uint8_t z80_read(uint32_t addr); | |
45 | void z80_memset(uint32_t addr, uint8_t data, uint32_t length); | |
46 | void z80_write_block_P(const FLASH uint8_t *src, uint32_t dest, uint32_t length); | |
47 | void z80_write_block(const uint8_t *src, uint32_t dest, uint32_t length); | |
48 | void z80_read_block (uint8_t *dest, uint32_t src, size_t length); | |
49 | ||
50 | ||
51 | typedef enum fifo_t { | |
52 | fifo_msgin, fifo_msgout, | |
53 | fifo_conin, fifo_conout, | |
54 | NUM_FIFOS | |
55 | } fifo_t; | |
56 | ||
57 | void z80_memfifo_init(const fifo_t f, uint32_t adr); | |
58 | int z80_memfifo_is_empty(const fifo_t f); | |
59 | int z80_memfifo_is_full(const fifo_t f); | |
60 | int z80_memfifo_getc(const fifo_t f); | |
61 | uint8_t z80_memfifo_getc_wait(const fifo_t f); | |
62 | void z80_memfifo_putc(fifo_t f, uint8_t val); | |
63 | ||
64 | void 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[]); |