• Home
  • Raw
  • Download

Lines Matching refs:NdefMap

97 static NFCSTATUS phFriNfc_Tpz_H_RdBytes(phFriNfc_NdefMap_t *NdefMap,
105 static NFCSTATUS phFriNfc_Tpz_H_ProReadID(phFriNfc_NdefMap_t *NdefMap);
111 static NFCSTATUS phFriNfc_Tpz_H_ProReadAll(phFriNfc_NdefMap_t *NdefMap);
117 static NFCSTATUS phFriNfc_Tpz_H_CallNxtOp(phFriNfc_NdefMap_t *NdefMap);
123 static NFCSTATUS phFriNfc_Tpz_H_ChkCCBytes(phFriNfc_NdefMap_t *NdefMap);
129 static NFCSTATUS phFriNfc_Tpz_H_findNDEFTLV(phFriNfc_NdefMap_t *NdefMap);
135 static NFCSTATUS phFriNfc_Tpz_H_WrAByte(phFriNfc_NdefMap_t *NdefMap,
145 static NFCSTATUS phFriNfc_Tpz_H_ProWrNMN(phFriNfc_NdefMap_t *NdefMap);
151 static NFCSTATUS phFriNfc_Tpz_H_ProWrTLV(phFriNfc_NdefMap_t *NdefMap);
157 static NFCSTATUS phFriNfc_Tpz_H_WrLByte(phFriNfc_NdefMap_t *NdefMap);
163 static NFCSTATUS phFriNfc_Tpz_H_CpDataToUsrBuf( phFriNfc_NdefMap_t *NdefMap);
169 static NFCSTATUS phFriNfc_Tpz_H_ProWrUsrData( phFriNfc_NdefMap_t *NdefMap);
175 static void phFriNfc_Tpz_H_BlkChk(phFriNfc_NdefMap_t *NdefMap);
181 static NFCSTATUS phFriNfc_Tpz_H_WrByte0ValE1(phFriNfc_NdefMap_t *NdefMap);
187 static void phFriNfc_Tpz_H_Complete(phFriNfc_NdefMap_t *NdefMap,
194 static NFCSTATUS phFriNfc_Tpz_H_ChkCCinChkNdef(phFriNfc_NdefMap_t *NdefMap);
200 static void phFriNfc_Tpz_H_ChkLockBits(phFriNfc_NdefMap_t *NdefMap);
206 static NFCSTATUS phFriNfc_Tpz_H_WrCCorTLV(phFriNfc_NdefMap_t *NdefMap);
226 static NFCSTATUS phFriNfc_Tpz_H_ProCCTLV(phFriNfc_NdefMap_t *NdefMap);
228 void phFriNfc_TopazMap_H_Reset(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_TopazMap_H_Reset() argument
231 NdefMap->TopazContainer.CRIndex = PH_FRINFC_NDEFMAP_CR_INVALID_OPE; in phFriNfc_TopazMap_H_Reset()
232 NdefMap->TopazContainer.CurrentBlock = PH_FRINFC_TOPAZ_VAL1; in phFriNfc_TopazMap_H_Reset()
233 NdefMap->TopazContainer.ByteNumber = PH_FRINFC_TOPAZ_VAL0; in phFriNfc_TopazMap_H_Reset()
234 NdefMap->TopazContainer.InternalState = PH_FRINFC_TOPAZ_VAL0; in phFriNfc_TopazMap_H_Reset()
235 (void)memset(NdefMap->TopazContainer.ReadBuffer, PH_FRINFC_TOPAZ_VAL0, in phFriNfc_TopazMap_H_Reset()
236 sizeof(NdefMap->TopazContainer.ReadBuffer)); in phFriNfc_TopazMap_H_Reset()
237 NdefMap->TopazContainer.ReadWriteCompleteFlag = PH_FRINFC_TOPAZ_FLAG0; in phFriNfc_TopazMap_H_Reset()
238 NdefMap->TopazContainer.RemainingSize = PH_FRINFC_TOPAZ_VAL0; in phFriNfc_TopazMap_H_Reset()
239 (void)memset(NdefMap->TopazContainer.UID, PH_FRINFC_TOPAZ_VAL0, in phFriNfc_TopazMap_H_Reset()
240 sizeof(NdefMap->TopazContainer.UID)); in phFriNfc_TopazMap_H_Reset()
241 NdefMap->TopazContainer.Cur_RW_Index=0; in phFriNfc_TopazMap_H_Reset()
242 NdefMap->TopazContainer.ByteRWFrmCard =0; in phFriNfc_TopazMap_H_Reset()
258 NFCSTATUS phFriNfc_TopazMap_ChkNdef( phFriNfc_NdefMap_t *NdefMap) in phFriNfc_TopazMap_ChkNdef() argument
262 if ( NdefMap != NULL) in phFriNfc_TopazMap_ChkNdef()
265 NdefMap->PrevOperation = PH_FRINFC_NDEFMAP_CHECK_OPE; in phFriNfc_TopazMap_ChkNdef()
268 NdefMap->TopazContainer.CRIndex = PH_FRINFC_NDEFMAP_CR_CHK_NDEF; in phFriNfc_TopazMap_ChkNdef()
269 NdefMap->TopazContainer.CurrentBlock = PH_FRINFC_TOPAZ_VAL1; in phFriNfc_TopazMap_ChkNdef()
270 NdefMap->TopazContainer.ByteNumber = PH_FRINFC_TOPAZ_VAL0; in phFriNfc_TopazMap_ChkNdef()
273 NdefMap->CardType = PH_FRINFC_NDEFMAP_TOPAZ_CARD; in phFriNfc_TopazMap_ChkNdef()
276 NdefMap->State = PH_FRINFC_TOPAZ_STATE_READID; in phFriNfc_TopazMap_ChkNdef()
277 NdefMap->PrevOperation = PH_FRINFC_NDEFMAP_CHECK_OPE; in phFriNfc_TopazMap_ChkNdef()
280 NdefMap->Cmd.JewelCmd = phHal_eJewel_Raw; in phFriNfc_TopazMap_ChkNdef()
281 NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL0] = PH_FRINFC_TOPAZ_CMD_READID; in phFriNfc_TopazMap_ChkNdef()
284 NdefMap->Cmd.JewelCmd = phHal_eJewel_RID; in phFriNfc_TopazMap_ChkNdef()
286 NdefMap->Cmd.JewelCmd = phHal_eJewelCmdListJewelRid; in phFriNfc_TopazMap_ChkNdef()
290 Result = phFriNfc_Tpz_H_RdBytes(NdefMap, NdefMap->TopazContainer.CurrentBlock, in phFriNfc_TopazMap_ChkNdef()
291 NdefMap->TopazContainer.ByteNumber); in phFriNfc_TopazMap_ChkNdef()
300 phFriNfc_NdefMap_t *NdefMap) in phFriNfc_TopazMap_ConvertToReadOnly() argument
304 result = phFriNfc_Tpz_H_WrAByte (NdefMap, CC_BLOCK_NUMBER, in phFriNfc_TopazMap_ConvertToReadOnly()
309 NdefMap->State = PH_FRINFC_TOPAZ_STATE_WR_CC_BYTE; in phFriNfc_TopazMap_ConvertToReadOnly()
324 NFCSTATUS phFriNfc_TopazMap_RdNdef( phFriNfc_NdefMap_t *NdefMap, in phFriNfc_TopazMap_RdNdef() argument
332 NdefMap->ApduBuffer = PacketData; in phFriNfc_TopazMap_RdNdef()
334 NdefMap->ApduBufferSize = *PacketDataLength; in phFriNfc_TopazMap_RdNdef()
336 NdefMap->NumOfBytesRead = PacketDataLength; in phFriNfc_TopazMap_RdNdef()
340 *NdefMap->NumOfBytesRead = PH_FRINFC_TOPAZ_VAL0; in phFriNfc_TopazMap_RdNdef()
342 NdefMap->ApduBuffIndex = PH_FRINFC_TOPAZ_VAL0; in phFriNfc_TopazMap_RdNdef()
344 NdefMap->Offset = Offset; in phFriNfc_TopazMap_RdNdef()
347 NdefMap->TopazContainer.CRIndex = PH_FRINFC_NDEFMAP_CR_RD_NDEF; in phFriNfc_TopazMap_RdNdef()
349 if( (Offset == PH_FRINFC_NDEFMAP_SEEK_BEGIN) || ( NdefMap->PrevOperation == in phFriNfc_TopazMap_RdNdef()
354 NdefMap->Offset = PH_FRINFC_NDEFMAP_SEEK_BEGIN; in phFriNfc_TopazMap_RdNdef()
356 NdefMap->TopazContainer.CurrentBlock = PH_FRINFC_TOPAZ_VAL1; in phFriNfc_TopazMap_RdNdef()
357 NdefMap->TopazContainer.ByteNumber = PH_FRINFC_TOPAZ_VAL0; in phFriNfc_TopazMap_RdNdef()
359 NdefMap->State = PH_FRINFC_TOPAZ_STATE_READALL; in phFriNfc_TopazMap_RdNdef()
360 NdefMap->TopazContainer.ReadWriteCompleteFlag = in phFriNfc_TopazMap_RdNdef()
364 NdefMap->Cmd.JewelCmd = phHal_eJewel_Raw; in phFriNfc_TopazMap_RdNdef()
365 NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL0] = PH_FRINFC_TOPAZ_CMD_READALL; in phFriNfc_TopazMap_RdNdef()
369 NdefMap->Cmd.JewelCmd = phHal_eJewel_ReadAll; in phFriNfc_TopazMap_RdNdef()
371 NdefMap->Cmd.JewelCmd = phHal_eJewelCmdListJewelReadAll; in phFriNfc_TopazMap_RdNdef()
377 NdefMap->PrevOperation = PH_FRINFC_NDEFMAP_READ_OPE; in phFriNfc_TopazMap_RdNdef()
380 (NdefMap->TopazContainer.ReadWriteCompleteFlag == in phFriNfc_TopazMap_RdNdef()
391 phFriNfc_Tpz_H_RdBytes(NdefMap, in phFriNfc_TopazMap_RdNdef()
392 NdefMap->TopazContainer.CurrentBlock, in phFriNfc_TopazMap_RdNdef()
393 NdefMap->TopazContainer.ByteNumber): in phFriNfc_TopazMap_RdNdef()
394 phFriNfc_Tpz_H_CpDataToUsrBuf(NdefMap)); in phFriNfc_TopazMap_RdNdef()
408 NFCSTATUS phFriNfc_TopazMap_WrNdef( phFriNfc_NdefMap_t *NdefMap, in phFriNfc_TopazMap_WrNdef() argument
416 NdefMap->ApduBuffer = PacketData; in phFriNfc_TopazMap_WrNdef()
418 NdefMap->ApduBufferSize = *PacketDataLength; in phFriNfc_TopazMap_WrNdef()
420 NdefMap->ApduBuffIndex = PH_FRINFC_TOPAZ_VAL0; in phFriNfc_TopazMap_WrNdef()
422 NdefMap->WrNdefPacketLength = PacketDataLength; in phFriNfc_TopazMap_WrNdef()
426 *NdefMap->WrNdefPacketLength = PH_FRINFC_TOPAZ_VAL0; in phFriNfc_TopazMap_WrNdef()
429 NdefMap->TopazContainer.CRIndex = PH_FRINFC_NDEFMAP_CR_WR_NDEF; in phFriNfc_TopazMap_WrNdef()
431 NdefMap->Offset = Offset; in phFriNfc_TopazMap_WrNdef()
435 (NdefMap->PrevOperation == PH_FRINFC_NDEFMAP_READ_OPE)) in phFriNfc_TopazMap_WrNdef()
437 NdefMap->Offset = PH_FRINFC_NDEFMAP_SEEK_BEGIN; in phFriNfc_TopazMap_WrNdef()
439 NdefMap->TopazContainer.CurrentBlock = PH_FRINFC_TOPAZ_VAL1; in phFriNfc_TopazMap_WrNdef()
440 NdefMap->TopazContainer.ByteNumber = PH_FRINFC_TOPAZ_VAL0; in phFriNfc_TopazMap_WrNdef()
442 NdefMap->State = PH_FRINFC_TOPAZ_STATE_READALL; in phFriNfc_TopazMap_WrNdef()
446 NdefMap->Cmd.JewelCmd = phHal_eJewel_Raw; in phFriNfc_TopazMap_WrNdef()
447 NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL0] = PH_FRINFC_TOPAZ_CMD_READALL; in phFriNfc_TopazMap_WrNdef()
450 NdefMap->Cmd.JewelCmd = phHal_eJewel_ReadAll; in phFriNfc_TopazMap_WrNdef()
452 NdefMap->Cmd.JewelCmd = phHal_eJewelCmdListJewelReadAll; in phFriNfc_TopazMap_WrNdef()
455 NdefMap->TopazContainer.ReadWriteCompleteFlag = in phFriNfc_TopazMap_WrNdef()
457 NdefMap->TopazContainer.RemainingSize = NdefMap->CardMemSize; in phFriNfc_TopazMap_WrNdef()
458 TempByteVal = NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL1]; in phFriNfc_TopazMap_WrNdef()
463 NdefMap->State = PH_FRINFC_TOPAZ_STATE_WRITE; in phFriNfc_TopazMap_WrNdef()
465 TempByteVal = NdefMap->ApduBuffer[NdefMap->ApduBuffIndex]; in phFriNfc_TopazMap_WrNdef()
469 NdefMap->PrevOperation = PH_FRINFC_NDEFMAP_WRITE_OPE; in phFriNfc_TopazMap_WrNdef()
471 (NdefMap->TopazContainer.ReadWriteCompleteFlag == in phFriNfc_TopazMap_WrNdef()
481 phFriNfc_Tpz_H_BlkChk(NdefMap); in phFriNfc_TopazMap_WrNdef()
483 Result = ((NdefMap->Offset == PH_FRINFC_NDEFMAP_SEEK_BEGIN)? in phFriNfc_TopazMap_WrNdef()
484 phFriNfc_Tpz_H_RdBytes(NdefMap, NdefMap->TopazContainer.CurrentBlock, in phFriNfc_TopazMap_WrNdef()
485 NdefMap->TopazContainer.ByteNumber): in phFriNfc_TopazMap_WrNdef()
486 phFriNfc_Tpz_H_WrAByte(NdefMap, NdefMap->TopazContainer.CurrentBlock, in phFriNfc_TopazMap_WrNdef()
487 NdefMap->TopazContainer.ByteNumber,TempByteVal)); in phFriNfc_TopazMap_WrNdef()
891 static NFCSTATUS phFriNfc_Tpz_H_RdBytes(phFriNfc_NdefMap_t *NdefMap, in phFriNfc_Tpz_H_RdBytes() argument
901 NdefMap->psDepAdditionalInfo.DepFlags.MetaChaining = PH_FRINFC_TOPAZ_VAL0; in phFriNfc_Tpz_H_RdBytes()
902 NdefMap->psDepAdditionalInfo.DepFlags.NADPresent = PH_FRINFC_TOPAZ_VAL0; in phFriNfc_Tpz_H_RdBytes()
903 NdefMap->psDepAdditionalInfo.NAD = PH_FRINFC_TOPAZ_VAL0; in phFriNfc_Tpz_H_RdBytes()
905 NdefMap->MapCompletionInfo.CompletionRoutine = phFriNfc_TopazMap_Process; in phFriNfc_Tpz_H_RdBytes()
906 NdefMap->MapCompletionInfo.Context = NdefMap; in phFriNfc_Tpz_H_RdBytes()
908 *NdefMap->SendRecvLength = NdefMap->TempReceiveLength; in phFriNfc_Tpz_H_RdBytes()
912 switch(NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL0]) in phFriNfc_Tpz_H_RdBytes()
914 switch(NdefMap->Cmd.JewelCmd) in phFriNfc_Tpz_H_RdBytes()
929 NdefMap->Cmd.JewelCmd = phHal_eJewel_Raw; in phFriNfc_Tpz_H_RdBytes()
931 NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL0] = PH_FRINFC_TOPAZ_CMD_READID; in phFriNfc_Tpz_H_RdBytes()
935 (void)memset(&(NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL1]), in phFriNfc_Tpz_H_RdBytes()
940 NdefMap->SendLength = index; in phFriNfc_Tpz_H_RdBytes()
943 NdefMap->SendLength = PH_FRINFC_TOPAZ_VAL0; in phFriNfc_Tpz_H_RdBytes()
958 NdefMap->Cmd.JewelCmd = phHal_eJewel_Raw; in phFriNfc_Tpz_H_RdBytes()
960 NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL0] = PH_FRINFC_TOPAZ_CMD_READALL; in phFriNfc_Tpz_H_RdBytes()
964 NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL1] = 0x00; in phFriNfc_Tpz_H_RdBytes()
966 NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL2] = 0x00; in phFriNfc_Tpz_H_RdBytes()
970 (void)memcpy(&(NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL3]), in phFriNfc_Tpz_H_RdBytes()
971 &(NdefMap->psRemoteDevInfo->RemoteDevInfo.Jewel_Info.Uid), in phFriNfc_Tpz_H_RdBytes()
977 NdefMap->SendLength = index; in phFriNfc_Tpz_H_RdBytes()
980 NdefMap->SendLength = PH_FRINFC_TOPAZ_VAL0; in phFriNfc_Tpz_H_RdBytes()
996 NdefMap->Cmd.JewelCmd = phHal_eJewel_Raw; in phFriNfc_Tpz_H_RdBytes()
998 NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL0] = PH_FRINFC_TOPAZ_CMD_READ; in phFriNfc_Tpz_H_RdBytes()
1006 NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL1] = in phFriNfc_Tpz_H_RdBytes()
1011 NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL2] = 0x00; in phFriNfc_Tpz_H_RdBytes()
1015 (void)memcpy(&(NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL3]), in phFriNfc_Tpz_H_RdBytes()
1016 &(NdefMap->psRemoteDevInfo->RemoteDevInfo.Jewel_Info.Uid), in phFriNfc_Tpz_H_RdBytes()
1021 NdefMap->SendLength = index; in phFriNfc_Tpz_H_RdBytes()
1027 NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL0] = in phFriNfc_Tpz_H_RdBytes()
1030 NdefMap->SendLength = PH_FRINFC_TOPAZ_VAL1; in phFriNfc_Tpz_H_RdBytes()
1038 NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL0] = 0x00; in phFriNfc_Tpz_H_RdBytes()
1039 NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL1] = 0x00; in phFriNfc_Tpz_H_RdBytes()
1040 NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL2] = 104; in phFriNfc_Tpz_H_RdBytes()
1041 NdefMap->SendLength = 3; in phFriNfc_Tpz_H_RdBytes()
1054 Result = phFriNfc_OvrHal_Transceive( NdefMap->LowerDevice, in phFriNfc_Tpz_H_RdBytes()
1055 &NdefMap->MapCompletionInfo, in phFriNfc_Tpz_H_RdBytes()
1056 NdefMap->psRemoteDevInfo, in phFriNfc_Tpz_H_RdBytes()
1057 NdefMap->Cmd, in phFriNfc_Tpz_H_RdBytes()
1058 &NdefMap->psDepAdditionalInfo, in phFriNfc_Tpz_H_RdBytes()
1059 NdefMap->SendRecvBuf, in phFriNfc_Tpz_H_RdBytes()
1060 NdefMap->SendLength, in phFriNfc_Tpz_H_RdBytes()
1061 NdefMap->SendRecvBuf, in phFriNfc_Tpz_H_RdBytes()
1062 NdefMap->SendRecvLength); in phFriNfc_Tpz_H_RdBytes()
1067 static NFCSTATUS phFriNfc_Tpz_H_WrAByte(phFriNfc_NdefMap_t *NdefMap, in phFriNfc_Tpz_H_WrAByte() argument
1079 NdefMap->psDepAdditionalInfo.DepFlags.MetaChaining = PH_FRINFC_TOPAZ_VAL0; in phFriNfc_Tpz_H_WrAByte()
1080 NdefMap->psDepAdditionalInfo.DepFlags.NADPresent = PH_FRINFC_TOPAZ_VAL0; in phFriNfc_Tpz_H_WrAByte()
1081 NdefMap->psDepAdditionalInfo.NAD = PH_FRINFC_TOPAZ_VAL0; in phFriNfc_Tpz_H_WrAByte()
1083 NdefMap->MapCompletionInfo.CompletionRoutine = phFriNfc_TopazMap_Process; in phFriNfc_Tpz_H_WrAByte()
1084 NdefMap->MapCompletionInfo.Context = NdefMap; in phFriNfc_Tpz_H_WrAByte()
1086 *NdefMap->SendRecvLength = NdefMap->TempReceiveLength; in phFriNfc_Tpz_H_WrAByte()
1089 NdefMap->Cmd.JewelCmd = phHal_eJewel_Raw; in phFriNfc_Tpz_H_WrAByte()
1092 NdefMap->Cmd.JewelCmd = phHal_eJewel_Write1E; in phFriNfc_Tpz_H_WrAByte()
1094 NdefMap->Cmd.JewelCmd = phHal_eJewelCmdListJewelWriteErase1; in phFriNfc_Tpz_H_WrAByte()
1100 NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL0] = PH_FRINFC_TOPAZ_CMD_WRITE_1E; in phFriNfc_Tpz_H_WrAByte()
1108 NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL1] = in phFriNfc_Tpz_H_WrAByte()
1113 NdefMap->SendRecvBuf[index] = ByteVal; in phFriNfc_Tpz_H_WrAByte()
1117 (void)memcpy(&(NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL3]), in phFriNfc_Tpz_H_WrAByte()
1118 &(NdefMap->psRemoteDevInfo->RemoteDevInfo.Jewel_Info.Uid), in phFriNfc_Tpz_H_WrAByte()
1123 NdefMap->SendLength = index; in phFriNfc_Tpz_H_WrAByte()
1131 NdefMap->SendRecvBuf[index] = in phFriNfc_Tpz_H_WrAByte()
1135 NdefMap->SendRecvBuf[index] = ByteVal; in phFriNfc_Tpz_H_WrAByte()
1137 NdefMap->SendLength = PH_FRINFC_TOPAZ_VAL2; in phFriNfc_Tpz_H_WrAByte()
1142 Result = phFriNfc_OvrHal_Transceive( NdefMap->LowerDevice, in phFriNfc_Tpz_H_WrAByte()
1143 &NdefMap->MapCompletionInfo, in phFriNfc_Tpz_H_WrAByte()
1144 NdefMap->psRemoteDevInfo, in phFriNfc_Tpz_H_WrAByte()
1145 NdefMap->Cmd, in phFriNfc_Tpz_H_WrAByte()
1146 &NdefMap->psDepAdditionalInfo, in phFriNfc_Tpz_H_WrAByte()
1147 NdefMap->SendRecvBuf, in phFriNfc_Tpz_H_WrAByte()
1148 NdefMap->SendLength, in phFriNfc_Tpz_H_WrAByte()
1149 NdefMap->SendRecvBuf, in phFriNfc_Tpz_H_WrAByte()
1150 NdefMap->SendRecvLength); in phFriNfc_Tpz_H_WrAByte()
1155 static NFCSTATUS phFriNfc_Tpz_H_ProReadID(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_Tpz_H_ProReadID() argument
1160 if(((NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL0] & in phFriNfc_Tpz_H_ProReadID()
1162 (*NdefMap->SendRecvLength == PH_FRINFC_TOPAZ_VAL6)) in phFriNfc_Tpz_H_ProReadID()
1165 (void)memcpy(NdefMap->TopazContainer.UID, in phFriNfc_Tpz_H_ProReadID()
1166 &NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL2], in phFriNfc_Tpz_H_ProReadID()
1170 NdefMap->State = PH_FRINFC_TOPAZ_STATE_READALL; in phFriNfc_Tpz_H_ProReadID()
1173 NdefMap->Cmd.JewelCmd = phHal_eJewel_Raw; in phFriNfc_Tpz_H_ProReadID()
1174 NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL0] = PH_FRINFC_TOPAZ_CMD_READALL; in phFriNfc_Tpz_H_ProReadID()
1177 NdefMap->Cmd.JewelCmd = phHal_eJewel_ReadAll; in phFriNfc_Tpz_H_ProReadID()
1179 NdefMap->Cmd.JewelCmd = phHal_eJewelCmdListJewelReadAll; in phFriNfc_Tpz_H_ProReadID()
1184 Result = phFriNfc_Tpz_H_RdBytes(NdefMap, NdefMap->TopazContainer.CurrentBlock, in phFriNfc_Tpz_H_ProReadID()
1185 NdefMap->TopazContainer.ByteNumber); in phFriNfc_Tpz_H_ProReadID()
1191 static NFCSTATUS phFriNfc_Tpz_H_ProReadAll(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_Tpz_H_ProReadAll() argument
1199 if ((NdefMap->TopazContainer.UID[0] == NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL2]) && in phFriNfc_Tpz_H_ProReadAll()
1200 (NdefMap->TopazContainer.UID[1] == NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL2 + 1]) && in phFriNfc_Tpz_H_ProReadAll()
1201 (NdefMap->TopazContainer.UID[2] == NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL2 + 2]) && in phFriNfc_Tpz_H_ProReadAll()
1202 (NdefMap->TopazContainer.UID[3] == NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL2 + 3])) in phFriNfc_Tpz_H_ProReadAll()
1211 memcompare = memcmp(NdefMap->TopazContainer.UID, in phFriNfc_Tpz_H_ProReadAll()
1212 &NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL2], in phFriNfc_Tpz_H_ProReadAll()
1216 if(((NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL0] & in phFriNfc_Tpz_H_ProReadAll()
1218 (*NdefMap->SendRecvLength == PH_FRINFC_TOPAZ_READALL_RESP) && in phFriNfc_Tpz_H_ProReadAll()
1222 (void)memcpy(NdefMap->TopazContainer.ReadBuffer, in phFriNfc_Tpz_H_ProReadAll()
1223 &NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL10], in phFriNfc_Tpz_H_ProReadAll()
1227 phFriNfc_Tpz_H_ChkLockBits(NdefMap); in phFriNfc_Tpz_H_ProReadAll()
1229 Result = phFriNfc_Tpz_H_CallNxtOp(NdefMap); in phFriNfc_Tpz_H_ProReadAll()
1234 static NFCSTATUS phFriNfc_Tpz_H_CallNxtOp(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_Tpz_H_CallNxtOp() argument
1240 switch(NdefMap->PrevOperation) in phFriNfc_Tpz_H_CallNxtOp()
1245 Result = phFriNfc_Tpz_H_ChkCCinChkNdef(NdefMap); in phFriNfc_Tpz_H_CallNxtOp()
1247 if (NdefMap->CardState != PH_NDEFMAP_CARD_STATE_INVALID) in phFriNfc_Tpz_H_CallNxtOp()
1250 Result = phFriNfc_Tpz_H_ChkSpcVer( NdefMap, in phFriNfc_Tpz_H_CallNxtOp()
1251 NdefMap->TopazContainer.ReadBuffer[PH_FRINFC_TOPAZ_VAL1]); in phFriNfc_Tpz_H_CallNxtOp()
1255 ( NdefMap->TopazContainer.ReadBuffer[PH_FRINFC_TOPAZ_VAL2] <= in phFriNfc_Tpz_H_CallNxtOp()
1258 Result = phFriNfc_Tpz_H_findNDEFTLV(NdefMap); in phFriNfc_Tpz_H_CallNxtOp()
1267 NdefMap->CardState = PH_NDEFMAP_CARD_STATE_INITIALIZED; in phFriNfc_Tpz_H_CallNxtOp()
1268 NdefMap->CardMemSize = in phFriNfc_Tpz_H_CallNxtOp()
1269 NdefMap->TopazContainer.RemainingSize = (uint16_t) in phFriNfc_Tpz_H_CallNxtOp()
1283 Result = phFriNfc_Tpz_H_ChkCCBytes(NdefMap); in phFriNfc_Tpz_H_CallNxtOp()
1289 phFriNfc_Tpz_H_findNDEFTLV(NdefMap)); in phFriNfc_Tpz_H_CallNxtOp()
1293 NdefMap->TopazContainer.ByteNumber += PH_FRINFC_TOPAZ_VAL2; in phFriNfc_Tpz_H_CallNxtOp()
1295 Result = phFriNfc_Tpz_H_CpDataToUsrBuf(NdefMap); in phFriNfc_Tpz_H_CallNxtOp()
1301 if((NdefMap->CardState == PH_NDEFMAP_CARD_STATE_READ_WRITE) || in phFriNfc_Tpz_H_CallNxtOp()
1302 (NdefMap->CardState == PH_NDEFMAP_CARD_STATE_INITIALIZED)) in phFriNfc_Tpz_H_CallNxtOp()
1306 Result = phFriNfc_Tpz_H_ChkCCBytes(NdefMap); in phFriNfc_Tpz_H_CallNxtOp()
1310 Result = phFriNfc_Tpz_H_findNDEFTLV(NdefMap); in phFriNfc_Tpz_H_CallNxtOp()
1313 NdefMap->TopazContainer.InternalState = PH_FRINFC_TOPAZ_WR_T_OF_TLV; in phFriNfc_Tpz_H_CallNxtOp()
1317 NdefMap->TLVStruct.NdefTLVByte = PH_FRINFC_TOPAZ_VAL4; in phFriNfc_Tpz_H_CallNxtOp()
1318 NdefMap->TLVStruct.NdefTLVBlock = PH_FRINFC_TOPAZ_VAL1; in phFriNfc_Tpz_H_CallNxtOp()
1319 NdefMap->TopazContainer.ByteNumber = PH_FRINFC_TOPAZ_VAL4; in phFriNfc_Tpz_H_CallNxtOp()
1321 NdefMap->TopazContainer.InternalState = PH_FRINFC_TOPAZ_WR_CC_BYTE0; in phFriNfc_Tpz_H_CallNxtOp()
1324 Result = phFriNfc_Tpz_H_WrCCorTLV(NdefMap); in phFriNfc_Tpz_H_CallNxtOp()
1331 static NFCSTATUS phFriNfc_Tpz_H_ChkCCBytes(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_Tpz_H_ChkCCBytes() argument
1336 if(NdefMap->TopazContainer.ReadBuffer[PH_FRINFC_TOPAZ_VAL0] == in phFriNfc_Tpz_H_ChkCCBytes()
1340 Result = phFriNfc_Tpz_H_ChkSpcVer( NdefMap, in phFriNfc_Tpz_H_ChkCCBytes()
1341 NdefMap->TopazContainer.ReadBuffer[PH_FRINFC_TOPAZ_VAL1]); in phFriNfc_Tpz_H_ChkCCBytes()
1344 Result = ((( NdefMap->TopazContainer.ReadBuffer[PH_FRINFC_TOPAZ_VAL2] > in phFriNfc_Tpz_H_ChkCCBytes()
1352 NdefMap->TopazContainer.RemainingSize = in phFriNfc_Tpz_H_ChkCCBytes()
1353 NdefMap->CardMemSize = ((Result == NFCSTATUS_SUCCESS)? in phFriNfc_Tpz_H_ChkCCBytes()
1355 NdefMap->CardMemSize); in phFriNfc_Tpz_H_ChkCCBytes()
1358 if(((NdefMap->PrevOperation == PH_FRINFC_NDEFMAP_WRITE_OPE) && in phFriNfc_Tpz_H_ChkCCBytes()
1359 (NdefMap->TopazContainer.ReadBuffer[PH_FRINFC_TOPAZ_VAL3] != in phFriNfc_Tpz_H_ChkCCBytes()
1367 if(((NdefMap->PrevOperation == PH_FRINFC_NDEFMAP_READ_OPE) && in phFriNfc_Tpz_H_ChkCCBytes()
1368 ((NdefMap->TopazContainer.ReadBuffer[PH_FRINFC_TOPAZ_VAL3] != in phFriNfc_Tpz_H_ChkCCBytes()
1370 (NdefMap->TopazContainer.ReadBuffer[PH_FRINFC_TOPAZ_VAL3] != in phFriNfc_Tpz_H_ChkCCBytes()
1380 extern NFCSTATUS phFriNfc_Tpz_H_ChkSpcVer( phFriNfc_NdefMap_t *NdefMap, in phFriNfc_Tpz_H_ChkSpcVer() argument
1387 PHNFC_UNUSED_VARIABLE(NdefMap); in phFriNfc_Tpz_H_ChkSpcVer()
1422 static NFCSTATUS phFriNfc_Tpz_H_findNDEFTLV(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_Tpz_H_findNDEFTLV() argument
1431 (NdefMap->TopazContainer.RemainingSize >= PH_FRINFC_TOPAZ_VAL3)) in phFriNfc_Tpz_H_findNDEFTLV()
1433 switch(NdefMap->TopazContainer.ReadBuffer[index]) in phFriNfc_Tpz_H_findNDEFTLV()
1440 NdefMap->TopazContainer.RemainingSize -= PH_FRINFC_TOPAZ_VAL2; in phFriNfc_Tpz_H_findNDEFTLV()
1442 Result = phFriNfc_MapTool_SetCardState(NdefMap, in phFriNfc_Tpz_H_findNDEFTLV()
1443 (uint32_t)NdefMap->TopazContainer.ReadBuffer[index]); in phFriNfc_Tpz_H_findNDEFTLV()
1445 if((NdefMap->TopazContainer.ReadBuffer[index] > in phFriNfc_Tpz_H_findNDEFTLV()
1446 NdefMap->TopazContainer.RemainingSize) || in phFriNfc_Tpz_H_findNDEFTLV()
1447 ((NdefMap->TopazContainer.ReadBuffer[index] == in phFriNfc_Tpz_H_findNDEFTLV()
1448 PH_FRINFC_TOPAZ_VAL0) && (NdefMap->PrevOperation == in phFriNfc_Tpz_H_findNDEFTLV()
1460 NdefMap->TLVStruct.BytesRemainLinTLV = in phFriNfc_Tpz_H_findNDEFTLV()
1461 NdefMap->TopazContainer.ReadBuffer[index]; in phFriNfc_Tpz_H_findNDEFTLV()
1464 NdefMap->TLVStruct.NdefTLVByte = (uint16_t)((index - PH_FRINFC_TOPAZ_VAL1) % in phFriNfc_Tpz_H_findNDEFTLV()
1467 NdefMap->TLVStruct.NdefTLVBlock = (uint8_t)(((index - PH_FRINFC_TOPAZ_VAL1) / in phFriNfc_Tpz_H_findNDEFTLV()
1471 NdefMap->TLVStruct.NdefTLVFoundFlag = PH_FRINFC_TOPAZ_FLAG1; in phFriNfc_Tpz_H_findNDEFTLV()
1473NdefMap->TopazContainer.ByteNumber = (uint8_t)(((NdefMap->TLVStruct.NdefTLVBlock - 1) * 8) + in phFriNfc_Tpz_H_findNDEFTLV()
1474 NdefMap->TLVStruct.NdefTLVByte); in phFriNfc_Tpz_H_findNDEFTLV()
1483 NdefMap->TopazContainer.RemainingSize--; in phFriNfc_Tpz_H_findNDEFTLV()
1499 NdefMap->TopazContainer.RemainingSize -= PH_FRINFC_TOPAZ_VAL2; in phFriNfc_Tpz_H_findNDEFTLV()
1500 if(NdefMap->TopazContainer.ReadBuffer[index] > in phFriNfc_Tpz_H_findNDEFTLV()
1501 NdefMap->TopazContainer.RemainingSize) in phFriNfc_Tpz_H_findNDEFTLV()
1512 NdefMap->TopazContainer.RemainingSize = in phFriNfc_Tpz_H_findNDEFTLV()
1513 NdefMap->TopazContainer.RemainingSize - in phFriNfc_Tpz_H_findNDEFTLV()
1514 NdefMap->TopazContainer.ReadBuffer[index]; in phFriNfc_Tpz_H_findNDEFTLV()
1518 (NdefMap->TopazContainer.ReadBuffer[index] + in phFriNfc_Tpz_H_findNDEFTLV()
1526 if((NdefMap->TLVStruct.NdefTLVFoundFlag == PH_FRINFC_TOPAZ_FLAG0) && in phFriNfc_Tpz_H_findNDEFTLV()
1527 (NdefMap->PrevOperation == PH_FRINFC_NDEFMAP_READ_OPE)) in phFriNfc_Tpz_H_findNDEFTLV()
1532 if((NdefMap->TLVStruct.NdefTLVFoundFlag == PH_FRINFC_TOPAZ_FLAG0) && in phFriNfc_Tpz_H_findNDEFTLV()
1533 ((NdefMap->PrevOperation == PH_FRINFC_NDEFMAP_WRITE_OPE) || in phFriNfc_Tpz_H_findNDEFTLV()
1534 (NdefMap->PrevOperation == PH_FRINFC_NDEFMAP_CHECK_OPE))) in phFriNfc_Tpz_H_findNDEFTLV()
1536 NdefMap->TLVStruct.NdefTLVByte = PH_FRINFC_TOPAZ_VAL4; in phFriNfc_Tpz_H_findNDEFTLV()
1537 NdefMap->TLVStruct.NdefTLVBlock = PH_FRINFC_TOPAZ_VAL1; in phFriNfc_Tpz_H_findNDEFTLV()
1538 NdefMap->TopazContainer.ByteNumber = PH_FRINFC_TOPAZ_VAL4; in phFriNfc_Tpz_H_findNDEFTLV()
1539 NdefMap->TopazContainer.RemainingSize = PH_FRINFC_TOPAZ_TOTAL_RWBYTES1; in phFriNfc_Tpz_H_findNDEFTLV()
1544 static NFCSTATUS phFriNfc_Tpz_H_CpDataToUsrBuf(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_Tpz_H_CpDataToUsrBuf() argument
1549 if(NdefMap->ApduBufferSize >= in phFriNfc_Tpz_H_CpDataToUsrBuf()
1550 NdefMap->TLVStruct.BytesRemainLinTLV) in phFriNfc_Tpz_H_CpDataToUsrBuf()
1554 (void)memcpy(NdefMap->ApduBuffer, in phFriNfc_Tpz_H_CpDataToUsrBuf()
1555 &(NdefMap->TopazContainer.ReadBuffer[ in phFriNfc_Tpz_H_CpDataToUsrBuf()
1556 NdefMap->TopazContainer.ByteNumber]), in phFriNfc_Tpz_H_CpDataToUsrBuf()
1557 NdefMap->TLVStruct.BytesRemainLinTLV); in phFriNfc_Tpz_H_CpDataToUsrBuf()
1560 *(NdefMap->NumOfBytesRead) = in phFriNfc_Tpz_H_CpDataToUsrBuf()
1561 NdefMap->TLVStruct.BytesRemainLinTLV; in phFriNfc_Tpz_H_CpDataToUsrBuf()
1563 NdefMap->TopazContainer.ByteNumber = in phFriNfc_Tpz_H_CpDataToUsrBuf()
1566 NdefMap->TopazContainer.ReadWriteCompleteFlag = in phFriNfc_Tpz_H_CpDataToUsrBuf()
1570 NdefMap->TopazContainer.RemainingSize = in phFriNfc_Tpz_H_CpDataToUsrBuf()
1571 NdefMap->TopazContainer.RemainingSize - in phFriNfc_Tpz_H_CpDataToUsrBuf()
1572 NdefMap->TLVStruct.BytesRemainLinTLV; in phFriNfc_Tpz_H_CpDataToUsrBuf()
1574 NdefMap->TLVStruct.BytesRemainLinTLV = in phFriNfc_Tpz_H_CpDataToUsrBuf()
1580 (void)memcpy(NdefMap->ApduBuffer, in phFriNfc_Tpz_H_CpDataToUsrBuf()
1581 &(NdefMap->TopazContainer.ReadBuffer[ in phFriNfc_Tpz_H_CpDataToUsrBuf()
1582 NdefMap->TopazContainer.ByteNumber]), in phFriNfc_Tpz_H_CpDataToUsrBuf()
1583 NdefMap->ApduBufferSize); in phFriNfc_Tpz_H_CpDataToUsrBuf()
1586 *(NdefMap->NumOfBytesRead) = in phFriNfc_Tpz_H_CpDataToUsrBuf()
1587 NdefMap->ApduBufferSize; in phFriNfc_Tpz_H_CpDataToUsrBuf()
1589 NdefMap->TopazContainer.ByteNumber = in phFriNfc_Tpz_H_CpDataToUsrBuf()
1590 (uint8_t)(NdefMap->TopazContainer.ByteNumber + in phFriNfc_Tpz_H_CpDataToUsrBuf()
1591 NdefMap->ApduBufferSize); in phFriNfc_Tpz_H_CpDataToUsrBuf()
1593 NdefMap->TopazContainer.RemainingSize in phFriNfc_Tpz_H_CpDataToUsrBuf()
1594 = NdefMap->TopazContainer.RemainingSize in phFriNfc_Tpz_H_CpDataToUsrBuf()
1595 - (uint16_t)NdefMap->ApduBufferSize; in phFriNfc_Tpz_H_CpDataToUsrBuf()
1597 NdefMap->TLVStruct.BytesRemainLinTLV = in phFriNfc_Tpz_H_CpDataToUsrBuf()
1598 NdefMap->TLVStruct.BytesRemainLinTLV - in phFriNfc_Tpz_H_CpDataToUsrBuf()
1599 (uint16_t)NdefMap->ApduBufferSize; in phFriNfc_Tpz_H_CpDataToUsrBuf()
1604 static NFCSTATUS phFriNfc_Tpz_H_ProWrNMN(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_Tpz_H_ProWrNMN() argument
1611 if((NdefMap->TopazContainer.InternalState == in phFriNfc_Tpz_H_ProWrNMN()
1613 (NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL0] == in phFriNfc_Tpz_H_ProWrNMN()
1615 (*NdefMap->SendRecvLength == PH_FRINFC_TOPAZ_VAL1)) in phFriNfc_Tpz_H_ProWrNMN()
1617 NdefMap->State = PH_FRINFC_TOPAZ_STATE_WRITE_L_TLV; in phFriNfc_Tpz_H_ProWrNMN()
1619 BlockNo = (uint8_t)(((NdefMap->TLVStruct.NdefTLVByte + PH_FRINFC_TOPAZ_VAL1) > in phFriNfc_Tpz_H_ProWrNMN()
1621 (NdefMap->TLVStruct.NdefTLVBlock + PH_FRINFC_TOPAZ_VAL1): in phFriNfc_Tpz_H_ProWrNMN()
1622 NdefMap->TLVStruct.NdefTLVBlock); in phFriNfc_Tpz_H_ProWrNMN()
1624 ByteNo = (uint8_t)((NdefMap->TLVStruct.NdefTLVByte + PH_FRINFC_TOPAZ_VAL1) % in phFriNfc_Tpz_H_ProWrNMN()
1629 NdefMap->TopazContainer.InternalState = PH_FRINFC_TOPAZ_WR_L_TLV_0; in phFriNfc_Tpz_H_ProWrNMN()
1631 Result = phFriNfc_Tpz_H_WrAByte( NdefMap, BlockNo, ByteNo, in phFriNfc_Tpz_H_ProWrNMN()
1636 if((NdefMap->TopazContainer.InternalState == in phFriNfc_Tpz_H_ProWrNMN()
1638 (NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL0] == in phFriNfc_Tpz_H_ProWrNMN()
1640 (*NdefMap->SendRecvLength == PH_FRINFC_TOPAZ_VAL1)) in phFriNfc_Tpz_H_ProWrNMN()
1643 NdefMap->CardState = (uint8_t)((NdefMap->CardState == in phFriNfc_Tpz_H_ProWrNMN()
1646 NdefMap->CardState); in phFriNfc_Tpz_H_ProWrNMN()
1648 *NdefMap->WrNdefPacketLength = NdefMap->ApduBuffIndex; in phFriNfc_Tpz_H_ProWrNMN()
1655 static NFCSTATUS phFriNfc_Tpz_H_ProWrTLV(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_Tpz_H_ProWrTLV() argument
1659 if((NdefMap->TopazContainer.InternalState == in phFriNfc_Tpz_H_ProWrTLV()
1661 (NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL0] == in phFriNfc_Tpz_H_ProWrTLV()
1663 (*NdefMap->SendRecvLength == PH_FRINFC_TOPAZ_VAL1)) in phFriNfc_Tpz_H_ProWrTLV()
1666 NdefMap->State = PH_FRINFC_TOPAZ_STATE_WRITE; in phFriNfc_Tpz_H_ProWrTLV()
1668 NdefMap->TopazContainer.ByteNumber++; in phFriNfc_Tpz_H_ProWrTLV()
1670 phFriNfc_Tpz_H_BlkChk(NdefMap); in phFriNfc_Tpz_H_ProWrTLV()
1674 Result = phFriNfc_Tpz_H_WrAByte( NdefMap, in phFriNfc_Tpz_H_ProWrTLV()
1675 NdefMap->TopazContainer.CurrentBlock, in phFriNfc_Tpz_H_ProWrTLV()
1676 NdefMap->TopazContainer.ByteNumber, in phFriNfc_Tpz_H_ProWrTLV()
1677 NdefMap->ApduBuffer[NdefMap->ApduBuffIndex] in phFriNfc_Tpz_H_ProWrTLV()
1682 if((NdefMap->TopazContainer.InternalState == in phFriNfc_Tpz_H_ProWrTLV()
1684 (((NdefMap->Offset == PH_FRINFC_NDEFMAP_SEEK_BEGIN) && in phFriNfc_Tpz_H_ProWrTLV()
1685 (NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL0] == in phFriNfc_Tpz_H_ProWrTLV()
1686 NdefMap->ApduBuffIndex)) || in phFriNfc_Tpz_H_ProWrTLV()
1687 ((NdefMap->Offset == PH_FRINFC_NDEFMAP_SEEK_CUR) && in phFriNfc_Tpz_H_ProWrTLV()
1688 (NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL0] == in phFriNfc_Tpz_H_ProWrTLV()
1689 (NdefMap->ApduBuffIndex + NdefMap->TLVStruct.BytesRemainLinTLV)))) && in phFriNfc_Tpz_H_ProWrTLV()
1690 (*NdefMap->SendRecvLength == PH_FRINFC_TOPAZ_VAL1)) in phFriNfc_Tpz_H_ProWrTLV()
1693 NdefMap->TLVStruct.BytesRemainLinTLV = in phFriNfc_Tpz_H_ProWrTLV()
1694 ((NdefMap->Offset == PH_FRINFC_NDEFMAP_SEEK_BEGIN)? in phFriNfc_Tpz_H_ProWrTLV()
1695 NdefMap->ApduBuffIndex: in phFriNfc_Tpz_H_ProWrTLV()
1696 (NdefMap->TLVStruct.BytesRemainLinTLV + NdefMap->ApduBuffIndex)); in phFriNfc_Tpz_H_ProWrTLV()
1699 Result = phFriNfc_Tpz_H_WrByte0ValE1(NdefMap); in phFriNfc_Tpz_H_ProWrTLV()
1705 static NFCSTATUS phFriNfc_Tpz_H_ProWrUsrData(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_Tpz_H_ProWrUsrData() argument
1710 if((NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL0] == in phFriNfc_Tpz_H_ProWrUsrData()
1711 NdefMap->ApduBuffer[NdefMap->ApduBuffIndex]) && in phFriNfc_Tpz_H_ProWrUsrData()
1712 (*NdefMap->SendRecvLength == PH_FRINFC_TOPAZ_VAL1)) in phFriNfc_Tpz_H_ProWrUsrData()
1715 NdefMap->ApduBuffIndex += PH_FRINFC_TOPAZ_VAL1; in phFriNfc_Tpz_H_ProWrUsrData()
1718 NdefMap->TopazContainer.RemainingSize -= PH_FRINFC_TOPAZ_VAL1; in phFriNfc_Tpz_H_ProWrUsrData()
1721 NdefMap->TopazContainer.ByteNumber++; in phFriNfc_Tpz_H_ProWrUsrData()
1724 phFriNfc_Tpz_H_BlkChk(NdefMap); in phFriNfc_Tpz_H_ProWrUsrData()
1727 if((NdefMap->ApduBufferSize == NdefMap->ApduBuffIndex) || in phFriNfc_Tpz_H_ProWrUsrData()
1728 (NdefMap->TopazContainer.RemainingSize == PH_FRINFC_TOPAZ_VAL0)) in phFriNfc_Tpz_H_ProWrUsrData()
1731 NdefMap->TopazContainer.ReadWriteCompleteFlag = (uint8_t) in phFriNfc_Tpz_H_ProWrUsrData()
1732 ((NdefMap->TopazContainer.RemainingSize == PH_FRINFC_TOPAZ_VAL0)? in phFriNfc_Tpz_H_ProWrUsrData()
1735 Result = phFriNfc_Tpz_H_WrLByte(NdefMap); in phFriNfc_Tpz_H_ProWrUsrData()
1740 NdefMap->State = PH_FRINFC_TOPAZ_STATE_WRITE; in phFriNfc_Tpz_H_ProWrUsrData()
1743 Result = phFriNfc_Tpz_H_WrAByte(NdefMap, NdefMap->TopazContainer.CurrentBlock, in phFriNfc_Tpz_H_ProWrUsrData()
1744 NdefMap->TopazContainer.ByteNumber, in phFriNfc_Tpz_H_ProWrUsrData()
1745 NdefMap->ApduBuffer[NdefMap->ApduBuffIndex] in phFriNfc_Tpz_H_ProWrUsrData()
1752 static NFCSTATUS phFriNfc_Tpz_H_WrLByte(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_Tpz_H_WrLByte() argument
1758 BlockNo = (uint8_t)(((NdefMap->TLVStruct.NdefTLVByte + in phFriNfc_Tpz_H_WrLByte()
1761 (NdefMap->TLVStruct.NdefTLVBlock + in phFriNfc_Tpz_H_WrLByte()
1763 NdefMap->TLVStruct.NdefTLVBlock); in phFriNfc_Tpz_H_WrLByte()
1765 ByteNo = (uint8_t)((NdefMap->TLVStruct.NdefTLVByte + in phFriNfc_Tpz_H_WrLByte()
1768 NdefMap->State = PH_FRINFC_TOPAZ_STATE_WRITE_L_TLV; in phFriNfc_Tpz_H_WrLByte()
1770 NdefMap->TopazContainer.InternalState = PH_FRINFC_TOPAZ_WR_L_TLV; in phFriNfc_Tpz_H_WrLByte()
1773 ((NdefMap->Offset == PH_FRINFC_NDEFMAP_SEEK_BEGIN)? in phFriNfc_Tpz_H_WrLByte()
1774 NdefMap->ApduBuffIndex: in phFriNfc_Tpz_H_WrLByte()
1775 (NdefMap->ApduBuffIndex + in phFriNfc_Tpz_H_WrLByte()
1776 NdefMap->TLVStruct.BytesRemainLinTLV)); in phFriNfc_Tpz_H_WrLByte()
1778 Result = phFriNfc_Tpz_H_WrAByte(NdefMap, BlockNo, ByteNo,TempByteVal); in phFriNfc_Tpz_H_WrLByte()
1782 static NFCSTATUS phFriNfc_Tpz_H_WrByte0ValE1(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_Tpz_H_WrByte0ValE1() argument
1787 NdefMap->State = PH_FRINFC_TOPAZ_STATE_WRITE_NMN; in phFriNfc_Tpz_H_WrByte0ValE1()
1789 NdefMap->TopazContainer.InternalState = PH_FRINFC_TOPAZ_WR_NMN_E1; in phFriNfc_Tpz_H_WrByte0ValE1()
1792 Result = phFriNfc_Tpz_H_WrAByte(NdefMap, PH_FRINFC_TOPAZ_VAL1, in phFriNfc_Tpz_H_WrByte0ValE1()
1797 static void phFriNfc_Tpz_H_Complete(phFriNfc_NdefMap_t *NdefMap, in phFriNfc_Tpz_H_Complete() argument
1801 NdefMap->State = PH_FRINFC_NDEFMAP_STATE_RESET_INIT; in phFriNfc_Tpz_H_Complete()
1804 NdefMap->CompletionRoutine[NdefMap->TopazContainer.CRIndex]. in phFriNfc_Tpz_H_Complete()
1805 CompletionRoutine(NdefMap->CompletionRoutine->Context, Status); in phFriNfc_Tpz_H_Complete()
1808 static void phFriNfc_Tpz_H_BlkChk(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_Tpz_H_BlkChk() argument
1810 NdefMap->TopazContainer.CurrentBlock = in phFriNfc_Tpz_H_BlkChk()
1811 (uint8_t)((NdefMap->TopazContainer.ByteNumber > in phFriNfc_Tpz_H_BlkChk()
1813 (NdefMap->TopazContainer.CurrentBlock + in phFriNfc_Tpz_H_BlkChk()
1815 NdefMap->TopazContainer.CurrentBlock); in phFriNfc_Tpz_H_BlkChk()
1817 NdefMap->TopazContainer.ByteNumber = (uint8_t)(NdefMap->TopazContainer.ByteNumber % in phFriNfc_Tpz_H_BlkChk()
1821 static NFCSTATUS phFriNfc_Tpz_H_ChkCCinChkNdef(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_Tpz_H_ChkCCinChkNdef() argument
1826 if(NdefMap->TopazContainer.ReadBuffer[PH_FRINFC_TOPAZ_VAL0] == in phFriNfc_Tpz_H_ChkCCinChkNdef()
1830 Result = (((NdefMap->TopazContainer.ReadBuffer[PH_FRINFC_TOPAZ_VAL3] & in phFriNfc_Tpz_H_ChkCCinChkNdef()
1836 NdefMap->CardMemSize = NdefMap->TopazContainer.RemainingSize = in phFriNfc_Tpz_H_ChkCCinChkNdef()
1839 NdefMap->CardMemSize); in phFriNfc_Tpz_H_ChkCCinChkNdef()
1842 if (NdefMap->CardState != PH_NDEFMAP_CARD_STATE_READ_ONLY) in phFriNfc_Tpz_H_ChkCCinChkNdef()
1844 NdefMap->CardState = (uint8_t)((Result == NFCSTATUS_SUCCESS)? in phFriNfc_Tpz_H_ChkCCinChkNdef()
1852 static void phFriNfc_Tpz_H_ChkLockBits(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_Tpz_H_ChkLockBits() argument
1855 NdefMap->CardState = (uint8_t) in phFriNfc_Tpz_H_ChkLockBits()
1856 (((NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_LOCKBIT_BYTENO_0] == in phFriNfc_Tpz_H_ChkLockBits()
1858 ((NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_LOCKBIT_BYTENO_1] == in phFriNfc_Tpz_H_ChkLockBits()
1860 (NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_LOCKBIT_BYTENO_1] == in phFriNfc_Tpz_H_ChkLockBits()
1866 if (NdefMap->CardState == PH_NDEFMAP_CARD_STATE_READ_WRITE) in phFriNfc_Tpz_H_ChkLockBits()
1868 if (NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_CC_BYTENO_3] == PH_FRINFC_TOPAZ_CC_READWRITE) in phFriNfc_Tpz_H_ChkLockBits()
1870 NdefMap->CardState = PH_NDEFMAP_CARD_STATE_READ_WRITE; in phFriNfc_Tpz_H_ChkLockBits()
1872 else if (NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_CC_BYTENO_3] == PH_FRINFC_TOPAZ_CC_READONLY) in phFriNfc_Tpz_H_ChkLockBits()
1874 NdefMap->CardState = PH_NDEFMAP_CARD_STATE_READ_ONLY; in phFriNfc_Tpz_H_ChkLockBits()
1878 NdefMap->CardState = PH_NDEFMAP_CARD_STATE_INVALID; in phFriNfc_Tpz_H_ChkLockBits()
1883 static NFCSTATUS phFriNfc_Tpz_H_WrCCorTLV(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_Tpz_H_WrCCorTLV() argument
1889 switch(NdefMap->TopazContainer.InternalState) in phFriNfc_Tpz_H_WrCCorTLV()
1923 ByteNo = (uint8_t)NdefMap->TLVStruct.NdefTLVByte; in phFriNfc_Tpz_H_WrCCorTLV()
1924 BlockNo = NdefMap->TLVStruct.NdefTLVBlock; in phFriNfc_Tpz_H_WrCCorTLV()
1927 NdefMap->State = PH_FRINFC_TOPAZ_STATE_WR_CC_OR_TLV; in phFriNfc_Tpz_H_WrCCorTLV()
1928 Result = phFriNfc_Tpz_H_WrAByte( NdefMap, BlockNo, ByteNo,TempByteVal); in phFriNfc_Tpz_H_WrCCorTLV()
1932 static NFCSTATUS phFriNfc_Tpz_H_ProCCTLV(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_Tpz_H_ProCCTLV() argument
1936 switch(NdefMap->TopazContainer.InternalState) in phFriNfc_Tpz_H_ProCCTLV()
1941 if((NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL0] == in phFriNfc_Tpz_H_ProCCTLV()
1943 (*NdefMap->SendRecvLength == PH_FRINFC_TOPAZ_VAL1)) in phFriNfc_Tpz_H_ProCCTLV()
1945 NdefMap->TopazContainer.InternalState = PH_FRINFC_TOPAZ_WR_CC_BYTE1; in phFriNfc_Tpz_H_ProCCTLV()
1946 Result = phFriNfc_Tpz_H_WrCCorTLV(NdefMap); in phFriNfc_Tpz_H_ProCCTLV()
1953 if((NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL0] == in phFriNfc_Tpz_H_ProCCTLV()
1955 (*NdefMap->SendRecvLength == PH_FRINFC_TOPAZ_VAL1)) in phFriNfc_Tpz_H_ProCCTLV()
1957 NdefMap->TopazContainer.InternalState = PH_FRINFC_TOPAZ_WR_CC_BYTE2; in phFriNfc_Tpz_H_ProCCTLV()
1958 Result = phFriNfc_Tpz_H_WrCCorTLV(NdefMap); in phFriNfc_Tpz_H_ProCCTLV()
1965 if((NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL0] == in phFriNfc_Tpz_H_ProCCTLV()
1967 (*NdefMap->SendRecvLength == PH_FRINFC_TOPAZ_VAL1)) in phFriNfc_Tpz_H_ProCCTLV()
1969 NdefMap->TopazContainer.InternalState = PH_FRINFC_TOPAZ_WR_CC_BYTE3; in phFriNfc_Tpz_H_ProCCTLV()
1970 Result = phFriNfc_Tpz_H_WrCCorTLV(NdefMap); in phFriNfc_Tpz_H_ProCCTLV()
1977 if((NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL0] == in phFriNfc_Tpz_H_ProCCTLV()
1979 (*NdefMap->SendRecvLength == PH_FRINFC_TOPAZ_VAL1)) in phFriNfc_Tpz_H_ProCCTLV()
1981 NdefMap->TopazContainer.InternalState = PH_FRINFC_TOPAZ_WR_T_OF_TLV; in phFriNfc_Tpz_H_ProCCTLV()
1982 Result = phFriNfc_Tpz_H_WrCCorTLV(NdefMap); in phFriNfc_Tpz_H_ProCCTLV()
1989 if((NdefMap->SendRecvBuf[PH_FRINFC_TOPAZ_VAL0] == in phFriNfc_Tpz_H_ProCCTLV()
1991 (*NdefMap->SendRecvLength == PH_FRINFC_TOPAZ_VAL1)) in phFriNfc_Tpz_H_ProCCTLV()
1994 NdefMap->TopazContainer.ByteNumber++; in phFriNfc_Tpz_H_ProCCTLV()
1996 phFriNfc_Tpz_H_BlkChk(NdefMap); in phFriNfc_Tpz_H_ProCCTLV()
1998 NdefMap->State = PH_FRINFC_TOPAZ_STATE_WRITE_NMN; in phFriNfc_Tpz_H_ProCCTLV()
2001 NdefMap->TopazContainer.InternalState = PH_FRINFC_TOPAZ_WR_NMN_0; in phFriNfc_Tpz_H_ProCCTLV()
2004 Result = phFriNfc_Tpz_H_WrAByte( NdefMap, PH_FRINFC_TOPAZ_VAL1, in phFriNfc_Tpz_H_ProCCTLV()