From 283060f962177254b128b0fee4b25de07853c5bf Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Sat, 27 Jul 2019 21:15:43 +0200 Subject: [PATCH] chg: renaming a struct --- CHANGELOG.md | 2 +- armsrc/appmain.c | 2 +- armsrc/apps.h | 4 +-- armsrc/lfops.c | 6 ++-- client/cmdlft55xx.c | 74 ++++++++++++++++++++++----------------------- include/pm3_cmd.h | 20 ++++++------ include/pmflash.h | 2 +- 7 files changed, 55 insertions(+), 55 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d35ed7a55..3857b2a3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] - - Add some more default keys (@ollibolli) + - Add some more default keys (ollibolli) - Fix T55x7 Downlink timings backward compatible (@mwalker33) - Add proper Makefile halting when using incompatible STANDALONE and PLATFORM vars (@doegox) - Add T55x7 Downlink mode support (@mwalker33) diff --git a/armsrc/appmain.c b/armsrc/appmain.c index 02829c20c..5cf0c5767 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -756,7 +756,7 @@ static void PacketReceived(PacketCommandNG *packet) { break; #ifdef WITH_LF case CMD_SET_LF_T55XX_CONFIG: { - setT55xxConfig(packet->oldarg[0], (t55xx_config *) packet->data.asBytes); + setT55xxConfig(packet->oldarg[0], (t55xx_configurations_t*) packet->data.asBytes); break; } case CMD_SET_LF_SAMPLING_CONFIG: { diff --git a/armsrc/apps.h b/armsrc/apps.h index aa1170ec7..d3fa44429 100644 --- a/armsrc/apps.h +++ b/armsrc/apps.h @@ -116,8 +116,8 @@ void EM4xReadWord(uint8_t addr, uint32_t pwd, uint8_t usepwd); void EM4xWriteWord(uint8_t addr, uint32_t data, uint32_t pwd, uint8_t usepwd); void Cotag(uint32_t arg0); -void setT55xxConfig(uint8_t arg0, t55xx_config *c); -t55xx_config *getT55xxConfig(void); +void setT55xxConfig(uint8_t arg0, t55xx_configurations_t *c); +t55xx_configurations_t *getT55xxConfig(void); void printT55xxConfig(void); void loadT55xxConfig(void); diff --git a/armsrc/lfops.c b/armsrc/lfops.c index 132ebe53c..92414f748 100644 --- a/armsrc/lfops.c +++ b/armsrc/lfops.c @@ -136,7 +136,7 @@ Initial values if not in flash { 31 , 20 , 18 , 40 , 0 , 0 , 15 }, // Leading 0 { 29 , 17 , 15 , 31 , 47 , 63 , 15 } // 1 of 4 */ -t55xx_config T55xx_Timing = { +t55xx_configurations_t T55xx_Timing = { { { 29 * 8, 17 * 8, 15 * 8, 47 * 8, 15 * 8, 0, 0 }, // Default Fixed { 31 * 8, 20 * 8, 18 * 8, 50 * 8, 15 * 8, 0, 0 }, // Long Leading Ref. @@ -210,7 +210,7 @@ void printT55xxConfig(void) { } } -void setT55xxConfig(uint8_t arg0, t55xx_config *c) { +void setT55xxConfig(uint8_t arg0, t55xx_configurations_t *c) { for (uint8_t i = 0; i < 4; i++) { if (c->m[i].start_gap != 0) T55xx_Timing.m[i].start_gap = c->m[i].start_gap; @@ -278,7 +278,7 @@ void setT55xxConfig(uint8_t arg0, t55xx_config *c) { #endif } -t55xx_config *getT55xxConfig(void) { +t55xx_configurations_t *getT55xxConfig(void) { return &T55xx_Timing;//_FixedBit; } diff --git a/client/cmdlft55xx.c b/client/cmdlft55xx.c index 9b7837f15..6a88116df 100644 --- a/client/cmdlft55xx.c +++ b/client/cmdlft55xx.c @@ -2611,57 +2611,57 @@ static int CmdT55xxSetDeviceConfig(const char *Cmd) { //Validations if (errors || cmdp == 0) return usage_lf_deviceconfig(); - t55xx_config conf = {{0}}; + t55xx_configurations_t configurations = {0}; if (set_defaults) { // fixed bit length - conf.m[T55XX_DLMODE_FIXED].start_gap = 29 * 8; - conf.m[T55XX_DLMODE_FIXED].write_gap = 17 * 8; - conf.m[T55XX_DLMODE_FIXED].write_0 = 15 * 8; - conf.m[T55XX_DLMODE_FIXED].write_1 = 47 * 8; - conf.m[T55XX_DLMODE_FIXED].read_gap = 15 * 8; - conf.m[T55XX_DLMODE_FIXED].write_2 = 0; - conf.m[T55XX_DLMODE_FIXED].write_3 = 0; + configurations.m[T55XX_DLMODE_FIXED].start_gap = 29 * 8; + configurations.m[T55XX_DLMODE_FIXED].write_gap = 17 * 8; + configurations.m[T55XX_DLMODE_FIXED].write_0 = 15 * 8; + configurations.m[T55XX_DLMODE_FIXED].write_1 = 47 * 8; + configurations.m[T55XX_DLMODE_FIXED].read_gap = 15 * 8; + configurations.m[T55XX_DLMODE_FIXED].write_2 = 0; + configurations.m[T55XX_DLMODE_FIXED].write_3 = 0; // long leading reference - conf.m[T55XX_DLMODE_LLR].start_gap = 31 * 8; - conf.m[T55XX_DLMODE_LLR].write_gap = 20 * 8; - conf.m[T55XX_DLMODE_LLR].write_0 = 18 * 8; - conf.m[T55XX_DLMODE_LLR].write_1 = 50 * 8; - conf.m[T55XX_DLMODE_LLR].read_gap = 15 * 8; - conf.m[T55XX_DLMODE_LLR].write_2 = 0; - conf.m[T55XX_DLMODE_LLR].write_3 = 0; + configurations.m[T55XX_DLMODE_LLR].start_gap = 31 * 8; + configurations.m[T55XX_DLMODE_LLR].write_gap = 20 * 8; + configurations.m[T55XX_DLMODE_LLR].write_0 = 18 * 8; + configurations.m[T55XX_DLMODE_LLR].write_1 = 50 * 8; + configurations.m[T55XX_DLMODE_LLR].read_gap = 15 * 8; + configurations.m[T55XX_DLMODE_LLR].write_2 = 0; + configurations.m[T55XX_DLMODE_LLR].write_3 = 0; // leading zero - conf.m[T55XX_DLMODE_LEADING_ZERO].start_gap = 31 * 8; - conf.m[T55XX_DLMODE_LEADING_ZERO].write_gap = 20 * 8; - conf.m[T55XX_DLMODE_LEADING_ZERO].write_0 = 18 * 8; - conf.m[T55XX_DLMODE_LEADING_ZERO].write_1 = 40 * 8; - conf.m[T55XX_DLMODE_LEADING_ZERO].read_gap = 15 * 8; - conf.m[T55XX_DLMODE_LEADING_ZERO].write_2 = 0; - conf.m[T55XX_DLMODE_LEADING_ZERO].write_3 = 0; + configurations.m[T55XX_DLMODE_LEADING_ZERO].start_gap = 31 * 8; + configurations.m[T55XX_DLMODE_LEADING_ZERO].write_gap = 20 * 8; + configurations.m[T55XX_DLMODE_LEADING_ZERO].write_0 = 18 * 8; + configurations.m[T55XX_DLMODE_LEADING_ZERO].write_1 = 40 * 8; + configurations.m[T55XX_DLMODE_LEADING_ZERO].read_gap = 15 * 8; + configurations.m[T55XX_DLMODE_LEADING_ZERO].write_2 = 0; + configurations.m[T55XX_DLMODE_LEADING_ZERO].write_3 = 0; // 1 of 4 coding reference - conf.m[T55XX_DLMODE_1OF4].start_gap = 29 * 8; - conf.m[T55XX_DLMODE_1OF4].write_gap = 17 * 8; - conf.m[T55XX_DLMODE_1OF4].write_0 = 15 * 8; - conf.m[T55XX_DLMODE_1OF4].write_1 = 31 * 8; - conf.m[T55XX_DLMODE_1OF4].read_gap = 15 * 8; - conf.m[T55XX_DLMODE_1OF4].write_2 = 47 * 8; - conf.m[T55XX_DLMODE_1OF4].write_3 = 63 * 8; + configurations.m[T55XX_DLMODE_1OF4].start_gap = 29 * 8; + configurations.m[T55XX_DLMODE_1OF4].write_gap = 17 * 8; + configurations.m[T55XX_DLMODE_1OF4].write_0 = 15 * 8; + configurations.m[T55XX_DLMODE_1OF4].write_1 = 31 * 8; + configurations.m[T55XX_DLMODE_1OF4].read_gap = 15 * 8; + configurations.m[T55XX_DLMODE_1OF4].write_2 = 47 * 8; + configurations.m[T55XX_DLMODE_1OF4].write_3 = 63 * 8; } else { - conf.m[downlink_mode].start_gap = startgap * 8; - conf.m[downlink_mode].write_gap = writegap * 8; - conf.m[downlink_mode].write_0 = write0 * 8; - conf.m[downlink_mode].write_1 = write1 * 8; - conf.m[downlink_mode].read_gap = readgap * 8; - conf.m[downlink_mode].write_2 = write2 * 8; - conf.m[downlink_mode].write_3 = write3 * 8; + configurations.m[downlink_mode].start_gap = startgap * 8; + configurations.m[downlink_mode].write_gap = writegap * 8; + configurations.m[downlink_mode].write_0 = write0 * 8; + configurations.m[downlink_mode].write_1 = write1 * 8; + configurations.m[downlink_mode].read_gap = readgap * 8; + configurations.m[downlink_mode].write_2 = write2 * 8; + configurations.m[downlink_mode].write_3 = write3 * 8; } clearCommandBuffer(); - SendCommandOLD(CMD_SET_LF_T55XX_CONFIG, shall_persist, 0, 0, &conf, sizeof(t55xx_config)); + SendCommandOLD(CMD_SET_LF_T55XX_CONFIG, shall_persist, 0, 0, &configurations, sizeof(t55xx_configurations_t)); return PM3_SUCCESS; } diff --git a/include/pm3_cmd.h b/include/pm3_cmd.h index be5d75b21..0c7a7d1e6 100644 --- a/include/pm3_cmd.h +++ b/include/pm3_cmd.h @@ -118,7 +118,7 @@ typedef struct { bool averaging; int divisor; int trigger_threshold; -} sample_config; +} PACKED sample_config; /* typedef struct { uint16_t start_gap; @@ -131,20 +131,20 @@ typedef struct { // Extended to support 1 of 4 timing typedef struct { - uint16_t start_gap ; - uint16_t write_gap ; - uint16_t write_0 ; - uint16_t write_1 ; - uint16_t read_gap ; - uint16_t write_2 ; - uint16_t write_3 ; - + uint16_t start_gap; + uint16_t write_gap; + uint16_t write_0; + uint16_t write_1; + uint16_t read_gap; + uint16_t write_2; + uint16_t write_3; } t55xx_config_t; + // This setup will allow for the 4 downlink modes "m" as well as other items if needed. // Given the one struct we can then read/write to flash/client in one go. typedef struct { t55xx_config_t m[4]; // mode -} t55xx_config; +} t55xx_configurations_t; /*typedef struct { uint16_t start_gap [4]; diff --git a/include/pmflash.h b/include/pmflash.h index b7bf39ddc..6e3a20e55 100644 --- a/include/pmflash.h +++ b/include/pmflash.h @@ -61,7 +61,7 @@ extern uint32_t FLASHMEM_SPIBAUDRATE; #endif #ifndef T55XX_CONFIG_LEN -# define T55XX_CONFIG_LEN sizeof( t55xx_config ) +# define T55XX_CONFIG_LEN sizeof( t55xx_configurations_t ) #endif #ifndef T55XX_CONFIG_OFFSET