From be88db1b543aad5d14d5f807942aceefa5432869 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 1 Sep 2026 13:34:02 +0200 Subject: [PATCH] move clock --- armsrc/sam_common.c | 32 +++++++++----------------------- armsrc/sam_common.h | 2 -- armsrc/sam_picopass.c | 1 + armsrc/sam_seos.c | 1 + 4 files changed, 11 insertions(+), 25 deletions(-) diff --git a/armsrc/sam_common.c b/armsrc/sam_common.c index 33d571d1e..db124f48f 100644 --- a/armsrc/sam_common.c +++ b/armsrc/sam_common.c @@ -19,6 +19,7 @@ #include #include "sam_common.h" +#include "util.h" // switch_clock_to_ticks / _countsspclk #include "iclass.h" #include "proxmark3_arm.h" #include "BigBuf.h" @@ -282,7 +283,8 @@ int sam_rxtx(const uint8_t *data, uint16_t n, uint8_t *resp, uint16_t *resplen) uint8_t cmd_getresp_t0[] = {0x00, ISO7816_GET_RESPONSE, 0x00, 0x00, more_len}; uint16_t want = more_len ? more_len : 256; uint8_t cmd_getresp_t1[] = {0x00, ISO7816_GET_RESPONSE, 0x00, 0x00, - 0x00, (uint8_t)(want >> 8), (uint8_t)want}; + 0x00, (uint8_t)(want >> 8), (uint8_t)want + }; const uint8_t *cmd_getresp = t1 ? cmd_getresp_t1 : cmd_getresp_t0; const uint16_t cmd_getresp_len = t1 ? sizeof(cmd_getresp_t1) : sizeof(cmd_getresp_t0); @@ -309,22 +311,6 @@ out: return res; } -// The tick counter and the ssp_clk counter share the same timer block, so a SAM -// session can only ever run one of them, and every handover starts the incoming -// counter from zero. The trace holds both halves, so each technology's frames -// are timed from the moment that technology took the timer over -void switch_clock_to_ticks(void) { - StopTicks(); - StartTicks(); - sc_log_trace_reset(); - trace_restart_timeline(); -} - -void switch_clock_to_countsspclk(void) { - StopTicks(); - StartCountSspClk(); - trace_restart_timeline(); -} /** * @brief Sends a payload to the SAM @@ -468,12 +454,12 @@ int sam_get_version(bool info) { uint16_t payload_len = sizeof(payload); int exchange = sam_send_payload( - 0x44, 0x0a, 0x44, - payload, - &payload_len, - response, - &response_len - ); + 0x44, 0x0a, 0x44, + payload, + &payload_len, + response, + &response_len + ); if (exchange != PM3_SUCCESS) { res = exchange; diff --git a/armsrc/sam_common.h b/armsrc/sam_common.h index 69e5d8c7f..9a92039b1 100644 --- a/armsrc/sam_common.h +++ b/armsrc/sam_common.h @@ -34,8 +34,6 @@ uint16_t sam_response_payload(const uint8_t *rx, uint16_t rx_len, uint16_t *payl int sam_rxtx(const uint8_t *data, uint16_t n, uint8_t *resp, uint16_t *resplen); -void switch_clock_to_ticks(void); -void switch_clock_to_countsspclk(void); // Backwards-compatible wrapper that calls sam_send_payload_ex with scFlag=0x00. int sam_send_payload( diff --git a/armsrc/sam_picopass.c b/armsrc/sam_picopass.c index 0f7172283..0294b9140 100644 --- a/armsrc/sam_picopass.c +++ b/armsrc/sam_picopass.c @@ -17,6 +17,7 @@ //----------------------------------------------------------------------------- #include "sam_picopass.h" #include "sam_common.h" +#include "util.h" // switch_clock_to_ticks / _countsspclk #include "sam_sc.h" #include "iclass.h" #include "crc16.h" diff --git a/armsrc/sam_seos.c b/armsrc/sam_seos.c index f99a7f2a1..7fdb49a48 100644 --- a/armsrc/sam_seos.c +++ b/armsrc/sam_seos.c @@ -18,6 +18,7 @@ //----------------------------------------------------------------------------- #include "sam_seos.h" #include "sam_common.h" +#include "util.h" // switch_clock_to_ticks / _countsspclk #include "sam_sc.h" #include "iclass.h"