-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathst-srx.h
38 lines (30 loc) · 1.01 KB
/
st-srx.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//
// Created by depau on 7/2/19.
//
#ifndef NFC_ST_SRX_ST_SRX_H
#define NFC_ST_SRX_ST_SRX_H
#define SRIX4K_EEPROM_LEN 0x80
#define SRI512_EEPROM_LEN 0x10
#define DUMP_LEN 0x100
#include <stdint.h>
#include <stdlib.h>
typedef struct {
uint8_t eeprom[SRIX4K_EEPROM_LEN * 4];
uint8_t padding[(DUMP_LEN - 1 - SRIX4K_EEPROM_LEN) * 4];
uint8_t system_block[1 * 4];
} st_srix4k_tag_t;
typedef struct {
uint8_t eeprom[SRI512_EEPROM_LEN * 4];
uint8_t padding[(DUMP_LEN - 1 - SRI512_EEPROM_LEN) * 4];
uint8_t system_block[1 * 4];
} st_sri512_tag_t;
typedef union {
st_srix4k_tag_t srix4k;
st_sri512_tag_t sri512;
uint8_t raw_bytes[DUMP_LEN * 4];
uint8_t raw_blocks[DUMP_LEN][4];
} st_srx_tag_t;
size_t st_srx_get_uid(nfc_device *pnd, uint8_t *uidRx, bool verbose);
size_t st_srx_read_block(nfc_device *pnd, uint8_t *blockRx, uint8_t address, bool verbose);
size_t st_srx_write_block(nfc_device *pnd, uint8_t *blockRx, uint8_t address, uint8_t *data, bool verbose);
#endif //NFC_ST_SRX_ST_SRX_H