eive-obsw/linux/payload/plocMpsocHelpers.cpp
Robin Mueller b03e53b6e9
All checks were successful
EIVE/eive-obsw/pipeline/pr-main This commit looks good
Re-work MPSoC handler module
2024-04-25 17:31:41 +02:00

96 lines
2.5 KiB
C++

#include "plocMpsocHelpers.h"
uint16_t mpsoc::getStatusFromRawData(const uint8_t* data) {
return (*(data + STATUS_OFFSET) << 8) | *(data + STATUS_OFFSET + 1);
}
std::string mpsoc::getStatusString(uint16_t status) {
switch (status) {
case (mpsoc::statusCode::UNKNOWN_APID): {
return "Unknown APID";
break;
}
case (mpsoc::statusCode::INCORRECT_LENGTH): {
return "Incorrect length";
break;
}
case (mpsoc::statusCode::INCORRECT_CRC): {
return "Incorrect crc";
break;
}
case (mpsoc::statusCode::INCORRECT_PKT_SEQ_CNT): {
return "Incorrect packet sequence count";
break;
}
case (mpsoc::statusCode::TC_NOT_ALLOWED_IN_MODE): {
return "TC not allowed in this mode";
break;
}
case (mpsoc::statusCode::TC_EXEUTION_DISABLED): {
return "TC execution disabled";
break;
}
case (mpsoc::statusCode::FLASH_MOUNT_FAILED): {
return "Flash mount failed";
break;
}
case (mpsoc::statusCode::FLASH_FILE_ALREADY_OPEN): {
return "Flash file already open";
break;
}
case (mpsoc::statusCode::FLASH_FILE_ALREADY_CLOSED): {
return "Flash file already closed";
break;
}
case (mpsoc::statusCode::FLASH_FILE_OPEN_FAILED): {
return "Flash file open failed";
break;
}
case (mpsoc::statusCode::FLASH_FILE_NOT_OPEN): {
return "Flash file not open";
break;
}
case (mpsoc::statusCode::FLASH_UNMOUNT_FAILED): {
return "Flash unmount failed";
break;
}
case (mpsoc::statusCode::HEAP_ALLOCATION_FAILED): {
return "Heap allocation failed";
break;
}
case (mpsoc::statusCode::INVALID_PARAMETER): {
return "Invalid parameter";
break;
}
case (mpsoc::statusCode::NOT_INITIALIZED): {
return "Not initialized";
break;
}
case (mpsoc::statusCode::REBOOT_IMMINENT): {
return "Reboot imminent";
break;
}
case (mpsoc::statusCode::CORRUPT_DATA): {
return "Corrupt data";
break;
}
case (mpsoc::statusCode::FLASH_CORRECTABLE_MISMATCH): {
return "Flash correctable mismatch";
break;
}
case (mpsoc::statusCode::FLASH_UNCORRECTABLE_MISMATCH): {
return "Flash uncorrectable mismatch";
break;
}
case (mpsoc::statusCode::DEFAULT_ERROR_CODE): {
return "Default error code";
break;
}
default:
std::stringstream ss;
ss << "0x" << std::hex << status;
return ss.str().c_str();
break;
}
return "";
}