29 lines
554 B
C
29 lines
554 B
C
#pragma once
|
|
|
|
#include <stdint.h>
|
|
|
|
enum mifare_cmd {
|
|
MIFARE_CMD_AUTH_KEY_A = 0x60,
|
|
MIFARE_CMD_AUTH_KEY_B = 0x61,
|
|
MIFARE_CMD_PERSONALIZE_UID = 0x40,
|
|
MIFARE_CMD_SET_MOD_TYPE = 0x43,
|
|
MIFARE_CMD_READ = 0x30,
|
|
MIFARE_CMD_WRITE = 0xA0,
|
|
MIFARE_CMD_DECREMENT = 0xC0,
|
|
MIFARE_CMD_INCREMENT = 0xC1,
|
|
MIFARE_CMD_RESTORE = 0xC2,
|
|
MIFARE_CMD_TRANSFER = 0xB0,
|
|
};
|
|
|
|
struct mifare_block {
|
|
uint8_t bytes[16];
|
|
};
|
|
|
|
struct mifare_sector {
|
|
struct mifare_block blocks[4];
|
|
};
|
|
|
|
struct mifare {
|
|
struct mifare_sector sectors[16];
|
|
};
|