mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
[FL-3867] Code formatting update (#3765)
* clang-format: AllowShortEnumsOnASingleLine: false * clang-format: InsertNewlineAtEOF: true * clang-format: Standard: c++20 * clang-format: AlignConsecutiveBitFields * clang-format: AlignConsecutiveMacros * clang-format: RemoveParentheses: ReturnStatement * clang-format: RemoveSemicolon: true * Restored RemoveParentheses: Leave, retained general changes for it * formatting: fixed logging TAGs * Formatting update for dev Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -8,26 +8,26 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MF_DESFIRE_CMD_GET_VERSION (0x60)
|
||||
#define MF_DESFIRE_CMD_GET_FREE_MEMORY (0x6E)
|
||||
#define MF_DESFIRE_CMD_GET_KEY_SETTINGS (0x45)
|
||||
#define MF_DESFIRE_CMD_GET_KEY_VERSION (0x64)
|
||||
#define MF_DESFIRE_CMD_GET_VERSION (0x60)
|
||||
#define MF_DESFIRE_CMD_GET_FREE_MEMORY (0x6E)
|
||||
#define MF_DESFIRE_CMD_GET_KEY_SETTINGS (0x45)
|
||||
#define MF_DESFIRE_CMD_GET_KEY_VERSION (0x64)
|
||||
#define MF_DESFIRE_CMD_GET_APPLICATION_IDS (0x6A)
|
||||
#define MF_DESFIRE_CMD_SELECT_APPLICATION (0x5A)
|
||||
#define MF_DESFIRE_CMD_GET_FILE_IDS (0x6F)
|
||||
#define MF_DESFIRE_CMD_GET_FILE_SETTINGS (0xF5)
|
||||
#define MF_DESFIRE_CMD_SELECT_APPLICATION (0x5A)
|
||||
#define MF_DESFIRE_CMD_GET_FILE_IDS (0x6F)
|
||||
#define MF_DESFIRE_CMD_GET_FILE_SETTINGS (0xF5)
|
||||
|
||||
#define MF_DESFIRE_CMD_READ_DATA (0xBD)
|
||||
#define MF_DESFIRE_CMD_GET_VALUE (0x6C)
|
||||
#define MF_DESFIRE_CMD_READ_DATA (0xBD)
|
||||
#define MF_DESFIRE_CMD_GET_VALUE (0x6C)
|
||||
#define MF_DESFIRE_CMD_READ_RECORDS (0xBB)
|
||||
|
||||
#define MF_DESFIRE_MAX_KEYS (14)
|
||||
#define MF_DESFIRE_MAX_KEYS (14)
|
||||
#define MF_DESFIRE_MAX_FILES (32)
|
||||
|
||||
#define MF_DESFIRE_UID_SIZE (7)
|
||||
#define MF_DESFIRE_BATCH_SIZE (5)
|
||||
#define MF_DESFIRE_UID_SIZE (7)
|
||||
#define MF_DESFIRE_BATCH_SIZE (5)
|
||||
#define MF_DESFIRE_APP_ID_SIZE (3)
|
||||
#define MF_DESFIRE_VALUE_SIZE (4)
|
||||
#define MF_DESFIRE_VALUE_SIZE (4)
|
||||
|
||||
typedef struct {
|
||||
uint8_t hw_vendor;
|
||||
|
||||
@@ -11,15 +11,15 @@
|
||||
MF_DESFIRE_FFF_PICC_PREFIX " " \
|
||||
"Free Memory"
|
||||
|
||||
#define MF_DESFIRE_FFF_CHANGE_KEY_ID_KEY "Change Key ID"
|
||||
#define MF_DESFIRE_FFF_CONFIG_CHANGEABLE_KEY "Config Changeable"
|
||||
#define MF_DESFIRE_FFF_CHANGE_KEY_ID_KEY "Change Key ID"
|
||||
#define MF_DESFIRE_FFF_CONFIG_CHANGEABLE_KEY "Config Changeable"
|
||||
#define MF_DESFIRE_FFF_FREE_CREATE_DELETE_KEY "Free Create Delete"
|
||||
#define MF_DESFIRE_FFF_FREE_DIR_LIST_KEY "Free Directory List"
|
||||
#define MF_DESFIRE_FFF_KEY_CHANGEABLE_KEY "Key Changeable"
|
||||
#define MF_DESFIRE_FFF_FLAGS_KEY "Flags"
|
||||
#define MF_DESFIRE_FFF_MAX_KEYS_KEY "Max Keys"
|
||||
#define MF_DESFIRE_FFF_FREE_DIR_LIST_KEY "Free Directory List"
|
||||
#define MF_DESFIRE_FFF_KEY_CHANGEABLE_KEY "Key Changeable"
|
||||
#define MF_DESFIRE_FFF_FLAGS_KEY "Flags"
|
||||
#define MF_DESFIRE_FFF_MAX_KEYS_KEY "Max Keys"
|
||||
|
||||
#define MF_DESFIRE_FFF_KEY_SUB_PREFIX "Key"
|
||||
#define MF_DESFIRE_FFF_KEY_SUB_PREFIX "Key"
|
||||
#define MF_DESFIRE_FFF_KEY_VERSION_KEY "Version"
|
||||
|
||||
#define MF_DESFIRE_FFF_APPLICATION_COUNT_KEY \
|
||||
@@ -33,15 +33,15 @@
|
||||
#define MF_DESFIRE_FFF_FILE_IDS_KEY \
|
||||
MF_DESFIRE_FFF_FILE_SUB_PREFIX " " \
|
||||
"IDs"
|
||||
#define MF_DESFIRE_FFF_FILE_TYPE_KEY "Type"
|
||||
#define MF_DESFIRE_FFF_FILE_TYPE_KEY "Type"
|
||||
#define MF_DESFIRE_FFF_FILE_COMM_SETTINGS_KEY "Communication Settings"
|
||||
#define MF_DESFIRE_FFF_FILE_ACCESS_RIGHTS_KEY "Access Rights"
|
||||
|
||||
#define MF_DESFIRE_FFF_FILE_SIZE_KEY "Size"
|
||||
|
||||
#define MF_DESFIRE_FFF_FILE_HI_LIMIT_KEY "Hi Limit"
|
||||
#define MF_DESFIRE_FFF_FILE_LO_LIMIT_KEY "Lo Limit"
|
||||
#define MF_DESFIRE_FFF_FILE_LIMIT_CREDIT_VALUE_KEY "Limited Credit Value"
|
||||
#define MF_DESFIRE_FFF_FILE_HI_LIMIT_KEY "Hi Limit"
|
||||
#define MF_DESFIRE_FFF_FILE_LO_LIMIT_KEY "Lo Limit"
|
||||
#define MF_DESFIRE_FFF_FILE_LIMIT_CREDIT_VALUE_KEY "Limited Credit Value"
|
||||
#define MF_DESFIRE_FFF_FILE_LIMIT_CREDIT_ENABLED_KEY "Limited Credit Enabled"
|
||||
|
||||
#define MF_DESFIRE_FFF_FILE_MAX_KEY "Max"
|
||||
@@ -78,12 +78,12 @@ bool mf_desfire_free_memory_parse(MfDesfireFreeMemory* data, const BitBuffer* bu
|
||||
bool mf_desfire_key_settings_parse(MfDesfireKeySettings* data, const BitBuffer* buf) {
|
||||
typedef struct FURI_PACKED {
|
||||
bool is_master_key_changeable : 1;
|
||||
bool is_free_directory_list : 1;
|
||||
bool is_free_create_delete : 1;
|
||||
bool is_config_changeable : 1;
|
||||
uint8_t change_key_id : 4;
|
||||
uint8_t max_keys : 4;
|
||||
uint8_t flags : 4;
|
||||
bool is_free_directory_list : 1;
|
||||
bool is_free_create_delete : 1;
|
||||
bool is_config_changeable : 1;
|
||||
uint8_t change_key_id : 4;
|
||||
uint8_t max_keys : 4;
|
||||
uint8_t flags : 4;
|
||||
} MfDesfireKeySettingsLayout;
|
||||
|
||||
const bool can_parse = bit_buffer_get_size_bytes(buf) == sizeof(MfDesfireKeySettingsLayout);
|
||||
@@ -164,8 +164,8 @@ bool mf_desfire_file_settings_parse(MfDesfireFileSettings* data, const BitBuffer
|
||||
|
||||
typedef struct FURI_PACKED {
|
||||
uint32_t size : 3 * BITS_IN_BYTE;
|
||||
uint32_t max : 3 * BITS_IN_BYTE;
|
||||
uint32_t cur : 3 * BITS_IN_BYTE;
|
||||
uint32_t max : 3 * BITS_IN_BYTE;
|
||||
uint32_t cur : 3 * BITS_IN_BYTE;
|
||||
} MfDesfireFileSettingsRecord;
|
||||
|
||||
typedef struct FURI_PACKED {
|
||||
|
||||
@@ -3,53 +3,53 @@
|
||||
#include "mf_desfire.h"
|
||||
|
||||
#define MF_DESFIRE_FFF_PICC_PREFIX "PICC"
|
||||
#define MF_DESFIRE_FFF_APP_PREFIX "Application"
|
||||
#define MF_DESFIRE_FFF_APP_PREFIX "Application"
|
||||
|
||||
// Successful operation
|
||||
#define MF_DESFIRE_STATUS_OPERATION_OK (0x00)
|
||||
#define MF_DESFIRE_STATUS_OPERATION_OK (0x00)
|
||||
// No changes done to backup files, CommitTransaction / AbortTransaction not necessary
|
||||
#define MF_DESFIRE_STATUS_NO_CHANGES (0x0C)
|
||||
#define MF_DESFIRE_STATUS_NO_CHANGES (0x0C)
|
||||
// Insufficient NV-Memory to complete command
|
||||
#define MF_DESFIRE_STATUS_OUT_OF_EEPROM_ERROR (0x0E)
|
||||
#define MF_DESFIRE_STATUS_OUT_OF_EEPROM_ERROR (0x0E)
|
||||
// Command code not supported
|
||||
#define MF_DESFIRE_STATUS_ILLEGAL_COMMAND_CODE (0x1C)
|
||||
#define MF_DESFIRE_STATUS_ILLEGAL_COMMAND_CODE (0x1C)
|
||||
// CRC or MAC does not match data Padding bytes not valid
|
||||
#define MF_DESFIRE_STATUS_INTEGRITY_ERROR (0x1E)
|
||||
#define MF_DESFIRE_STATUS_INTEGRITY_ERROR (0x1E)
|
||||
// Invalid key number specified
|
||||
#define MF_DESFIRE_STATUS_NO_SUCH_KEY (0x40)
|
||||
#define MF_DESFIRE_STATUS_NO_SUCH_KEY (0x40)
|
||||
// Length of command string invalid
|
||||
#define MF_DESFIRE_STATUS_LENGTH_ERROR (0x7E)
|
||||
#define MF_DESFIRE_STATUS_LENGTH_ERROR (0x7E)
|
||||
// Current configuration / status does not allow the requested command
|
||||
#define MF_DESFIRE_STATUS_PERMISSION_DENIED (0x9D)
|
||||
#define MF_DESFIRE_STATUS_PERMISSION_DENIED (0x9D)
|
||||
// Value of the parameter(s) invalid
|
||||
#define MF_DESFIRE_STATUS_PARAMETER_ERROR (0x9E)
|
||||
#define MF_DESFIRE_STATUS_PARAMETER_ERROR (0x9E)
|
||||
// Requested AID not present on PICC
|
||||
#define MF_DESFIRE_STATUS_APPLICATION_NOT_FOUND (0xA0)
|
||||
// Unrecoverable error within application, application will be disabled
|
||||
#define MF_DESFIRE_STATUS_APPL_INTEGRITY_ERROR (0xA1)
|
||||
#define MF_DESFIRE_STATUS_APPL_INTEGRITY_ERROR (0xA1)
|
||||
// Current authentication status does not allow the requested command
|
||||
#define MF_DESFIRE_STATUS_AUTHENTICATION_ERROR (0xAE)
|
||||
#define MF_DESFIRE_STATUS_AUTHENTICATION_ERROR (0xAE)
|
||||
// Additional data frame is expected to be sent
|
||||
#define MF_DESFIRE_STATUS_ADDITIONAL_FRAME (0xAF)
|
||||
#define MF_DESFIRE_STATUS_ADDITIONAL_FRAME (0xAF)
|
||||
// Attempt to read/write data from/to beyond the file's/record's limits
|
||||
// Attempt to exceed the limits of a value file.
|
||||
#define MF_DESFIRE_STATUS_BOUNDARY_ERROR (0xBE)
|
||||
#define MF_DESFIRE_STATUS_BOUNDARY_ERROR (0xBE)
|
||||
// Unrecoverable error within PICC, PICC will be disabled
|
||||
#define MF_DESFIRE_STATUS_PICC_INTEGRITY_ERROR (0xC1)
|
||||
#define MF_DESFIRE_STATUS_PICC_INTEGRITY_ERROR (0xC1)
|
||||
// Previous Command was not fully completed. Not all Frames were requested or provided by the PCD
|
||||
#define MF_DESFIRE_STATUS_COMMAND_ABORTED (0xCA)
|
||||
#define MF_DESFIRE_STATUS_COMMAND_ABORTED (0xCA)
|
||||
// PICC was disabled by an unrecoverable error
|
||||
#define MF_DESFIRE_STATUS_PICC_DISABLED_ERROR (0xCD)
|
||||
#define MF_DESFIRE_STATUS_PICC_DISABLED_ERROR (0xCD)
|
||||
// Number of Applications limited to 28, no additional CreateApplication possible
|
||||
#define MF_DESFIRE_STATUS_COUNT_ERROR (0xCE)
|
||||
#define MF_DESFIRE_STATUS_COUNT_ERROR (0xCE)
|
||||
// Creation of file/application failed because file/application with same number already exists
|
||||
#define MF_DESFIRE_STATUS_DUBLICATE_ERROR (0xDE)
|
||||
#define MF_DESFIRE_STATUS_DUBLICATE_ERROR (0xDE)
|
||||
// Could not complete NV-write operation due to loss of power, internal backup/rollback mechanism activated
|
||||
#define MF_DESFIRE_STATUS_EEPROM_ERROR (0xEE)
|
||||
#define MF_DESFIRE_STATUS_EEPROM_ERROR (0xEE)
|
||||
// Specified file number does not exist
|
||||
#define MF_DESFIRE_STATUS_FILE_NOT_FOUND (0xF0)
|
||||
#define MF_DESFIRE_STATUS_FILE_NOT_FOUND (0xF0)
|
||||
// Unrecoverable error within file, file will be disabled
|
||||
#define MF_DESFIRE_STATUS_FILE_INTEGRITY_ERROR (0xF1)
|
||||
#define MF_DESFIRE_STATUS_FILE_INTEGRITY_ERROR (0xF1)
|
||||
|
||||
// SimpleArray configurations
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
#define TAG "MfDesfirePoller"
|
||||
|
||||
#define MF_DESFIRE_BUF_SIZE (64U)
|
||||
#define MF_DESFIRE_BUF_SIZE (64U)
|
||||
#define MF_DESFIRE_RESULT_BUF_SIZE (512U)
|
||||
|
||||
typedef NfcCommand (*MfDesfirePollerReadHandler)(MfDesfirePoller* instance);
|
||||
|
||||
Reference in New Issue
Block a user