mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-23 03:32:32 +00:00
Attempts to stub in read from microcontroller, and extends command 0x06.
A complete guess on the latter, as if you didn't know.
This commit is contained in:
parent
0ae49b356a
commit
7e106c6add
@ -95,14 +95,12 @@ void GLU::set_command(uint8_t command) {
|
|||||||
// Accumulate input until a full comamnd is received;
|
// Accumulate input until a full comamnd is received;
|
||||||
// the state machine otherwise gets somewhat oversized.
|
// the state machine otherwise gets somewhat oversized.
|
||||||
next_command_.push_back(command);
|
next_command_.push_back(command);
|
||||||
printf("ADB command: %02x\n", command);
|
|
||||||
|
|
||||||
// Command dispatch; each entry should do whatever it needs
|
// Command dispatch; each entry should do whatever it needs
|
||||||
// to do and then either: (i) break, if completed; or
|
// to do and then either: (i) break, if completed; or
|
||||||
// (ii) return, if awaiting further input.
|
// (ii) return, if awaiting further input.
|
||||||
#define RequireSize(n) if(next_command_.size() < (n)) return;
|
#define RequireSize(n) if(next_command_.size() < (n)) return;
|
||||||
switch(next_command_[0]) {
|
switch(next_command_[0]) {
|
||||||
// One-byte commands.
|
|
||||||
case 0x01: abort(); break;
|
case 0x01: abort(); break;
|
||||||
case 0x02: reset_microcontroller(); break;
|
case 0x02: reset_microcontroller(); break;
|
||||||
case 0x03: flush_keyboard_buffer(); break;
|
case 0x03: flush_keyboard_buffer(); break;
|
||||||
@ -118,7 +116,7 @@ void GLU::set_command(uint8_t command) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x06: // Set configuration bytes
|
case 0x06: // Set configuration bytes
|
||||||
RequireSize(4);
|
RequireSize(is_rom03_ ? 8 : 4);
|
||||||
set_configuration_bytes(&next_command_[1]);
|
set_configuration_bytes(&next_command_[1]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -132,6 +130,11 @@ void GLU::set_command(uint8_t command) {
|
|||||||
// TODO: what does the ROM03-paired ADB GLU do with the extra four bytes?
|
// TODO: what does the ROM03-paired ADB GLU do with the extra four bytes?
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 0x09: // Read microcontroller memory.
|
||||||
|
RequireSize(3);
|
||||||
|
pending_response_.push_back(read_microcontroller_address(uint16_t(next_command_[1] | (next_command_[2] << 8))));
|
||||||
|
break;
|
||||||
|
|
||||||
case 0x0d: // Get version number.
|
case 0x0d: // Get version number.
|
||||||
pending_response_.push_back(6); // Seems to be what ROM03 is looking for?
|
pending_response_.push_back(6); // Seems to be what ROM03 is looking for?
|
||||||
break;
|
break;
|
||||||
@ -154,6 +157,10 @@ void GLU::set_command(uint8_t command) {
|
|||||||
}
|
}
|
||||||
#undef RequireSize
|
#undef RequireSize
|
||||||
|
|
||||||
|
printf("ADB executed: ");
|
||||||
|
for(auto c : next_command_) printf("%02x ", c);
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
// Input was dealt with, so throw it away.
|
// Input was dealt with, so throw it away.
|
||||||
next_command_.clear();
|
next_command_.clear();
|
||||||
}
|
}
|
||||||
@ -184,3 +191,8 @@ void GLU::set_device_srq(int mask) {
|
|||||||
// TODO: do I need to do any more than this here?
|
// TODO: do I need to do any more than this here?
|
||||||
device_srq_ = mask;
|
device_srq_ = mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t GLU::read_microcontroller_address(uint16_t address) {
|
||||||
|
printf("Read from microcontroller %04x\n", address);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -50,6 +50,8 @@ class GLU {
|
|||||||
int device_srq_ = 0;
|
int device_srq_ = 0;
|
||||||
|
|
||||||
void set_configuration_bytes(uint8_t *);
|
void set_configuration_bytes(uint8_t *);
|
||||||
|
|
||||||
|
uint8_t read_microcontroller_address(uint16_t);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user