Device: Refactor A2B APIs

* Removes features in `A2BMessage` class to support API for reading 16, 24, and 32 bit samples from A2B channels
* Re-organizes WAV receiving and transmitting code and API
* Creates API for mapping message channels to WAV channels and vice versa for transmitting and receiving
* Fixes `icsneo::Network::NetID::ExtendedData` VnetID bug for `icsneo::ExtendedDataMessage` decoding
* Creates RAD-A2B sequence chart example
* Fixes coremini uploading for certain devices in EEPROM by introducing `icsneo::Device::supportsEraseMemory`
This commit is contained in:
Yasser Yassine
2024-03-12 12:06:49 +00:00
committed by Kyle Schwarz
parent 06f6861130
commit cb22e622b3
33 changed files with 1014 additions and 947 deletions
+9 -5
View File
@@ -490,7 +490,7 @@ bool Device::startScript(Disk::MemoryType memType)
const auto response = com->waitForMessageSync([&]() {
return com->sendCommand(Command::LoadCoreMini, location);
}, filter);
}, filter, std::chrono::milliseconds(2000));
if(!response) {
report(APIEvent::Type::NoDeviceResponse, APIEvent::Severity::Error);
@@ -522,14 +522,14 @@ bool Device::stopScript()
return true;
}
bool Device::uploadCoremini(std::unique_ptr<std::istream>&& stream, Disk::MemoryType memType) {
bool Device::uploadCoremini(std::istream& stream, Disk::MemoryType memType) {
if(!stream || stream->bad()) {
if(stream.bad()) {
report(APIEvent::Type::RequiredParameterNull, APIEvent::Severity::Error);
return false;
}
std::vector<char> bin(std::istreambuf_iterator<char>(*stream), {}); // Read the whole stream
std::vector<char> bin(std::istreambuf_iterator<char>(stream), {}); // Read the whole stream
if(bin.size() < 4) {
report(APIEvent::Type::BufferInsufficient, APIEvent::Severity::Error);
@@ -596,6 +596,10 @@ bool Device::uploadCoremini(std::unique_ptr<std::istream>&& stream, Disk::Memory
bool Device::eraseScriptMemory(Disk::MemoryType memType, uint64_t amount) {
static std::shared_ptr<MessageFilter> NeoEraseDone = std::make_shared<MessageFilter>(Network::NetID::NeoMemoryWriteDone);
if(!supportsEraseMemory()) {
return true;
}
auto startAddress = getCoreminiStartAddress(memType);
if(!startAddress) {
return false;
@@ -612,7 +616,7 @@ bool Device::eraseScriptMemory(Disk::MemoryType memType, uint64_t amount) {
arguments[0] = static_cast<uint8_t>(memType);
*reinterpret_cast<uint32_t*>(&arguments[1]) = static_cast<uint32_t>(*startAddress / 512);
*reinterpret_cast<uint32_t*>(&arguments[5])= numWords;
*reinterpret_cast<uint32_t*>(&arguments[5]) = numWords;
auto msg = com->waitForMessageSync([this, &arguments] {
return com->sendCommand(Command::NeoEraseMemory, arguments);