iso15sim: rename, move and PACK iso15_tag struct to be usable in client

This commit is contained in:
Yann GASCUEL 2024-01-23 15:41:33 +01:00
commit 05912ff130
4 changed files with 30 additions and 30 deletions

View file

@ -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;

View file

@ -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)

View file

@ -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);

View file

@ -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_