62 #define DEV_ADB_LENGTH 0x2000 64 #define N_VIA_REGS 0x10 65 #define VIA_REG_SHIFT 9 71 "vBufB",
"vBufA",
"vDirB",
"vDirA",
72 "vT1C",
"vT1CH",
"vT1L",
"vT1LH",
73 "vT2C",
"vT2CH",
"vSR",
"vACR",
74 "vPCR",
"vIFR",
"vIER",
"(unknown)" };
102 #define BUFB_nINTR 0x08 103 #define BUFB_ACK 0x10 104 #define BUFB_nTIP 0x20 107 #define ACR_SR_OUT 0x10 134 static void adb_reset(
struct adb_data *d)
138 memset(d->
reg, 0,
sizeof(d->
reg));
161 debug(
"[ adb: COMMAND:");
167 fatal(
"[ adb: WEIRD output length: %i ]\n",
183 fatal(
"dev=%i reg=%i\n", dev, reg);
198 }
else if ((d->
output_buf[1] & 0x0c) == 0x08) {
202 fatal(
"[ adb: ADBLISTEN not to kbd ]\n");
207 fatal(
"[ adb: unknown ADBLISTEN ]\n");
213 fatal(
"[ adb: unknown ADB command? ]\n");
231 gettimeofday(&tv, NULL);
240 fatal(
"[ adb: reboot. TODO: make this nicer ]\n");
243 fatal(
"[ adb: UNIMPLEMENTED PRAM/RTC command ]\n");
248 default:
fatal(
"[ adb: UNKNOWN command type 0x%02x ]\n",
266 static void adb_transfer(
struct cpu *cpu,
struct adb_data *d,
int state_change)
268 unsigned char c = 0x00;
272 debug(
"[ adb: transfer #%lli done ]\n",
275 adb_process_cmd(cpu, d);
279 debug(
"[ adb: starting transfer #%lli: %s ]\n", (
long long)
290 fatal(
"[ adb: INPUT beyond end of data? ]\n");
293 debug(
"input 0x%02x", c);
302 debug(
"output 0x%02x", c);
315 uint64_t idata = 0, odata = 0;
324 fatal(
"[ adb: %s non-via register? offset 0x%x ]\n",
325 writeflag ==
MEM_READ?
"read from" :
"write to",
328 fatal(
"[ adb: read from %s: 0x%02x ]\n",
332 fatal(
"[ adb: write to %s: 0x%02x ]\n", via_regname[
340 switch (relative_addr) {
355 switch (relative_addr) {
360 int old_tip = d->
tip;
361 int old_ack = d->
ack;
363 idata &= ~BUFB_nINTR;
375 fatal(
"[ adb: WARNING! UNIMPLEMENTED bits in" 376 " vBufB: 0x%02x ]\n", (
int)idata);
377 if (old_tip != d->
tip)
378 adb_transfer(cpu, d, 1);
379 else if (old_ack != d->
ack)
380 adb_transfer(cpu, d, 0);
410 if (idata != 0x04 && idata != 0x84)
411 fatal(
"[ adb: WARNING! vIER value 0x%x is" 412 " UNKNOWN ]\n", (
int)idata);
416 default:
if ((relative_addr & ((1 <<
VIA_REG_SHIFT) - 1)) != 0)
417 fatal(
"[ adb: %s non-via register? offset 0x%x ]\n",
418 writeflag ==
MEM_READ?
"read from" :
"write to",
421 fatal(
"[ adb: READ from UNIMPLEMENTED %s ]\n",
424 fatal(
"[ adb: WRITE to UNIMPLEMENTED %s: 0x%x ]\n",
442 memset(d, 0,
sizeof(
struct adb_data));
uint64_t memory_readmax64(struct cpu *cpu, unsigned char *buf, int len)
void fatal(const char *fmt,...)
uint8_t input_buf[MAX_BUF]
#define CHECK_ALLOCATION(ptr)
#define INTERRUPT_ASSERT(istruct)
uint8_t output_buf[MAX_BUF]
#define INTERRUPT_CONNECT(name, istruct)
void memory_writemax64(struct cpu *cpu, unsigned char *buf, int len, uint64_t data)
void memory_device_register(struct memory *mem, const char *, uint64_t baseaddr, uint64_t len, int(*f)(struct cpu *, struct memory *, uint64_t, unsigned char *, size_t, int, void *), void *extra, int flags, unsigned char *dyntrans_data)
void machine_add_tickfunction(struct machine *machine, void(*func)(struct cpu *, void *), void *extra, int clockshift)
#define INTERRUPT_DEASSERT(istruct)