refactored topaz commands. It still uses a global var with dynamic memory. Added rdbl, wrbl, view, dump commands to match rest of client

This commit is contained in:
iceman1001 committed 2022-08-05 22:46:59 +02:00
1 parent 5a4b8c8224
commit 62980b5038
7 files changed
+567 -139

No files matched your search

+25 -1
View File
@@ -21,8 +21,32 @@
#include "common.h"
#define TOPAZ_STATIC_MEMORY (0x0F * 8) // 15 blocks with 8 Bytes each
#define TOPAZ_BLOCK_SIZE 8
#define TOPAZ_MAX_SIZE 512
// a struct to describe a memory area which contains lock bits and the corresponding lockable memory area
typedef struct dynamic_lock_area_s {
struct dynamic_lock_area_s *next;
uint16_t byte_offset; // the address of the lock bits
uint16_t size_in_bits;
uint16_t first_locked_byte; // the address of the lockable area
uint16_t bytes_locked_per_bit;
} dynamic_lock_area_t;
typedef struct topaz_tag_s {
uint8_t HR01[2];
uint8_t uid[7];
uint16_t size;
uint8_t data_blocks[TOPAZ_STATIC_MEMORY / 8][8]; // this memory is always there
uint8_t *dynamic_memory; // this memory can be there
dynamic_lock_area_t *dynamic_lock_areas; // lock area descriptors
} topaz_tag_t;
int CmdHFTopaz(const char *Cmd);
int CmdHFTopazInfo(const char *Cmd);
int readTopazUid(bool loop, bool verbose);
#endif