From e4006a7563afcd41a908022f4b793f4c1229ac73 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Sat, 20 Apr 2019 10:34:54 +0200 Subject: [PATCH] doc errors --- armsrc/appmain.c | 2 +- common/cmd.c | 4 ++-- doc/new_frame_format.txt | 2 +- include/usb_cmd.h | 34 ++++++++++++++++++---------------- 4 files changed, 22 insertions(+), 20 deletions(-) diff --git a/armsrc/appmain.c b/armsrc/appmain.c index 69de9f1a6..146e1fd3c 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -1567,7 +1567,7 @@ void __attribute__((noreturn)) AppMain(void) { int16_t ret = receive_ng(&rx); if (ret == PM3_SUCCESS) { PacketReceived(&rx); - } else if (ret != PM3_NODATA) { + } else if (ret != PM3_ENODATA) { Dbprintf("Error in frame reception"); // TODO DOEGOX if error, shall we resync ? } diff --git a/common/cmd.c b/common/cmd.c index 83e48895e..c1320e0cc 100644 --- a/common/cmd.c +++ b/common/cmd.c @@ -158,7 +158,7 @@ static int16_t receive_ng_internal(PacketCommandNG *rx, uint32_t read_ng(uint8_t PacketCommandNGRaw rx_raw; size_t bytes = read_ng((uint8_t *)&rx_raw.pre, sizeof(PacketCommandNGPreamble)); if (bytes == 0) - return PM3_NODATA; + return PM3_ENODATA; if (bytes != sizeof(PacketCommandNGPreamble)) return PM3_EIO; rx->magic = rx_raw.pre.magic; @@ -229,6 +229,6 @@ int16_t receive_ng(PacketCommandNG *rx) { // Check if there is a FPC packet available return receive_ng_internal(rx, usart_read_ng, true); #else - return PM3_NODATA; + return PM3_ENODATA; #endif } diff --git a/doc/new_frame_format.txt b/doc/new_frame_format.txt index d4b16efd4..359437407 100644 --- a/doc/new_frame_format.txt +++ b/doc/new_frame_format.txt @@ -174,7 +174,7 @@ Commands do WaitForResponseTimeoutW (or dl_it) which uses getReply to fetch resp API transition ============== -In short, to mode from one format to the other, we need for each command: +In short, to move from one format to the other, we need for each command: * (client TX) SendCommandOLD -> SendCommandNG (with all stuff in ad-hoc structs in "data" field) * (pm3 RX) PacketCommandNG parsing, from "oldarg" to only the "data" field diff --git a/include/usb_cmd.h b/include/usb_cmd.h index 316c99c3c..a52271d61 100644 --- a/include/usb_cmd.h +++ b/include/usb_cmd.h @@ -393,39 +393,41 @@ typedef struct { #define FLAG_NONEWLINE 0x0010 #define FLAG_NOPROMPT 0x0100 -// Error codes +// Error codes Usages: // Success (no error) #define PM3_SUCCESS 0 + // Undefined error #define PM3_EUNDEF -1 -// Invalid argument(s) +// Invalid argument(s) client: user input parsing #define PM3_EINVARG -2 -// Operation not supported by device +// Operation not supported by device client/pm3: probably only on pm3 once client becomes universal #define PM3_EDEVNOTSUPP -3 -// Operation timed out +// Operation timed out client: no response in time from pm3 #define PM3_ETIMEOUT -4 -// Operation aborted (by user) +// Operation aborted (by user) client/pm3: kbd/button pressed #define PM3_EOPABORTED -5 -// Not (yet) implemented +// Not (yet) implemented client/pm3: TBD placeholder #define PM3_ENOTIMPL -6 -// Error while RF transmission +// Error while RF transmission client/pm3: fail between pm3 & card #define PM3_ERFTRANS -7 -// Input / output error +// Input / output error pm3: error in client frame reception #define PM3_EIO -8 -// Buffer overflow +// Buffer overflow client/pm3: specified buffer too large for the operation #define PM3_EOVFLOW -9 -// Software error +// Software error client/pm3: e.g. error in parsing some data #define PM3_ESOFT -10 -// Flash error +// Flash error client/pm3: error in RDV4 Flash operation #define PM3_EFLASH -11 -// Memory allocation error +// Memory allocation error client: error in memory allocation (maybe also for pm3 BigBuff?) #define PM3_EMALLOC -12 -// File error +// File error client: error related to file access on host #define PM3_EFILE -13 -// No data -#define PM3_NODATA -98 -// Quit program + +// No data pm3: reserved, no host frame available (not really an error) +#define PM3_ENODATA -98 +// Quit program client: reserved, order to quit the program #define PM3_EFATAL -99