fix no error reporting

This commit is contained in:
Mateusz Faderewski 2024-08-05 01:06:35 +02:00
parent 080f4ce0ba
commit 4187a5cec7
2 changed files with 10 additions and 2 deletions

View File

@ -123,12 +123,16 @@ static void sc64_cmd_irq_callback (void) {
const char *sc64_error_description (sc64_error_t error) { const char *sc64_error_description (sc64_error_t error) {
if (error == SC64_OK) {
return "No error";
}
sc64_error_type_t type = (sc64_error_type_t) ((error >> 24) & 0xFF); sc64_error_type_t type = (sc64_error_type_t) ((error >> 24) & 0xFF);
error &= 0xFFFFFF; error &= 0xFFFFFF;
if (type == ERROR_TYPE_CFG) { if (type == ERROR_TYPE_CFG) {
switch ((sc64_cfg_error_t) (error)) { switch ((sc64_cfg_error_t) (error)) {
case SC64_OK: return "No error"; case CFG_OK: return "No error (CFG)";
case CFG_ERROR_UNKNOWN_COMMAND: return "Unknown command"; case CFG_ERROR_UNKNOWN_COMMAND: return "Unknown command";
case CFG_ERROR_INVALID_ARGUMENT: return "Invalid argument"; case CFG_ERROR_INVALID_ARGUMENT: return "Invalid argument";
case CFG_ERROR_INVALID_ADDRESS: return "Invalid address"; case CFG_ERROR_INVALID_ADDRESS: return "Invalid address";

View File

@ -7,13 +7,17 @@
#include <stdint.h> #include <stdint.h>
#define SC64_OK (0)
typedef enum { typedef enum {
ERROR_TYPE_OBSOLETE = 0,
ERROR_TYPE_CFG = 1, ERROR_TYPE_CFG = 1,
ERROR_TYPE_SD_CARD = 2, ERROR_TYPE_SD_CARD = 2,
} sc64_error_type_t; } sc64_error_type_t;
typedef enum { typedef enum {
SC64_OK = 0, CFG_OK = 0,
CFG_ERROR_UNKNOWN_COMMAND = 1, CFG_ERROR_UNKNOWN_COMMAND = 1,
CFG_ERROR_INVALID_ARGUMENT = 2, CFG_ERROR_INVALID_ARGUMENT = 2,
CFG_ERROR_INVALID_ADDRESS = 3, CFG_ERROR_INVALID_ADDRESS = 3,