15d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*
25d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * Copyright (C) 2010 NXP Semiconductors
35d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
45d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * Licensed under the Apache License, Version 2.0 (the "License");
55d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * you may not use this file except in compliance with the License.
65d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * You may obtain a copy of the License at
75d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
85d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *      http://www.apache.org/licenses/LICENSE-2.0
95d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * Unless required by applicable law or agreed to in writing, software
115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * distributed under the License is distributed on an "AS IS" BASIS,
125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * See the License for the specific language governing permissions and
145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * limitations under the License.
155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*
185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \file  phFriNfc_MifareULMap.h
195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief NFC Ndef Mapping For Mifare UL Card.
205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * Project: NFC-FRI
225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * $Date: Fri Aug  7 13:06:49 2009 $
245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * $Author: ing07336 $
255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * $Revision: 1.9 $
265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * $Aliases: 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 $
275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifndef PHFRINFC_MIFAREULMAP_H
315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PHFRINFC_MIFAREULMAP_H
325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phFriNfc.h>
345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#if !defined PH_HAL4_ENABLE
355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phHal4Nfc.h>
365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif
375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phNfcStatus.h>
385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phNfcTypes.h>
395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phFriNfc_NdefMap.h>
405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MIFAREMAP_FILEREVISION "$Revision: 1.9 $"
425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MIFAREMAP_FILEALIASES  "$Aliases: 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 $"
435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \name Mifare UL - states of the Finite State machine
475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@{*/
505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_STATE_READ                        1   /*!< Read State */
515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_STATE_WRITE                       2   /*!< Write is going on*/
525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_STATE_CHK_NDEF_COMP               3   /*!< Check Ndef is going on */
535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_STATE_FND_NDEF_COMP               4   /*!< to find the NDEF TLV */
545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_STATE_TERM_TLV                    5   /*!< to write the terminator TLV */
555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_STATE_WR_LEN_TLV                  6   /*!< Write L value of TLV */
565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_STATE_SELECT_SECTOR_CHK_1         7   /*!< to send sector select command 1 */
575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_STATE_SELECT_SECTOR_CHK_2		 8   /*!< to send sector select command 2 */
585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_STATE_SELECT_SECTOR_RESET_1       9   /*!< to send sector select command 1 for resetting sector 0 */
595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_STATE_SELECT_SECTOR_RESET_2		 10   /*!< to send sector select command 2 for resetting sector 0 */
605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_STATE_SELECT_SECTOR_READ_1      	 11   /*!< to send sector select command 1 for resetting sector 0 */
615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_STATE_SELECT_SECTOR_READ_2		 12   /*!< to send sector select command 2 for resetting sector 0 */
625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_STATE_SELECT_SECTOR_WRITE_1       13   /*!< to send sector select command 1 for resetting sector 0 */
635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_STATE_SELECT_SECTOR_WRITE_2		 14   /*!< to send sector select command 2 for resetting sector 0 */
645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_STATE_SELECT_SECTOR_RW_1       15   /*!< to send sector select command 1 for resetting sector 0 */
655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_STATE_SELECT_SECTOR_RW_2		 16   /*!< to send sector select command 2 for resetting sector 0 */
665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_STATE_SELECT_SECTOR_WRITE_INIT_1       17   /*!< to send sector select command 1 for resetting sector 0 */
675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_STATE_SELECT_SECTOR_WRITE_INIT_2		 18   /*!< to send sector select command 2 for resetting sector 0 */
685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@}*/
715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \name Mifare - constants for the capability container
745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@{*/
775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_CC_BYTE0                 0xE1 /*!< Capability container byte 0 = 0xE1 */
785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_CC_BYTE1                 0x10 /*!< Capability container byte 1 = 0x10 */
795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_CC_BYTE2                 0x06 /*!< Capability container byte 2 = 0x06 */
805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_CC_BYTE3_RW              0x00 /*!< Capability container byte 3 = 0x00 for
815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                                                  READ WRITE/INITIALISED card state*/
825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_CC_BYTE3_RO              0x0F /*!< Capability container byte 3 = 0x0F for
835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                                                  READ only card state*/
845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@}*/
855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \name Mifare - constants for Flags
885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@{*/
915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_FLAG0                    0 /*!< Flag value = 0 */
925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_FLAG1                    1 /*!< Flag value = 1 */
935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@}*/
945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \name Mifare - constants for left shift
975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@{*/
1005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_SHIFT8                   8 /*!< Flag value = 0 */
1015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@}*/
1025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
1045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \name Mifare - TLV related constants
1055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
1075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@{*/
1085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_NDEFTLV_T                0x03 /*!< Type value of TLV = 0x03 */
1095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_NDEFTLV_L                0x00 /*!< Length value of TLV = 0x00 */
1105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_NDEFTLV_LFF              0xFF /*!< Length value of TLV = 0xFF */
1115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_TERMTLV                  0xFE /*!< Terminator TLV value = 0xFE */
1125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_NULLTLV                  0x00 /*!< Null TLV value = 0x00 */
1135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_LOCK_CTRL_TLV			0x01 /*!< Lock Control TLV value = 0x01 */
1145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_MEM_CTRL_TLV				0x02 /*!< Memory Control TVL value = 0x02 */
1155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_PROPRIETRY_TLV			0xFD /*!< Proprietry TVL value = 0xFD */
1165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@}*/
1195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
1225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \name Mifare - Standard constants
1235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
1255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@{*/
1265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_WR_A_BLK                 0x05 /*!< Send Length for Write Ndef */
1275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_MAX_SEND_BUF_TO_READ     0x01 /*!< Send Length for Read Ndef */
1285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_CHECK_RESP               0x04 /*!< Value of the Sense Response for Mifare UL */
1295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_OTP_OFFSET               3    /*!< To initialise the Offset */
1305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_MUL8                     8    /*!< Multiply by 8 */
1315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_VAL0                     0    /*!< Value 0 */
1325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_VAL1                     1    /*!< Value 1 */
1335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_VAL2                     2    /*!< Value 2 */
1345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_VAL3                     3    /*!< Value 3 */
1355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_VAL4                     4    /*!< Value 4 */
1365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_VAL5                     5    /*!< Value 5 */
1375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_VAL64                    64    /*!< Value 64 */
1385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_BYTE0                    0x00 /*!< Byte number 0 */
1395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_BYTE1                    0x01 /*!< Byte number 1 */
1405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_BYTE2                    0x02 /*!< Byte number 2 */
1415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_BYTE3                    0x03 /*!< Byte number 3 */
1425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_BYTE4                    0x04 /*!< Byte number 4 */
1435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_BLOCK0                   0x00 /*!< Block number 0 */
1445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_BLOCK1                   0x01 /*!< Block number 1 */
1455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_BLOCK2                   0x02 /*!< Block number 2 */
1465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_BLOCK3                   0x03 /*!< Block number 3 */
1475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_BLOCK4                   0x04 /*!< Block number 4 */
1485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_BLOCK5                   0x05 /*!< Block number 5 */
1495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_RDBYTES_16               0x10 /*!< Read Bytes 16 */
1515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_STMFUL_MAX_CARD_SZ            48   /*!< For static maximum memory size is 48 bytes */
1525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_NDEFMAP_MFUL_WR_BUF_STR               0x04 /*!< To store the block of data written to the card */
1535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@}*/
1545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
1565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief \copydoc page_reg Resets the component instance to the initial state and lets the component forget about
1575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *        the list of registered items. Moreover, the lower device is set.
1585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] NdefMap Pointer to a valid or uninitialised instance of \ref phFriNfc_NdefMap_t .
1605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \note  This function has to be called at the beginning, after creating an instance of
1625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *        \ref phFriNfc_NdefMap_t . Use this function to reset the instance and/or switch
1635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *        to a different underlying device (different NFC device or device mode, or different
1645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *        Remote Device).
1655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
1665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS phFriNfc_MifareUL_H_Reset(  phFriNfc_NdefMap_t        *NdefMap);
1675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
1695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief \copydoc page_ovr Initiates Reading of NDEF information from the Remote Device.
1705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * The function initiates the reading of NDEF information from a Remote Device.
1725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * It performs a reset of the state and starts the action (state machine).
1735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * A periodic call of the \ref phFriNfc_NdefMap_Process has to be done once the action
1745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * has been triggered.
1755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] NdefMap Pointer to a valid instance of the \ref phFriNfc_NdefMap_t structure describing
1775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                    the component context.
1785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] PacketData  Pointer to a location that receives the NDEF Packet.
1805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in,out] PacketDataLength Pointer to a variable receiving the length of the NDEF packet.
1825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] Offset Indicates whether the read operation shall start from the begining of the
1845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            file/card storage \b or continue from the last offset. The last Offset set is stored
1855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            within a context variable (must not be modified by the integration).
1865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            If the caller sets the value to \ref PH_FRINFC_NDEFMAP_SEEK_CUR, the component shall
1875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            start reading from the last offset set (continue where it has stopped before).
1885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            If set to \ref PH_FRINFC_NDEFMAP_SEEK_BEGIN, the component shall start reading
1895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            from the begining of the card (restarted)
1905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_PENDING                       The action has been successfully triggered.
1925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_INVALID_DEVICE_REQUEST        If Previous Operation is Write Ndef and Offset
1935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                                                 is Current then this error is displayed.
1945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_EOF_NDEF_CONTAINER_REACHED         No Space in the File to read.
1955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_MORE_INFORMATION              There are more bytes to read in the card.
1965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_SUCCESS                       Last Byte of the card read.
1975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_INVALID_DEVICE                The device has not been opened or has been disconnected
1985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                                                 meanwhile.
1995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_CMD_ABORTED                   The caller/driver has aborted the request.
2005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_BUFFER_TOO_SMALL              The buffer provided by the caller is too small.
2015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_RF_TIMEOUT                    No data has been received within the TIMEOUT period.
2025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
2045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS phFriNfc_MifareUL_RdNdef( phFriNfc_NdefMap_t  *NdefMap,
2065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                    uint8_t             *PacketData,
2075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                    uint32_t            *PacketDataLength,
2085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                    uint8_t             Offset);
2095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
2115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief \copydoc page_ovr Initiates Writing of NDEF information to the Remote Device.
2125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * The function initiates the writing of NDEF information to a Remote Device.
2145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * It performs a reset of the state and starts the action (state machine).
2155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * A periodic call of the \ref phFriNfc_NdefMap_Process has to be done once the action
2165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * has been triggered.
2175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] NdefMap Pointer to a valid instance of the \ref phFriNfc_NdefMap_t structure describing
2195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                    the component context.
2205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] PacketData  Pointer to a location that holds the prepared NDEF Packet.
2225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in,out] PacketDataLength Variable specifying the length of the prepared NDEF packet.
2245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] Offset Indicates whether the write operation shall start from the begining of the
2265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            file/card storage \b or continue from the last offset. The last Offset set is stored
2275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            within a context variable (must not be modified by the integration).
2285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            If the caller sets the value to \ref PH_FRINFC_NDEFMAP_SEEK_CUR, the component shall
2295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            start writing from the last offset set (continue where it has stopped before).
2305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            If set to \ref PH_FRINFC_NDEFMAP_SEEK_BEGIN, the component shall start writing
2315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            from the begining of the card (restarted)
2325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_PENDING                        The action has been successfully triggered.
2345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_INVALID_DEVICE_REQUEST         If Previous Operation is Write Ndef and Offset
2355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                                                  is Current then this error is displayed.
2365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_EOF_NDEF_CONTAINER_REACHED               Last byte is written to the card after this
2375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                                                  no further writing is possible.
2385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_SUCCESS                        Buffer provided by the user is completely written
2395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                                                  into the card.
2405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_INVALID_DEVICE                 The device has not been opened or has been disconnected
2415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                                                  meanwhile.
2425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_CMD_ABORTED                    The caller/driver has aborted the request.
2435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_BUFFER_TOO_SMALL               The buffer provided by the caller is too small.
2445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_RF_TIMEOUT                     No data has been received within the TIMEOUT period.
2455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
2475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS phFriNfc_MifareUL_WrNdef( phFriNfc_NdefMap_t  *NdefMap,
2495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                    uint8_t             *PacketData,
2505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                    uint32_t            *PacketDataLength,
2515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                    uint8_t             Offset);
2525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
2545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief \copydoc page_ovr Check whether a particulat Remote Device is NDEF compliant.
2555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * The function checks whether the peer device is NDEF compliant.
2575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] NdefMap Pointer to a valid instance of the \ref phFriNfc_NdefMap_t structure describing
2595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                    the component context.
2605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_PENDING               The action has been successfully triggered.
2625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_INVALID_PARAMETER     At least one parameter of the function is invalid.
2635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_INVALID_DEVICE         The device has not been opened or has been disconnected
2645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                                          meanwhile.
2655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_CMD_ABORTED            The caller/driver has aborted the request.
2665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_BUFFER_TOO_SMALL       The buffer provided by the caller is too small.
2675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_RF_TIMEOUT             No data has been received within the TIMEOUT period.
2685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
2705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS phFriNfc_MifareUL_ChkNdef(    phFriNfc_NdefMap_t  *NdefMap);
2725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
2745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief \copydoc page_cb Completion Routine, Processing function, needed to avoid long blocking.
2755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * The function call scheme is according to \ref grp_interact. No State reset is performed during operation.
2775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \copydoc pphFriNfc_Cr_t
2795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \note The lower (Overlapped HAL) layer must register a pointer to this function as a Completion
2815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *       Routine in order to be able to notify the component that an I/O has finished and data are
2825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *       ready to be processed.
2835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
2855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellyvoid phFriNfc_MifareUL_Process( void        *Context,
2875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                NFCSTATUS   Status);
2885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif /* PHFRINFC_MIFAREULMAP_H */
291