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_TopazMap.h
195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief NFC Ndef Mapping For Mifare UL Card.
205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * Project: NFC-FRI
225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
23c0bdf30e40dd60628bfafd5f93a3a911e3b91da9Martijn Coenen * $Date: Mon Dec 13 14:14:14 2010 $
245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * $Author: ing02260 $
25c0bdf30e40dd60628bfafd5f93a3a911e3b91da9Martijn Coenen * $Revision: 1.26 $
2680ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen * $Aliases:  $
275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifndef PHFRINFC_TOPAZMAP_H
315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PHFRINFC_TOPAZMAP_H
325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phFriNfc.h>
3480ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen#ifdef PH_HAL4_ENABLE
355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phHal4Nfc.h>
3680ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen#else
3780ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen#include <phHalNfc.h>
385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif
395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phNfcStatus.h>
405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phNfcTypes.h>
415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phFriNfc_NdefMap.h>
425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
44c0bdf30e40dd60628bfafd5f93a3a911e3b91da9Martijn Coenen#define PH_FRINFC_NDEFMAP_TOPAZMAP_FILEREVISION "$Revision: 1.26 $"
4580ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen#define PH_FRINFC_NDEFMAP_TOPAZMAP_FILEALIASES  "$Aliases:  $"
465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#if !defined (ES_HW_VER)
485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    #define ES_HW_VER                                       (32U)
505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif /* #if !defined (ES_HW_VER) */
525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#if (ES_HW_VER >= 32)
545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /* This macro is used for the new 3.2 chip,as the JEWEL_READ and
565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        JEWEL_WRITE for this chip is removed from the firmware. And for the
575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        new FW, only JEWEL_RAW shall be used */
585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    #define TOPAZ_RAW_SUPPORT
595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif /* #if (ES_HW_VER == 32) */
615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
6280ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen#define TOPAZ_UID_LENGTH_FOR_READ_WRITE                     0x04U
6380ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen
645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \name Topaz - states of the Finite State machine
665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@{*/
695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_STATE_READ                        1   /*!< Read State */
705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_STATE_WRITE                       2   /*!< Write is going on*/
715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_STATE_CHK_NDEF                    3   /*!< Check Ndef is going on */
725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_STATE_READID                      4   /*!< Read Id under progress */
735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_STATE_READALL                     5   /*!< Read all under progress */
745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_STATE_WRITE_NMN                   6   /*!< Write ndef magic number */
755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_STATE_WRITE_L_TLV                 7   /*!< Write length field of TLV */
765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_STATE_WR_CC_OR_TLV                8   /*!< Write CC or NDEF TLV */
7780ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen
7880ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen#ifdef FRINFC_READONLY_NDEF
7980ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen
80c0bdf30e40dd60628bfafd5f93a3a911e3b91da9Martijn Coenen    #define PH_FRINFC_TOPAZ_STATE_WR_CC_BYTE               9   /*!< READ ONLY state */
81c0bdf30e40dd60628bfafd5f93a3a911e3b91da9Martijn Coenen    #define PH_FRINFC_TOPAZ_STATE_RD_LOCK0_BYTE           10  /*!< read Lock byte 0 state */
82c0bdf30e40dd60628bfafd5f93a3a911e3b91da9Martijn Coenen    #define PH_FRINFC_TOPAZ_STATE_WR_LOCK0_BYTE           11  /*!< write Lock byte 0 state */
83c0bdf30e40dd60628bfafd5f93a3a911e3b91da9Martijn Coenen    #define PH_FRINFC_TOPAZ_STATE_RD_LOCK1_BYTE           12  /*!< read Lock byte 1 state */
84c0bdf30e40dd60628bfafd5f93a3a911e3b91da9Martijn Coenen    #define PH_FRINFC_TOPAZ_STATE_WR_LOCK1_BYTE           13  /*!< write Lock byte 1 state */
8580ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen
8680ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen#endif /* #ifdef FRINFC_READONLY_NDEF */
875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@}*/
885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \name Topaz - constants for the capability container
915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@{*/
945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_CC_BYTE0                 0xE1 /*!< Capability container byte 0 = 0xE1 (NMN) */
955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_CC_BYTE1                 0x10 /*!< Capability container byte 1 = 0x10 (version number) */
965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_CC_BYTE2_MAX             0x0E /*!< Capability container byte 2 = 0x0E (Total free space
975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                                            in the card) */
985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_CC_BYTE3_RW              0x00 /*!< Capability container byte 3 = 0x00 for
995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                                                  READ WRITE/INITIALISED card state */
1005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_CC_BYTE3_RO              0x0F /*!< Capability container byte 3 = 0x0F for
1015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                                                  READ only card state */
1025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@}*/
1045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
1065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \name Topaz - constants for Flags
1075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
1095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@{*/
1105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_FLAG0                    0 /*!< Flag value = 0 */
1115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_FLAG1                    1 /*!< Flag value = 1 */
1125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@}*/
1135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
1155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \name Topaz - constants for left shift
1165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
1185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@{*/
1195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_SHIFT3                   3 /*!< Shift by 3 bits */
1205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@}*/
1215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
1235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \name Topaz - internal state for write
1245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
1265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@{*/
1275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellyenum
1285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{
1295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PH_FRINFC_TOPAZ_WR_CC_BYTE0,                  /*!< CC Byte 0 = 0xE1 ndef magic number */
1305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PH_FRINFC_TOPAZ_WR_CC_BYTE1,                  /*!< CC Byte 1 = 0x10 version number */
1315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PH_FRINFC_TOPAZ_WR_CC_BYTE2,                  /*!< CC Byte 2 = 0x0C space in the data area */
1325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PH_FRINFC_TOPAZ_WR_CC_BYTE3,                  /*!< CC Byte 3 = 0x00 read write access */
1335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PH_FRINFC_TOPAZ_WR_T_OF_TLV,                  /*!< CC Byte 3 = 0x00 read write access */
1345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PH_FRINFC_TOPAZ_WR_NMN_0,                     /*!< NMN = 0x00 */
1355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PH_FRINFC_TOPAZ_WR_NMN_E1,                    /*!< NMN = 0xE1 */
1365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PH_FRINFC_TOPAZ_WR_L_TLV_0,                   /*!< L field of TLV = 0 */
1375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PH_FRINFC_TOPAZ_WR_L_TLV,                     /*!< To update the L field */
1385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PH_FRINFC_TOPAZ_DYNAMIC_INIT_CHK_NDEF,    /*!< Internal state to represent the  parsing of card to locate Ndef TLV*/
1395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PH_FRINFC_TOPAZ_DYNAMIC_INIT_FIND_NDEF_TLV
1405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly};
1435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@}*/
1445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
1465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \name Topaz - TLV related constants
1475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
1495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@{*/
1505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_NULL_T                   0x00 /*!< Null TLV value = 0x00 */
1515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_LOCK_CTRL_T              0x01 /*!< Lock TLV = 0x01 */
1525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_MEM_CTRL_T               0x02 /*!< Memory TLV = 0x02 */
1535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_NDEF_T                   0x03 /*!< NDEF TLV = 0x03 */
1545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_PROP_T                   0xFD /*!< NDEF TLV = 0xFD */
1555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_TERM_T                   0xFE /*!< Terminator TLV value = 0xFE */
1565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_NDEFTLV_L                0x00 /*!< Length value of TLV = 0x00 */
1585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_NDEFTLV_LFF              0xFF /*!< Length value of TLV = 0xFF */
1595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_MAX_CARD_SZ              0x60 /*!< Send Length for Read Ndef */
1605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@}*/
1615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
1645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \name Topaz - Standard constants
1655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
1675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@{*/
1685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_WR_A_BYTE                0x02 /*!< Send Length for Write Ndef */
1695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_SEND_BUF_READ            0x01 /*!< Send Length for Read Ndef */
1705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_HEADROM0_CHK             0xFF /*!< To check the header rom byte 0 */
1715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_HEADROM0_VAL             0x11 /*!< Header rom byte 0 value of static card */
1725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_READALL_RESP             0x7A /*!< Response of the read all command 122 bytes */
1735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_TOTAL_RWBYTES            0x60 /*!< Total number of raw Bytes that can
1745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                                            be read or written to the card 96 bytes */
1755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_TOTAL_RWBYTES1           0x5A /*!< Total number of bytes that can be read
1765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                                            or written 90 bytes */
1775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_BYTE3_MSB                0xF0 /*!< most significant nibble of byte 3(RWA) shall be
1785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                                            0 */
1795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_LOCKBIT_BYTE114          0x01 /*!< lock bits value of byte 104 */
1805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_LOCKBIT_BYTE115_1        0x60 /*!< lock bits value of byte 105 */
1815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_LOCKBIT_BYTE115_2        0xE0 /*!< lock bits value of byte 105 */
1825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_LOCKBIT_BYTENO_0         114  /*!< lock bits byte number 104 */
1835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_LOCKBIT_BYTENO_1         115  /*!< lock bits byte number 105 */
1845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_CC_BYTENO_3              13   /*! Lock status according to CC bytes */
1855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_CC_READWRITE             0x00     /*! Lock status according to CC bytes */
1865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_CC_READONLY              0x0F     /*! Lock status according to CC bytes */
1875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/**Topaz static commands*/
1895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_CMD_READID               0x78U
1905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_CMD_READALL              0x00U
1915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_CMD_READ                 0x01U
1925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_CMD_WRITE_1E             0x53U
1935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_CMD_WRITE_1NE            0x1AU
1945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/**Topaz Dynamic commands*/
1965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_CMD_RSEG                 0x10U
1975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_CMD_READ8                0x02U
1985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_CMD_WRITE_E8             0x54U
1995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_CMD_WRITE_NE8            0x1BU
2005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellyenum
2025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{
2035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PH_FRINFC_TOPAZ_VAL0,
2045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PH_FRINFC_TOPAZ_VAL1,
2055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PH_FRINFC_TOPAZ_VAL2,
2065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PH_FRINFC_TOPAZ_VAL3,
2075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PH_FRINFC_TOPAZ_VAL4,
2085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PH_FRINFC_TOPAZ_VAL5,
2095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PH_FRINFC_TOPAZ_VAL6,
2105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PH_FRINFC_TOPAZ_VAL7,
2115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PH_FRINFC_TOPAZ_VAL8,
2125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PH_FRINFC_TOPAZ_VAL9,
2135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PH_FRINFC_TOPAZ_VAL10,
2145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PH_FRINFC_TOPAZ_VAL11,
2155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PH_FRINFC_TOPAZ_VAL12,
2165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PH_FRINFC_TOPAZ_VAL13,
2175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PH_FRINFC_TOPAZ_VAL14,
2185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PH_FRINFC_TOPAZ_VAL15,
2195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PH_FRINFC_TOPAZ_VAL16,
2205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PH_FRINFC_TOPAZ_VAL17,
2215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PH_FRINFC_TOPAZ_VAL18
2225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly};
2235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@}*/
2265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
2285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief \copydoc page_reg Resets the component instance to the initial state and lets the component forget about
2295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *        the list of registered items. Moreover, the lower device is set.
2305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] NdefMap Pointer to a valid or uninitialised instance of \ref phFriNfc_NdefMap_t .
2325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \note  This function has to be called at the beginning, after creating an instance of
2345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *        \ref phFriNfc_NdefMap_t . Use this function to reset the instance and/or switch
2355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *        to a different underlying device (different NFC device or device mode, or different
2365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *        Remote Device).
2375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
2385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellyvoid phFriNfc_TopazMap_H_Reset(  phFriNfc_NdefMap_t        *NdefMap);
2395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
24080ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen#ifdef FRINFC_READONLY_NDEF
24180ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen
24280ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen/*!
24380ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen * \ingroup grp_fri_smart_card_formatting
24480ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen *
24580ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen * \brief Initiates the conversion of the already NDEF formatted tag to READ ONLY.
24680ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen *
24780ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen * \copydoc page_ovr  The function initiates the conversion of the already NDEF formatted
24880ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen * tag to READ ONLY.After this formation, remote card would be properly Ndef Compliant and READ ONLY.
24980ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen * Depending upon the different card type, this function handles formatting procedure.
25080ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen * This function supports only for the TOPAZ tags.
25180ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen *
25280ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen * \param[in] NdefMap Pointer to a valid instance of the \ref phFriNfc_NdefMap_t structure describing
25380ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen *                    the component context.
25480ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen * \retval  NFCSTATUS_PENDING   The action has been successfully triggered.
25580ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen * \retval  Other values        An error has occurred.
25680ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen *
25780ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen */
25880ee29b88ec489e2bbf6ae446692229d36755429Martijn CoenenNFCSTATUS
25980ee29b88ec489e2bbf6ae446692229d36755429Martijn CoenenphFriNfc_TopazMap_ConvertToReadOnly (
26080ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen    phFriNfc_NdefMap_t          *NdefMap);
26180ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen
26280ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen#endif /* #ifdef FRINFC_READONLY_NDEF */
26380ee29b88ec489e2bbf6ae446692229d36755429Martijn Coenen
2645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
2655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief \copydoc page_ovr Initiates Reading of NDEF information from the Remote Device.
2665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * The function initiates the reading of NDEF information from a Remote Device.
2685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * It performs a reset of the state and starts the action (state machine).
2695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * A periodic call of the \ref phFriNfc_NdefMap_Process has to be done once the action
2705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * has been triggered.
2715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] NdefMap Pointer to a valid instance of the \ref phFriNfc_NdefMap_t structure describing
2735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                    the component context.
2745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] PacketData  Pointer to a location that receives the NDEF Packet.
2765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in,out] PacketDataLength Pointer to a variable receiving the length of the NDEF packet.
2785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] Offset Indicates whether the read operation shall start from the begining of the
2805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            file/card storage \b or continue from the last offset. The last Offset set is stored
2815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            within a context variable (must not be modified by the integration).
2825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            If the caller sets the value to \ref PH_FRINFC_NDEFMAP_SEEK_CUR, the component shall
2835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            start reading from the last offset set (continue where it has stopped before).
2845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            If set to \ref PH_FRINFC_NDEFMAP_SEEK_BEGIN, the component shall start reading
2855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            from the begining of the card (restarted)
2865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_PENDING                       The action has been successfully triggered.
2885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_INVALID_DEVICE_REQUEST        If Previous Operation is Write Ndef and Offset
2895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                                                 is Current then this error is displayed.
2905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_EOF_NDEF_CONTAINER_REACHED         No Space in the File to read.
2915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_MORE_INFORMATION              There are more bytes to read in the card.
2925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_SUCCESS                       Last Byte of the card read.
2935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_INVALID_DEVICE                The device has not been opened or has been disconnected
2945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                                                 meanwhile.
2955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_CMD_ABORTED                   The caller/driver has aborted the request.
2965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_BUFFER_TOO_SMALL              The buffer provided by the caller is too small.
2975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_RF_TIMEOUT                    No data has been received within the TIMEOUT period.
2985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
3005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS phFriNfc_TopazMap_RdNdef( phFriNfc_NdefMap_t  *NdefMap,
3025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                    uint8_t             *PacketData,
3035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                    uint32_t            *PacketDataLength,
3045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                    uint8_t             Offset);
3055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
3095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief \copydoc page_ovr Initiates Writing of NDEF information to the Remote Device.
3105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * The function initiates the writing of NDEF information to a Remote Device.
3125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * It performs a reset of the state and starts the action (state machine).
3135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * A periodic call of the \ref phFriNfc_NdefMap_Process has to be done once the action
3145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * has been triggered.
3155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] NdefMap Pointer to a valid instance of the \ref phFriNfc_NdefMap_t structure describing
3175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                    the component context.
3185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] PacketData  Pointer to a location that holds the prepared NDEF Packet.
3205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in,out] PacketDataLength Variable specifying the length of the prepared NDEF packet.
3225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] Offset Indicates whether the write operation shall start from the begining of the
3245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            file/card storage \b or continue from the last offset. The last Offset set is stored
3255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            within a context variable (must not be modified by the integration).
3265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            If the caller sets the value to \ref PH_FRINFC_NDEFMAP_SEEK_CUR, the component shall
3275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            start writing from the last offset set (continue where it has stopped before).
3285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            If set to \ref PH_FRINFC_NDEFMAP_SEEK_BEGIN, the component shall start writing
3295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            from the begining of the card (restarted)
3305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_PENDING                        The action has been successfully triggered.
3325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_INVALID_DEVICE_REQUEST         If Previous Operation is Write Ndef and Offset
3335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                                                  is Current then this error is displayed.
3345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_EOF_NDEF_CONTAINER_REACHED               Last byte is written to the card after this
3355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                                                  no further writing is possible.
3365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_SUCCESS                        Buffer provided by the user is completely written
3375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                                                  into the card.
3385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_INVALID_DEVICE                 The device has not been opened or has been disconnected
3395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                                                  meanwhile.
3405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_CMD_ABORTED                    The caller/driver has aborted the request.
3415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_BUFFER_TOO_SMALL               The buffer provided by the caller is too small.
3425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_RF_TIMEOUT                     No data has been received within the TIMEOUT period.
3435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
3455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS phFriNfc_TopazMap_WrNdef( phFriNfc_NdefMap_t  *NdefMap,
3475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                    uint8_t             *PacketData,
3485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                    uint32_t            *PacketDataLength,
3495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                    uint8_t             Offset);
3505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
3525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief \copydoc page_ovr Check whether a particulat Remote Device is NDEF compliant.
3535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * The function checks whether the peer device is NDEF compliant.
3555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] NdefMap Pointer to a valid instance of the \ref phFriNfc_NdefMap_t structure describing
3575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                    the component context.
3585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_PENDING               The action has been successfully triggered.
3605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_INVALID_PARAMETER     At least one parameter of the function is invalid.
3615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_INVALID_DEVICE         The device has not been opened or has been disconnected
3625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                                          meanwhile.
3635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_CMD_ABORTED            The caller/driver has aborted the request.
3645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_BUFFER_TOO_SMALL       The buffer provided by the caller is too small.
3655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_RF_TIMEOUT             No data has been received within the TIMEOUT period.
3665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
3685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS phFriNfc_TopazMap_ChkNdef(    phFriNfc_NdefMap_t  *NdefMap);
3705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellyextern NFCSTATUS phFriNfc_Tpz_H_ChkSpcVer( phFriNfc_NdefMap_t  *NdefMap,
3725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                          uint8_t             VersionNo);
3735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
3765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief \copydoc page_cb Completion Routine, Processing function, needed to avoid long blocking.
3775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * The function call scheme is according to \ref grp_interact. No State reset is performed during operation.
3795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \copydoc pphFriNfc_Cr_t
3815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \note The lower (Overlapped HAL) layer must register a pointer to this function as a Completion
3835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *       Routine in order to be able to notify the component that an I/O has finished and data are
3845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *       ready to be processed.
3855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
3875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellyvoid phFriNfc_TopazMap_Process( void        *Context,
3895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                NFCSTATUS   Status);
3905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
3935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \name TopazDynamicMap - Following section describes constans, functions, variables used in
3945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *       Topaz Dyanmic card mapping. Ex : Topaz-512
3955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
3975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@{*/
3985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
3995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief \copydoc Dynamic Card supported definitions.
4005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \note State Mechine Delcations.
4015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
4025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
4035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_STATE_WRITE_COMPLETE            11  /*!< Write Operation Complete */
4045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_STATE_NXP_READ                  12
4055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_STATE_RD_CCBLK                  13
4065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_STATE_INIT_RD_CCBLK             14
4075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_STATE_INIT_WR                   15
4085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_STATE_WRITE_LEN                 16
4095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_STATE_FIND_NDEF_TLV             17
4105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMI_FOUND_RESERV_AREA                18
4115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_NOT_FOUND_RESERV_AREA           19
4125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_PROCESS_CHK_NDEF                20
4135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_FIND_NDEF_TLV                   21
4145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_INIT_RD_NDEF                    22
4155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_STATE_WR_MEM_TLV                23
4165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_STATE_WR_LOCK_TLV               24
4175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
4185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
4195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief \copydoc Dynamic Card : Capability Container bytes.
4205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \note State Mechine Delcations.
4215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
4225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
4235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_CC_BYTE2_MMSIZE                 0x3F  /*!< Capability container byte 2 = 0x3F (Total free space
4245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                                                        in the card) */
4255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_HEADROM0_VAL                    0x12  /*!< Header rom byte 0 value of dynamic card */
4265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
4275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_TOTAL_RWBYTES                   0x1CC /*!< Total number of raw Bytes that can
4285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                                                        be read or written to the card 460 bytes
4295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly																		460 = 512 - 6 bloks * 8(48)( this includes 2 bytes of null byte in 02 block)
4305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly																		- 4 bytes ( NDEF TLV )*/
4315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_MAX_CARD_SZ                     0x1E0 /*!< Card size */
4325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_MX_ONEBYTE_TLV_SIZE             0xFF  /*!< MAX size supported in one byte length TLV*/
4335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_MAX_DATA_SIZE_TO_WRITE          0xE6  /*!< MAX size supported by HAL if the data size > 255*/
4345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
4355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_LOCKBYTE_0                      0x00 /*!< lock bits value of byte 104 */
4365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_LOCKBYTE_1                      0x00 /*!< lock bits value of byte 105 */
4375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_LOCKBYTE_2TO7                   0x00 /*!< lock bits value of byte 105 */
4385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
4395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_LOCKBIT_BYTENO_0                112  /*!< lock bits byte number 104:Blk0-7 */
4405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_LOCKBIT_BYTENO_1                113  /*!< lock bits byte number 105:Blk08-F */
4415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_LOCKBIT_BYTENO_2                122  /*!< lock bits byte number 124:Blk10-17 */
4425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_LOCKBIT_BYTENO_3                123  /*!< lock bits byte number 125:Blk18-1F */
4435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_LOCKBIT_BYTENO_4                124  /*!< lock bits byte number 126:Blk20-27*/
4445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_LOCKBIT_BYTENO_5                125  /*!< lock bits byte number 127:Blk28-2F*/
4455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_LOCKBIT_BYTENO_6                126  /*!< lock bits byte number 128:Blk30-37*/
4465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_LOCKBIT_BYTENO_7                127  /*!< lock bits byte number 128:Blk30-37*/
4475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_CC_BYTENO_3                     11   /*! Lock status according to CC bytes */
4485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
4495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_SEGMENT0                        0x00  /*!< 00000000 : 0th segment */
4505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_READSEG_RESP                    0x80
4515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
4525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_MAX_BYTES_TO_READ_IN_ONEB_LTLV_FSEG             78
4535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_MAX_BYTES_TO_READ_IN_THREEB_LTLV_FSEG           76
4545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
4555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_MAX_DATA_SIZE                                   PHHAL_MAX_DATASIZE
4565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_FSEG_BYTE_COUNT                                 104
4575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_SEG_BYTE_COUNT									128
4585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_CC_BLK_SIZE                                     18
4595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_CC_BLK_ADDRESS                                  8
4605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_UID_BLK_ADDRESS                                 0
4615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_LOCK_BYTE_SIZE                                  24
4625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_FSEG_TOT_DATA_BYTES                             120
4635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
4645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_DATA_BYTE_COUNT_OF_FSEG_IN_ONEB_LTLV_FSEG       26
4655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_TOPAZ_DYNAMIC_DATA_BYTE_COUNT_OF_FSEG_IN_THREEB_LTLV_FSEG     28
4665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
4675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
4685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellyenum
4695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{
4705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
4715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    NULL_TLV,
4725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    LOCK_TLV,
4735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    MEM_TLV,
4745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    NDEF_TLV,
4755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PROP_TLV,
4765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    TERM_TLV,
4775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    INVALID_TLV,
4785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    VALID_TLV,
4795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    TLV_NOT_FOUND
4805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
4815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly};
4825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
4835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
4845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief \copydoc page_ovr Initiates Reading of NDEF information from the Remote Device.
4855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
4865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * The function initiates the reading of NDEF information from a Remote Device.
4875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * It performs a reset of the state and starts the action (state machine).
4885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * A periodic call of the \ref phFriNfc_NdefMap_Process has to be done once the action
4895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * has been triggered.
4905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
4915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] NdefMap Pointer to a valid instance of the \ref phFriNfc_NdefMap_t structure describing
4925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                    the component context.
4935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
4945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] PacketData  Pointer to a location that receives the NDEF Packet.
4955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
4965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in,out] PacketDataLength Pointer to a variable receiving the length of the NDEF packet.
4975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
4985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] Offset Indicates whether the read operation shall start from the begining of the
4995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            file/card storage \b or continue from the last offset. The last Offset set is stored
5005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            within a context variable (must not be modified by the integration).
5015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            If the caller sets the value to \ref PH_FRINFC_NDEFMAP_SEEK_CUR, the component shall
5025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            start reading from the last offset set (continue where it has stopped before).
5035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            If set to \ref PH_FRINFC_NDEFMAP_SEEK_BEGIN, the component shall start reading
5045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            from the begining of the card (restarted)
5055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
5065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_PENDING                       The action has been successfully triggered.
5075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_INVALID_DEVICE_REQUEST        If Previous Operation is Write Ndef and Offset
5085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                                                 is Current then this error is displayed.
5095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_EOF_NDEF_CONTAINER_REACHED         No Space in the File to read.
5105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_MORE_INFORMATION              There are more bytes to read in the card.
5115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_SUCCESS                       Last Byte of the card read.
5125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_INVALID_DEVICE                The device has not been opened or has been disconnected
5135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                                                 meanwhile.
5145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_CMD_ABORTED                   The caller/driver has aborted the request.
5155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_BUFFER_TOO_SMALL              The buffer provided by the caller is too small.
5165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_RF_TIMEOUT                    No data has been received within the TIMEOUT period.
5175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
5185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
5195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
5205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS phFriNfc_TopazDynamicMap_RdNdef( phFriNfc_NdefMap_t  *NdefMap,
5215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                    uint8_t             *PacketData,
5225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                    uint32_t            *PacketDataLength,
5235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                    uint8_t             Offset);
5245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
5255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
5265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief \copydoc page_ovr Initiates Writing of NDEF information to the Remote Device.
5275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
5285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * The function initiates the writing of NDEF information to a Remote Device.
5295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * It performs a reset of the state and starts the action (state machine).
5305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * A periodic call of the \ref phFriNfc_NdefMap_Process has to be done once the action
5315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * has been triggered.
5325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
5335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] NdefMap Pointer to a valid instance of the \ref phFriNfc_NdefMap_t structure describing
5345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                    the component context.
5355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
5365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] PacketData  Pointer to a location that holds the prepared NDEF Packet.
5375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
5385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in,out] PacketDataLength Variable specifying the length of the prepared NDEF packet.
5395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
5405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] Offset Indicates whether the write operation shall start from the begining of the
5415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            file/card storage \b or continue from the last offset. The last Offset set is stored
5425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            within a context variable (must not be modified by the integration).
5435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            If the caller sets the value to \ref PH_FRINFC_NDEFMAP_SEEK_CUR, the component shall
5445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            start writing from the last offset set (continue where it has stopped before).
5455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            If set to \ref PH_FRINFC_NDEFMAP_SEEK_BEGIN, the component shall start writing
5465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *            from the begining of the card (restarted)
5475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
5485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_PENDING                        The action has been successfully triggered.
5495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_INVALID_DEVICE_REQUEST         If Previous Operation is Write Ndef and Offset
5505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                                                  is Current then this error is displayed.
5515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_EOF_NDEF_CONTAINER_REACHED               Last byte is written to the card after this
5525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                                                  no further writing is possible.
5535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_SUCCESS                        Buffer provided by the user is completely written
5545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                                                  into the card.
5555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_INVALID_DEVICE                 The device has not been opened or has been disconnected
5565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                                                  meanwhile.
5575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_CMD_ABORTED                    The caller/driver has aborted the request.
5585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_BUFFER_TOO_SMALL               The buffer provided by the caller is too small.
5595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_RF_TIMEOUT                     No data has been received within the TIMEOUT period.
5605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
5615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
5625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS phFriNfc_TopazDynamicMap_WrNdef( phFriNfc_NdefMap_t  *NdefMap,
5635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                    uint8_t             *PacketData,
5645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                    uint32_t            *PacketDataLength,
5655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                    uint8_t             Offset);
5665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
5675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
5685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief \copydoc page_ovr Check whether a particulat Remote Device is NDEF compliant.
5695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
5705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * The function checks whether the peer device is NDEF compliant.
5715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
5725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in] NdefMap Pointer to a valid instance of the \ref phFriNfc_NdefMap_t structure describing
5735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                    the component context.
5745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
5755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_PENDING               The action has been successfully triggered.
5765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_INVALID_PARAMETER     At least one parameter of the function is invalid.
5775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_INVALID_DEVICE         The device has not been opened or has been disconnected
5785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                                          meanwhile.
5795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_CMD_ABORTED            The caller/driver has aborted the request.
5805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_BUFFER_TOO_SMALL       The buffer provided by the caller is too small.
5815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_RF_TIMEOUT             No data has been received within the TIMEOUT period.
5825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
5835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
5845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS phFriNfc_TopazDynamicMap_ChkNdef(    phFriNfc_NdefMap_t  *NdefMap);
5855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
5865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
5875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief \copydoc page_cb Completion Routine, Processing function, needed to avoid long blocking.
5885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
5895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * The function call scheme is according to \ref grp_interact. No State reset is performed during operation.
5905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
5915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \copydoc pphFriNfc_Cr_t
5925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
5935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \note The lower (Overlapped HAL) layer must register a pointer to this function as a Completion
5945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *       Routine in order to be able to notify the component that an I/O has finished and data are
5955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *       ready to be processed.
5965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
5975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
5985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellyvoid phFriNfc_TopazDynamicMap_Process( void        *Context,
5995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                NFCSTATUS   Status);
600a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen
601a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen#ifdef FRINFC_READONLY_NDEF
602a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen/*!
603a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen * \brief \copydoc page_ovr Initiates Writing of NDEF information to the Remote Device.
604a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen *
605a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen * The function initiates the writing of NDEF information to a Remote Device.
606a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen * It performs a reset of the state and starts the action (state machine).
607a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen * A periodic call of the \ref phFriNfc_NdefMap_Process has to be done once the action
608a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen * has been triggered.
609a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen *
610a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen * \param[in] psNdefMap Pointer to a valid instance of the \ref phFriNfc_NdefMap_t structure describing
611a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen *                    the component context.
612a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen *
613a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen *
614a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen * \retval NFCSTATUS_PENDING                        The action has been successfully triggered.
615a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen * \retval NFCSTATUS_INVALID_DEVICE_REQUEST         If Previous Operation is Write Ndef and Offset
616a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen *                                                  is Current then this error is displayed.
617a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen * \retval NFCSTATUS_EOF_NDEF_CONTAINER_REACHED               Last byte is written to the card after this
618a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen *                                                  no further writing is possible.
619a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen * \retval NFCSTATUS_SUCCESS                        Buffer provided by the user is completely written
620a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen *                                                  into the card.
621a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen * \retval NFCSTATUS_INVALID_DEVICE                 The device has not been opened or has been disconnected
622a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen *                                                  meanwhile.
623a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen * \retval NFCSTATUS_CMD_ABORTED                    The caller/driver has aborted the request.
624a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen * \retval NFCSTATUS_BUFFER_TOO_SMALL               The buffer provided by the caller is too small.
625a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen * \retval NFCSTATUS_RF_TIMEOUT                     No data has been received within the TIMEOUT period.
626a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen *
627a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen */
628a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn CoenenNFCSTATUS
629a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn CoenenphFriNfc_TopazDynamicMap_ConvertToReadOnly (
630a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen    phFriNfc_NdefMap_t     *psNdefMap);
631a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen#endif /* #ifdef FRINFC_READONLY_NDEF */
632a6243755a9b438bfbfe0be331ece55953f8cf9ebMartijn Coenen
6335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
6345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
6355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif /* PHFRINFC_TOPAZMAP_H */
6365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
637