unleashed-firmware/applications/external/nfc_magic/lib/magic/gen4.h
Avery 490447bbd4
NFC: Add support for Gen4 "ultimate card" in Magic app (#2238)
* NFC: gen4 gtu detect in magic app
* NFC: more support for GTU card
* NFC: Fix Gen1 in Magic
* Allow double UIDs for MFClassic on GTU cards
* NFC: Small magic app tweaks
* nfc magic: notify card event on wiping
* nfc magic: fix power consumption
* nfc magic: disable i2c writing and fix wipe loop
* NfcMagic: correct formatting in printf
* NfcMagic: correct formatting in printf, proper version
* nfc_magic: rework card found notification and gen4 wiping

Co-authored-by: あく <alleteam@gmail.com>
2023-05-26 02:01:02 +09:00

49 lines
1.4 KiB
C

#pragma once
#include <lib/nfc/protocols/mifare_classic.h>
#define MAGIC_GEN4_DEFAULT_PWD 0x00000000
#define MAGIC_GEN4_CONFIG_LEN 32
#define NFCID1_SINGLE_SIZE 4
#define NFCID1_DOUBLE_SIZE 7
#define NFCID1_TRIPLE_SIZE 10
typedef enum {
MagicGen4UIDLengthSingle = 0x00,
MagicGen4UIDLengthDouble = 0x01,
MagicGen4UIDLengthTriple = 0x02
} MagicGen4UIDLength;
typedef enum {
MagicGen4UltralightModeUL_EV1 = 0x00,
MagicGen4UltralightModeNTAG = 0x01,
MagicGen4UltralightModeUL_C = 0x02,
MagicGen4UltralightModeUL = 0x03
} MagicGen4UltralightMode;
typedef enum {
// for writing original (shadow) data
MagicGen4ShadowModePreWrite = 0x00,
// written data can be read once before restored to original
MagicGen4ShadowModeRestore = 0x01,
// written data is discarded
MagicGen4ShadowModeIgnore = 0x02,
// apparently for UL?
MagicGen4ShadowModeHighSpeedIgnore = 0x03
} MagicGen4ShadowMode;
bool magic_gen4_get_cfg(uint32_t pwd, uint8_t* config);
bool magic_gen4_set_cfg(uint32_t pwd, const uint8_t* config, uint8_t config_length, bool fuse);
bool magic_gen4_set_pwd(uint32_t old_pwd, uint32_t new_pwd);
bool magic_gen4_read_blk(uint32_t pwd, uint8_t block_num, uint8_t* data);
bool magic_gen4_write_blk(uint32_t pwd, uint8_t block_num, const uint8_t* data);
bool magic_gen4_wipe(uint32_t pwd);
void magic_gen4_deactivate();