From 05912ff130ca9a7d8e0b688d4cefd9e360d44968 Mon Sep 17 00:00:00 2001 From: Yann GASCUEL <34003959+lnv42@users.noreply.github.com> Date: Tue, 23 Jan 2024 15:41:33 +0100 Subject: [PATCH] iso15sim: rename, move and PACK iso15_tag struct to be usable in client --- armsrc/Standalone/hf_15sim.c | 4 ++-- armsrc/iso15693.c | 2 +- armsrc/iso15693.h | 27 --------------------------- include/iso15.h | 27 +++++++++++++++++++++++++++ 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/armsrc/Standalone/hf_15sim.c b/armsrc/Standalone/hf_15sim.c index f6427686a..edea4b30f 100644 --- a/armsrc/Standalone/hf_15sim.c +++ b/armsrc/Standalone/hf_15sim.c @@ -69,7 +69,7 @@ void RunMod(void) { FpgaDownloadAndGo(FPGA_BITSTREAM_HF_15); - iso15693_tag *tag = (iso15693_tag*) BigBuf_get_EM_addr(); + iso15_tag_t *tag = (iso15_tag_t*) BigBuf_get_EM_addr(); if (tag == NULL) return; uint8_t cmd[8] = {0}; @@ -118,7 +118,7 @@ void RunMod(void) { Dbprintf("Start dumping tag"); - memset(tag, 0, sizeof(iso15693_tag)); + memset(tag, 0, sizeof(iso15_tag_t)); memcpy(tag->uid, &recv[2], 8); i=10; diff --git a/armsrc/iso15693.c b/armsrc/iso15693.c index dbe9288a7..83ad93ed0 100644 --- a/armsrc/iso15693.c +++ b/armsrc/iso15693.c @@ -2132,7 +2132,7 @@ void SimTagIso15693(uint8_t *uid, uint8_t block_size) { // free eventually allocated BigBuf memory BigBuf_free_keep_EM(); - iso15693_tag *tag = (iso15693_tag*) BigBuf_get_EM_addr(); + iso15_tag_t *tag = (iso15_tag_t*) BigBuf_get_EM_addr(); if (tag == NULL) return; if (uid != NULL) { // new tag (need initialization) diff --git a/armsrc/iso15693.h b/armsrc/iso15693.h index 1de06520d..a3cb5174a 100644 --- a/armsrc/iso15693.h +++ b/armsrc/iso15693.h @@ -33,33 +33,6 @@ #define DELAY_ISO15693_VCD_TO_VICC_READER 1056 // 1056/3,39MHz = 311.5us from end of command EOF to start of tag response #define DELAY_ISO15693_VICC_TO_VCD_READER 1024 // 1024/3.39MHz = 302.1us between end of tag response and next reader command -#define ISO15693_TAG_MAX_PAGES 64 // in page -#define ISO15693_TAG_MAX_SIZE 2048 // in byte (64 pages of 256 bits) - -typedef struct iso15693_tag { - uint8_t uid[8]; - uint8_t dsfid; - bool dsfidLock; - uint8_t afi; - bool afiLock; - uint8_t bytesPerPage; - uint8_t pagesCount; - uint8_t ic; - uint8_t locks[ISO15693_TAG_MAX_PAGES]; - uint8_t data[ISO15693_TAG_MAX_SIZE]; - uint8_t random[2]; - uint8_t privacyPasswd[4]; - enum { - TAG_STATE_NO_FIELD, - TAG_STATE_READY, - TAG_STATE_ACTIVATED, // useless ? - TAG_STATE_SELECTED, - TAG_STATE_SILENCED - } state; - bool expectFast; - bool expectFsk; -} iso15693_tag; - void Iso15693InitReader(void); void Iso15693InitTag(void); void CodeIso15693AsReader(const uint8_t *cmd, int n); diff --git a/include/iso15.h b/include/iso15.h index 7d2b0e12f..7f1e5b306 100644 --- a/include/iso15.h +++ b/include/iso15.h @@ -44,4 +44,31 @@ typedef struct { uint8_t raw[]; // First byte in raw, raw[0] is ISO15693 protocol flag byte } PACKED iso15_raw_cmd_t; +#define ISO15693_TAG_MAX_PAGES 64 // in page +#define ISO15693_TAG_MAX_SIZE 2048 // in byte (64 pages of 256 bits) + +typedef struct { + uint8_t uid[8]; + uint8_t dsfid; + bool dsfidLock; + uint8_t afi; + bool afiLock; + uint8_t bytesPerPage; + uint8_t pagesCount; + uint8_t ic; + uint8_t locks[ISO15693_TAG_MAX_PAGES]; + uint8_t data[ISO15693_TAG_MAX_SIZE]; + uint8_t random[2]; + uint8_t privacyPasswd[4]; + enum { + TAG_STATE_NO_FIELD, + TAG_STATE_READY, + TAG_STATE_ACTIVATED, // useless ? + TAG_STATE_SELECTED, + TAG_STATE_SILENCED + } state; + bool expectFast; + bool expectFsk; +} PACKED iso15_tag_t; + #endif // _ISO15_H_