Merge pull request #2654 from Antiklesys/master
[RRG-proxmark3.git] / client / src / cmdhftopaz.h
blob19dfbb2f9fa7a9610ceab54d37e301e527640829
1 //-----------------------------------------------------------------------------
2 // Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // See LICENSE.txt for the text of the license.
15 //-----------------------------------------------------------------------------
16 // High frequency Topaz (NFC Type 1) commands
17 //-----------------------------------------------------------------------------
19 #ifndef CMDHFTOPAZ_H__
20 #define CMDHFTOPAZ_H__
22 #include "common.h"
25 #define TOPAZ_STATIC_MEMORY (0x0F * 8) // 15 blocks with 8 Bytes each
26 #define TOPAZ_BLOCK_SIZE 8
27 #define TOPAZ_MAX_SIZE 512
29 // a struct to describe a memory area which contains lock bits and the corresponding lockable memory area
30 typedef struct dynamic_lock_area_s {
31 struct dynamic_lock_area_s *next;
32 uint16_t byte_offset; // the address of the lock bits
33 uint16_t size_in_bits;
34 uint16_t first_locked_byte; // the address of the lockable area
35 uint16_t bytes_locked_per_bit;
36 } dynamic_lock_area_t;
38 typedef struct topaz_tag_s {
39 uint8_t HR01[2];
40 uint8_t uid[7];
41 uint16_t size;
42 uint8_t data_blocks[TOPAZ_STATIC_MEMORY / 8][8]; // this memory is always there
43 uint8_t *dynamic_memory; // this memory can be there
44 dynamic_lock_area_t *dynamic_lock_areas; // lock area descriptors
45 } topaz_tag_t;
49 int CmdHFTopaz(const char *Cmd);
50 int CmdHFTopazInfo(const char *Cmd);
51 int readTopazUid(bool loop, bool verbose);
52 #endif