1 /* 2 * Copyright (C) 2010 NXP Semiconductors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 /*! 18 * \file phFriNfc_MifareStdMap.h 19 * \brief NFC Ndef Mapping For Remote Devices. 20 * 21 * Project: NFC-FRI 22 * 23 * $Date: Tue May 19 10:30:01 2009 $ 24 * $Author: ing07336 $ 25 * $Revision: 1.7 $ 26 * $Aliases: NFC_FRI1.1_WK922_PREP1,NFC_FRI1.1_WK920_R25_1,NFC_FRI1.1_WK922_R26_1,NFC_FRI1.1_WK924_PREP1,NFC_FRI1.1_WK924_R27_1,NFC_FRI1.1_WK926_R28_1,NFC_FRI1.1_WK928_R29_1,NFC_FRI1.1_WK930_R30_1,NFC_FRI1.1_WK934_PREP_1,NFC_FRI1.1_WK934_R31_1,NFC_FRI1.1_WK941_PREP1,NFC_FRI1.1_WK941_PREP2,NFC_FRI1.1_WK941_1,NFC_FRI1.1_WK943_R32_1,NFC_FRI1.1_WK949_PREP1,NFC_FRI1.1_WK943_R32_10,NFC_FRI1.1_WK943_R32_13,NFC_FRI1.1_WK943_R32_14,NFC_FRI1.1_WK1007_R33_1,NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $ 27 * 28 */ 29 30 #ifndef PHFRINFC_MIFARESTDMAP_H 31 #define PHFRINFC_MIFARESTDMAP_H 32 33 #include <phFriNfc.h> 34 #ifdef PH_HAL4_ENABLE 35 #include <phHal4Nfc.h> 36 #else 37 #include <phHalNfc.h> 38 #endif 39 /** Fix: [NFC-FRI * * * CCB * * * 0000429]: 40 phFriNfc_MifareMap : Error during compilation **/ 41 #include <phNfcStatus.h> 42 #include <phFriNfc_OvrHal.h> 43 44 #ifndef PH_HAL4_ENABLE 45 #include <phFriNfc_OvrHalCmd.h> 46 #endif 47 48 #include <phNfcTypes.h> 49 #include <phFriNfc_NdefMap.h> 50 51 /*! \ingroup grp_file_attributes 52 * \name NDEF Mapping 53 * 54 * File: \ref phFriNfc_NdefMap.h 55 * 56 */ 57 /*@{*/ 58 #define PH_FRINFC_MIFARESTDMAP_FILEREVISION "$Revision: 1.7 $" 59 #define PH_FRINFC_MIFARESTDMAP_FILEALIASES "$Aliases: NFC_FRI1.1_WK922_PREP1,NFC_FRI1.1_WK920_R25_1,NFC_FRI1.1_WK922_R26_1,NFC_FRI1.1_WK924_PREP1,NFC_FRI1.1_WK924_R27_1,NFC_FRI1.1_WK926_R28_1,NFC_FRI1.1_WK928_R29_1,NFC_FRI1.1_WK930_R30_1,NFC_FRI1.1_WK934_PREP_1,NFC_FRI1.1_WK934_R31_1,NFC_FRI1.1_WK941_PREP1,NFC_FRI1.1_WK941_PREP2,NFC_FRI1.1_WK941_1,NFC_FRI1.1_WK943_R32_1,NFC_FRI1.1_WK949_PREP1,NFC_FRI1.1_WK943_R32_10,NFC_FRI1.1_WK943_R32_13,NFC_FRI1.1_WK943_R32_14,NFC_FRI1.1_WK1007_R33_1,NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $" 60 /*@}*/ 61 62 63 /*! \defgroup grp_fri_nfc_ndef_map NDEF Mapping for Remote Devices 64 * 65 * This component encapsulates Ndef Registration and Listening data and functionality. 66 */ 67 /*@{*/ 68 69 /*! 70 * \name NDEF Mapping - states of the Finite State machine 71 * 72 */ 73 /*@{*/ 74 #define PH_FRINFC_NDEFMAP_STATE_INIT 0 /*!< Init state. The start-up state */ 75 #define PH_FRINFC_NDEFMAP_STATE_READ 1 /*!< Read State */ 76 #define PH_FRINFC_NDEFMAP_STATE_WRITE 2 /*!< Write is going on*/ 77 #define PH_FRINFC_NDEFMAP_STATE_AUTH 3 /*!< Authenticate is going on*/ 78 #define PH_FRINFC_NDEFMAP_STATE_CHK_NDEF_COMP 4 /*!< Check Ndef is going on */ 79 #define PH_FRINFC_NDEFMAP_STATE_RD_ACS_BIT 5 /*!< Read access bit is in progress */ 80 #define PH_FRINFC_NDEFMAP_STATE_WR_NDEF_LEN 6 /*!< Write NDEF TLV LEngth*/ 81 #define PH_FRINFC_NDEFMAP_STATE_RD_TO_WR_NDEF_LEN 7 /*!< read to write the Ndef TLV*/ 82 #define PH_FRINFC_NDEFMAP_STATE_GET_ACT_CARDSIZE 8 /*!< Get the card size */ 83 #define PH_FRINFC_NDEFMAP_STATE_RD_BEF_WR 9 /*!< Read the NDEF TLV block before starting write */ 84 #define PH_FRINFC_NDEFMAP_STATE_WR_TLV 10 /*!< Read the NDEF TLV block before starting write */ 85 #define PH_FRINFC_NDEFMAP_STATE_RD_TLV 11 /*!< Read the NDEF TLV block */ 86 #define PH_FRINFC_NDEFMAP_STATE_TERM_TLV 12 /*!< Write terminator TLV block */ 87 #define PH_FRINFC_NDEFMAP_STATE_POLL 13 /*!< Poll in progress */ 88 #define PH_FRINFC_NDEFMAP_STATE_DISCONNECT 14 /*!< Disconnect in progress */ 89 #define PH_FRINFC_NDEFMAP_STATE_CONNECT 15 /*!< Connect in progress */ 90 91 #define PH_FRINFC_NDEFMAP_STATE_RD_SEC_ACS_BIT 16 /*!< Convert to ReadOnly in progress */ 92 #define PH_FRINFC_NDEFMAP_STATE_WRITE_SEC 17 /*!< Convert to ReadOnly in progress */ 93 94 95 /*@}*/ 96 97 /*! 98 * \name Mifare Standard - NDEF Compliant Flags 99 * 100 */ 101 /*@{*/ 102 #define PH_FRINFC_MIFARESTD_NDEF_COMP 0 /*!< Sector is NDEF Compliant */ 103 #define PH_FRINFC_MIFARESTD_NON_NDEF_COMP 1 /*!< Sector is not NDEF Compliant */ 104 /*@}*/ 105 106 /*! 107 * \name Mifare Standard - NDEF Compliant Flags 108 * 109 */ 110 /*@{*/ 111 #define PH_FRINFC_MIFARESTD_PROP_1ST_CONFIG 0 /*!< No proprietary forum sector found */ 112 #define PH_FRINFC_MIFARESTD_PROP_2ND_CONFIG 1 /*!< Here the proprietary 113 forum sector exists after NFC forum 114 sector */ 115 #define PH_FRINFC_MIFARESTD_PROP_3RD_CONFIG 2 /*!< Here the proprietary 116 forum sector exists before NFC forum 117 sector */ 118 /*@}*/ 119 120 /*! 121 * \name Mifare Standard - NDEF Compliant Flags 122 * 123 */ 124 /*@{*/ 125 #define PH_FRINFC_MIFARESTD_MADSECT_ACS_BYTE6 0x78 /*!< Access Bit for Byte 6 in 126 MAD sector trailer */ 127 #define PH_FRINFC_MIFARESTD_MADSECT_ACS_BYTE7 0x77 /*!< Access Bit for Byte 7 in 128 MAD sector trailer */ 129 #define PH_FRINFC_MIFARESTD_NFCSECT_ACS_BYTE6 0x7F /*!< Access Bit for Byte 6 in 130 NFC forum sector trailer */ 131 #define PH_FRINFC_MIFARESTD_NFCSECT_ACS_BYTE7 0x07 /*!< Access Bit for Byte 7 in 132 NFC forum sector trailer */ 133 #define PH_FRINFC_MIFARESTD_ACS_BYTE8 0x88 /*!< Access Bit for Byte 8 in 134 all sector trailer */ 135 #define PH_FRINFC_MIFARESTD_NFCSECT_RDACS_BYTE6 0x07 /*!< Access Bit for Byte 6 in 136 NFC forum sector trailer for 137 Read Only State */ 138 #define PH_FRINFC_MIFARESTD_NFCSECT_RDACS_BYTE7 0x8F /*!< Access Bit for Byte 7 in 139 NFC forum sector trailer 140 Read Only State */ 141 #define PH_FRINFC_MIFARESTD_NFCSECT_RDACS_BYTE8 0x0F /*!< Access Bit for Byte 8 in 142 NFC forum sector trailer 143 Read Only State */ 144 /*@}*/ 145 146 /*! 147 * \name Mifare Standard - Mifare Standard constants 148 * 149 */ 150 /*@{*/ 151 #define MIFARE_MAX_SEND_BUF_TO_READ 1 /*!< Send Length for Reading a Block */ 152 #define MIFARE_MAX_SEND_BUF_TO_WRITE 17 /*!< Send Length for writing a Block */ 153 #define MIFARE_AUTHENTICATE_CMD_LENGTH 7 /*!< Send Length for authenticating a Block */ 154 /*@}*/ 155 156 /*! 157 * \name Mifare standard - Constants 158 * 159 */ 160 /*@{*/ 161 #define PH_FRINFC_MIFARESTD_MAD_BLK0 0 /*!< Block number 0 */ 162 #define PH_FRINFC_MIFARESTD_MAD_BLK1 1 /*!< Block number 1 */ 163 #define PH_FRINFC_MIFARESTD_MAD_BLK2 2 /*!< Block number 2 */ 164 #define PH_FRINFC_MIFARESTD_MAD_BLK3 3 /*!< Block number 3 */ 165 #define PH_FRINFC_MIFARESTD_BLK4 4 /*!< Block number 4 */ 166 #define PH_FRINFC_MIFARESTD_BLK5 5 /*!< Block number 5 */ 167 #define PH_FRINFC_MIFARESTD_BLK6 6 /*!< Block number 6 */ 168 #define PH_FRINFC_MIFARESTD_BLK7 7 /*!< Block number 7 */ 169 #define PH_FRINFC_MIFARESTD_BLK8 8 /*!< Block number 8 */ 170 #define PH_FRINFC_MIFARESTD_BLK9 9 /*!< Block number 9 */ 171 #define PH_FRINFC_MIFARESTD_BLK10 10 /*!< Block number 10 */ 172 #define PH_FRINFC_MIFARESTD_BLK11 11 /*!< Block number 11 */ 173 #define PH_FRINFC_MIFARESTD_BLK12 12 /*!< Block number 12 */ 174 #define PH_FRINFC_MIFARESTD_BLK13 13 /*!< Block number 13 */ 175 #define PH_FRINFC_MIFARESTD_BLK14 14 /*!< Block number 14 */ 176 #define PH_FRINFC_MIFARESTD_BLK15 15 /*!< Block number 15 */ 177 #define PH_FRINFC_MIFARESTD_MAD_BLK16 16 /*!< Block number 16 */ 178 #define PH_FRINFC_MIFARESTD_MAD_BLK63 63 /*!< Block number 63 */ 179 #define PH_FRINFC_MIFARESTD_MAD_BLK64 64 /*!< Block number 64 */ 180 #define PH_FRINFC_MIFARESTD_MAD_BLK65 65 /*!< Block number 65 */ 181 #define PH_FRINFC_MIFARESTD_MAD_BLK66 66 /*!< Block number 66 */ 182 #define PH_FRINFC_MIFARESTD_MAD_BLK67 67 /*!< Block number 67 */ 183 #define PH_FRINFC_MIFARESTD4K_BLK128 128 /*!< Block number 128 for Mifare 4k */ 184 #define PH_FRINFC_MIFARESTD_SECTOR_NO0 0 /*!< Sector 0 */ 185 #define PH_FRINFC_MIFARESTD_SECTOR_NO1 1 /*!< Sector 1 */ 186 #define PH_FRINFC_MIFARESTD_SECTOR_NO16 16 /*!< Sector 16 */ 187 #define PH_FRINFC_MIFARESTD_SECTOR_NO39 39 /*!< Sector 39 */ 188 #define PH_FRINFC_MIFARESTD_SECTOR_NO32 32 /*!< Sector 32 */ 189 #define PH_FRINFC_MIFARESTD4K_TOTAL_SECTOR 40 /*!< Sector 40 */ 190 #define PH_FRINFC_MIFARESTD1K_TOTAL_SECTOR 16 /*!< Sector 40 */ 191 #define PH_FRINFC_MIFARESTD_BYTES_READ 16 /*!< Bytes read */ 192 #define PH_FRINFC_MIFARESTD_BLOCK_BYTES 16 /*!< Bytes per block */ 193 #define PH_FRINFC_MIFARESTD_SECTOR_BLOCKS 16 /*!< Blocks per sector */ 194 #define PH_FRINFC_MIFARESTD_WR_A_BLK 17 /*!< 17 bytes (including current block) 195 are given to transfer */ 196 #define PH_FRINFC_MIFARESTD4K_MAX_BLOCKS 210 /*!< Maximum number of Mifare 4k Blocks 197 excluding sector trailer */ 198 #define PH_FRINFC_MIFARESTD1K_MAX_BLK 63 /*!< Maximum number of Mifare 1k blocks 199 including the sector trailer*/ 200 #define PH_FRINFC_MIFARESTD4K_MAX_BLK 254 /*!< Maximum number of Mifare 4k blocks 201 including the sector trailer*/ 202 #define PH_FRINFC_MIFARESTD_FLAG1 1 /*!< Flag to set 1 */ 203 #define PH_FRINFC_MIFARESTD_FLAG0 0 /*!< Flag to set 0 */ 204 #define PH_FRINFC_MIFARESTD_INC_1 1 /*!< increment by 1 */ 205 #define PH_FRINFC_MIFARESTD_INC_2 2 /*!< increment by 2 */ 206 #define PH_FRINFC_MIFARESTD_INC_3 3 /*!< increment by 3 */ 207 #define PH_FRINFC_MIFARESTD_INC_4 4 /*!< increment by 4 */ 208 #define PH_FRINFC_MIFARESTD_VAL0 0 /*!< Value initialised to 0 */ 209 #define PH_FRINFC_MIFARESTD_VAL1 1 /*!< Value initialised to 1 */ 210 #define PH_FRINFC_MIFARESTD_VAL2 2 /*!< Value initialised to 2 */ 211 #define PH_FRINFC_MIFARESTD_VAL3 3 /*!< Value initialised to 3 */ 212 #define PH_FRINFC_MIFARESTD_VAL4 4 /*!< Value initialised to 4 */ 213 #define PH_FRINFC_MIFARESTD_VAL5 5 /*!< Value initialised to 5 */ 214 #define PH_FRINFC_MIFARESTD_VAL6 6 /*!< Value initialised to 6 */ 215 #define PH_FRINFC_MIFARESTD_VAL7 7 /*!< Value initialised to 7 */ 216 #define PH_FRINFC_MIFARESTD_VAL8 8 /*!< Value initialised to 8 */ 217 #define PH_FRINFC_MIFARESTD_VAL9 9 /*!< Value initialised to 9 */ 218 #define PH_FRINFC_MIFARESTD_VAL10 10 /*!< Value initialised to 10 */ 219 #define PH_FRINFC_MIFARESTD_VAL11 11 /*!< Value initialised to 11 */ 220 #define PH_FRINFC_MIFARESTD_VAL12 12 /*!< Value initialised to 12 */ 221 #define PH_FRINFC_MIFARESTD_VAL13 13 /*!< Value initialised to 13 */ 222 #define PH_FRINFC_MIFARESTD_VAL14 14 /*!< Value initialised to 14 */ 223 #define PH_FRINFC_MIFARESTD_VAL15 15 /*!< Value initialised to 15 */ 224 #define PH_FRINFC_MIFARESTD_VAL16 16 /*!< Value initialised to 16 */ 225 #define PH_FRINFC_MIFARESTD_NDEFTLV_L 0xFF /*!< Length of the TLV */ 226 #define PH_FRINFC_MIFARESTD_NDEFTLV_T 0x03 /*!< Length of the TLV */ 227 #define PH_FRINFC_MIFARESTD_NDEFTLV_L0 0x00 /*!< Length of the TLV */ 228 #define PH_FRINFC_MIFARESTD_NDEFTLV_LBYTES0 0 /*!< Number of bytes taken by length (L) of the TLV */ 229 #define PH_FRINFC_MIFARESTD_NDEFTLV_LBYTES1 1 /*!< Number of bytes taken by length (L) of the TLV */ 230 #define PH_FRINFC_MIFARESTD_NDEFTLV_LBYTES2 2 /*!< Number of bytes taken by length (L) of the TLV */ 231 #define PH_FRINFC_MIFARESTD_NDEFTLV_LBYTES3 3 /*!< Number of bytes taken by length (L) of the TLV */ 232 #define PH_FRINFC_MIFARESTD_PROPTLV_T 0xFD /*!< Type of Proprietary TLV */ 233 #define PH_FRINFC_MIFARESTD_TERMTLV_T 0xFE /*!< Type of Terminator TLV */ 234 #define PH_FRINFC_MIFARESTD_NULLTLV_T 0x00 /*!< Type of NULL TLV */ 235 #define PH_FRINFC_MIFARESTD_LEFTSHIFT8 8 /*!< Left shift by 8 */ 236 #define PH_FRINFC_MIFARESTD_RIGHTSHIFT8 8 /*!< Right shift by 8 */ 237 #define PH_FRINFC_MIFARESTD_MASK_FF 0xFF /*!< Mask 0xFF */ 238 #define PH_FRINFC_MIFARESTD_MASK_GPB_WR 0x03 /*!< Mask 0x03 for GPB byte */ 239 #define PH_FRINFC_MIFARESTD_MASK_GPB_RD 0x0C /*!< Mask 0xOC for GPB byte */ 240 #define PH_FRINFC_MIFARESTD_GPB_RD_WR_VAL 0x00 /*!< GPB Read Write value */ 241 #define PH_FRINFC_MIFARESTD_KEY_LEN 0x06 /*!< MIFARE Std key length */ 242 243 /*@}*/ 244 245 246 /*! 247 * \brief \copydoc page_reg Resets the component instance to the initial state and lets the component forget about 248 * the list of registered items. Moreover, the lower device is set. 249 * 250 * \param[in] NdefMap Pointer to a valid or uninitialised instance of \ref phFriNfc_NdefMap_t . 251 * 252 * \note This function has to be called at the beginning, after creating an instance of 253 * \ref phFriNfc_NdefMap_t . Use this function to reset the instance and/or switch 254 * to a different underlying device (different NFC device or device mode, or different 255 * Remote Device). 256 */ 257 NFCSTATUS phFriNfc_MifareStdMap_H_Reset( phFriNfc_NdefMap_t *NdefMap); 258 259 260 261 /*! 262 * \brief \copydoc page_ovr Initiates Reading of NDEF information from the Remote Device. 263 * 264 * The function initiates the reading of NDEF information from a Remote Device. 265 * It performs a reset of the state and starts the action (state machine). 266 * A periodic call of the \ref phFriNfc_NdefMap_Process has to be done once the action 267 * has been triggered. 268 * 269 * \param[in] NdefMap Pointer to a valid instance of the \ref phFriNfc_NdefMap_t structure describing 270 * the component context. 271 * 272 * \param[in] PacketData Pointer to a location that receives the NDEF Packet. 273 * 274 * \param[in,out] PacketDataLength Pointer to a variable receiving the length of the NDEF packet. 275 * 276 * \param[in] Offset Indicates whether the read operation shall start from the begining of the 277 * file/card storage \b or continue from the last offset. The last Offset set is stored 278 * within a context variable (must not be modified by the integration). 279 * If the caller sets the value to \ref PH_FRINFC_NDEFMAP_SEEK_CUR, the component shall 280 * start reading from the last offset set (continue where it has stopped before). 281 * If set to \ref PH_FRINFC_NDEFMAP_SEEK_BEGIN, the component shall start reading 282 * from the begining of the card (restarted) 283 * 284 * \retval NFCSTATUS_PENDING The action has been successfully triggered. 285 * \retval NFCSTATUS_INVALID_DEVICE_REQUEST If Previous Operation is Write Ndef and Offset 286 * is Current then this error is displayed. 287 * \retval NFCSTATUS_EOF_NDEF_CONTAINER_REACHED No Space in the File to read. 288 * \retval NFCSTATUS_MORE_INFORMATION There are more bytes to read in the card. 289 * \retval NFCSTATUS_SUCCESS Last Byte of the card read. 290 * \retval NFCSTATUS_INVALID_DEVICE The device has not been opened or has been disconnected 291 * meanwhile. 292 * \retval NFCSTATUS_CMD_ABORTED The caller/driver has aborted the request. 293 * \retval NFCSTATUS_BUFFER_TOO_SMALL The buffer provided by the caller is too small. 294 * \retval NFCSTATUS_RF_TIMEOUT No data has been received within the TIMEOUT period. 295 * 296 */ 297 NFCSTATUS phFriNfc_MifareStdMap_RdNdef( phFriNfc_NdefMap_t *NdefMap, 298 uint8_t *PacketData, 299 uint32_t *PacketDataLength, 300 uint8_t Offset); 301 302 303 /*! 304 * \brief \copydoc page_ovr Initiates Writing of NDEF information to the Remote Device. 305 * 306 * The function initiates the writing of NDEF information to a Remote Device. 307 * It performs a reset of the state and starts the action (state machine). 308 * A periodic call of the \ref phFriNfc_NdefMap_Process has to be done once the action 309 * has been triggered. 310 * 311 * \param[in] NdefMap Pointer to a valid instance of the \ref phFriNfc_NdefMap_t structure describing 312 * the component context. 313 * 314 * \param[in] PacketData Pointer to a location that holds the prepared NDEF Packet. 315 * 316 * \param[in,out] PacketDataLength Variable specifying the length of the prepared NDEF packet. 317 * 318 * \param[in] Offset Indicates whether the write operation shall start from the begining of the 319 * file/card storage \b or continue from the last offset. The last Offset set is stored 320 * within a context variable (must not be modified by the integration). 321 * If the caller sets the value to \ref PH_FRINFC_NDEFMAP_SEEK_CUR, the component shall 322 * start writing from the last offset set (continue where it has stopped before). 323 * If set to \ref PH_FRINFC_NDEFMAP_SEEK_BEGIN, the component shall start writing 324 * from the begining of the card (restarted) 325 * 326 * \retval NFCSTATUS_PENDING The action has been successfully triggered. 327 * \retval NFCSTATUS_INVALID_DEVICE_REQUEST If Previous Operation is Write Ndef and Offset 328 * is Current then this error is displayed. 329 * \retval NFCSTATUS_EOF_NDEF_CONTAINER_REACHED Last byte is written to the card after this 330 * no further writing is possible. 331 * \retval NFCSTATUS_SUCCESS Buffer provided by the user is completely written 332 * into the card. 333 * \retval NFCSTATUS_INVALID_DEVICE The device has not been opened or has been disconnected 334 * meanwhile. 335 * \retval NFCSTATUS_CMD_ABORTED The caller/driver has aborted the request. 336 * \retval NFCSTATUS_BUFFER_TOO_SMALL The buffer provided by the caller is too small. 337 * \retval NFCSTATUS_RF_TIMEOUT No data has been received within the TIMEOUT period. 338 * 339 */ 340 341 NFCSTATUS phFriNfc_MifareStdMap_WrNdef( phFriNfc_NdefMap_t *NdefMap, 342 uint8_t *PacketData, 343 uint32_t *PacketDataLength, 344 uint8_t Offset); 345 346 347 /*! 348 * \brief \copydoc page_ovr Check whether a particulat Remote Device is NDEF compliant. 349 * 350 * The function checks whether the peer device is NDEF compliant. 351 * 352 * \param[in] NdefMap Pointer to a valid instance of the \ref phFriNfc_NdefMap_t structure describing 353 * the component context. 354 * 355 * \retval NFCSTATUS_PENDING The action has been successfully triggered. 356 * \retval NFCSTATUS_INVALID_PARAMETER At least one parameter of the function is invalid. 357 * \retval NFCSTATUS_INVALID_DEVICE The device has not been opened or has been disconnected 358 * meanwhile. 359 * \retval NFCSTATUS_CMD_ABORTED The caller/driver has aborted the request. 360 * \retval NFCSTATUS_BUFFER_TOO_SMALL The buffer provided by the caller is too small. 361 * \retval NFCSTATUS_RF_TIMEOUT No data has been received within the TIMEOUT period. 362 * 363 */ 364 NFCSTATUS phFriNfc_MifareStdMap_ChkNdef(phFriNfc_NdefMap_t *NdefMap); 365 366 /*! 367 * \brief \copydoc page_cb Completion Routine, Processing function, needed to avoid long blocking. 368 * 369 * The function call scheme is according to \ref grp_interact. No State reset is performed during operation. 370 * 371 * \copydoc pphFriNfc_Cr_t 372 * 373 * \note The lower (Overlapped HAL) layer must register a pointer to this function as a Completion 374 * Routine in order to be able to notify the component that an I/O has finished and data are 375 * ready to be processed. 376 * 377 */ 378 void phFriNfc_MifareStdMap_Process( void *Context, 379 NFCSTATUS Status); 380 381 /*! 382 * 383 * The function Convert the Mifare card to ReadOnly. 384 * 385 * \param[in] NdefMap Pointer to a valid instance of the \ref phFriNfc_NdefMap_t structure describing 386 * the component context. 387 * 388 * \retval NFCSTATUS_PENDING The action has been successfully triggered. 389 * \retval NFCSTATUS_INVALID_PARAMETER At least one parameter of the function is invalid. 390 * \retval NFCSTATUS_INVALID_STATE The mifare card should be in read_write state to convert card to 391 * readonly.If any other state the function return NFCSTATUS_INVALID_STATE 392 *\retval NFCSTATUS_NOT_ALLOWED If card is already in read_only state or initialized state 393 * 394 */ 395 NFCSTATUS phFriNfc_MifareStdMap_ConvertToReadOnly(phFriNfc_NdefMap_t *NdefMap, const uint8_t *ScrtKeyB); 396 397 #endif /* PHFRINFC_MIFARESTDMAP_H */ 398