Updated to v0.95
[hackover2013-badge-firmware.git] / drivers / sensors / pn532 / pn532_mifare.h
1 /**************************************************************************/
2 /*!
3 @file pn532_mifare.h
4 */
5 /**************************************************************************/
6
7 #ifndef __PN532_MIFARE_H__
8 #define __PN532_MIFARE_H__
9
10 #include "projectconfig.h"
11
12 typedef enum pn532_mifare_cmd_e
13 {
14 PN532_MIFARE_CMD_AUTH_A = 0x60,
15 PN532_MIFARE_CMD_AUTH_B = 0x61,
16 PN532_MIFARE_CMD_READ = 0x30,
17 PN532_MIFARE_CMD_WRITE = 0xA0,
18 PN532_MIFARE_CMD_TRANSFER = 0xB0,
19 PN532_MIFARE_CMD_DECREMENT = 0xC0,
20 PN532_MIFARE_CMD_INCREMENT = 0xC1,
21 PN532_MIFARE_CMD_STORE = 0xC2
22 }
23 pn532_mifare_cmd_t;
24
25 typedef struct
26 {
27 byte_t abtKey[6];
28 byte_t abtUid[4];
29 }
30 pn532_mifare_param_auth_t;
31
32 typedef struct
33 {
34 byte_t abtData[16];
35 }
36 pn532_mifare_param_data_t;
37
38 typedef struct
39 {
40 byte_t abtValue[4];
41 }
42 pn532_mifare_param_value_t;
43
44 typedef union
45 {
46 pn532_mifare_param_auth_t mpa;
47 pn532_mifare_param_data_t mpd;
48 pn532_mifare_param_value_t mpv;
49 }
50 pn532_mifare_param_t;
51
52 // MIFARE Classic
53 typedef struct
54 {
55 byte_t abtUID[4];
56 byte_t btBCC;
57 byte_t btUnknown;
58 byte_t abtATQA[2];
59 byte_t abtUnknown[8];
60 }
61 pn532_mifare_classic_block_manufacturer_t;
62
63 typedef struct
64 {
65 byte_t abtData[16];
66 }
67 pn532_mifare_classic_block_data_t;
68
69 typedef struct
70 {
71 byte_t abtKeyA[6];
72 byte_t abtAccessBits[4];
73 byte_t abtKeyB[6];
74 }
75 pn532_mifare_classic_block_trailer_t;
76
77 typedef union
78 {
79 pn532_mifare_classic_block_manufacturer_t mbm;
80 pn532_mifare_classic_block_data_t mbd;
81 pn532_mifare_classic_block_trailer_t mbt;
82 }
83 pn532_mifare_classic_block_t;
84
85 typedef struct
86 {
87 pn532_mifare_classic_block_t amb[256];
88 }
89 pn532_mifare_classic_tag_t;
90
91 // MIFARE Ultralight
92 typedef struct
93 {
94 byte_t sn0[3];
95 byte_t btBCC0;
96 byte_t sn1[4];
97 byte_t btBCC1;
98 byte_t internal;
99 byte_t lock[2];
100 byte_t otp[4];
101 }
102 pn532_mifareul_block_manufacturer_t;
103
104 typedef struct
105 {
106 byte_t abtData[16];
107 }
108 pn532_mifareul_block_data_t;
109
110 typedef union
111 {
112 pn532_mifareul_block_manufacturer_t mbm;
113 pn532_mifareul_block_data_t mbd;
114 }
115 pn532_mifareul_block_t;
116
117 typedef struct
118 {
119 pn532_mifareul_block_t amb[4];
120 }
121 pn532_mifareul_tag_t;
122
123 #endif
This page took 0.050464 seconds and 5 git commands to generate.