• Home
  • Raw
  • Download

Lines Matching refs:NdefMap

65 static NFCSTATUS phFriNfc_MifStd_H_RdABlock(phFriNfc_NdefMap_t *NdefMap);
71 static NFCSTATUS phFriNfc_MifStd_H_WrABlock(phFriNfc_NdefMap_t *NdefMap);
77 static NFCSTATUS phFriNfc_MifStd_H_AuthSector(phFriNfc_NdefMap_t *NdefMap);
83 static NFCSTATUS phFriNfc_MifStd4k_H_CheckNdef(phFriNfc_NdefMap_t *NdefMap);
88 static void phFriNfc_MifStd_H_fillAIDarray(phFriNfc_NdefMap_t *NdefMap);
100 static NFCSTATUS phFriNfc_MifStd_H_BlkChk(phFriNfc_NdefMap_t *NdefMap);
105 static NFCSTATUS phFriNfc_MifStd_H_RdAcsBit(phFriNfc_NdefMap_t *NdefMap);
110 static NFCSTATUS phFriNfc_MifStd_H_ChkAcsBit(phFriNfc_NdefMap_t *NdefMap);
116 static NFCSTATUS phFriNfc_MifStd_H_ChkRdWr(phFriNfc_NdefMap_t *NdefMap);
122 static void phFriNfc_MifStd_H_ChkNdefCmpltSects(phFriNfc_NdefMap_t *NdefMap);
129 static uint8_t phFriNfc_MifStd_H_ChkNdefLen(phFriNfc_NdefMap_t *NdefMap,
137 static NFCSTATUS phFriNfc_MifStd_H_RdNdefTLV(phFriNfc_NdefMap_t *NdefMap,
146 static NFCSTATUS phFriNfc_MifStd_H_RemainTLV(phFriNfc_NdefMap_t *NdefMap,
154 static NFCSTATUS phFriNfc_MifStd_H_ChkIntLen(phFriNfc_NdefMap_t *NdefMap);
160 static NFCSTATUS phFriNfc_MifStd_H_IntLenWioutNdef(phFriNfc_NdefMap_t *NdefMap,
168 static NFCSTATUS phFriNfc_MifStd_H_IntLenWithNdef(phFriNfc_NdefMap_t *NdefMap,
175 static uint8_t phFriNfc_MifStd_H_UpdateTLV(phFriNfc_NdefMap_t *NdefMap);
181 static NFCSTATUS phFriNfc_MifStd_H_WriteNdefLen(phFriNfc_NdefMap_t *NdefMap);
187 static NFCSTATUS phFriNfc_MifStd_H_ChkNdefCmpltBlocks(phFriNfc_NdefMap_t *NdefMap);
193 static void phFriNfc_MifStd_H_SetNdefBlkAuth(phFriNfc_NdefMap_t *NdefMap);
199 static void phFriNfc_MifStd_H_RdWrReset(phFriNfc_NdefMap_t *NdefMap);
205 static NFCSTATUS phFriNfc_MifStd_H_RdtoWrNdefLen(phFriNfc_NdefMap_t *NdefMap);
211 static NFCSTATUS phFriNfc_MifStd_H_GetActCardLen(phFriNfc_NdefMap_t *NdefMap);
217 static NFCSTATUS phFriNfc_MifStd_H_ChkTLVs(phFriNfc_NdefMap_t *NdefMap,
224 static NFCSTATUS phFriNfc_MifStd_H_GetNxtTLV(phFriNfc_NdefMap_t *NdefMap,
232 static NFCSTATUS phFriNfc_MifStd_H_Chk16Bytes(phFriNfc_NdefMap_t *NdefMap,
239 static NFCSTATUS phFriNfc_MifStd_H_ChkRemainTLVs(phFriNfc_NdefMap_t *NdefMap,
247 static void phFriNfc_MifStd_H_Complete(phFriNfc_NdefMap_t *NdefMap,
254 static void phFriNfc_MifStd_H_Get1kStTrail(phFriNfc_NdefMap_t *NdefMap);
260 static void phFriNfc_MifStd_H_Get4kStTrail(phFriNfc_NdefMap_t *NdefMap);
266 static NFCSTATUS phFriNfc_MifStd_H_ProChkNdef(phFriNfc_NdefMap_t *NdefMap);
272 static NFCSTATUS phFriNfc_MifStd_H_ProAuth(phFriNfc_NdefMap_t *NdefMap);
278 static NFCSTATUS phFriNfc_MifStd_H_Rd16Bytes(phFriNfc_NdefMap_t *NdefMap,
285 static NFCSTATUS phFriNfc_MifStd_H_ProAcsBits(phFriNfc_NdefMap_t *NdefMap);
290 static NFCSTATUS phFriNfc_MifStd_H_GPBChk(phFriNfc_NdefMap_t *NdefMap);
296 static NFCSTATUS phFriNfc_MifStd_H_ProStatNotValid(phFriNfc_NdefMap_t *NdefMap,
302 static NFCSTATUS phFriNfc_MifStd_H_RdBeforeWr(phFriNfc_NdefMap_t *NdefMap);
308 static NFCSTATUS phFriNfc_MifStd_H_ProBytesToWr(phFriNfc_NdefMap_t *NdefMap);
313 static NFCSTATUS phFriNfc_MifStd_H_fillSendBuf(phFriNfc_NdefMap_t *NdefMap,
319 static NFCSTATUS phFriNfc_MifStd_H_WrTLV(phFriNfc_NdefMap_t *NdefMap);
324 static NFCSTATUS phFriNfc_MifStd_H_ProWrTLV(phFriNfc_NdefMap_t *NdefMap);
329 static uint8_t phFriNfc_MifStd_H_UpdRemTLV(phFriNfc_NdefMap_t *NdefMap);
335 static void phFriNfc_MifStd_H_fillTLV1(phFriNfc_NdefMap_t *NdefMap);
341 static void phFriNfc_MifStd_H_fillTLV2(phFriNfc_NdefMap_t *NdefMap);
347 static NFCSTATUS phFriNfc_MifStd_H_CallWrNdefLen(phFriNfc_NdefMap_t *NdefMap);
353 static NFCSTATUS phFriNfc_MifStd_H_BlkChk_1(phFriNfc_NdefMap_t *NdefMap);
359 static void phFriNfc_MifStd_H_fillTLV1_1(phFriNfc_NdefMap_t *NdefMap);
365 static void phFriNfc_MifStd_H_fillTLV2_1(phFriNfc_NdefMap_t *NdefMap);
370 static NFCSTATUS phFriNfc_MifStd_H_RdTLV(phFriNfc_NdefMap_t *NdefMap);
375 static NFCSTATUS phFriNfc_MifStd_H_ProRdTLV(phFriNfc_NdefMap_t *NdefMap);
380 static NFCSTATUS phFriNfc_MifStd_H_WrTermTLV(phFriNfc_NdefMap_t *NdefMap);
385 static NFCSTATUS phFriNfc_MifStd_H_ProWrABlock(phFriNfc_NdefMap_t *NdefMap);
392 static NFCSTATUS phFriNfc_MifStd_H_CallPoll(phFriNfc_NdefMap_t *NdefMap);
399 static NFCSTATUS phFriNfc_MifStd_H_CallConnect(phFriNfc_NdefMap_t *NdefMap);
405 static NFCSTATUS phFriNfc_MifStd_H_CallDisCon(phFriNfc_NdefMap_t *NdefMap);
410 static void phFriNfc_MifStd1k_H_BlkChk(phFriNfc_NdefMap_t *NdefMap,
415 static NFCSTATUS phFriNfc_MifStd_H_ProSectorTrailorAcsBits(phFriNfc_NdefMap_t *NdefMap);
416 static NFCSTATUS phFriNfc_MifStd_H_WrSectorTrailorBlock(phFriNfc_NdefMap_t *NdefMap);
417 static NFCSTATUS phFriNfc_MifStd_H_ProWrSectorTrailor(phFriNfc_NdefMap_t *NdefMap);
463 NFCSTATUS phFriNfc_MifareStdMap_H_Reset(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifareStdMap_H_Reset() argument
467 if ( NdefMap == NULL) in phFriNfc_MifareStdMap_H_Reset()
474 NdefMap->StdMifareContainer.currentBlock = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifareStdMap_H_Reset()
480 NdefMap->StdMifareContainer.internalBuf[index] = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifareStdMap_H_Reset()
483 NdefMap->StdMifareContainer.internalLength = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifareStdMap_H_Reset()
485 NdefMap->CardState = PH_NDEFMAP_CARD_STATE_INITIALIZED; in phFriNfc_MifareStdMap_H_Reset()
488 NdefMap->StdMifareContainer.RemainingBufFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_H_Reset()
492 NdefMap->StdMifareContainer.ReadWriteCompleteFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_H_Reset()
495 NdefMap->StdMifareContainer.internalBufFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_H_Reset()
498 NdefMap->StdMifareContainer.AuthDone = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_H_Reset()
501 NdefMap->StdMifareContainer.SectorIndex = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifareStdMap_H_Reset()
503 NdefMap->StdMifareContainer.NdefBlocks = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifareStdMap_H_Reset()
505 NdefMap->StdMifareContainer.NoOfNdefCompBlocks = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifareStdMap_H_Reset()
507 NdefMap->StdMifareContainer.ReadAcsBitFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_H_Reset()
509 NdefMap->StdMifareContainer.remSizeUpdFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_H_Reset()
511 NdefMap->TLVStruct.NoLbytesinTLV = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifareStdMap_H_Reset()
513 NdefMap->TLVStruct.prevLenByteValue = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifareStdMap_H_Reset()
515 NdefMap->TLVStruct.BytesRemainLinTLV = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifareStdMap_H_Reset()
517 NdefMap->TLVStruct.NdefTLVBlock = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifareStdMap_H_Reset()
519 NdefMap->TLVStruct.NdefTLVByte = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifareStdMap_H_Reset()
521 NdefMap->TLVStruct.NULLTLVCount = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifareStdMap_H_Reset()
523 NdefMap->StdMifareContainer.remainingSize = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifareStdMap_H_Reset()
525 NdefMap->StdMifareContainer.ReadNdefFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_H_Reset()
527 NdefMap->StdMifareContainer.WrNdefFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_H_Reset()
529 NdefMap->StdMifareContainer.ChkNdefFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_H_Reset()
531 NdefMap->StdMifareContainer.aidCompleteFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_H_Reset()
533 NdefMap->StdMifareContainer.NFCforumSectFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_H_Reset()
535 NdefMap->StdMifareContainer.ProprforumSectFlag = PH_FRINFC_MIFARESTD_PROP_1ST_CONFIG; in phFriNfc_MifareStdMap_H_Reset()
537 NdefMap->StdMifareContainer.ReadCompleteFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_H_Reset()
539 NdefMap->StdMifareContainer.FirstReadFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_H_Reset()
541 NdefMap->StdMifareContainer.WrLength = PH_FRINFC_MIFARESTD_VAL1; in phFriNfc_MifareStdMap_H_Reset()
543 NdefMap->StdMifareContainer.ChkNdefCompleteFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_H_Reset()
545 NdefMap->StdMifareContainer.ReadOnlySectorIndex = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_H_Reset()
547 NdefMap->StdMifareContainer.TotalNoSectors = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_H_Reset()
549 NdefMap->StdMifareContainer.SectorTrailerBlockNo = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_H_Reset()
568 NFCSTATUS phFriNfc_MifareStdMap_ChkNdef( phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifareStdMap_ChkNdef() argument
574 if ( NdefMap == NULL) in phFriNfc_MifareStdMap_ChkNdef()
581 NdefMap->psDepAdditionalInfo.DepFlags.MetaChaining = 0; in phFriNfc_MifareStdMap_ChkNdef()
582 NdefMap->psDepAdditionalInfo.DepFlags.NADPresent = 0; in phFriNfc_MifareStdMap_ChkNdef()
583 NdefMap->psDepAdditionalInfo.NAD = 0; in phFriNfc_MifareStdMap_ChkNdef()
584 NdefMap->PrevOperation = PH_FRINFC_NDEFMAP_CHECK_OPE; in phFriNfc_MifareStdMap_ChkNdef()
585 NdefMap->StdMifareContainer.CRIndex = PH_FRINFC_NDEFMAP_CR_CHK_NDEF; in phFriNfc_MifareStdMap_ChkNdef()
590 sak = NdefMap->psRemoteDevInfo->RemoteDevInfo.CardInfo106. in phFriNfc_MifareStdMap_ChkNdef()
592 atq = NdefMap->psRemoteDevInfo->RemoteDevInfo.CardInfo106. in phFriNfc_MifareStdMap_ChkNdef()
595 sak = NdefMap->psRemoteDevInfo->RemoteDevInfo.Iso14443A_Info.Sak; in phFriNfc_MifareStdMap_ChkNdef()
596 atq = NdefMap->psRemoteDevInfo->RemoteDevInfo.Iso14443A_Info.AtqA[0]; in phFriNfc_MifareStdMap_ChkNdef()
603 NdefMap->StdMifareContainer.NoOfNdefCompBlocks = in phFriNfc_MifareStdMap_ChkNdef()
605 NdefMap->StdMifareContainer.remainingSize = in phFriNfc_MifareStdMap_ChkNdef()
606 ((NdefMap->CardType == PH_FRINFC_MIFARESTD_VAL0)? in phFriNfc_MifareStdMap_ChkNdef()
609 NdefMap->StdMifareContainer.remainingSize); in phFriNfc_MifareStdMap_ChkNdef()
610 NdefMap->CardType = PH_FRINFC_NDEFMAP_MIFARE_STD_1K_CARD; in phFriNfc_MifareStdMap_ChkNdef()
615 NdefMap->StdMifareContainer.NoOfNdefCompBlocks = in phFriNfc_MifareStdMap_ChkNdef()
617 NdefMap->StdMifareContainer.remainingSize = in phFriNfc_MifareStdMap_ChkNdef()
618 ((NdefMap->CardType == PH_FRINFC_MIFARESTD_VAL0)? in phFriNfc_MifareStdMap_ChkNdef()
621 NdefMap->StdMifareContainer.remainingSize); in phFriNfc_MifareStdMap_ChkNdef()
622 NdefMap->CardType = PH_FRINFC_NDEFMAP_MIFARE_STD_4K_CARD; in phFriNfc_MifareStdMap_ChkNdef()
630 if((NdefMap->StdMifareContainer.currentBlock != 0) && in phFriNfc_MifareStdMap_ChkNdef()
631 (NdefMap->StdMifareContainer.currentBlock != 1) && in phFriNfc_MifareStdMap_ChkNdef()
632 (NdefMap->StdMifareContainer.currentBlock != 2) && in phFriNfc_MifareStdMap_ChkNdef()
633 (NdefMap->StdMifareContainer.currentBlock != 64) && in phFriNfc_MifareStdMap_ChkNdef()
634 (NdefMap->StdMifareContainer.currentBlock != 65) && in phFriNfc_MifareStdMap_ChkNdef()
635 (NdefMap->StdMifareContainer.currentBlock != 66) ) in phFriNfc_MifareStdMap_ChkNdef()
639 else if( NdefMap->StdMifareContainer.AuthDone == 0) in phFriNfc_MifareStdMap_ChkNdef()
645 if(NdefMap->StdMifareContainer.currentBlock == 0) in phFriNfc_MifareStdMap_ChkNdef()
647 NdefMap->StdMifareContainer.currentBlock = 1; in phFriNfc_MifareStdMap_ChkNdef()
650 status = phFriNfc_MifStd_H_AuthSector(NdefMap); in phFriNfc_MifareStdMap_ChkNdef()
656 if ((NdefMap->CardType == PH_FRINFC_NDEFMAP_MIFARE_STD_4K_CARD) || in phFriNfc_MifareStdMap_ChkNdef()
657 (NdefMap->CardType == PH_FRINFC_NDEFMAP_MIFARE_STD_1K_CARD)) in phFriNfc_MifareStdMap_ChkNdef()
660 NdefMap->State = PH_FRINFC_NDEFMAP_STATE_CHK_NDEF_COMP; in phFriNfc_MifareStdMap_ChkNdef()
661 NdefMap->PrevOperation = PH_FRINFC_NDEFMAP_CHECK_OPE; in phFriNfc_MifareStdMap_ChkNdef()
662 NdefMap->StdMifareContainer.ChkNdefFlag = PH_FRINFC_MIFARESTD_FLAG1; in phFriNfc_MifareStdMap_ChkNdef()
664 NdefMap->MapCompletionInfo.CompletionRoutine = phFriNfc_MifareStdMap_Process; in phFriNfc_MifareStdMap_ChkNdef()
665 NdefMap->MapCompletionInfo.Context = NdefMap; in phFriNfc_MifareStdMap_ChkNdef()
668 NdefMap->Cmd.MfCmd = phHal_eMifareCmdListMifareRead; in phFriNfc_MifareStdMap_ChkNdef()
670 NdefMap->Cmd.MfCmd = phHal_eMifareRead; in phFriNfc_MifareStdMap_ChkNdef()
672 *NdefMap->SendRecvLength = NdefMap->TempReceiveLength; in phFriNfc_MifareStdMap_ChkNdef()
673 NdefMap->SendRecvBuf[0] = NdefMap->StdMifareContainer.currentBlock; in phFriNfc_MifareStdMap_ChkNdef()
674 NdefMap->SendLength = MIFARE_MAX_SEND_BUF_TO_READ; in phFriNfc_MifareStdMap_ChkNdef()
677 status = phFriNfc_OvrHal_Transceive( NdefMap->LowerDevice, in phFriNfc_MifareStdMap_ChkNdef()
678 &NdefMap->MapCompletionInfo, in phFriNfc_MifareStdMap_ChkNdef()
679 NdefMap->psRemoteDevInfo, in phFriNfc_MifareStdMap_ChkNdef()
680 NdefMap->Cmd, in phFriNfc_MifareStdMap_ChkNdef()
681 &NdefMap->psDepAdditionalInfo, in phFriNfc_MifareStdMap_ChkNdef()
682 NdefMap->SendRecvBuf, in phFriNfc_MifareStdMap_ChkNdef()
683 NdefMap->SendLength, in phFriNfc_MifareStdMap_ChkNdef()
684 NdefMap->SendRecvBuf, in phFriNfc_MifareStdMap_ChkNdef()
685 NdefMap->SendRecvLength); in phFriNfc_MifareStdMap_ChkNdef()
709 NFCSTATUS phFriNfc_MifareStdMap_RdNdef( phFriNfc_NdefMap_t *NdefMap, in phFriNfc_MifareStdMap_RdNdef() argument
716 NdefMap->ApduBufferSize = *PacketDataLength; in phFriNfc_MifareStdMap_RdNdef()
717 NdefMap->NumOfBytesRead = PacketDataLength; in phFriNfc_MifareStdMap_RdNdef()
718 *NdefMap->NumOfBytesRead = 0; in phFriNfc_MifareStdMap_RdNdef()
719 NdefMap->ApduBuffIndex = 0; in phFriNfc_MifareStdMap_RdNdef()
720 NdefMap->PrevOperation = PH_FRINFC_NDEFMAP_READ_OPE; in phFriNfc_MifareStdMap_RdNdef()
721 NdefMap->StdMifareContainer.CRIndex = PH_FRINFC_NDEFMAP_CR_RD_NDEF; in phFriNfc_MifareStdMap_RdNdef()
723 if((NdefMap->CardState == PH_NDEFMAP_CARD_STATE_INVALID) in phFriNfc_MifareStdMap_RdNdef()
724 || (NdefMap->CardState == PH_NDEFMAP_CARD_STATE_INITIALIZED)) in phFriNfc_MifareStdMap_RdNdef()
732 if( (Offset == PH_FRINFC_NDEFMAP_SEEK_BEGIN) || ( NdefMap->PrevOperation == in phFriNfc_MifareStdMap_RdNdef()
735 phFriNfc_MifStd_H_RdWrReset(NdefMap); in phFriNfc_MifareStdMap_RdNdef()
736 NdefMap->StdMifareContainer.ReadNdefFlag = PH_FRINFC_MIFARESTD_FLAG1; in phFriNfc_MifareStdMap_RdNdef()
737 NdefMap->TLVStruct.NdefTLVFoundFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_RdNdef()
741 (NdefMap->StdMifareContainer.ReadWriteCompleteFlag == in phFriNfc_MifareStdMap_RdNdef()
748 NdefMap->Offset = (((Offset != PH_FRINFC_NDEFMAP_SEEK_BEGIN) && in phFriNfc_MifareStdMap_RdNdef()
749 ( NdefMap->PrevOperation == in phFriNfc_MifareStdMap_RdNdef()
753 status = phFriNfc_MifStd_H_BlkChk(NdefMap); in phFriNfc_MifareStdMap_RdNdef()
756 NdefMap->ApduBuffer = PacketData; in phFriNfc_MifareStdMap_RdNdef()
759 NdefMap->StdMifareContainer.ReadWriteCompleteFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_RdNdef()
763 ((NdefMap->StdMifareContainer.AuthDone == PH_FRINFC_MIFARESTD_FLAG1)? in phFriNfc_MifareStdMap_RdNdef()
764 phFriNfc_MifStd_H_RdABlock(NdefMap): in phFriNfc_MifareStdMap_RdNdef()
765 phFriNfc_MifStd_H_AuthSector(NdefMap)); in phFriNfc_MifareStdMap_RdNdef()
780 NFCSTATUS phFriNfc_MifareStdMap_WrNdef( phFriNfc_NdefMap_t *NdefMap, in phFriNfc_MifareStdMap_WrNdef() argument
787 NdefMap->ApduBuffer = PacketData; in phFriNfc_MifareStdMap_WrNdef()
788 NdefMap->ApduBufferSize = *PacketDataLength; in phFriNfc_MifareStdMap_WrNdef()
789 NdefMap->ApduBuffIndex = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifareStdMap_WrNdef()
790 NdefMap->WrNdefPacketLength = PacketDataLength; in phFriNfc_MifareStdMap_WrNdef()
791 *NdefMap->WrNdefPacketLength = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifareStdMap_WrNdef()
792 NdefMap->PrevOperation = PH_FRINFC_NDEFMAP_WRITE_OPE; in phFriNfc_MifareStdMap_WrNdef()
793 NdefMap->StdMifareContainer.CRIndex = PH_FRINFC_NDEFMAP_CR_WR_NDEF; in phFriNfc_MifareStdMap_WrNdef()
795 if((NdefMap->CardState == PH_NDEFMAP_CARD_STATE_INVALID) in phFriNfc_MifareStdMap_WrNdef()
796 || (NdefMap->CardState == PH_NDEFMAP_CARD_STATE_READ_ONLY)) in phFriNfc_MifareStdMap_WrNdef()
805 (NdefMap->PrevOperation == PH_FRINFC_NDEFMAP_READ_OPE)) in phFriNfc_MifareStdMap_WrNdef()
807 NdefMap->TLVStruct.NdefTLVFoundFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_WrNdef()
808 NdefMap->StdMifareContainer.RdBeforeWrFlag = PH_FRINFC_MIFARESTD_FLAG1; in phFriNfc_MifareStdMap_WrNdef()
809 NdefMap->StdMifareContainer.WrNdefFlag = PH_FRINFC_MIFARESTD_FLAG1; in phFriNfc_MifareStdMap_WrNdef()
810 NdefMap->StdMifareContainer.internalLength = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifareStdMap_WrNdef()
811 NdefMap->StdMifareContainer.RdAfterWrFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_WrNdef()
812 NdefMap->StdMifareContainer.AuthDone = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_WrNdef()
813 NdefMap->TLVStruct.NULLTLVCount = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifareStdMap_WrNdef()
814 NdefMap->TLVStruct.NdefTLVByte = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifareStdMap_WrNdef()
815 NdefMap->TLVStruct.NdefTLVAuthFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_WrNdef()
816 NdefMap->StdMifareContainer.FirstReadFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_WrNdef()
817 NdefMap->StdMifareContainer.remainingSize = in phFriNfc_MifareStdMap_WrNdef()
818 (NdefMap->StdMifareContainer.NoOfNdefCompBlocks * in phFriNfc_MifareStdMap_WrNdef()
820 NdefMap->StdMifareContainer.currentBlock = in phFriNfc_MifareStdMap_WrNdef()
822 NdefMap->StdMifareContainer.NdefBlocks = PH_FRINFC_MIFARESTD_VAL1; in phFriNfc_MifareStdMap_WrNdef()
823 NdefMap->StdMifareContainer.NFCforumSectFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_WrNdef()
833 NdefMap->StdMifareContainer.PollFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_WrNdef()
835 NdefMap->StdMifareContainer.PollFlag = PH_FRINFC_MIFARESTD_FLAG1; in phFriNfc_MifareStdMap_WrNdef()
837 NdefMap->StdMifareContainer.WrLength = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifareStdMap_WrNdef()
838 NdefMap->StdMifareContainer.FirstWriteFlag = PH_FRINFC_MIFARESTD_FLAG1; in phFriNfc_MifareStdMap_WrNdef()
842 (NdefMap->StdMifareContainer.ReadWriteCompleteFlag == in phFriNfc_MifareStdMap_WrNdef()
843 PH_FRINFC_MIFARESTD_FLAG1)) || ((NdefMap->StdMifareContainer.PollFlag == in phFriNfc_MifareStdMap_WrNdef()
852 NdefMap->Offset = (((Offset != PH_FRINFC_NDEFMAP_SEEK_BEGIN) && in phFriNfc_MifareStdMap_WrNdef()
853 ( NdefMap->PrevOperation == in phFriNfc_MifareStdMap_WrNdef()
857 NdefMap->StdMifareContainer.AuthDone = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_WrNdef()
858 status = phFriNfc_MifStd_H_BlkChk(NdefMap); in phFriNfc_MifareStdMap_WrNdef()
859 NdefMap->StdMifareContainer.ReadWriteCompleteFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_WrNdef()
862 if(NdefMap->StdMifareContainer.PollFlag == in phFriNfc_MifareStdMap_WrNdef()
867 status = phFriNfc_MifStd_H_CallDisCon(NdefMap); in phFriNfc_MifareStdMap_WrNdef()
870 else if(NdefMap->StdMifareContainer.AuthDone == PH_FRINFC_MIFARESTD_FLAG1) in phFriNfc_MifareStdMap_WrNdef()
872 status = ((NdefMap->Offset == in phFriNfc_MifareStdMap_WrNdef()
874 phFriNfc_MifStd_H_RdBeforeWr(NdefMap): in phFriNfc_MifareStdMap_WrNdef()
875 phFriNfc_MifStd_H_WrABlock(NdefMap)); in phFriNfc_MifareStdMap_WrNdef()
879 status = phFriNfc_MifStd_H_AuthSector(NdefMap); in phFriNfc_MifareStdMap_WrNdef()
900 phFriNfc_NdefMap_t *NdefMap; in phFriNfc_MifareStdMap_Process() local
908 NdefMap = (phFriNfc_NdefMap_t *)Context; in phFriNfc_MifareStdMap_Process()
912 switch(NdefMap->State) in phFriNfc_MifareStdMap_Process()
915 Status = phFriNfc_MifStd_H_ProChkNdef(NdefMap); in phFriNfc_MifareStdMap_Process()
924 if((*NdefMap->SendRecvLength == PH_FRINFC_MIFARESTD_BYTES_READ) && in phFriNfc_MifareStdMap_Process()
925 (NdefMap->ApduBuffIndex < (uint16_t)NdefMap->ApduBufferSize)) in phFriNfc_MifareStdMap_Process()
929 if(NdefMap->TLVStruct.BytesRemainLinTLV != 0) in phFriNfc_MifareStdMap_Process()
934 Status = phFriNfc_MifStd_H_RemainTLV(NdefMap, &NDEFFlag, &Temp16Bytes); in phFriNfc_MifareStdMap_Process()
945 (NdefMap->TLVStruct.NdefTLVFoundFlag == in phFriNfc_MifareStdMap_Process()
949 Status = phFriNfc_MifStd_H_RdNdefTLV(NdefMap, &Temp16Bytes); in phFriNfc_MifareStdMap_Process()
961 Status = phFriNfc_MifStd_H_ProWrABlock(NdefMap); in phFriNfc_MifareStdMap_Process()
969 *NdefMap->WrNdefPacketLength = NdefMap->ApduBuffIndex; in phFriNfc_MifareStdMap_Process()
974 NdefMap->StdMifareContainer.FirstReadFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_Process()
975 Status = phFriNfc_MifStd_H_ProAuth(NdefMap); in phFriNfc_MifareStdMap_Process()
982 Status = phFriNfc_MifStd_H_ProAcsBits(NdefMap); in phFriNfc_MifareStdMap_Process()
989 if(NdefMap->StdMifareContainer.RdAfterWrFlag == in phFriNfc_MifareStdMap_Process()
992 Status = phFriNfc_MifStd_H_CallWrNdefLen(NdefMap); in phFriNfc_MifareStdMap_Process()
1000 if(NdefMap->StdMifareContainer.TempBlockNo == in phFriNfc_MifareStdMap_Process()
1001 NdefMap->StdMifareContainer.currentBlock) in phFriNfc_MifareStdMap_Process()
1003 (void)memcpy( NdefMap->StdMifareContainer.internalBuf, in phFriNfc_MifareStdMap_Process()
1004 NdefMap->StdMifareContainer.Buffer, in phFriNfc_MifareStdMap_Process()
1005 NdefMap->StdMifareContainer.internalLength); in phFriNfc_MifareStdMap_Process()
1007 *NdefMap->WrNdefPacketLength = NdefMap->ApduBuffIndex; in phFriNfc_MifareStdMap_Process()
1008 NdefMap->StdMifareContainer.currentBlock = in phFriNfc_MifareStdMap_Process()
1009 NdefMap->StdMifareContainer.TempBlockNo; in phFriNfc_MifareStdMap_Process()
1010 NdefMap->CardState = (uint8_t)((NdefMap->CardState == in phFriNfc_MifareStdMap_Process()
1013 NdefMap->CardState); in phFriNfc_MifareStdMap_Process()
1029 if(*NdefMap->SendRecvLength == PH_FRINFC_MIFARESTD_BYTES_READ) in phFriNfc_MifareStdMap_Process()
1035 NdefMap->SendRecvBuf[i] = NdefMap->SendRecvBuf[i-1]; in phFriNfc_MifareStdMap_Process()
1037 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL0] = in phFriNfc_MifareStdMap_Process()
1038 NdefMap->StdMifareContainer.currentBlock; in phFriNfc_MifareStdMap_Process()
1039 Status = phFriNfc_MifStd_H_WriteNdefLen(NdefMap); in phFriNfc_MifareStdMap_Process()
1048 if(NdefMap->TLVStruct.NoLbytesinTLV > PH_FRINFC_MIFARESTD_VAL0) in phFriNfc_MifareStdMap_Process()
1051 Status = phFriNfc_MifStd_H_ChkRemainTLVs(NdefMap, &CRFlag, &NDEFFlag); in phFriNfc_MifareStdMap_Process()
1052 NdefMap->TLVStruct.NoLbytesinTLV = in phFriNfc_MifareStdMap_Process()
1058 Status = phFriNfc_MifStd_H_ChkTLVs(NdefMap, &CRFlag); in phFriNfc_MifareStdMap_Process()
1060 if(((NdefMap->StdMifareContainer.ReadNdefFlag == in phFriNfc_MifareStdMap_Process()
1062 (NdefMap->StdMifareContainer.WrNdefFlag == in phFriNfc_MifareStdMap_Process()
1066 NdefMap->StdMifareContainer.NFCforumSectFlag = in phFriNfc_MifareStdMap_Process()
1071 if(((NdefMap->StdMifareContainer.WrNdefFlag == in phFriNfc_MifareStdMap_Process()
1073 (NdefMap->CardState == PH_NDEFMAP_CARD_STATE_READ_ONLY)) || in phFriNfc_MifareStdMap_Process()
1074 ((NdefMap->StdMifareContainer.ReadNdefFlag == in phFriNfc_MifareStdMap_Process()
1076 (NdefMap->CardState == PH_NDEFMAP_CARD_STATE_INITIALIZED))) in phFriNfc_MifareStdMap_Process()
1081 if(NdefMap->StdMifareContainer.AuthDone == in phFriNfc_MifareStdMap_Process()
1084 Status = phFriNfc_MifStd_H_AuthSector(NdefMap); in phFriNfc_MifareStdMap_Process()
1088 Status = ((NdefMap->StdMifareContainer.ReadNdefFlag == in phFriNfc_MifareStdMap_Process()
1090 phFriNfc_MifStd_H_RdTLV(NdefMap): in phFriNfc_MifareStdMap_Process()
1091 phFriNfc_MifStd_H_RdBeforeWr(NdefMap)); in phFriNfc_MifareStdMap_Process()
1093 NdefMap->StdMifareContainer.ReadNdefFlag = in phFriNfc_MifareStdMap_Process()
1095 NdefMap->StdMifareContainer.WrNdefFlag = in phFriNfc_MifareStdMap_Process()
1099 if(NdefMap->StdMifareContainer.ChkNdefFlag == in phFriNfc_MifareStdMap_Process()
1110 Status = phFriNfc_MifStd_H_ProBytesToWr(NdefMap); in phFriNfc_MifareStdMap_Process()
1117 Status = phFriNfc_MifStd_H_ProWrTLV(NdefMap); in phFriNfc_MifareStdMap_Process()
1124 Status = phFriNfc_MifStd_H_ProRdTLV(NdefMap); in phFriNfc_MifareStdMap_Process()
1131 phFriNfc_MifStd_H_SetNdefBlkAuth(NdefMap); in phFriNfc_MifareStdMap_Process()
1132 NdefMap->StdMifareContainer.currentBlock = in phFriNfc_MifareStdMap_Process()
1133 NdefMap->TLVStruct.NdefTLVBlock; in phFriNfc_MifareStdMap_Process()
1134 Status = phFriNfc_MifStd_H_RdtoWrNdefLen(NdefMap); in phFriNfc_MifareStdMap_Process()
1141 NdefMap->StdMifareContainer.PollFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_Process()
1144 Status = phFriNfc_MifStd_H_CallPoll(NdefMap); in phFriNfc_MifareStdMap_Process()
1152 Status = phFriNfc_MifStd_H_CallConnect(NdefMap); in phFriNfc_MifareStdMap_Process()
1159 if(NdefMap->StdMifareContainer.FirstReadFlag == PH_FRINFC_MIFARESTD_FLAG1) in phFriNfc_MifareStdMap_Process()
1161 NdefMap->StdMifareContainer.FirstReadFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_Process()
1162 Status = phFriNfc_MifStd_H_AuthSector(NdefMap); in phFriNfc_MifareStdMap_Process()
1164 else if((NdefMap->CardType == PH_FRINFC_NDEFMAP_MIFARE_STD_1K_CARD || in phFriNfc_MifareStdMap_Process()
1165 NdefMap->CardType == PH_FRINFC_NDEFMAP_MIFARE_STD_4K_CARD) && in phFriNfc_MifareStdMap_Process()
1166 (NdefMap->StdMifareContainer.ReadOnlySectorIndex && in phFriNfc_MifareStdMap_Process()
1167NdefMap->StdMifareContainer.SectorTrailerBlockNo == NdefMap->StdMifareContainer.currentBlock)) in phFriNfc_MifareStdMap_Process()
1169 NdefMap->StdMifareContainer.ReadOnlySectorIndex = in phFriNfc_MifareStdMap_Process()
1171 NdefMap->StdMifareContainer.SectorTrailerBlockNo = in phFriNfc_MifareStdMap_Process()
1173 NdefMap->StdMifareContainer.currentBlock = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_Process()
1178 Status = ((((NdefMap->Offset == PH_FRINFC_NDEFMAP_SEEK_CUR) && in phFriNfc_MifareStdMap_Process()
1179 (NdefMap->PrevOperation == PH_FRINFC_NDEFMAP_WRITE_OPE)) || in phFriNfc_MifareStdMap_Process()
1180 (NdefMap->StdMifareContainer.WrLength > in phFriNfc_MifareStdMap_Process()
1182 phFriNfc_MifStd_H_ProStatNotValid(NdefMap, Status): in phFriNfc_MifareStdMap_Process()
1183 phFriNfc_MifStd_H_AuthSector(NdefMap)); in phFriNfc_MifareStdMap_Process()
1191 Status = phFriNfc_MifStd_H_ProSectorTrailorAcsBits(NdefMap); in phFriNfc_MifareStdMap_Process()
1196 (NdefMap->StdMifareContainer.WriteAcsBitFlag == PH_FRINFC_MIFARESTD_FLAG0)) in phFriNfc_MifareStdMap_Process()
1205 NdefMap->StdMifareContainer.WriteAcsBitFlag = PH_FRINFC_MIFARESTD_FLAG1; in phFriNfc_MifareStdMap_Process()
1209 if(NdefMap->CardState != PH_NDEFMAP_CARD_STATE_READ_ONLY) in phFriNfc_MifareStdMap_Process()
1211 … Status = phFriNfc_MapTool_SetCardState(NdefMap, NdefMap->TLVStruct.BytesRemainLinTLV); in phFriNfc_MifareStdMap_Process()
1220 Status = phFriNfc_MifStd_H_ProWrSectorTrailor(NdefMap); in phFriNfc_MifareStdMap_Process()
1234 else if(NdefMap->State == PH_FRINFC_NDEFMAP_STATE_AUTH) in phFriNfc_MifareStdMap_Process()
1236 NdefMap->StdMifareContainer.PollFlag = PH_FRINFC_MIFARESTD_FLAG1; in phFriNfc_MifareStdMap_Process()
1237 if(NdefMap->StdMifareContainer.FirstWriteFlag == in phFriNfc_MifareStdMap_Process()
1240 NdefMap->StdMifareContainer.FirstWriteFlag = in phFriNfc_MifareStdMap_Process()
1242 NdefMap->StdMifareContainer.WrLength = in phFriNfc_MifareStdMap_Process()
1243 ((NdefMap->StdMifareContainer.NFCforumSectFlag == in phFriNfc_MifareStdMap_Process()
1246 NdefMap->StdMifareContainer.WrLength); in phFriNfc_MifareStdMap_Process()
1256 else*/ if(NdefMap->StdMifareContainer.WrLength == PH_FRINFC_MIFARESTD_VAL0) in phFriNfc_MifareStdMap_Process()
1265 Status = phFriNfc_MifStd_H_CallDisCon(NdefMap); in phFriNfc_MifareStdMap_Process()
1280 phFriNfc_MifStd_H_Complete(NdefMap, Status); in phFriNfc_MifareStdMap_Process()
1284 static NFCSTATUS phFriNfc_MifStd_H_RdABlock(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_RdABlock() argument
1289 NdefMap->psDepAdditionalInfo.DepFlags.MetaChaining = 0; in phFriNfc_MifStd_H_RdABlock()
1290 NdefMap->psDepAdditionalInfo.DepFlags.NADPresent = 0; in phFriNfc_MifStd_H_RdABlock()
1291 NdefMap->psDepAdditionalInfo.NAD = 0; in phFriNfc_MifStd_H_RdABlock()
1293 NdefMap->State = PH_FRINFC_NDEFMAP_STATE_READ; in phFriNfc_MifStd_H_RdABlock()
1294 NdefMap->PrevOperation = PH_FRINFC_NDEFMAP_READ_OPE; in phFriNfc_MifStd_H_RdABlock()
1295 NdefMap->MapCompletionInfo.CompletionRoutine = phFriNfc_MifareStdMap_Process; in phFriNfc_MifStd_H_RdABlock()
1296 NdefMap->MapCompletionInfo.Context = NdefMap; in phFriNfc_MifStd_H_RdABlock()
1298 if( NdefMap->ApduBuffIndex < in phFriNfc_MifStd_H_RdABlock()
1299 (uint16_t)NdefMap->ApduBufferSize) in phFriNfc_MifStd_H_RdABlock()
1302 if(NdefMap->StdMifareContainer.internalLength > PH_FRINFC_MIFARESTD_VAL0) in phFriNfc_MifStd_H_RdABlock()
1304 status = phFriNfc_MifStd_H_ChkIntLen(NdefMap); in phFriNfc_MifStd_H_RdABlock()
1308 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL0] = in phFriNfc_MifStd_H_RdABlock()
1309 NdefMap->StdMifareContainer.currentBlock; in phFriNfc_MifStd_H_RdABlock()
1310 NdefMap->SendLength = MIFARE_MAX_SEND_BUF_TO_READ; in phFriNfc_MifStd_H_RdABlock()
1311 *NdefMap->SendRecvLength = NdefMap->TempReceiveLength; in phFriNfc_MifStd_H_RdABlock()
1314 NdefMap->Cmd.MfCmd = phHal_eMifareCmdListMifareRead; in phFriNfc_MifStd_H_RdABlock()
1316 NdefMap->Cmd.MfCmd = phHal_eMifareRead; in phFriNfc_MifStd_H_RdABlock()
1319 status = phFriNfc_OvrHal_Transceive( NdefMap->LowerDevice, in phFriNfc_MifStd_H_RdABlock()
1320 &NdefMap->MapCompletionInfo, in phFriNfc_MifStd_H_RdABlock()
1321 NdefMap->psRemoteDevInfo, in phFriNfc_MifStd_H_RdABlock()
1322 NdefMap->Cmd, in phFriNfc_MifStd_H_RdABlock()
1323 &NdefMap->psDepAdditionalInfo, in phFriNfc_MifStd_H_RdABlock()
1324 NdefMap->SendRecvBuf, in phFriNfc_MifStd_H_RdABlock()
1325 NdefMap->SendLength, in phFriNfc_MifStd_H_RdABlock()
1326 NdefMap->SendRecvBuf, in phFriNfc_MifStd_H_RdABlock()
1327 NdefMap->SendRecvLength); in phFriNfc_MifStd_H_RdABlock()
1333 if((((NdefMap->StdMifareContainer.NoOfNdefCompBlocks - in phFriNfc_MifStd_H_RdABlock()
1334 NdefMap->StdMifareContainer.NdefBlocks) * in phFriNfc_MifStd_H_RdABlock()
1336 (NdefMap->ApduBufferSize == NdefMap->ApduBuffIndex)) in phFriNfc_MifStd_H_RdABlock()
1338 NdefMap->StdMifareContainer.ReadWriteCompleteFlag = in phFriNfc_MifStd_H_RdABlock()
1339 (uint8_t)((((NdefMap->StdMifareContainer.NoOfNdefCompBlocks - in phFriNfc_MifStd_H_RdABlock()
1340 NdefMap->StdMifareContainer.NdefBlocks) * in phFriNfc_MifStd_H_RdABlock()
1344 *NdefMap->NumOfBytesRead = NdefMap->ApduBuffIndex; in phFriNfc_MifStd_H_RdABlock()
1363 static NFCSTATUS phFriNfc_MifStd_H_WrABlock(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_WrABlock() argument
1374 NdefMap->psDepAdditionalInfo.DepFlags.MetaChaining = 0; in phFriNfc_MifStd_H_WrABlock()
1375 NdefMap->psDepAdditionalInfo.DepFlags.NADPresent = 0; in phFriNfc_MifStd_H_WrABlock()
1376 NdefMap->psDepAdditionalInfo.NAD = 0; in phFriNfc_MifStd_H_WrABlock()
1377 NdefMap->MapCompletionInfo.CompletionRoutine = phFriNfc_MifareStdMap_Process; in phFriNfc_MifStd_H_WrABlock()
1378 NdefMap->MapCompletionInfo.Context = NdefMap; in phFriNfc_MifStd_H_WrABlock()
1379 NdefMap->PrevOperation = PH_FRINFC_NDEFMAP_WRITE_OPE; in phFriNfc_MifStd_H_WrABlock()
1381 NdefMap->State = PH_FRINFC_NDEFMAP_STATE_WRITE; in phFriNfc_MifStd_H_WrABlock()
1384 if( NdefMap->ApduBuffIndex < in phFriNfc_MifStd_H_WrABlock()
1385 (uint16_t)NdefMap->ApduBufferSize) in phFriNfc_MifStd_H_WrABlock()
1387 RemainingBytes = (((uint16_t)(NdefMap->ApduBufferSize - in phFriNfc_MifStd_H_WrABlock()
1388 NdefMap->ApduBuffIndex) < in phFriNfc_MifStd_H_WrABlock()
1389 NdefMap->StdMifareContainer.remainingSize )? in phFriNfc_MifStd_H_WrABlock()
1390 (uint16_t)(NdefMap->ApduBufferSize - in phFriNfc_MifStd_H_WrABlock()
1391 NdefMap->ApduBuffIndex): in phFriNfc_MifStd_H_WrABlock()
1392 NdefMap->StdMifareContainer.remainingSize); in phFriNfc_MifStd_H_WrABlock()
1394 NdefMap->SendRecvBuf[0] = NdefMap->StdMifareContainer.currentBlock; in phFriNfc_MifStd_H_WrABlock()
1398 if(NdefMap->StdMifareContainer.internalLength > 0) in phFriNfc_MifStd_H_WrABlock()
1401 (void)memcpy(&( NdefMap->SendRecvBuf[Temp16Bytes]), in phFriNfc_MifStd_H_WrABlock()
1402 NdefMap->StdMifareContainer.internalBuf, in phFriNfc_MifStd_H_WrABlock()
1403 NdefMap->StdMifareContainer.internalLength); in phFriNfc_MifStd_H_WrABlock()
1405 Temp16Bytes += (uint8_t)(NdefMap->StdMifareContainer.internalLength); in phFriNfc_MifStd_H_WrABlock()
1411 (void)memcpy(&(NdefMap->SendRecvBuf[Temp16Bytes]), in phFriNfc_MifStd_H_WrABlock()
1412 NdefMap->ApduBuffer, in phFriNfc_MifStd_H_WrABlock()
1415 NdefMap->NumOfBytesWritten = in phFriNfc_MifStd_H_WrABlock()
1418 *NdefMap->DataCount = (Temp16Bytes - PH_FRINFC_MIFARESTD_VAL1); in phFriNfc_MifStd_H_WrABlock()
1422 (void)memcpy(&(NdefMap->SendRecvBuf[Temp16Bytes]), in phFriNfc_MifStd_H_WrABlock()
1423 NdefMap->ApduBuffer, in phFriNfc_MifStd_H_WrABlock()
1426 NdefMap->StdMifareContainer.internalBufFlag = PH_FRINFC_MIFARESTD_FLAG1; in phFriNfc_MifStd_H_WrABlock()
1427 NdefMap->NumOfBytesWritten = RemainingBytes; in phFriNfc_MifStd_H_WrABlock()
1429 *NdefMap->DataCount = (Temp16Bytes - PH_FRINFC_MIFARESTD_VAL1); in phFriNfc_MifStd_H_WrABlock()
1435 NdefMap->SendRecvBuf[(Temp16Bytes + index)] = in phFriNfc_MifStd_H_WrABlock()
1439 NdefMap->TLVStruct.SetTermTLVFlag = PH_FRINFC_MIFARESTD_FLAG1; in phFriNfc_MifStd_H_WrABlock()
1450 (void)memcpy( &(NdefMap->SendRecvBuf[ in phFriNfc_MifStd_H_WrABlock()
1452 &(NdefMap->ApduBuffer[ in phFriNfc_MifStd_H_WrABlock()
1453 NdefMap->ApduBuffIndex]), in phFriNfc_MifStd_H_WrABlock()
1456 NdefMap->NumOfBytesWritten = (MIFARE_MAX_SEND_BUF_TO_WRITE - Temp16Bytes); in phFriNfc_MifStd_H_WrABlock()
1458 *NdefMap->DataCount = (Temp16Bytes - PH_FRINFC_MIFARESTD_VAL1); in phFriNfc_MifStd_H_WrABlock()
1464 (void)memcpy(&(NdefMap->SendRecvBuf[ in phFriNfc_MifStd_H_WrABlock()
1466 &(NdefMap->ApduBuffer[ in phFriNfc_MifStd_H_WrABlock()
1467 NdefMap->ApduBuffIndex]), in phFriNfc_MifStd_H_WrABlock()
1470 NdefMap->StdMifareContainer.RemainingBufFlag = PH_FRINFC_MIFARESTD_FLAG1; in phFriNfc_MifStd_H_WrABlock()
1471 NdefMap->NumOfBytesWritten = RemainingBytes; in phFriNfc_MifStd_H_WrABlock()
1473 *NdefMap->DataCount = (Temp16Bytes - PH_FRINFC_MIFARESTD_VAL1); in phFriNfc_MifStd_H_WrABlock()
1479 NdefMap->SendRecvBuf[index] = (uint8_t)((index == in phFriNfc_MifStd_H_WrABlock()
1484 NdefMap->TLVStruct.SetTermTLVFlag = PH_FRINFC_MIFARESTD_FLAG1; in phFriNfc_MifStd_H_WrABlock()
1489 (void)memcpy( NdefMap->StdMifareContainer.Buffer, in phFriNfc_MifStd_H_WrABlock()
1490 &(NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_INC_1]), in phFriNfc_MifStd_H_WrABlock()
1494 NdefMap->SendLength = MIFARE_MAX_SEND_BUF_TO_WRITE; in phFriNfc_MifStd_H_WrABlock()
1496 NdefMap->Cmd.MfCmd = phHal_eMifareCmdListMifareWrite16; in phFriNfc_MifStd_H_WrABlock()
1498 NdefMap->Cmd.MfCmd = phHal_eMifareWrite16; in phFriNfc_MifStd_H_WrABlock()
1500 *NdefMap->SendRecvLength = NdefMap->TempReceiveLength; in phFriNfc_MifStd_H_WrABlock()
1502 status = phFriNfc_OvrHal_Transceive( NdefMap->LowerDevice, in phFriNfc_MifStd_H_WrABlock()
1503 &NdefMap->MapCompletionInfo, in phFriNfc_MifStd_H_WrABlock()
1504 NdefMap->psRemoteDevInfo, in phFriNfc_MifStd_H_WrABlock()
1505 NdefMap->Cmd, in phFriNfc_MifStd_H_WrABlock()
1506 &NdefMap->psDepAdditionalInfo, in phFriNfc_MifStd_H_WrABlock()
1507 NdefMap->SendRecvBuf, in phFriNfc_MifStd_H_WrABlock()
1508 NdefMap->SendLength, in phFriNfc_MifStd_H_WrABlock()
1509 NdefMap->SendRecvBuf, in phFriNfc_MifStd_H_WrABlock()
1510 NdefMap->SendRecvLength); in phFriNfc_MifStd_H_WrABlock()
1514 if(NdefMap->StdMifareContainer.NdefBlocks > in phFriNfc_MifStd_H_WrABlock()
1515 NdefMap->StdMifareContainer.NoOfNdefCompBlocks) in phFriNfc_MifStd_H_WrABlock()
1517 NdefMap->StdMifareContainer.ReadWriteCompleteFlag = in phFriNfc_MifStd_H_WrABlock()
1522 else if( NdefMap->ApduBuffIndex == in phFriNfc_MifStd_H_WrABlock()
1523 (uint16_t)NdefMap->ApduBufferSize) in phFriNfc_MifStd_H_WrABlock()
1542 static NFCSTATUS phFriNfc_MifStd_H_AuthSector(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_AuthSector() argument
1547 NdefMap->psDepAdditionalInfo.DepFlags.MetaChaining = 0; in phFriNfc_MifStd_H_AuthSector()
1548 NdefMap->psDepAdditionalInfo.DepFlags.NADPresent = 0; in phFriNfc_MifStd_H_AuthSector()
1549 NdefMap->psDepAdditionalInfo.NAD = 0; in phFriNfc_MifStd_H_AuthSector()
1550 NdefMap->MapCompletionInfo.CompletionRoutine = phFriNfc_MifareStdMap_Process; in phFriNfc_MifStd_H_AuthSector()
1551 NdefMap->MapCompletionInfo.Context = NdefMap; in phFriNfc_MifStd_H_AuthSector()
1553 *NdefMap->SendRecvLength = NdefMap->TempReceiveLength; in phFriNfc_MifStd_H_AuthSector()
1554 NdefMap->State = PH_FRINFC_NDEFMAP_STATE_AUTH; in phFriNfc_MifStd_H_AuthSector()
1558 NdefMap->Cmd.MfCmd = phHal_eMifareCmdListMifareAuthentA; in phFriNfc_MifStd_H_AuthSector()
1560 NdefMap->Cmd.MfCmd = phHal_eMifareAuthentA; in phFriNfc_MifStd_H_AuthSector()
1562 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL0] = in phFriNfc_MifStd_H_AuthSector()
1563 ((NdefMap->TLVStruct.NdefTLVAuthFlag == in phFriNfc_MifStd_H_AuthSector()
1565 NdefMap->TLVStruct.NdefTLVBlock: in phFriNfc_MifStd_H_AuthSector()
1566 NdefMap->StdMifareContainer.currentBlock); in phFriNfc_MifStd_H_AuthSector()
1571 if(( (NdefMap->StdMifareContainer.currentBlock != PH_FRINFC_MIFARESTD_MAD_BLK0) && in phFriNfc_MifStd_H_AuthSector()
1572 (NdefMap->StdMifareContainer.currentBlock != PH_FRINFC_MIFARESTD_MAD_BLK1) && in phFriNfc_MifStd_H_AuthSector()
1573 (NdefMap->StdMifareContainer.currentBlock != PH_FRINFC_MIFARESTD_MAD_BLK2) && in phFriNfc_MifStd_H_AuthSector()
1574 (NdefMap->StdMifareContainer.currentBlock != PH_FRINFC_MIFARESTD_MAD_BLK64) && in phFriNfc_MifStd_H_AuthSector()
1575 (NdefMap->StdMifareContainer.currentBlock != PH_FRINFC_MIFARESTD_MAD_BLK65) && in phFriNfc_MifStd_H_AuthSector()
1576 (NdefMap->StdMifareContainer.currentBlock != PH_FRINFC_MIFARESTD_MAD_BLK66)) || in phFriNfc_MifStd_H_AuthSector()
1577 (NdefMap->TLVStruct.NdefTLVAuthFlag == in phFriNfc_MifStd_H_AuthSector()
1580 NdefMap->SendRecvBuf[1] = PH_FRINFC_NDEFMAP_MIFARESTD_AUTH_NDEFSECT1; /* 0xD3 */ in phFriNfc_MifStd_H_AuthSector()
1581 NdefMap->SendRecvBuf[2] = PH_FRINFC_NDEFMAP_MIFARESTD_AUTH_NDEFSECT2; /* 0xF7 */ in phFriNfc_MifStd_H_AuthSector()
1582 NdefMap->SendRecvBuf[3] = PH_FRINFC_NDEFMAP_MIFARESTD_AUTH_NDEFSECT1; /* 0xD3 */ in phFriNfc_MifStd_H_AuthSector()
1583 NdefMap->SendRecvBuf[4] = PH_FRINFC_NDEFMAP_MIFARESTD_AUTH_NDEFSECT2; /* 0xF7 */ in phFriNfc_MifStd_H_AuthSector()
1584 NdefMap->SendRecvBuf[5] = PH_FRINFC_NDEFMAP_MIFARESTD_AUTH_NDEFSECT1; /* 0xD3 */ in phFriNfc_MifStd_H_AuthSector()
1585 NdefMap->SendRecvBuf[6] = PH_FRINFC_NDEFMAP_MIFARESTD_AUTH_NDEFSECT2; /* 0xF7 */ in phFriNfc_MifStd_H_AuthSector()
1589 NdefMap->SendRecvBuf[1] = PH_FRINFC_NDEFMAP_MIFARESTD_AUTH_MADSECT1; /* 0xA0 */ in phFriNfc_MifStd_H_AuthSector()
1590 NdefMap->SendRecvBuf[2] = PH_FRINFC_NDEFMAP_MIFARESTD_AUTH_MADSECT2; /* 0xA1 */ in phFriNfc_MifStd_H_AuthSector()
1591 NdefMap->SendRecvBuf[3] = PH_FRINFC_NDEFMAP_MIFARESTD_AUTH_MADSECT3; /* 0xA2 */ in phFriNfc_MifStd_H_AuthSector()
1592 NdefMap->SendRecvBuf[4] = PH_FRINFC_NDEFMAP_MIFARESTD_AUTH_MADSECT4; /* 0xA3 */ in phFriNfc_MifStd_H_AuthSector()
1593 NdefMap->SendRecvBuf[5] = PH_FRINFC_NDEFMAP_MIFARESTD_AUTH_MADSECT5; /* 0xA4 */ in phFriNfc_MifStd_H_AuthSector()
1594 NdefMap->SendRecvBuf[6] = PH_FRINFC_NDEFMAP_MIFARESTD_AUTH_MADSECT6; /* 0xA5 */ in phFriNfc_MifStd_H_AuthSector()
1597 if (NdefMap->CardType == PH_FRINFC_NDEFMAP_MIFARE_STD_1K_CARD || in phFriNfc_MifStd_H_AuthSector()
1598 NdefMap->CardType == PH_FRINFC_NDEFMAP_MIFARE_STD_4K_CARD) in phFriNfc_MifStd_H_AuthSector()
1600 if (NdefMap->StdMifareContainer.ReadOnlySectorIndex && in phFriNfc_MifStd_H_AuthSector()
1601NdefMap->StdMifareContainer.SectorTrailerBlockNo == NdefMap->StdMifareContainer.currentBlock) in phFriNfc_MifStd_H_AuthSector()
1603 …memcpy (&NdefMap->SendRecvBuf[1], &NdefMap->StdMifareContainer.UserScrtKeyB[0], PH_FRINFC_MIFAREST… in phFriNfc_MifStd_H_AuthSector()
1607 NdefMap->Cmd.MfCmd = phHal_eMifareCmdListMifareAuthentB; in phFriNfc_MifStd_H_AuthSector()
1609 NdefMap->Cmd.MfCmd = phHal_eMifareAuthentB; in phFriNfc_MifStd_H_AuthSector()
1614 NdefMap->SendLength = MIFARE_AUTHENTICATE_CMD_LENGTH; in phFriNfc_MifStd_H_AuthSector()
1615 *NdefMap->SendRecvLength = NdefMap->TempReceiveLength; in phFriNfc_MifStd_H_AuthSector()
1617 status = phFriNfc_OvrHal_Transceive( NdefMap->LowerDevice, in phFriNfc_MifStd_H_AuthSector()
1618 &NdefMap->MapCompletionInfo, in phFriNfc_MifStd_H_AuthSector()
1619 NdefMap->psRemoteDevInfo, in phFriNfc_MifStd_H_AuthSector()
1620 NdefMap->Cmd, in phFriNfc_MifStd_H_AuthSector()
1621 &NdefMap->psDepAdditionalInfo, in phFriNfc_MifStd_H_AuthSector()
1622 NdefMap->SendRecvBuf, in phFriNfc_MifStd_H_AuthSector()
1623 NdefMap->SendLength, in phFriNfc_MifStd_H_AuthSector()
1624 NdefMap->SendRecvBuf, in phFriNfc_MifStd_H_AuthSector()
1625 NdefMap->SendRecvLength); in phFriNfc_MifStd_H_AuthSector()
1630 static void phFriNfc_MifStd_H_Complete(phFriNfc_NdefMap_t *NdefMap, in phFriNfc_MifStd_H_Complete() argument
1634 NdefMap->State = PH_FRINFC_NDEFMAP_STATE_RESET_INIT; in phFriNfc_MifStd_H_Complete()
1637 NdefMap->CompletionRoutine[NdefMap->StdMifareContainer.CRIndex]. in phFriNfc_MifStd_H_Complete()
1638 CompletionRoutine(NdefMap->CompletionRoutine->Context, Result); in phFriNfc_MifStd_H_Complete()
1641 static NFCSTATUS phFriNfc_MifStd4k_H_CheckNdef(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd4k_H_CheckNdef() argument
1646 if(NdefMap->StdMifareContainer.currentBlock == PH_FRINFC_MIFARESTD_MAD_BLK2) in phFriNfc_MifStd4k_H_CheckNdef()
1648 NdefMap->StdMifareContainer.currentBlock = PH_FRINFC_MIFARESTD_MAD_BLK64; in phFriNfc_MifStd4k_H_CheckNdef()
1649 NdefMap->StdMifareContainer.AuthDone = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifStd4k_H_CheckNdef()
1651 else if(NdefMap->StdMifareContainer.currentBlock == PH_FRINFC_MIFARESTD_MAD_BLK64) in phFriNfc_MifStd4k_H_CheckNdef()
1653 NdefMap->StdMifareContainer.currentBlock = PH_FRINFC_MIFARESTD_MAD_BLK65; in phFriNfc_MifStd4k_H_CheckNdef()
1657 NdefMap->StdMifareContainer.currentBlock = PH_FRINFC_MIFARESTD_MAD_BLK66; in phFriNfc_MifStd4k_H_CheckNdef()
1660 Result = phFriNfc_MifareStdMap_ChkNdef(NdefMap); in phFriNfc_MifStd4k_H_CheckNdef()
1666 static void phFriNfc_MifStd_H_fillAIDarray(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_fillAIDarray() argument
1670 if( (NdefMap->StdMifareContainer.currentBlock == PH_FRINFC_MIFARESTD_MAD_BLK1) || in phFriNfc_MifStd_H_fillAIDarray()
1671 (NdefMap->StdMifareContainer.currentBlock == PH_FRINFC_MIFARESTD_MAD_BLK64)) in phFriNfc_MifStd_H_fillAIDarray()
1676 NdefMap->StdMifareContainer.aid[NdefMap->StdMifareContainer.SectorIndex] = in phFriNfc_MifStd_H_fillAIDarray()
1678 NdefMap->StdMifareContainer.SectorIndex++; in phFriNfc_MifStd_H_fillAIDarray()
1684 if((NdefMap->SendRecvBuf[byteindex] == PH_FRINFC_NDEFMAP_MIFARESTD_NDEF_COMPVAL2) && in phFriNfc_MifStd_H_fillAIDarray()
1685 (NdefMap->SendRecvBuf[(byteindex + 1)] == PH_FRINFC_NDEFMAP_MIFARESTD_NDEF_COMPVAL1)) in phFriNfc_MifStd_H_fillAIDarray()
1689 NdefMap->StdMifareContainer.NFCforumSectFlag = PH_FRINFC_MIFARESTD_FLAG1; in phFriNfc_MifStd_H_fillAIDarray()
1690 NdefMap->StdMifareContainer.aid[NdefMap->StdMifareContainer.SectorIndex] = in phFriNfc_MifStd_H_fillAIDarray()
1692 NdefMap->StdMifareContainer.SectorIndex++; in phFriNfc_MifStd_H_fillAIDarray()
1696 NdefMap->StdMifareContainer.aid[NdefMap->StdMifareContainer.SectorIndex] = in phFriNfc_MifStd_H_fillAIDarray()
1698 NdefMap->StdMifareContainer.SectorIndex++; in phFriNfc_MifStd_H_fillAIDarray()
1702 NdefMap->StdMifareContainer.aidCompleteFlag = in phFriNfc_MifStd_H_fillAIDarray()
1703 ((NdefMap->StdMifareContainer.NFCforumSectFlag == in phFriNfc_MifStd_H_fillAIDarray()
1708 NdefMap->StdMifareContainer.NFCforumSectFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifStd_H_fillAIDarray()
1709 if(NdefMap->StdMifareContainer.aidCompleteFlag == PH_FRINFC_MIFARESTD_FLAG1) in phFriNfc_MifStd_H_fillAIDarray()
1719 if((NdefMap->StdMifareContainer.aidCompleteFlag == PH_FRINFC_MIFARESTD_FLAG1) && in phFriNfc_MifStd_H_fillAIDarray()
1720 (NdefMap->CardType == PH_FRINFC_NDEFMAP_MIFARE_STD_1K_CARD)) in phFriNfc_MifStd_H_fillAIDarray()
1724 for(byteindex = NdefMap->StdMifareContainer.SectorIndex; in phFriNfc_MifStd_H_fillAIDarray()
1728 NdefMap->StdMifareContainer.aid[byteindex] = in phFriNfc_MifStd_H_fillAIDarray()
1734 else if((NdefMap->StdMifareContainer.aidCompleteFlag == PH_FRINFC_MIFARESTD_FLAG1) && in phFriNfc_MifStd_H_fillAIDarray()
1735 (NdefMap->CardType == PH_FRINFC_NDEFMAP_MIFARE_STD_4K_CARD)) in phFriNfc_MifStd_H_fillAIDarray()
1737 for(byteindex = NdefMap->StdMifareContainer.SectorIndex; in phFriNfc_MifStd_H_fillAIDarray()
1741 NdefMap->StdMifareContainer.aid[byteindex] = in phFriNfc_MifStd_H_fillAIDarray()
1747 static NFCSTATUS phFriNfc_MifStd_H_BlkChk(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_BlkChk() argument
1755 SectorID = phFriNfc_MifStd_H_GetSect(NdefMap->StdMifareContainer.currentBlock); in phFriNfc_MifStd_H_BlkChk()
1758 if(NdefMap->CardType == PH_FRINFC_NDEFMAP_MIFARE_STD_1K_CARD) in phFriNfc_MifStd_H_BlkChk()
1763 SectorID = phFriNfc_MifStd_H_GetSect(NdefMap->StdMifareContainer.currentBlock); in phFriNfc_MifStd_H_BlkChk()
1771 phFriNfc_MifStd1k_H_BlkChk(NdefMap, SectorID, &callbreak); in phFriNfc_MifStd_H_BlkChk()
1784 else if(NdefMap->StdMifareContainer.currentBlock == PH_FRINFC_MIFARESTD_MAD_BLK64) in phFriNfc_MifStd_H_BlkChk()
1786 NdefMap->StdMifareContainer.currentBlock += PH_FRINFC_MIFARESTD_BLK4; in phFriNfc_MifStd_H_BlkChk()
1792 if(NdefMap->StdMifareContainer.currentBlock == PH_FRINFC_MIFARESTD_MAD_BLK63) in phFriNfc_MifStd_H_BlkChk()
1794 NdefMap->StdMifareContainer.currentBlock += PH_FRINFC_MIFARESTD_BLK4; in phFriNfc_MifStd_H_BlkChk()
1798 phFriNfc_MifStd1k_H_BlkChk(NdefMap, SectorID, &callbreak); in phFriNfc_MifStd_H_BlkChk()
1804 if(((NdefMap->StdMifareContainer.currentBlock + 1) % in phFriNfc_MifStd_H_BlkChk()
1807 NdefMap->StdMifareContainer.currentBlock++; in phFriNfc_MifStd_H_BlkChk()
1811 if(NdefMap->StdMifareContainer.aid[SectorID] == in phFriNfc_MifStd_H_BlkChk()
1820 if((NdefMap->StdMifareContainer.currentBlock == in phFriNfc_MifStd_H_BlkChk()
1823 (NdefMap->StdMifareContainer.internalLength == 0)) in phFriNfc_MifStd_H_BlkChk()
1825 NdefMap->StdMifareContainer.AuthDone = 0; in phFriNfc_MifStd_H_BlkChk()
1831 NdefMap->StdMifareContainer.currentBlock += 16; in phFriNfc_MifStd_H_BlkChk()
1862 static NFCSTATUS phFriNfc_MifStd_H_RdAcsBit(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_RdAcsBit() argument
1865 NdefMap->State = PH_FRINFC_NDEFMAP_STATE_RD_ACS_BIT; in phFriNfc_MifStd_H_RdAcsBit()
1867 if( NdefMap->StdMifareContainer.ReadOnlySectorIndex && in phFriNfc_MifStd_H_RdAcsBit()
1868 NdefMap->StdMifareContainer.currentBlock == NdefMap->StdMifareContainer.SectorTrailerBlockNo) in phFriNfc_MifStd_H_RdAcsBit()
1870 NdefMap->State = PH_FRINFC_NDEFMAP_STATE_RD_SEC_ACS_BIT; in phFriNfc_MifStd_H_RdAcsBit()
1873 if(NdefMap->StdMifareContainer.ReadAcsBitFlag == PH_FRINFC_MIFARESTD_FLAG1) in phFriNfc_MifStd_H_RdAcsBit()
1876 ((NdefMap->StdMifareContainer.currentBlock > 127)? in phFriNfc_MifStd_H_RdAcsBit()
1877 phFriNfc_MifStd_H_Get4kStTrail(NdefMap): in phFriNfc_MifStd_H_RdAcsBit()
1878 phFriNfc_MifStd_H_Get1kStTrail(NdefMap)); in phFriNfc_MifStd_H_RdAcsBit()
1883 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL0] = in phFriNfc_MifStd_H_RdAcsBit()
1884 NdefMap->StdMifareContainer.currentBlock; in phFriNfc_MifStd_H_RdAcsBit()
1887 Result = phFriNfc_MifStd_H_Rd16Bytes(NdefMap, in phFriNfc_MifStd_H_RdAcsBit()
1888 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL0]); in phFriNfc_MifStd_H_RdAcsBit()
1893 static NFCSTATUS phFriNfc_MifStd_H_ChkAcsBit(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_ChkAcsBit() argument
1898 if((NdefMap->StdMifareContainer.currentBlock == PH_FRINFC_MIFARESTD_MAD_BLK0) || in phFriNfc_MifStd_H_ChkAcsBit()
1899 (NdefMap->StdMifareContainer.currentBlock == PH_FRINFC_MIFARESTD_MAD_BLK1) || in phFriNfc_MifStd_H_ChkAcsBit()
1900 (NdefMap->StdMifareContainer.currentBlock == PH_FRINFC_MIFARESTD_MAD_BLK2) || in phFriNfc_MifStd_H_ChkAcsBit()
1901 (NdefMap->StdMifareContainer.currentBlock == PH_FRINFC_MIFARESTD_MAD_BLK3) || in phFriNfc_MifStd_H_ChkAcsBit()
1902 (NdefMap->StdMifareContainer.currentBlock == PH_FRINFC_MIFARESTD_MAD_BLK64) || in phFriNfc_MifStd_H_ChkAcsBit()
1903 (NdefMap->StdMifareContainer.currentBlock == PH_FRINFC_MIFARESTD_MAD_BLK65) || in phFriNfc_MifStd_H_ChkAcsBit()
1904 (NdefMap->StdMifareContainer.currentBlock == PH_FRINFC_MIFARESTD_MAD_BLK66) ) in phFriNfc_MifStd_H_ChkAcsBit()
1909 if(((NdefMap->SendRecvBuf[ in phFriNfc_MifStd_H_ChkAcsBit()
1913 ((NdefMap->SendRecvBuf[ in phFriNfc_MifStd_H_ChkAcsBit()
1917 ((NdefMap->SendRecvBuf[ in phFriNfc_MifStd_H_ChkAcsBit()
1922 NdefMap->StdMifareContainer.WriteFlag = in phFriNfc_MifStd_H_ChkAcsBit()
1924 NdefMap->StdMifareContainer.ReadFlag = in phFriNfc_MifStd_H_ChkAcsBit()
1929 NdefMap->StdMifareContainer.WriteFlag = in phFriNfc_MifStd_H_ChkAcsBit()
1931 NdefMap->StdMifareContainer.ReadFlag = in phFriNfc_MifStd_H_ChkAcsBit()
1937 NdefMap->CardState = PH_NDEFMAP_CARD_STATE_INITIALIZED; in phFriNfc_MifStd_H_ChkAcsBit()
1945 if(((NdefMap->SendRecvBuf[ in phFriNfc_MifStd_H_ChkAcsBit()
1949 ((NdefMap->SendRecvBuf[ in phFriNfc_MifStd_H_ChkAcsBit()
1953 ((NdefMap->SendRecvBuf[ in phFriNfc_MifStd_H_ChkAcsBit()
1958 NdefMap->StdMifareContainer.WriteFlag = in phFriNfc_MifStd_H_ChkAcsBit()
1960 NdefMap->StdMifareContainer.ReadFlag = in phFriNfc_MifStd_H_ChkAcsBit()
1963 else if(((NdefMap->SendRecvBuf[ in phFriNfc_MifStd_H_ChkAcsBit()
1967 ((NdefMap->SendRecvBuf[ in phFriNfc_MifStd_H_ChkAcsBit()
1971 ((NdefMap->SendRecvBuf[ in phFriNfc_MifStd_H_ChkAcsBit()
1979 NdefMap->StdMifareContainer.WriteFlag = in phFriNfc_MifStd_H_ChkAcsBit()
1981 NdefMap->StdMifareContainer.ReadFlag = in phFriNfc_MifStd_H_ChkAcsBit()
1986 NdefMap->StdMifareContainer.WriteFlag = in phFriNfc_MifStd_H_ChkAcsBit()
1988 NdefMap->StdMifareContainer.ReadFlag = in phFriNfc_MifStd_H_ChkAcsBit()
1998 Result = phFriNfc_MifStd_H_GPBChk(NdefMap); in phFriNfc_MifStd_H_ChkAcsBit()
2006 Result = phFriNfc_MifStd_H_GPBChk(NdefMap); in phFriNfc_MifStd_H_ChkAcsBit()
2013 static NFCSTATUS phFriNfc_MifStd_H_ChkRdWr(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_ChkRdWr() argument
2016 switch(NdefMap->PrevOperation) in phFriNfc_MifStd_H_ChkRdWr()
2019 if(NdefMap->CardState == in phFriNfc_MifStd_H_ChkRdWr()
2026 else if((NdefMap->StdMifareContainer.currentBlock > 3) && in phFriNfc_MifStd_H_ChkRdWr()
2027 (NdefMap->StdMifareContainer.ChkNdefCompleteFlag == in phFriNfc_MifStd_H_ChkRdWr()
2029 (NdefMap->StdMifareContainer.currentBlock != in phFriNfc_MifStd_H_ChkRdWr()
2031 (NdefMap->StdMifareContainer.currentBlock != in phFriNfc_MifStd_H_ChkRdWr()
2047 Result = ((NdefMap->StdMifareContainer.ReadAcsBitFlag == in phFriNfc_MifStd_H_ChkRdWr()
2049 phFriNfc_MifStd_H_RdAcsBit(NdefMap): in phFriNfc_MifStd_H_ChkRdWr()
2050 phFriNfc_MifStd_H_AuthSector(NdefMap)); in phFriNfc_MifStd_H_ChkRdWr()
2054 Result = phFriNfc_MifareStdMap_ChkNdef(NdefMap); in phFriNfc_MifStd_H_ChkRdWr()
2059 if(NdefMap->CardState == in phFriNfc_MifStd_H_ChkRdWr()
2066 else if(NdefMap->StdMifareContainer.ReadNdefFlag == in phFriNfc_MifStd_H_ChkRdWr()
2069 Result = phFriNfc_MifStd_H_GetActCardLen(NdefMap); in phFriNfc_MifStd_H_ChkRdWr()
2073 Result = phFriNfc_MifStd_H_RdABlock(NdefMap); in phFriNfc_MifStd_H_ChkRdWr()
2078 if((NdefMap->CardState == in phFriNfc_MifStd_H_ChkRdWr()
2080 (NdefMap->CardState == in phFriNfc_MifStd_H_ChkRdWr()
2087 else if(NdefMap->StdMifareContainer.WrNdefFlag == in phFriNfc_MifStd_H_ChkRdWr()
2090 Result = phFriNfc_MifStd_H_GetActCardLen(NdefMap); in phFriNfc_MifStd_H_ChkRdWr()
2092 else if(NdefMap->StdMifareContainer.RdBeforeWrFlag == in phFriNfc_MifStd_H_ChkRdWr()
2097 Result = phFriNfc_MifStd_H_RdBeforeWr(NdefMap); in phFriNfc_MifStd_H_ChkRdWr()
2099 else if(NdefMap->StdMifareContainer.RdAfterWrFlag == in phFriNfc_MifStd_H_ChkRdWr()
2102 Result = phFriNfc_MifStd_H_RdtoWrNdefLen(NdefMap); in phFriNfc_MifStd_H_ChkRdWr()
2106 Result = (((NdefMap->TLVStruct.NdefTLVBlock == in phFriNfc_MifStd_H_ChkRdWr()
2107 NdefMap->StdMifareContainer.currentBlock) && in phFriNfc_MifStd_H_ChkRdWr()
2108 (NdefMap->Offset == in phFriNfc_MifStd_H_ChkRdWr()
2110 phFriNfc_MifStd_H_RdBeforeWr(NdefMap): in phFriNfc_MifStd_H_ChkRdWr()
2111 phFriNfc_MifStd_H_WrABlock(NdefMap)); in phFriNfc_MifStd_H_ChkRdWr()
2116 Result = ((NdefMap->StdMifareContainer.ReadFlag == in phFriNfc_MifStd_H_ChkRdWr()
2120 phFriNfc_MifStd_H_GetActCardLen(NdefMap)); in phFriNfc_MifStd_H_ChkRdWr()
2133 static void phFriNfc_MifStd_H_ChkNdefCmpltSects(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_ChkNdefCmpltSects() argument
2136 if(NdefMap->CardType == PH_FRINFC_NDEFMAP_MIFARE_STD_4K_CARD) in phFriNfc_MifStd_H_ChkNdefCmpltSects()
2145 && (NdefMap->StdMifareContainer.aid[index] == in phFriNfc_MifStd_H_ChkNdefCmpltSects()
2149 NdefMap->StdMifareContainer.NoOfNdefCompBlocks -= in phFriNfc_MifStd_H_ChkNdefCmpltSects()
2156 if(NdefMap->StdMifareContainer.aid[index] == in phFriNfc_MifStd_H_ChkNdefCmpltSects()
2160 NdefMap->StdMifareContainer.NoOfNdefCompBlocks -= in phFriNfc_MifStd_H_ChkNdefCmpltSects()
2172 if(NdefMap->StdMifareContainer.aid[index] == in phFriNfc_MifStd_H_ChkNdefCmpltSects()
2178 NdefMap->StdMifareContainer.NoOfNdefCompBlocks -= in phFriNfc_MifStd_H_ChkNdefCmpltSects()
2186 static uint8_t phFriNfc_MifStd_H_ChkNdefLen(phFriNfc_NdefMap_t *NdefMap,
2194 TempLength = ((NdefMap->StdMifareContainer.internalLength > 0)?
2195 NdefMap->StdMifareContainer.internalLength :
2198 if(NdefMap->StdMifareContainer.internalLength > 0)
2201 NdefMap->StdMifareContainer.internalBuf,
2207 NdefMap->SendRecvBuf,
2212 if(NdefMap->TLVStruct.NoLbytesinTLV != PH_FRINFC_MIFARESTD_VAL0)
2214 switch(NdefMap->TLVStruct.NoLbytesinTLV)
2220 NdefMap->TLVStruct.BytesRemainLinTLV = *TempBuffer;
2221 NdefMap->TLVStruct.BytesRemainLinTLV =
2222 ((NdefMap->TLVStruct.BytesRemainLinTLV
2226 *CRFlag = (uint8_t)((NdefMap->TLVStruct.BytesRemainLinTLV <
2230 NdefMap->TLVStruct.BytesRemainLinTLV = ((*CRFlag ==
2233 NdefMap->TLVStruct.BytesRemainLinTLV);
2240 NdefMap->TLVStruct.BytesRemainLinTLV =
2241 NdefMap->TLVStruct.prevLenByteValue;
2243 NdefMap->TLVStruct.BytesRemainLinTLV =
2244 ((NdefMap->TLVStruct.BytesRemainLinTLV
2246 *CRFlag = (uint8_t)((NdefMap->TLVStruct.BytesRemainLinTLV <
2251 NdefMap->TLVStruct.BytesRemainLinTLV = ((*CRFlag ==
2254 NdefMap->TLVStruct.BytesRemainLinTLV);
2260 NdefMap->TLVStruct.NoLbytesinTLV = PH_FRINFC_MIFARESTD_NDEFTLV_LBYTES0;
2261 NdefMap->TLVStruct.TcheckedinTLVFlag = PH_FRINFC_MIFARESTD_FLAG0;
2262 NdefMap->TLVStruct.LcheckedinTLVFlag = PH_FRINFC_MIFARESTD_FLAG0;
2269 NdefMap->TLVStruct.BytesRemainLinTLV =
2273 NdefMap->TLVStruct.TcheckedinTLVFlag = (((NDEFlength + PH_FRINFC_MIFARESTD_INC_1)
2278 NdefMap->TLVStruct.LcheckedinTLVFlag = (((NDEFlength + PH_FRINFC_MIFARESTD_INC_1)
2290 NdefMap->TLVStruct.NoLbytesinTLV = PH_FRINFC_MIFARESTD_VAL2;
2292 NdefMap->TLVStruct.TcheckedinTLVFlag = PH_FRINFC_MIFARESTD_FLAG1;
2293 NdefMap->TLVStruct.LcheckedinTLVFlag = PH_FRINFC_MIFARESTD_FLAG0;
2300 NdefMap->TLVStruct.NoLbytesinTLV = PH_FRINFC_MIFARESTD_VAL1;
2302 NdefMap->TLVStruct.TcheckedinTLVFlag = PH_FRINFC_MIFARESTD_FLAG1;
2303 NdefMap->TLVStruct.LcheckedinTLVFlag = PH_FRINFC_MIFARESTD_FLAG0;
2305 NdefMap->TLVStruct.prevLenByteValue =
2306 NdefMap->SendRecvBuf[(NDEFlength + PH_FRINFC_MIFARESTD_INC_1)];
2311 NdefMap->TLVStruct.TcheckedinTLVFlag = (((NDEFlength + PH_FRINFC_MIFARESTD_INC_3)
2317 NdefMap->TLVStruct.LcheckedinTLVFlag = (((NDEFlength + PH_FRINFC_MIFARESTD_INC_1)
2323 NdefMap->TLVStruct.NoLbytesinTLV = PH_FRINFC_MIFARESTD_VAL0;
2327 NdefMap->TLVStruct.BytesRemainLinTLV =
2331 NdefMap->TLVStruct.BytesRemainLinTLV =
2332 ((NdefMap->TLVStruct.BytesRemainLinTLV
2336 *CRFlag = (uint8_t)((NdefMap->TLVStruct.BytesRemainLinTLV <
2346 static NFCSTATUS phFriNfc_MifStd_H_RdNdefTLV(phFriNfc_NdefMap_t *NdefMap,
2355 while(PH_FRINFC_MIFARESTD_FLAG1 == NdefMap->TLVStruct.NdefTLVFoundFlag)
2357 RemainingBytes = ((uint16_t)NdefMap->ApduBufferSize -
2358 NdefMap->ApduBuffIndex);
2359 if(((( NdefMap->StdMifareContainer.NoOfNdefCompBlocks -
2360 NdefMap->StdMifareContainer.NdefBlocks) *
2368 RemainingBytes = ((( NdefMap->StdMifareContainer.NoOfNdefCompBlocks -
2369 NdefMap->StdMifareContainer.NdefBlocks) * 16) +
2370 NdefMap->StdMifareContainer.internalLength);
2374 NdefMap->TLVStruct.NdefTLVFoundFlag = PH_FRINFC_MIFARESTD_FLAG0;
2376 if((NdefMap->TLVStruct.TcheckedinTLVFlag != PH_FRINFC_MIFARESTD_FLAG1) &&
2377 (NdefMap->TLVStruct.LcheckedinTLVFlag != PH_FRINFC_MIFARESTD_FLAG1) &&
2378 (NdefMap->TLVStruct.NoLbytesinTLV != PH_FRINFC_MIFARESTD_NDEFTLV_LBYTES0))
2388 if(NdefMap->TLVStruct.TcheckedinTLVFlag != PH_FRINFC_MIFARESTD_FLAG1)
2390 CRFlag = ((NdefMap->SendRecvBuf[(*Temp16Bytes)]!=
2397 NdefMap->StdMifareContainer.ReadWriteCompleteFlag =
2407 NdefMap->TLVStruct.TcheckedinTLVFlag = PH_FRINFC_MIFARESTD_FLAG0;
2412 NdefMap->TLVStruct.NdefTLVFoundFlag = PH_FRINFC_MIFARESTD_FLAG1;
2413 NdefMap->TLVStruct.TcheckedinTLVFlag = PH_FRINFC_MIFARESTD_FLAG1;
2415 NdefMap->StdMifareContainer.currentBlock++;
2416 NdefMap->StdMifareContainer.NdefBlocks++;
2417 Result = phFriNfc_MifStd_H_BlkChk(NdefMap);
2420 if(NdefMap->StdMifareContainer.AuthDone == PH_FRINFC_MIFARESTD_FLAG1)
2422 Result = phFriNfc_MifStd_H_RdABlock(NdefMap);
2426 Result = phFriNfc_MifStd_H_AuthSector(NdefMap);
2432 if(NdefMap->TLVStruct.LcheckedinTLVFlag != PH_FRINFC_MIFARESTD_FLAG1)
2442 *Temp16Bytes += phFriNfc_MifStd_H_ChkNdefLen(NdefMap,
2447 NdefMap->StdMifareContainer.ReadWriteCompleteFlag =
2455 NdefMap->TLVStruct.LcheckedinTLVFlag = PH_FRINFC_MIFARESTD_FLAG0;
2460 NdefMap->TLVStruct.NdefTLVFoundFlag = PH_FRINFC_MIFARESTD_FLAG1;
2461 NdefMap->TLVStruct.TcheckedinTLVFlag = PH_FRINFC_MIFARESTD_FLAG1;
2463 NdefMap->StdMifareContainer.currentBlock++;
2464 NdefMap->StdMifareContainer.NdefBlocks++;
2465 Result = phFriNfc_MifStd_H_BlkChk(NdefMap);
2468 if(NdefMap->StdMifareContainer.AuthDone == PH_FRINFC_MIFARESTD_FLAG1)
2470 Result = phFriNfc_MifStd_H_RdABlock(NdefMap);
2474 Result = phFriNfc_MifStd_H_AuthSector(NdefMap);
2480 if((NdefMap->TLVStruct.BytesRemainLinTLV <=
2483 NdefMap->TLVStruct.BytesRemainLinTLV))
2486 (void)memcpy(&(NdefMap->ApduBuffer[
2487 NdefMap->ApduBuffIndex]),
2488 &(NdefMap->SendRecvBuf[
2491 NdefMap->ApduBuffIndex += RemainingBytes;
2493 NdefMap->TLVStruct.BytesRemainLinTLV -= RemainingBytes;
2495 if(NdefMap->TLVStruct.BytesRemainLinTLV == 0)
2497 NdefMap->TLVStruct.NdefTLVFoundFlag = PH_FRINFC_MIFARESTD_FLAG1;
2498 NdefMap->TLVStruct.TcheckedinTLVFlag = PH_FRINFC_MIFARESTD_FLAG0;
2499 NdefMap->TLVStruct.LcheckedinTLVFlag = PH_FRINFC_MIFARESTD_FLAG0;
2505 (void)memcpy(NdefMap->StdMifareContainer.internalBuf,
2506 &(NdefMap->SendRecvBuf[(*Temp16Bytes)]),
2510 NdefMap->StdMifareContainer.internalLength =
2516 else if((NdefMap->TLVStruct.BytesRemainLinTLV <=
2519 NdefMap->TLVStruct.BytesRemainLinTLV))
2522 (void)memcpy(&(NdefMap->ApduBuffer[
2523 NdefMap->ApduBuffIndex]),
2524 &(NdefMap->SendRecvBuf[
2526 NdefMap->TLVStruct.BytesRemainLinTLV);
2528 NdefMap->ApduBuffIndex += NdefMap->TLVStruct.BytesRemainLinTLV;
2529 *Temp16Bytes += ((uint8_t)NdefMap->TLVStruct.BytesRemainLinTLV);
2530 NdefMap->TLVStruct.BytesRemainLinTLV = 0;
2531 NdefMap->TLVStruct.NdefTLVFoundFlag = PH_FRINFC_MIFARESTD_FLAG1;
2532 NdefMap->TLVStruct.TcheckedinTLVFlag = PH_FRINFC_MIFARESTD_FLAG0;
2533 NdefMap->TLVStruct.LcheckedinTLVFlag = PH_FRINFC_MIFARESTD_FLAG0;
2539 NdefMap->StdMifareContainer.currentBlock++;
2540 NdefMap->StdMifareContainer.NdefBlocks++;
2541 Result = phFriNfc_MifStd_H_BlkChk(NdefMap);
2544 if(NdefMap->StdMifareContainer.AuthDone == PH_FRINFC_MIFARESTD_FLAG1)
2546 Result = phFriNfc_MifStd_H_RdABlock(NdefMap);
2550 Result = phFriNfc_MifStd_H_AuthSector(NdefMap);
2556 else if((NdefMap->TLVStruct.BytesRemainLinTLV >
2562 (void)memcpy(&(NdefMap->ApduBuffer[
2563 NdefMap->ApduBuffIndex]),
2564 &(NdefMap->SendRecvBuf[
2567 NdefMap->ApduBuffIndex += RemainingBytes;
2568 NdefMap->TLVStruct.BytesRemainLinTLV -= RemainingBytes;
2571 NdefMap->StdMifareContainer.ReadWriteCompleteFlag = (uint8_t)
2572 (((NdefMap->StdMifareContainer.remainingSize == PH_FRINFC_MIFARESTD_VAL0) ||
2573 (NdefMap->TLVStruct.BytesRemainLinTLV == PH_FRINFC_MIFARESTD_VAL0))?
2578 NdefMap->StdMifareContainer.currentBlock++;
2579 NdefMap->StdMifareContainer.NdefBlocks++;
2585 (void)memcpy(NdefMap->StdMifareContainer.internalBuf,
2586 &(NdefMap->SendRecvBuf[((*Temp16Bytes) + RemainingBytes)]),
2591 NdefMap->StdMifareContainer.internalLength =
2601 if((NdefMap->TLVStruct.BytesRemainLinTLV >
2607 (void)memcpy(&(NdefMap->ApduBuffer[
2608 NdefMap->ApduBuffIndex]),
2609 &(NdefMap->SendRecvBuf[
2612 NdefMap->ApduBuffIndex += (PH_FRINFC_MIFARESTD_BYTES_READ - *Temp16Bytes);
2613 NdefMap->TLVStruct.BytesRemainLinTLV -=
2619 NdefMap->StdMifareContainer.currentBlock++;
2620 NdefMap->StdMifareContainer.NdefBlocks++;
2621 Result = phFriNfc_MifStd_H_BlkChk(NdefMap);
2624 Result = ((NdefMap->StdMifareContainer.AuthDone ==
2626 phFriNfc_MifStd_H_RdABlock(NdefMap):
2627 phFriNfc_MifStd_H_AuthSector(NdefMap));
2637 (NdefMap->ApduBuffIndex == PH_FRINFC_MIFARESTD_VAL0))?
2641 *NdefMap->NumOfBytesRead = NdefMap->ApduBuffIndex;
2642 phFriNfc_MifStd_H_Complete(NdefMap, Result);
2648 static NFCSTATUS phFriNfc_MifStd_H_RemainTLV(phFriNfc_NdefMap_t *NdefMap, in phFriNfc_MifStd_H_RemainTLV() argument
2656 RemainingBytes = ((uint16_t)NdefMap->ApduBufferSize - in phFriNfc_MifStd_H_RemainTLV()
2657 NdefMap->ApduBuffIndex); in phFriNfc_MifStd_H_RemainTLV()
2659 if(NdefMap->StdMifareContainer.remainingSize < in phFriNfc_MifStd_H_RemainTLV()
2665 RemainingBytes = NdefMap->StdMifareContainer.remainingSize; in phFriNfc_MifStd_H_RemainTLV()
2669 if((NdefMap->TLVStruct.BytesRemainLinTLV <= in phFriNfc_MifStd_H_RemainTLV()
2671 (RemainingBytes <= NdefMap->TLVStruct.BytesRemainLinTLV)) in phFriNfc_MifStd_H_RemainTLV()
2674 (void)memcpy(&(NdefMap->ApduBuffer[ in phFriNfc_MifStd_H_RemainTLV()
2675 NdefMap->ApduBuffIndex]), in phFriNfc_MifStd_H_RemainTLV()
2676 &(NdefMap->SendRecvBuf[ in phFriNfc_MifStd_H_RemainTLV()
2679 NdefMap->ApduBuffIndex += RemainingBytes; in phFriNfc_MifStd_H_RemainTLV()
2680 NdefMap->StdMifareContainer.remainingSize -= RemainingBytes; in phFriNfc_MifStd_H_RemainTLV()
2684 if(RemainingBytes != NdefMap->TLVStruct.BytesRemainLinTLV) in phFriNfc_MifStd_H_RemainTLV()
2686 (void)memcpy( NdefMap->StdMifareContainer.internalBuf, in phFriNfc_MifStd_H_RemainTLV()
2688 &(NdefMap->SendRecvBuf[((*Temp16Bytes) + RemainingBytes)]), in phFriNfc_MifStd_H_RemainTLV()
2690 &(NdefMap->SendRecvBuf[RemainingBytes]), in phFriNfc_MifStd_H_RemainTLV()
2696 NdefMap->StdMifareContainer.internalLength = in phFriNfc_MifStd_H_RemainTLV()
2702 NdefMap->TLVStruct.BytesRemainLinTLV -= RemainingBytes; in phFriNfc_MifStd_H_RemainTLV()
2704 if(NdefMap->StdMifareContainer.internalLength == PH_FRINFC_MIFARESTD_VAL0) in phFriNfc_MifStd_H_RemainTLV()
2706 NdefMap->StdMifareContainer.ReadWriteCompleteFlag = (uint8_t) in phFriNfc_MifStd_H_RemainTLV()
2707 (((NdefMap->StdMifareContainer.remainingSize == PH_FRINFC_MIFARESTD_VAL0) || in phFriNfc_MifStd_H_RemainTLV()
2708 (NdefMap->TLVStruct.BytesRemainLinTLV == PH_FRINFC_MIFARESTD_VAL0))? in phFriNfc_MifStd_H_RemainTLV()
2713 NdefMap->StdMifareContainer.currentBlock++; in phFriNfc_MifStd_H_RemainTLV()
2714 NdefMap->StdMifareContainer.NdefBlocks++; in phFriNfc_MifStd_H_RemainTLV()
2717 if(NdefMap->TLVStruct.BytesRemainLinTLV == PH_FRINFC_MIFARESTD_VAL0) in phFriNfc_MifStd_H_RemainTLV()
2721 NdefMap->TLVStruct.NdefTLVFoundFlag = PH_FRINFC_MIFARESTD_FLAG1; in phFriNfc_MifStd_H_RemainTLV()
2722 NdefMap->TLVStruct.LcheckedinTLVFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifStd_H_RemainTLV()
2723 NdefMap->TLVStruct.TcheckedinTLVFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifStd_H_RemainTLV()
2729 else if((NdefMap->TLVStruct.BytesRemainLinTLV <= in phFriNfc_MifStd_H_RemainTLV()
2731 (RemainingBytes > NdefMap->TLVStruct.BytesRemainLinTLV)) in phFriNfc_MifStd_H_RemainTLV()
2734 (void)memcpy(&(NdefMap->ApduBuffer[ in phFriNfc_MifStd_H_RemainTLV()
2735 NdefMap->ApduBuffIndex]), in phFriNfc_MifStd_H_RemainTLV()
2736 &(NdefMap->SendRecvBuf[ in phFriNfc_MifStd_H_RemainTLV()
2738 NdefMap->TLVStruct.BytesRemainLinTLV); in phFriNfc_MifStd_H_RemainTLV()
2739 NdefMap->ApduBuffIndex += NdefMap->TLVStruct.BytesRemainLinTLV; in phFriNfc_MifStd_H_RemainTLV()
2740 NdefMap->StdMifareContainer.remainingSize -= in phFriNfc_MifStd_H_RemainTLV()
2741 NdefMap->TLVStruct.BytesRemainLinTLV; in phFriNfc_MifStd_H_RemainTLV()
2742 NdefMap->TLVStruct.NdefTLVFoundFlag = PH_FRINFC_MIFARESTD_FLAG1; in phFriNfc_MifStd_H_RemainTLV()
2743 *Temp16Bytes += ((uint8_t)NdefMap->TLVStruct.BytesRemainLinTLV); in phFriNfc_MifStd_H_RemainTLV()
2744 NdefMap->TLVStruct.BytesRemainLinTLV = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifStd_H_RemainTLV()
2748 NdefMap->TLVStruct.LcheckedinTLVFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifStd_H_RemainTLV()
2749 NdefMap->TLVStruct.TcheckedinTLVFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifStd_H_RemainTLV()
2751 if(NdefMap->TLVStruct.BytesRemainLinTLV == in phFriNfc_MifStd_H_RemainTLV()
2755 NdefMap->TLVStruct.BytesRemainLinTLV = in phFriNfc_MifStd_H_RemainTLV()
2757 NdefMap->StdMifareContainer.currentBlock++; in phFriNfc_MifStd_H_RemainTLV()
2758 NdefMap->StdMifareContainer.NdefBlocks++; in phFriNfc_MifStd_H_RemainTLV()
2759 Result = phFriNfc_MifStd_H_BlkChk(NdefMap); in phFriNfc_MifStd_H_RemainTLV()
2762 if(NdefMap->StdMifareContainer.AuthDone == PH_FRINFC_MIFARESTD_FLAG1) in phFriNfc_MifStd_H_RemainTLV()
2764 Result = phFriNfc_MifStd_H_RdABlock(NdefMap); in phFriNfc_MifStd_H_RemainTLV()
2768 Result = phFriNfc_MifStd_H_AuthSector(NdefMap); in phFriNfc_MifStd_H_RemainTLV()
2774 NdefMap->TLVStruct.BytesRemainLinTLV = in phFriNfc_MifStd_H_RemainTLV()
2781 else if((NdefMap->TLVStruct.BytesRemainLinTLV > in phFriNfc_MifStd_H_RemainTLV()
2786 (void)memcpy(&(NdefMap->ApduBuffer[ in phFriNfc_MifStd_H_RemainTLV()
2787 NdefMap->ApduBuffIndex]), in phFriNfc_MifStd_H_RemainTLV()
2788 &(NdefMap->SendRecvBuf[ in phFriNfc_MifStd_H_RemainTLV()
2791 NdefMap->ApduBuffIndex += RemainingBytes; in phFriNfc_MifStd_H_RemainTLV()
2792 NdefMap->StdMifareContainer.remainingSize -= RemainingBytes; in phFriNfc_MifStd_H_RemainTLV()
2795 NdefMap->TLVStruct.BytesRemainLinTLV -= RemainingBytes; in phFriNfc_MifStd_H_RemainTLV()
2811 (void)memcpy( NdefMap->StdMifareContainer.internalBuf, in phFriNfc_MifStd_H_RemainTLV()
2812 &(NdefMap->SendRecvBuf[(RemainingBytes + (*Temp16Bytes))]), in phFriNfc_MifStd_H_RemainTLV()
2817 NdefMap->StdMifareContainer.internalLength = in phFriNfc_MifStd_H_RemainTLV()
2822 (void)memcpy( NdefMap->StdMifareContainer.internalBuf, in phFriNfc_MifStd_H_RemainTLV()
2823 &(NdefMap->SendRecvBuf[RemainingBytes]), in phFriNfc_MifStd_H_RemainTLV()
2828 NdefMap->StdMifareContainer.internalLength = in phFriNfc_MifStd_H_RemainTLV()
2834 NdefMap->StdMifareContainer.ReadWriteCompleteFlag = (uint8_t) in phFriNfc_MifStd_H_RemainTLV()
2835 (((NdefMap->StdMifareContainer.remainingSize == PH_FRINFC_MIFARESTD_VAL0) || in phFriNfc_MifStd_H_RemainTLV()
2836 (NdefMap->TLVStruct.BytesRemainLinTLV == PH_FRINFC_MIFARESTD_VAL0))? in phFriNfc_MifStd_H_RemainTLV()
2841 NdefMap->StdMifareContainer.currentBlock++; in phFriNfc_MifStd_H_RemainTLV()
2842 NdefMap->StdMifareContainer.NdefBlocks++; in phFriNfc_MifStd_H_RemainTLV()
2845 NdefMap->TLVStruct.NdefTLVFoundFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifStd_H_RemainTLV()
2851 if((NdefMap->TLVStruct.BytesRemainLinTLV > in phFriNfc_MifStd_H_RemainTLV()
2857 (void)memcpy(&(NdefMap->ApduBuffer in phFriNfc_MifStd_H_RemainTLV()
2858 [NdefMap->ApduBuffIndex]), in phFriNfc_MifStd_H_RemainTLV()
2859 &(NdefMap->SendRecvBuf[ in phFriNfc_MifStd_H_RemainTLV()
2862 NdefMap->ApduBuffIndex += (PH_FRINFC_MIFARESTD_BYTES_READ - (*Temp16Bytes)); in phFriNfc_MifStd_H_RemainTLV()
2863 NdefMap->StdMifareContainer.remainingSize -= in phFriNfc_MifStd_H_RemainTLV()
2865NdefMap->TLVStruct.BytesRemainLinTLV -= (PH_FRINFC_MIFARESTD_BYTES_READ - (*Temp16Bytes)); in phFriNfc_MifStd_H_RemainTLV()
2867 if(NdefMap->TLVStruct.BytesRemainLinTLV != PH_FRINFC_MIFARESTD_NDEFTLV_LBYTES0) in phFriNfc_MifStd_H_RemainTLV()
2869 NdefMap->TLVStruct.NdefTLVFoundFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifStd_H_RemainTLV()
2872 NdefMap->StdMifareContainer.currentBlock++; in phFriNfc_MifStd_H_RemainTLV()
2873 NdefMap->StdMifareContainer.NdefBlocks++; in phFriNfc_MifStd_H_RemainTLV()
2874 Result = phFriNfc_MifStd_H_BlkChk(NdefMap); in phFriNfc_MifStd_H_RemainTLV()
2877 Result = ((NdefMap->StdMifareContainer.AuthDone == in phFriNfc_MifStd_H_RemainTLV()
2879 phFriNfc_MifStd_H_RdABlock(NdefMap): in phFriNfc_MifStd_H_RemainTLV()
2880 phFriNfc_MifStd_H_AuthSector(NdefMap)); in phFriNfc_MifStd_H_RemainTLV()
2887 *NdefMap->NumOfBytesRead = NdefMap->ApduBuffIndex; in phFriNfc_MifStd_H_RemainTLV()
2888 NdefMap->StdMifareContainer.ReadWriteCompleteFlag = (uint8_t) in phFriNfc_MifStd_H_RemainTLV()
2889 (((NdefMap->StdMifareContainer.remainingSize == PH_FRINFC_MIFARESTD_VAL0) || in phFriNfc_MifStd_H_RemainTLV()
2890 (NdefMap->TLVStruct.BytesRemainLinTLV == PH_FRINFC_MIFARESTD_VAL0))? in phFriNfc_MifStd_H_RemainTLV()
2898 static NFCSTATUS phFriNfc_MifStd_H_ChkIntLen(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_ChkIntLen() argument
2904 if(NdefMap->TLVStruct.BytesRemainLinTLV != 0) in phFriNfc_MifStd_H_ChkIntLen()
2908 Result = phFriNfc_MifStd_H_IntLenWioutNdef(NdefMap, &NDEFFlag, &TempintBytes); in phFriNfc_MifStd_H_ChkIntLen()
2916 (NdefMap->TLVStruct.NdefTLVFoundFlag == in phFriNfc_MifStd_H_ChkIntLen()
2920 Result = phFriNfc_MifStd_H_IntLenWithNdef(NdefMap, &TempintBytes); in phFriNfc_MifStd_H_ChkIntLen()
2926 static NFCSTATUS phFriNfc_MifStd_H_IntLenWioutNdef(phFriNfc_NdefMap_t *NdefMap, in phFriNfc_MifStd_H_IntLenWioutNdef() argument
2934 RemainingBytes = ((uint16_t)NdefMap->ApduBufferSize - in phFriNfc_MifStd_H_IntLenWioutNdef()
2935 NdefMap->ApduBuffIndex); in phFriNfc_MifStd_H_IntLenWioutNdef()
2937 if(NdefMap->StdMifareContainer.remainingSize < in phFriNfc_MifStd_H_IntLenWioutNdef()
2943 RemainingBytes = NdefMap->StdMifareContainer.remainingSize; in phFriNfc_MifStd_H_IntLenWioutNdef()
2947 if((NdefMap->TLVStruct.BytesRemainLinTLV <= in phFriNfc_MifStd_H_IntLenWioutNdef()
2948 NdefMap->StdMifareContainer.internalLength) && in phFriNfc_MifStd_H_IntLenWioutNdef()
2949 (RemainingBytes <= NdefMap->TLVStruct.BytesRemainLinTLV)) in phFriNfc_MifStd_H_IntLenWioutNdef()
2951 (void)memcpy(&(NdefMap->ApduBuffer[ in phFriNfc_MifStd_H_IntLenWioutNdef()
2952 NdefMap->ApduBuffIndex]), in phFriNfc_MifStd_H_IntLenWioutNdef()
2953 &(NdefMap->StdMifareContainer.internalBuf[ in phFriNfc_MifStd_H_IntLenWioutNdef()
2956 NdefMap->ApduBuffIndex += RemainingBytes; in phFriNfc_MifStd_H_IntLenWioutNdef()
2957 NdefMap->StdMifareContainer.remainingSize -= RemainingBytes; in phFriNfc_MifStd_H_IntLenWioutNdef()
2962 (void)memcpy( NdefMap->StdMifareContainer.internalBuf, in phFriNfc_MifStd_H_IntLenWioutNdef()
2963 &(NdefMap->StdMifareContainer.internalBuf[RemainingBytes]), in phFriNfc_MifStd_H_IntLenWioutNdef()
2964 (NdefMap->StdMifareContainer.internalLength - RemainingBytes)); in phFriNfc_MifStd_H_IntLenWioutNdef()
2967 NdefMap->StdMifareContainer.internalLength -= RemainingBytes; in phFriNfc_MifStd_H_IntLenWioutNdef()
2969 NdefMap->TLVStruct.BytesRemainLinTLV -= RemainingBytes; in phFriNfc_MifStd_H_IntLenWioutNdef()
2970 if(NdefMap->StdMifareContainer.internalLength == PH_FRINFC_MIFARESTD_VAL0) in phFriNfc_MifStd_H_IntLenWioutNdef()
2972 NdefMap->StdMifareContainer.ReadWriteCompleteFlag = (uint8_t) in phFriNfc_MifStd_H_IntLenWioutNdef()
2973 (((NdefMap->StdMifareContainer.remainingSize == PH_FRINFC_MIFARESTD_VAL0) || in phFriNfc_MifStd_H_IntLenWioutNdef()
2974 (NdefMap->TLVStruct.BytesRemainLinTLV == PH_FRINFC_MIFARESTD_VAL0))? in phFriNfc_MifStd_H_IntLenWioutNdef()
2979 NdefMap->StdMifareContainer.currentBlock++; in phFriNfc_MifStd_H_IntLenWioutNdef()
2980 NdefMap->StdMifareContainer.NdefBlocks++; in phFriNfc_MifStd_H_IntLenWioutNdef()
2984 if(NdefMap->TLVStruct.BytesRemainLinTLV == 0) in phFriNfc_MifStd_H_IntLenWioutNdef()
2988 NdefMap->TLVStruct.NdefTLVFoundFlag = PH_FRINFC_MIFARESTD_FLAG1; in phFriNfc_MifStd_H_IntLenWioutNdef()
2989 NdefMap->TLVStruct.LcheckedinTLVFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifStd_H_IntLenWioutNdef()
2990 NdefMap->TLVStruct.TcheckedinTLVFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifStd_H_IntLenWioutNdef()
2996 else if((NdefMap->TLVStruct.BytesRemainLinTLV <= in phFriNfc_MifStd_H_IntLenWioutNdef()
2997 NdefMap->StdMifareContainer.internalLength) && in phFriNfc_MifStd_H_IntLenWioutNdef()
2998 (RemainingBytes > NdefMap->TLVStruct.BytesRemainLinTLV)) in phFriNfc_MifStd_H_IntLenWioutNdef()
3000 (void)memcpy(&(NdefMap->ApduBuffer[NdefMap->ApduBuffIndex]), in phFriNfc_MifStd_H_IntLenWioutNdef()
3001 &(NdefMap->StdMifareContainer.internalBuf[(*TempintBytes)]), in phFriNfc_MifStd_H_IntLenWioutNdef()
3002 NdefMap->TLVStruct.BytesRemainLinTLV); in phFriNfc_MifStd_H_IntLenWioutNdef()
3004 NdefMap->ApduBuffIndex += NdefMap->TLVStruct.BytesRemainLinTLV; in phFriNfc_MifStd_H_IntLenWioutNdef()
3005 NdefMap->StdMifareContainer.remainingSize -= in phFriNfc_MifStd_H_IntLenWioutNdef()
3006 NdefMap->TLVStruct.BytesRemainLinTLV; in phFriNfc_MifStd_H_IntLenWioutNdef()
3007 NdefMap->TLVStruct.NdefTLVFoundFlag = PH_FRINFC_MIFARESTD_FLAG1; in phFriNfc_MifStd_H_IntLenWioutNdef()
3009 *TempintBytes += ((uint8_t)NdefMap->TLVStruct.BytesRemainLinTLV); in phFriNfc_MifStd_H_IntLenWioutNdef()
3012 NdefMap->TLVStruct.LcheckedinTLVFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifStd_H_IntLenWioutNdef()
3013 NdefMap->TLVStruct.TcheckedinTLVFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifStd_H_IntLenWioutNdef()
3015 NdefMap->TLVStruct.BytesRemainLinTLV = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifStd_H_IntLenWioutNdef()
3016 NdefMap->StdMifareContainer.ReadWriteCompleteFlag = (uint8_t) in phFriNfc_MifStd_H_IntLenWioutNdef()
3017 (((NdefMap->StdMifareContainer.remainingSize == PH_FRINFC_MIFARESTD_VAL0) || in phFriNfc_MifStd_H_IntLenWioutNdef()
3018 (NdefMap->TLVStruct.BytesRemainLinTLV == PH_FRINFC_MIFARESTD_VAL0))? in phFriNfc_MifStd_H_IntLenWioutNdef()
3024 NdefMap->StdMifareContainer.ReadWriteCompleteFlag) in phFriNfc_MifStd_H_IntLenWioutNdef()
3031 if( NdefMap->TLVStruct.BytesRemainLinTLV == in phFriNfc_MifStd_H_IntLenWioutNdef()
3032 NdefMap->StdMifareContainer.internalLength) in phFriNfc_MifStd_H_IntLenWioutNdef()
3035 NdefMap->TLVStruct.BytesRemainLinTLV = in phFriNfc_MifStd_H_IntLenWioutNdef()
3037 NdefMap->StdMifareContainer.internalLength = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifStd_H_IntLenWioutNdef()
3040 NdefMap->StdMifareContainer.currentBlock++; in phFriNfc_MifStd_H_IntLenWioutNdef()
3041 NdefMap->StdMifareContainer.NdefBlocks++; in phFriNfc_MifStd_H_IntLenWioutNdef()
3042 Result = phFriNfc_MifStd_H_BlkChk(NdefMap); in phFriNfc_MifStd_H_IntLenWioutNdef()
3046 ((NdefMap->StdMifareContainer.AuthDone == PH_FRINFC_MIFARESTD_FLAG1)? in phFriNfc_MifStd_H_IntLenWioutNdef()
3047 phFriNfc_MifStd_H_RdABlock(NdefMap): in phFriNfc_MifStd_H_IntLenWioutNdef()
3048 phFriNfc_MifStd_H_AuthSector(NdefMap)); in phFriNfc_MifStd_H_IntLenWioutNdef()
3054 NdefMap->TLVStruct.BytesRemainLinTLV = in phFriNfc_MifStd_H_IntLenWioutNdef()
3059 else if((NdefMap->TLVStruct.BytesRemainLinTLV > in phFriNfc_MifStd_H_IntLenWioutNdef()
3060 NdefMap->StdMifareContainer.internalLength) && in phFriNfc_MifStd_H_IntLenWioutNdef()
3061 (RemainingBytes <= NdefMap->StdMifareContainer.internalLength)) in phFriNfc_MifStd_H_IntLenWioutNdef()
3063 (void)memcpy(&(NdefMap->ApduBuffer[NdefMap->ApduBuffIndex]), in phFriNfc_MifStd_H_IntLenWioutNdef()
3064 &(NdefMap->StdMifareContainer.internalBuf[(*TempintBytes)]), in phFriNfc_MifStd_H_IntLenWioutNdef()
3067 NdefMap->ApduBuffIndex += RemainingBytes; in phFriNfc_MifStd_H_IntLenWioutNdef()
3068 NdefMap->StdMifareContainer.remainingSize -= in phFriNfc_MifStd_H_IntLenWioutNdef()
3072 NdefMap->TLVStruct.BytesRemainLinTLV -= RemainingBytes; in phFriNfc_MifStd_H_IntLenWioutNdef()
3076 (void)memcpy( NdefMap->StdMifareContainer.internalBuf, in phFriNfc_MifStd_H_IntLenWioutNdef()
3077 &(NdefMap->StdMifareContainer.internalBuf[RemainingBytes]), in phFriNfc_MifStd_H_IntLenWioutNdef()
3078 (NdefMap->StdMifareContainer.internalLength - RemainingBytes)); in phFriNfc_MifStd_H_IntLenWioutNdef()
3081 NdefMap->StdMifareContainer.internalLength -= RemainingBytes; in phFriNfc_MifStd_H_IntLenWioutNdef()
3082 if(NdefMap->StdMifareContainer.internalLength == PH_FRINFC_MIFARESTD_VAL0) in phFriNfc_MifStd_H_IntLenWioutNdef()
3084 NdefMap->StdMifareContainer.ReadWriteCompleteFlag = (uint8_t) in phFriNfc_MifStd_H_IntLenWioutNdef()
3085 (((NdefMap->StdMifareContainer.remainingSize == PH_FRINFC_MIFARESTD_VAL0) || in phFriNfc_MifStd_H_IntLenWioutNdef()
3086 (NdefMap->TLVStruct.BytesRemainLinTLV == PH_FRINFC_MIFARESTD_VAL0))? in phFriNfc_MifStd_H_IntLenWioutNdef()
3091 NdefMap->StdMifareContainer.currentBlock++; in phFriNfc_MifStd_H_IntLenWioutNdef()
3092 NdefMap->StdMifareContainer.NdefBlocks++; in phFriNfc_MifStd_H_IntLenWioutNdef()
3095 NdefMap->TLVStruct.NdefTLVFoundFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifStd_H_IntLenWioutNdef()
3101 if((NdefMap->TLVStruct.BytesRemainLinTLV > in phFriNfc_MifStd_H_IntLenWioutNdef()
3102 NdefMap->StdMifareContainer.internalLength) && in phFriNfc_MifStd_H_IntLenWioutNdef()
3103 (RemainingBytes > NdefMap->StdMifareContainer.internalLength)) in phFriNfc_MifStd_H_IntLenWioutNdef()
3105 (void)memcpy(&(NdefMap->ApduBuffer[NdefMap->ApduBuffIndex]), in phFriNfc_MifStd_H_IntLenWioutNdef()
3106 &(NdefMap->StdMifareContainer.internalBuf[(*TempintBytes)]), in phFriNfc_MifStd_H_IntLenWioutNdef()
3107 NdefMap->StdMifareContainer.internalLength); in phFriNfc_MifStd_H_IntLenWioutNdef()
3109 NdefMap->ApduBuffIndex += NdefMap->StdMifareContainer.internalLength; in phFriNfc_MifStd_H_IntLenWioutNdef()
3110 NdefMap->StdMifareContainer.remainingSize -= in phFriNfc_MifStd_H_IntLenWioutNdef()
3111 NdefMap->StdMifareContainer.internalLength; in phFriNfc_MifStd_H_IntLenWioutNdef()
3112 NdefMap->TLVStruct.BytesRemainLinTLV -= NdefMap->StdMifareContainer.internalLength; in phFriNfc_MifStd_H_IntLenWioutNdef()
3114 if(NdefMap->TLVStruct.BytesRemainLinTLV != PH_FRINFC_MIFARESTD_NDEFTLV_LBYTES0) in phFriNfc_MifStd_H_IntLenWioutNdef()
3116 NdefMap->TLVStruct.NdefTLVFoundFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifStd_H_IntLenWioutNdef()
3119 NdefMap->StdMifareContainer.internalLength = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifStd_H_IntLenWioutNdef()
3121 NdefMap->StdMifareContainer.currentBlock++; in phFriNfc_MifStd_H_IntLenWioutNdef()
3122 NdefMap->StdMifareContainer.NdefBlocks++; in phFriNfc_MifStd_H_IntLenWioutNdef()
3123 Result = phFriNfc_MifStd_H_BlkChk(NdefMap); in phFriNfc_MifStd_H_IntLenWioutNdef()
3126 Result = ((NdefMap->StdMifareContainer.AuthDone == in phFriNfc_MifStd_H_IntLenWioutNdef()
3128 phFriNfc_MifStd_H_RdABlock(NdefMap): in phFriNfc_MifStd_H_IntLenWioutNdef()
3129 phFriNfc_MifStd_H_AuthSector(NdefMap)); in phFriNfc_MifStd_H_IntLenWioutNdef()
3136 NdefMap->StdMifareContainer.ReadWriteCompleteFlag = (uint8_t) in phFriNfc_MifStd_H_IntLenWioutNdef()
3137 (((NdefMap->StdMifareContainer.remainingSize == PH_FRINFC_MIFARESTD_VAL0) || in phFriNfc_MifStd_H_IntLenWioutNdef()
3138 (NdefMap->TLVStruct.BytesRemainLinTLV == PH_FRINFC_MIFARESTD_VAL0))? in phFriNfc_MifStd_H_IntLenWioutNdef()
3141 *NdefMap->NumOfBytesRead = NdefMap->ApduBuffIndex; in phFriNfc_MifStd_H_IntLenWioutNdef()
3146 static NFCSTATUS phFriNfc_MifStd_H_IntLenWithNdef(phFriNfc_NdefMap_t *NdefMap,
3155 RemainingBytes = (uint16_t)(NdefMap->ApduBufferSize - NdefMap->ApduBuffIndex);
3156 while(PH_FRINFC_MIFARESTD_FLAG1 == NdefMap->TLVStruct.NdefTLVFoundFlag)
3158 NdefMap->TLVStruct.NdefTLVFoundFlag = PH_FRINFC_MIFARESTD_FLAG0;
3159 RemainingBytes = ((uint16_t)NdefMap->ApduBufferSize -
3160 NdefMap->ApduBuffIndex);
3161 if(((( NdefMap->StdMifareContainer.NoOfNdefCompBlocks -
3162 NdefMap->StdMifareContainer.NdefBlocks) *
3164 (NdefMap->StdMifareContainer.internalLength -
3171 RemainingBytes = ((( NdefMap->StdMifareContainer.NoOfNdefCompBlocks -
3172 NdefMap->StdMifareContainer.NdefBlocks) * 16) +
3173 (NdefMap->StdMifareContainer.internalLength -
3178 if((NdefMap->TLVStruct.TcheckedinTLVFlag != PH_FRINFC_MIFARESTD_FLAG1) &&
3179 (NdefMap->TLVStruct.LcheckedinTLVFlag != PH_FRINFC_MIFARESTD_FLAG1) &&
3180 (NdefMap->TLVStruct.NoLbytesinTLV != PH_FRINFC_MIFARESTD_NDEFTLV_LBYTES0))
3190 if(NdefMap->TLVStruct.TcheckedinTLVFlag != PH_FRINFC_MIFARESTD_FLAG1)
3192 CRFlag =(uint8_t) ((NdefMap->StdMifareContainer.internalBuf[(*TempintBytes)]!=
3199 NdefMap->StdMifareContainer.ReadWriteCompleteFlag =
3209 NdefMap->TLVStruct.TcheckedinTLVFlag = PH_FRINFC_MIFARESTD_FLAG0;
3212 if(*TempintBytes == NdefMap->StdMifareContainer.internalLength)
3214 NdefMap->StdMifareContainer.internalLength = PH_FRINFC_MIFARESTD_VAL0;
3215 NdefMap->TLVStruct.NdefTLVFoundFlag = PH_FRINFC_MIFARESTD_FLAG1;
3216 NdefMap->TLVStruct.TcheckedinTLVFlag = PH_FRINFC_MIFARESTD_FLAG1;
3218 NdefMap->StdMifareContainer.currentBlock++;
3219 NdefMap->StdMifareContainer.NdefBlocks++;
3220 Result = phFriNfc_MifStd_H_BlkChk(NdefMap);
3224 ((NdefMap->StdMifareContainer.AuthDone == PH_FRINFC_MIFARESTD_FLAG1)?
3225 phFriNfc_MifStd_H_RdABlock(NdefMap):
3226 phFriNfc_MifStd_H_AuthSector(NdefMap));
3232 if(NdefMap->TLVStruct.LcheckedinTLVFlag != PH_FRINFC_MIFARESTD_FLAG1)
3234 CRFlag = (uint8_t)((NdefMap->StdMifareContainer.internalBuf[(*TempintBytes)]==
3241 NdefMap->StdMifareContainer.ReadWriteCompleteFlag =
3247 *TempintBytes += phFriNfc_MifStd_H_ChkNdefLen(NdefMap,
3252 NdefMap->StdMifareContainer.ReadWriteCompleteFlag =
3260 NdefMap->TLVStruct.LcheckedinTLVFlag = PH_FRINFC_MIFARESTD_FLAG0;
3263 if(*TempintBytes == NdefMap->StdMifareContainer.internalLength)
3265 NdefMap->StdMifareContainer.internalLength = PH_FRINFC_MIFARESTD_VAL0;
3266 NdefMap->TLVStruct.NdefTLVFoundFlag = PH_FRINFC_MIFARESTD_FLAG1;
3267 NdefMap->TLVStruct.TcheckedinTLVFlag = PH_FRINFC_MIFARESTD_FLAG1;
3269 NdefMap->StdMifareContainer.currentBlock++;
3270 NdefMap->StdMifareContainer.NdefBlocks++;
3271 Result = phFriNfc_MifStd_H_BlkChk(NdefMap);
3274 Result = ((NdefMap->StdMifareContainer.AuthDone ==
3276 phFriNfc_MifStd_H_RdABlock(NdefMap):
3277 phFriNfc_MifStd_H_AuthSector(NdefMap));
3282 if( (NdefMap->TLVStruct.BytesRemainLinTLV <=
3283 (NdefMap->StdMifareContainer.internalLength - *TempintBytes)) &&
3284 (RemainingBytes <= NdefMap->TLVStruct.BytesRemainLinTLV))
3287 (void)memcpy(&(NdefMap->ApduBuffer[
3288 NdefMap->ApduBuffIndex]),
3289 &(NdefMap->StdMifareContainer.internalBuf[
3293 NdefMap->ApduBuffIndex += RemainingBytes;
3295 NdefMap->TLVStruct.BytesRemainLinTLV -= RemainingBytes;
3296 if(NdefMap->TLVStruct.BytesRemainLinTLV == 0)
3298 NdefMap->TLVStruct.NdefTLVFoundFlag = PH_FRINFC_MIFARESTD_FLAG1;
3301 (void)memcpy( NdefMap->StdMifareContainer.internalBuf,
3302 &(NdefMap->StdMifareContainer.internalBuf[
3305 NdefMap->StdMifareContainer.internalLength -= (*TempintBytes +
3311 else if((NdefMap->TLVStruct.BytesRemainLinTLV <=
3312 (NdefMap->StdMifareContainer.internalLength - *TempintBytes)) &&
3313 (RemainingBytes > NdefMap->TLVStruct.BytesRemainLinTLV))
3316 (void)memcpy(&(NdefMap->ApduBuffer[
3317 NdefMap->ApduBuffIndex]),
3318 &(NdefMap->StdMifareContainer.internalBuf[
3320 NdefMap->TLVStruct.BytesRemainLinTLV);
3323 NdefMap->ApduBuffIndex += NdefMap->TLVStruct.BytesRemainLinTLV;
3324 *TempintBytes += ((uint8_t)NdefMap->TLVStruct.BytesRemainLinTLV);
3325 NdefMap->TLVStruct.BytesRemainLinTLV = PH_FRINFC_MIFARESTD_VAL0;
3326 NdefMap->TLVStruct.NdefTLVFoundFlag = PH_FRINFC_MIFARESTD_FLAG1;
3329 if(*TempintBytes == NdefMap->StdMifareContainer.internalLength)
3332 NdefMap->StdMifareContainer.currentBlock++;
3333 NdefMap->StdMifareContainer.NdefBlocks++;
3334 Result = phFriNfc_MifStd_H_BlkChk(NdefMap);
3337 Result = ((NdefMap->StdMifareContainer.AuthDone ==
3339 phFriNfc_MifStd_H_RdABlock(NdefMap):
3340 phFriNfc_MifStd_H_AuthSector(NdefMap));
3345 else if((NdefMap->TLVStruct.BytesRemainLinTLV >
3346 (NdefMap->StdMifareContainer.internalLength - *TempintBytes)) &&
3347 (RemainingBytes <= (NdefMap->StdMifareContainer.internalLength -
3351 (void)memcpy(&(NdefMap->ApduBuffer[
3352 NdefMap->ApduBuffIndex]),
3353 &(NdefMap->StdMifareContainer.internalBuf[
3356 NdefMap->ApduBuffIndex += RemainingBytes;
3358 NdefMap->TLVStruct.BytesRemainLinTLV -= RemainingBytes;
3362 (void)memcpy(NdefMap->StdMifareContainer.internalBuf,
3363 &(NdefMap->StdMifareContainer.internalBuf[(*TempintBytes)]),
3364 (NdefMap->StdMifareContainer.internalLength - *TempintBytes));
3367 NdefMap->StdMifareContainer.internalLength -= *TempintBytes;
3373 if((NdefMap->TLVStruct.BytesRemainLinTLV >
3374 (NdefMap->StdMifareContainer.internalLength - *TempintBytes)) &&
3375 (RemainingBytes > (NdefMap->StdMifareContainer.internalLength -
3379 (void)memcpy(&(NdefMap->ApduBuffer[
3380 NdefMap->ApduBuffIndex]),
3381 &(NdefMap->StdMifareContainer.internalBuf[
3383 (NdefMap->StdMifareContainer.internalLength -
3385 NdefMap->ApduBuffIndex += (NdefMap->StdMifareContainer.internalLength -
3387 NdefMap->TLVStruct.BytesRemainLinTLV -=
3388 (NdefMap->StdMifareContainer.internalLength - *TempintBytes);
3389 *TempintBytes += (uint8_t)(NdefMap->StdMifareContainer.internalLength -
3392 NdefMap->StdMifareContainer.internalLength -= *TempintBytes;
3395 NdefMap->StdMifareContainer.currentBlock++;
3396 NdefMap->StdMifareContainer.NdefBlocks++;
3397 Result = phFriNfc_MifStd_H_BlkChk(NdefMap);
3400 Result = ((NdefMap->StdMifareContainer.AuthDone ==
3402 phFriNfc_MifStd_H_RdABlock(NdefMap):
3403 phFriNfc_MifStd_H_AuthSector(NdefMap));
3410 if(((( NdefMap->StdMifareContainer.NoOfNdefCompBlocks -
3411 NdefMap->StdMifareContainer.NdefBlocks) *
3413 NdefMap->StdMifareContainer.internalLength) ==
3416 NdefMap->StdMifareContainer.ReadWriteCompleteFlag =
3423 (NdefMap->ApduBuffIndex == PH_FRINFC_MIFARESTD_VAL0))?
3428 *NdefMap->NumOfBytesRead = NdefMap->ApduBuffIndex;
3435 static NFCSTATUS phFriNfc_MifStd_H_WriteNdefLen(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_WriteNdefLen() argument
3438 NdefMap->State = PH_FRINFC_NDEFMAP_STATE_WR_NDEF_LEN; in phFriNfc_MifStd_H_WriteNdefLen()
3444 if(NdefMap->StdMifareContainer.currentBlock == in phFriNfc_MifStd_H_WriteNdefLen()
3445 NdefMap->TLVStruct.NdefTLVBlock) in phFriNfc_MifStd_H_WriteNdefLen()
3448 if(NdefMap->TLVStruct.NULLTLVCount >= in phFriNfc_MifStd_H_WriteNdefLen()
3451 phFriNfc_MifStd_H_fillTLV1(NdefMap); in phFriNfc_MifStd_H_WriteNdefLen()
3455 phFriNfc_MifStd_H_fillTLV2(NdefMap); in phFriNfc_MifStd_H_WriteNdefLen()
3460 if(NdefMap->TLVStruct.NULLTLVCount >= in phFriNfc_MifStd_H_WriteNdefLen()
3463 phFriNfc_MifStd_H_fillTLV1_1(NdefMap); in phFriNfc_MifStd_H_WriteNdefLen()
3467 phFriNfc_MifStd_H_fillTLV2_1(NdefMap); in phFriNfc_MifStd_H_WriteNdefLen()
3471 (void)memcpy( NdefMap->StdMifareContainer.Buffer, in phFriNfc_MifStd_H_WriteNdefLen()
3472 &(NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL1]), in phFriNfc_MifStd_H_WriteNdefLen()
3477 NdefMap->SendLength = MIFARE_MAX_SEND_BUF_TO_WRITE; in phFriNfc_MifStd_H_WriteNdefLen()
3480 NdefMap->Cmd.MfCmd = phHal_eMifareCmdListMifareWrite16; in phFriNfc_MifStd_H_WriteNdefLen()
3482 NdefMap->Cmd.MfCmd = phHal_eMifareWrite16; in phFriNfc_MifStd_H_WriteNdefLen()
3485 *NdefMap->SendRecvLength = NdefMap->TempReceiveLength; in phFriNfc_MifStd_H_WriteNdefLen()
3487 Result = phFriNfc_OvrHal_Transceive( NdefMap->LowerDevice, in phFriNfc_MifStd_H_WriteNdefLen()
3488 &NdefMap->MapCompletionInfo, in phFriNfc_MifStd_H_WriteNdefLen()
3489 NdefMap->psRemoteDevInfo, in phFriNfc_MifStd_H_WriteNdefLen()
3490 NdefMap->Cmd, in phFriNfc_MifStd_H_WriteNdefLen()
3491 &NdefMap->psDepAdditionalInfo, in phFriNfc_MifStd_H_WriteNdefLen()
3492 NdefMap->SendRecvBuf, in phFriNfc_MifStd_H_WriteNdefLen()
3493 NdefMap->SendLength, in phFriNfc_MifStd_H_WriteNdefLen()
3494 NdefMap->SendRecvBuf, in phFriNfc_MifStd_H_WriteNdefLen()
3495 NdefMap->SendRecvLength); in phFriNfc_MifStd_H_WriteNdefLen()
3500 static NFCSTATUS phFriNfc_MifStd_H_ChkNdefCmpltBlocks(phFriNfc_NdefMap_t *NdefMap)
3506 if((NdefMap->StdMifareContainer.NoOfNdefCompBlocks !=
3508 (NdefMap->StdMifareContainer.NoOfNdefCompBlocks <=
3513 NdefMap->StdMifareContainer.currentBlock = 4;
3514 NdefMap->StdMifareContainer.AuthDone = PH_FRINFC_MIFARESTD_FLAG0;
3515 Result = phFriNfc_MifStd_H_BlkChk(NdefMap);
3517 (NdefMap->StdMifareContainer.AuthDone ==
3520 NdefMap->StdMifareContainer.ReadAcsBitFlag = 0;
3521 Result = phFriNfc_MifStd_H_RdAcsBit(NdefMap);
3525 Result = phFriNfc_MifStd_H_AuthSector(NdefMap);
3532 static void phFriNfc_MifStd_H_RdWrReset(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_RdWrReset() argument
3534 NdefMap->StdMifareContainer.currentBlock = PH_FRINFC_MIFARESTD_BLK4; in phFriNfc_MifStd_H_RdWrReset()
3535 NdefMap->StdMifareContainer.NdefBlocks = PH_FRINFC_MIFARESTD_VAL1; in phFriNfc_MifStd_H_RdWrReset()
3536 NdefMap->TLVStruct.BytesRemainLinTLV = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifStd_H_RdWrReset()
3537 NdefMap->TLVStruct.LcheckedinTLVFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifStd_H_RdWrReset()
3538 NdefMap->TLVStruct.TcheckedinTLVFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifStd_H_RdWrReset()
3539 NdefMap->TLVStruct.NdefTLVAuthFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifStd_H_RdWrReset()
3540 NdefMap->TLVStruct.NdefTLVBlock = PH_FRINFC_MIFARESTD_MAD_BLK0; in phFriNfc_MifStd_H_RdWrReset()
3541 NdefMap->TLVStruct.NdefTLVByte = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifStd_H_RdWrReset()
3542 NdefMap->TLVStruct.NoLbytesinTLV = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifStd_H_RdWrReset()
3543 NdefMap->TLVStruct.NULLTLVCount = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifStd_H_RdWrReset()
3544 NdefMap->StdMifareContainer.internalLength = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifStd_H_RdWrReset()
3545 NdefMap->StdMifareContainer.AuthDone = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifStd_H_RdWrReset()
3546 NdefMap->StdMifareContainer.NFCforumSectFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifStd_H_RdWrReset()
3547 NdefMap->StdMifareContainer.FirstReadFlag = PH_FRINFC_MIFARESTD_FLAG1; in phFriNfc_MifStd_H_RdWrReset()
3548 NdefMap->StdMifareContainer.ReadWriteCompleteFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifStd_H_RdWrReset()
3549 NdefMap->StdMifareContainer.remainingSize = (uint16_t) in phFriNfc_MifStd_H_RdWrReset()
3550 (NdefMap->StdMifareContainer.NoOfNdefCompBlocks * in phFriNfc_MifStd_H_RdWrReset()
3552 NdefMap->StdMifareContainer.WrLength = PH_FRINFC_MIFARESTD_VAL1; in phFriNfc_MifStd_H_RdWrReset()
3556 static NFCSTATUS phFriNfc_MifStd_H_RdtoWrNdefLen(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_RdtoWrNdefLen() argument
3559 NdefMap->State = PH_FRINFC_NDEFMAP_STATE_RD_TO_WR_NDEF_LEN; in phFriNfc_MifStd_H_RdtoWrNdefLen()
3561 if(NdefMap->TLVStruct.NdefTLVAuthFlag == PH_FRINFC_MIFARESTD_FLAG1) in phFriNfc_MifStd_H_RdtoWrNdefLen()
3563 NdefMap->StdMifareContainer.AuthDone = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifStd_H_RdtoWrNdefLen()
3564 Result = phFriNfc_MifStd_H_AuthSector(NdefMap); in phFriNfc_MifStd_H_RdtoWrNdefLen()
3568 NdefMap->SendRecvBuf[0] = NdefMap->StdMifareContainer.currentBlock; in phFriNfc_MifStd_H_RdtoWrNdefLen()
3569 NdefMap->SendLength = MIFARE_MAX_SEND_BUF_TO_READ; in phFriNfc_MifStd_H_RdtoWrNdefLen()
3570 *NdefMap->SendRecvLength = NdefMap->TempReceiveLength; in phFriNfc_MifStd_H_RdtoWrNdefLen()
3573 NdefMap->Cmd.MfCmd = phHal_eMifareCmdListMifareRead; in phFriNfc_MifStd_H_RdtoWrNdefLen()
3575 NdefMap->Cmd.MfCmd = phHal_eMifareRead; in phFriNfc_MifStd_H_RdtoWrNdefLen()
3578 Result = phFriNfc_OvrHal_Transceive( NdefMap->LowerDevice, in phFriNfc_MifStd_H_RdtoWrNdefLen()
3579 &NdefMap->MapCompletionInfo, in phFriNfc_MifStd_H_RdtoWrNdefLen()
3580 NdefMap->psRemoteDevInfo, in phFriNfc_MifStd_H_RdtoWrNdefLen()
3581 NdefMap->Cmd, in phFriNfc_MifStd_H_RdtoWrNdefLen()
3582 &NdefMap->psDepAdditionalInfo, in phFriNfc_MifStd_H_RdtoWrNdefLen()
3583 NdefMap->SendRecvBuf, in phFriNfc_MifStd_H_RdtoWrNdefLen()
3584 NdefMap->SendLength, in phFriNfc_MifStd_H_RdtoWrNdefLen()
3585 NdefMap->SendRecvBuf, in phFriNfc_MifStd_H_RdtoWrNdefLen()
3586 NdefMap->SendRecvLength); in phFriNfc_MifStd_H_RdtoWrNdefLen()
3592 static void phFriNfc_MifStd_H_SetNdefBlkAuth(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_SetNdefBlkAuth() argument
3594 NdefMap->TLVStruct.NdefTLVAuthFlag = in phFriNfc_MifStd_H_SetNdefBlkAuth()
3595 ((phFriNfc_MifStd_H_GetSect(NdefMap->TLVStruct.NdefTLVBlock) in phFriNfc_MifStd_H_SetNdefBlkAuth()
3596 == phFriNfc_MifStd_H_GetSect(NdefMap->StdMifareContainer.currentBlock))? in phFriNfc_MifStd_H_SetNdefBlkAuth()
3601 static NFCSTATUS phFriNfc_MifStd_H_GetActCardLen(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_GetActCardLen() argument
3604 NdefMap->State = PH_FRINFC_NDEFMAP_STATE_GET_ACT_CARDSIZE; in phFriNfc_MifStd_H_GetActCardLen()
3605 NdefMap->PrevOperation = PH_FRINFC_NDEFMAP_GET_ACTSIZE_OPE; in phFriNfc_MifStd_H_GetActCardLen()
3607 Result = ((NdefMap->StdMifareContainer.AuthDone == in phFriNfc_MifStd_H_GetActCardLen()
3609 phFriNfc_MifStd_H_AuthSector(NdefMap): in phFriNfc_MifStd_H_GetActCardLen()
3610 phFriNfc_MifStd_H_Rd16Bytes(NdefMap, in phFriNfc_MifStd_H_GetActCardLen()
3611 NdefMap->StdMifareContainer.currentBlock)); in phFriNfc_MifStd_H_GetActCardLen()
3616 static NFCSTATUS phFriNfc_MifStd_H_ChkTLVs(phFriNfc_NdefMap_t *NdefMap, in phFriNfc_MifStd_H_ChkTLVs() argument
3623 NdefMap->PrevOperation = PH_FRINFC_NDEFMAP_GET_ACTSIZE_OPE; in phFriNfc_MifStd_H_ChkTLVs()
3624 TempLength = NdefMap->TLVStruct.NdefTLVByte; in phFriNfc_MifStd_H_ChkTLVs()
3628 if((NdefMap->SendRecvBuf[TempLength] != PH_FRINFC_MIFARESTD_TERMTLV_T) && in phFriNfc_MifStd_H_ChkTLVs()
3629 (NdefMap->SendRecvBuf[TempLength] != PH_FRINFC_MIFARESTD_NULLTLV_T) && in phFriNfc_MifStd_H_ChkTLVs()
3630 (NdefMap->SendRecvBuf[TempLength] != PH_FRINFC_MIFARESTD_NDEFTLV_T) && in phFriNfc_MifStd_H_ChkTLVs()
3631 (FALSE == NdefMap->TLVStruct.NdefTLVFoundFlag)) in phFriNfc_MifStd_H_ChkTLVs()
3635 NdefMap->TLVStruct.BytesRemainLinTLV = 0; in phFriNfc_MifStd_H_ChkTLVs()
3636 NdefMap->CardState = PH_NDEFMAP_CARD_STATE_INVALID; in phFriNfc_MifStd_H_ChkTLVs()
3643 if((NdefMap->SendRecvBuf[TempLength] != PH_FRINFC_MIFARESTD_TERMTLV_T) && in phFriNfc_MifStd_H_ChkTLVs()
3644 (NdefMap->SendRecvBuf[TempLength] != PH_FRINFC_MIFARESTD_NULLTLV_T)) in phFriNfc_MifStd_H_ChkTLVs()
3646 if(NdefMap->SendRecvBuf[TempLength] == PH_FRINFC_MIFARESTD_NDEFTLV_T) in phFriNfc_MifStd_H_ChkTLVs()
3648 NdefMap->TLVStruct.NdefTLVBlock = in phFriNfc_MifStd_H_ChkTLVs()
3649 NdefMap->StdMifareContainer.currentBlock; in phFriNfc_MifStd_H_ChkTLVs()
3650 NdefMap->TLVStruct.NdefTLVByte = (uint8_t)TempLength; in phFriNfc_MifStd_H_ChkTLVs()
3651 NdefMap->TLVStruct.NdefTLVFoundFlag = in phFriNfc_MifStd_H_ChkTLVs()
3652 ((NdefMap->SendRecvBuf[TempLength] == in phFriNfc_MifStd_H_ChkTLVs()
3657 NdefMap->TLVStruct.NULLTLVCount = ((NdefMap->TLVStruct.NULLTLVCount in phFriNfc_MifStd_H_ChkTLVs()
3660 NdefMap->TLVStruct.NULLTLVCount); in phFriNfc_MifStd_H_ChkTLVs()
3664 NdefMap->TLVStruct.NULLTLVCount = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifStd_H_ChkTLVs()
3670 NdefMap->TLVStruct.TcheckedinTLVFlag = in phFriNfc_MifStd_H_ChkTLVs()
3672 NdefMap->TLVStruct.NoLbytesinTLV = in phFriNfc_MifStd_H_ChkTLVs()
3675 Result = phFriNfc_MifStd_H_Chk16Bytes( NdefMap, in phFriNfc_MifStd_H_ChkTLVs()
3685 if((((( NdefMap->StdMifareContainer.NoOfNdefCompBlocks - in phFriNfc_MifStd_H_ChkTLVs()
3686 NdefMap->StdMifareContainer.NdefBlocks) * in phFriNfc_MifStd_H_ChkTLVs()
3690 NdefMap->SendRecvBuf[TempLength]) && in phFriNfc_MifStd_H_ChkTLVs()
3691 ((NdefMap->SendRecvBuf[TempLength] < in phFriNfc_MifStd_H_ChkTLVs()
3693 (NdefMap->TLVStruct.NdefTLVFoundFlag != in phFriNfc_MifStd_H_ChkTLVs()
3703 if((((( NdefMap->StdMifareContainer.NoOfNdefCompBlocks - in phFriNfc_MifStd_H_ChkTLVs()
3704 NdefMap->StdMifareContainer.NdefBlocks) * in phFriNfc_MifStd_H_ChkTLVs()
3708 NdefMap->SendRecvBuf[TempLength]) && in phFriNfc_MifStd_H_ChkTLVs()
3709 ((NdefMap->SendRecvBuf[TempLength] == in phFriNfc_MifStd_H_ChkTLVs()
3711 (NdefMap->TLVStruct.NdefTLVFoundFlag == in phFriNfc_MifStd_H_ChkTLVs()
3721 if((NdefMap->TLVStruct.NdefTLVFoundFlag == in phFriNfc_MifStd_H_ChkTLVs()
3723 (NdefMap->SendRecvBuf[TempLength] < in phFriNfc_MifStd_H_ChkTLVs()
3726 Result = phFriNfc_MapTool_SetCardState(NdefMap, in phFriNfc_MifStd_H_ChkTLVs()
3727 NdefMap->SendRecvBuf[TempLength]); in phFriNfc_MifStd_H_ChkTLVs()
3728 NdefMap->TLVStruct.BytesRemainLinTLV = in phFriNfc_MifStd_H_ChkTLVs()
3729 NdefMap->SendRecvBuf[TempLength]; in phFriNfc_MifStd_H_ChkTLVs()
3730 NdefMap->StdMifareContainer.remainingSize -= in phFriNfc_MifStd_H_ChkTLVs()
3733 NdefMap->StdMifareContainer.remSizeUpdFlag = in phFriNfc_MifStd_H_ChkTLVs()
3734 (uint8_t)((NdefMap->TLVStruct.NULLTLVCount >= in phFriNfc_MifStd_H_ChkTLVs()
3743 NdefMap->StdMifareContainer.remainingSize -= in phFriNfc_MifStd_H_ChkTLVs()
3744 (( NdefMap->SendRecvBuf[TempLength] < in phFriNfc_MifStd_H_ChkTLVs()
3746 (NdefMap->SendRecvBuf[TempLength] in phFriNfc_MifStd_H_ChkTLVs()
3750 if(( NdefMap->SendRecvBuf[TempLength] == in phFriNfc_MifStd_H_ChkTLVs()
3762 ((NdefMap->SendRecvBuf[TempLength] < in phFriNfc_MifStd_H_ChkTLVs()
3764 phFriNfc_MifStd_H_GetNxtTLV(NdefMap, &TempLength, &TL4bytesFlag): in phFriNfc_MifStd_H_ChkTLVs()
3770 NdefMap->TLVStruct.TcheckedinTLVFlag = in phFriNfc_MifStd_H_ChkTLVs()
3772 NdefMap->TLVStruct.NoLbytesinTLV = in phFriNfc_MifStd_H_ChkTLVs()
3775 Result = phFriNfc_MifStd_H_GetActCardLen(NdefMap); in phFriNfc_MifStd_H_ChkTLVs()
3786 Result = ((NdefMap->SendRecvBuf[TempLength] == in phFriNfc_MifStd_H_ChkTLVs()
3797 NdefMap->TLVStruct.NULLTLVCount = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifStd_H_ChkTLVs()
3802 NdefMap->TLVStruct.TcheckedinTLVFlag = in phFriNfc_MifStd_H_ChkTLVs()
3804 NdefMap->TLVStruct.NoLbytesinTLV = in phFriNfc_MifStd_H_ChkTLVs()
3807 Result = phFriNfc_MifStd_H_Chk16Bytes( NdefMap, in phFriNfc_MifStd_H_ChkTLVs()
3814 ShiftLength = NdefMap->SendRecvBuf[TempLength]; in phFriNfc_MifStd_H_ChkTLVs()
3818 NdefMap->TLVStruct.TcheckedinTLVFlag = in phFriNfc_MifStd_H_ChkTLVs()
3820 NdefMap->TLVStruct.NoLbytesinTLV = in phFriNfc_MifStd_H_ChkTLVs()
3822 NdefMap->TLVStruct.prevLenByteValue = in phFriNfc_MifStd_H_ChkTLVs()
3823 NdefMap->SendRecvBuf[(TempLength - in phFriNfc_MifStd_H_ChkTLVs()
3826 Result = phFriNfc_MifStd_H_Chk16Bytes( NdefMap, in phFriNfc_MifStd_H_ChkTLVs()
3834 if(((( NdefMap->StdMifareContainer.NoOfNdefCompBlocks - in phFriNfc_MifStd_H_ChkTLVs()
3835 NdefMap->StdMifareContainer.NdefBlocks) * in phFriNfc_MifStd_H_ChkTLVs()
3840 << 8) + NdefMap->SendRecvBuf[TempLength])) in phFriNfc_MifStd_H_ChkTLVs()
3848 if(NdefMap->TLVStruct.NdefTLVFoundFlag == in phFriNfc_MifStd_H_ChkTLVs()
3852 NdefMap->SendRecvBuf[TempLength]); in phFriNfc_MifStd_H_ChkTLVs()
3853 NdefMap->TLVStruct.BytesRemainLinTLV = ShiftLength; in phFriNfc_MifStd_H_ChkTLVs()
3854 Result = phFriNfc_MapTool_SetCardState(NdefMap, in phFriNfc_MifStd_H_ChkTLVs()
3856 NdefMap->StdMifareContainer.remainingSize -= in phFriNfc_MifStd_H_ChkTLVs()
3862 NdefMap->StdMifareContainer.remainingSize -= in phFriNfc_MifStd_H_ChkTLVs()
3864 NdefMap->SendRecvBuf[(TempLength + PH_FRINFC_MIFARESTD_VAL1)]); in phFriNfc_MifStd_H_ChkTLVs()
3868 Result = phFriNfc_MifStd_H_GetNxtTLV(NdefMap, &TempLength, &TL4bytesFlag); in phFriNfc_MifStd_H_ChkTLVs()
3873 NdefMap->TLVStruct.TcheckedinTLVFlag = in phFriNfc_MifStd_H_ChkTLVs()
3875 NdefMap->TLVStruct.NoLbytesinTLV = in phFriNfc_MifStd_H_ChkTLVs()
3877 Result = phFriNfc_MifStd_H_GetActCardLen(NdefMap); in phFriNfc_MifStd_H_ChkTLVs()
3885 else if((NdefMap->SendRecvBuf[TempLength] == PH_FRINFC_MIFARESTD_TERMTLV_T) && in phFriNfc_MifStd_H_ChkTLVs()
3886 (NdefMap->TLVStruct.NdefTLVFoundFlag == PH_FRINFC_MIFARESTD_FLAG0)) in phFriNfc_MifStd_H_ChkTLVs()
3890 NdefMap->StdMifareContainer.ReadWriteCompleteFlag = in phFriNfc_MifStd_H_ChkTLVs()
3895 else if(NdefMap->SendRecvBuf[TempLength] == PH_FRINFC_MIFARESTD_NULLTLV_T) in phFriNfc_MifStd_H_ChkTLVs()
3898 NdefMap->TLVStruct.NULLTLVCount += PH_FRINFC_MIFARESTD_VAL1; in phFriNfc_MifStd_H_ChkTLVs()
3899 ShiftLength = NdefMap->SendRecvBuf[(TempLength - PH_FRINFC_MIFARESTD_VAL1)]; in phFriNfc_MifStd_H_ChkTLVs()
3900 NdefMap->StdMifareContainer.remainingSize -= PH_FRINFC_MIFARESTD_VAL1; in phFriNfc_MifStd_H_ChkTLVs()
3901 if(NdefMap->StdMifareContainer.remainingSize < in phFriNfc_MifStd_H_ChkTLVs()
3902 (( ShiftLength << 8) + NdefMap->SendRecvBuf[TempLength])) in phFriNfc_MifStd_H_ChkTLVs()
3908 Result = phFriNfc_MifStd_H_Chk16Bytes( NdefMap, in phFriNfc_MifStd_H_ChkTLVs()
3912 NdefMap->TLVStruct.NdefTLVByte = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifStd_H_ChkTLVs()
3918 if((NdefMap->SendRecvBuf[TempLength] == PH_FRINFC_MIFARESTD_TERMTLV_T) && in phFriNfc_MifStd_H_ChkTLVs()
3919 (NdefMap->TLVStruct.NdefTLVFoundFlag == PH_FRINFC_MIFARESTD_FLAG1)) in phFriNfc_MifStd_H_ChkTLVs()
3923 NdefMap->StdMifareContainer.remainingSize -= in phFriNfc_MifStd_H_ChkTLVs()
3929 if(NdefMap->TLVStruct.BytesRemainLinTLV > in phFriNfc_MifStd_H_ChkTLVs()
3930 NdefMap->StdMifareContainer.remainingSize) in phFriNfc_MifStd_H_ChkTLVs()
3937 if(NdefMap->StdMifareContainer.remainingSize == in phFriNfc_MifStd_H_ChkTLVs()
3940 Result = ((NdefMap->TLVStruct.NdefTLVFoundFlag == in phFriNfc_MifStd_H_ChkTLVs()
3950 static NFCSTATUS phFriNfc_MifStd_H_GetNxtTLV(phFriNfc_NdefMap_t *NdefMap, in phFriNfc_MifStd_H_GetNxtTLV() argument
3965 (*TempLength) += (NdefMap->SendRecvBuf[TempLen] + in phFriNfc_MifStd_H_GetNxtTLV()
3968 if(NdefMap->TLVStruct.NdefTLVFoundFlag == PH_FRINFC_MIFARESTD_FLAG0) in phFriNfc_MifStd_H_GetNxtTLV()
3973 (NdefMap->SendRecvBuf[TempLen] - in phFriNfc_MifStd_H_GetNxtTLV()
3981 (NdefMap->SendRecvBuf[TempLen] - in phFriNfc_MifStd_H_GetNxtTLV()
3988 if(NdefMap->TLVStruct.NoLbytesinTLV == in phFriNfc_MifStd_H_GetNxtTLV()
3991 ShiftLength = NdefMap->TLVStruct.prevLenByteValue; in phFriNfc_MifStd_H_GetNxtTLV()
3993 << 8) + NdefMap->SendRecvBuf[TempLen] + in phFriNfc_MifStd_H_GetNxtTLV()
3998 << 8) + NdefMap->SendRecvBuf[TempLen]) - in phFriNfc_MifStd_H_GetNxtTLV()
4003 ShiftLength = NdefMap->SendRecvBuf[(TempLen - PH_FRINFC_MIFARESTD_VAL1)]; in phFriNfc_MifStd_H_GetNxtTLV()
4005 << 8) + NdefMap->SendRecvBuf[TempLen] + in phFriNfc_MifStd_H_GetNxtTLV()
4010 << 8) + NdefMap->SendRecvBuf[TempLen]) - in phFriNfc_MifStd_H_GetNxtTLV()
4015 NdefMap->TLVStruct.NdefTLVByte = in phFriNfc_MifStd_H_GetNxtTLV()
4022 NdefMap->StdMifareContainer.currentBlock++; in phFriNfc_MifStd_H_GetNxtTLV()
4023 NdefMap->StdMifareContainer.NdefBlocks++; in phFriNfc_MifStd_H_GetNxtTLV()
4024 Result = phFriNfc_MifStd_H_BlkChk(NdefMap); in phFriNfc_MifStd_H_GetNxtTLV()
4031 if(NdefMap->TLVStruct.NdefTLVByte == PH_FRINFC_MIFARESTD_VAL0) in phFriNfc_MifStd_H_GetNxtTLV()
4033 NdefMap->StdMifareContainer.currentBlock++; in phFriNfc_MifStd_H_GetNxtTLV()
4034 NdefMap->StdMifareContainer.NdefBlocks++; in phFriNfc_MifStd_H_GetNxtTLV()
4035 Result = phFriNfc_MifStd_H_BlkChk(NdefMap); in phFriNfc_MifStd_H_GetNxtTLV()
4041 static NFCSTATUS phFriNfc_MifStd_H_Chk16Bytes(phFriNfc_NdefMap_t *NdefMap, in phFriNfc_MifStd_H_Chk16Bytes() argument
4047 NdefMap->StdMifareContainer.currentBlock++; in phFriNfc_MifStd_H_Chk16Bytes()
4048 NdefMap->StdMifareContainer.NdefBlocks++; in phFriNfc_MifStd_H_Chk16Bytes()
4049 Result = phFriNfc_MifStd_H_BlkChk(NdefMap); in phFriNfc_MifStd_H_Chk16Bytes()
4052 ((NdefMap->StdMifareContainer.AuthDone == PH_FRINFC_MIFARESTD_FLAG1)? in phFriNfc_MifStd_H_Chk16Bytes()
4053 phFriNfc_MifStd_H_GetActCardLen(NdefMap): in phFriNfc_MifStd_H_Chk16Bytes()
4054 phFriNfc_MifStd_H_AuthSector(NdefMap)); in phFriNfc_MifStd_H_Chk16Bytes()
4059 static NFCSTATUS phFriNfc_MifStd_H_ChkRemainTLVs(phFriNfc_NdefMap_t *NdefMap, in phFriNfc_MifStd_H_ChkRemainTLVs() argument
4068 switch(NdefMap->TLVStruct.NoLbytesinTLV) in phFriNfc_MifStd_H_ChkRemainTLVs()
4072 Result = ((NdefMap->TLVStruct.NdefTLVFoundFlag == in phFriNfc_MifStd_H_ChkRemainTLVs()
4074 phFriNfc_MapTool_SetCardState(NdefMap, in phFriNfc_MifStd_H_ChkRemainTLVs()
4075 NdefMap->SendRecvBuf[TempLength]): in phFriNfc_MifStd_H_ChkRemainTLVs()
4081 if((NdefMap->SendRecvBuf[TempLength] < in phFriNfc_MifStd_H_ChkRemainTLVs()
4085 NdefMap->StdMifareContainer.remainingSize -= in phFriNfc_MifStd_H_ChkRemainTLVs()
4088 Result = ((NdefMap->SendRecvBuf[TempLength] > in phFriNfc_MifStd_H_ChkRemainTLVs()
4089 NdefMap->StdMifareContainer.remainingSize)? in phFriNfc_MifStd_H_ChkRemainTLVs()
4094 if((NdefMap->TLVStruct.NdefTLVFoundFlag == in phFriNfc_MifStd_H_ChkRemainTLVs()
4098 NdefMap->TLVStruct.BytesRemainLinTLV = in phFriNfc_MifStd_H_ChkRemainTLVs()
4099 NdefMap->SendRecvBuf[TempLength]; in phFriNfc_MifStd_H_ChkRemainTLVs()
4106 Result = phFriNfc_MifStd_H_GetNxtTLV(NdefMap, in phFriNfc_MifStd_H_ChkRemainTLVs()
4109 NdefMap->StdMifareContainer.remainingSize -= in phFriNfc_MifStd_H_ChkRemainTLVs()
4110 NdefMap->SendRecvBuf[TempLength]; in phFriNfc_MifStd_H_ChkRemainTLVs()
4115 Result = phFriNfc_MifStd_H_GetActCardLen(NdefMap); in phFriNfc_MifStd_H_ChkRemainTLVs()
4124 else if((NdefMap->SendRecvBuf[TempLength] == in phFriNfc_MifStd_H_ChkRemainTLVs()
4129 NdefMap->StdMifareContainer.remainingSize -= in phFriNfc_MifStd_H_ChkRemainTLVs()
4132 Result = (((((uint16_t)NdefMap->SendRecvBuf[TempLength] << 8) + in phFriNfc_MifStd_H_ChkRemainTLVs()
4133 NdefMap->SendRecvBuf[(TempLength + in phFriNfc_MifStd_H_ChkRemainTLVs()
4135 NdefMap->StdMifareContainer.remainingSize)? in phFriNfc_MifStd_H_ChkRemainTLVs()
4139 if((NdefMap->TLVStruct.NdefTLVFoundFlag == in phFriNfc_MifStd_H_ChkRemainTLVs()
4143 NdefMap->TLVStruct.NULLTLVCount = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifStd_H_ChkRemainTLVs()
4144 NdefMap->TLVStruct.BytesRemainLinTLV = in phFriNfc_MifStd_H_ChkRemainTLVs()
4145 (((uint16_t)NdefMap->SendRecvBuf[TempLength] << 8) + in phFriNfc_MifStd_H_ChkRemainTLVs()
4146 NdefMap->SendRecvBuf[(TempLength + in phFriNfc_MifStd_H_ChkRemainTLVs()
4154 Result = phFriNfc_MifStd_H_GetNxtTLV(NdefMap, in phFriNfc_MifStd_H_ChkRemainTLVs()
4156 NdefMap->StdMifareContainer.remainingSize -= in phFriNfc_MifStd_H_ChkRemainTLVs()
4157 (((uint16_t)NdefMap->SendRecvBuf[TempLength] << 8) + in phFriNfc_MifStd_H_ChkRemainTLVs()
4158 NdefMap->SendRecvBuf[(TempLength + in phFriNfc_MifStd_H_ChkRemainTLVs()
4162 Result = phFriNfc_MifStd_H_GetActCardLen(NdefMap); in phFriNfc_MifStd_H_ChkRemainTLVs()
4181 ShiftLength = ((NdefMap->TLVStruct.NoLbytesinTLV == in phFriNfc_MifStd_H_ChkRemainTLVs()
4183 ((NdefMap->TLVStruct.prevLenByteValue << 8) + in phFriNfc_MifStd_H_ChkRemainTLVs()
4184 NdefMap->SendRecvBuf[TempLength]): in phFriNfc_MifStd_H_ChkRemainTLVs()
4185 (((uint16_t)NdefMap->SendRecvBuf[TempLength] << 8) + in phFriNfc_MifStd_H_ChkRemainTLVs()
4186 NdefMap->SendRecvBuf[(TempLength + in phFriNfc_MifStd_H_ChkRemainTLVs()
4188 if(((( NdefMap->StdMifareContainer.NoOfNdefCompBlocks - in phFriNfc_MifStd_H_ChkRemainTLVs()
4189 NdefMap->StdMifareContainer.NdefBlocks) * in phFriNfc_MifStd_H_ChkRemainTLVs()
4202 NdefMap->StdMifareContainer.remainingSize -= in phFriNfc_MifStd_H_ChkRemainTLVs()
4204 if(NdefMap->TLVStruct.NdefTLVFoundFlag == in phFriNfc_MifStd_H_ChkRemainTLVs()
4207 NdefMap->TLVStruct.BytesRemainLinTLV = ShiftLength; in phFriNfc_MifStd_H_ChkRemainTLVs()
4208 if(NdefMap->TLVStruct.BytesRemainLinTLV > in phFriNfc_MifStd_H_ChkRemainTLVs()
4209 NdefMap->StdMifareContainer.remainingSize) in phFriNfc_MifStd_H_ChkRemainTLVs()
4219 NdefMap->StdMifareContainer.remainingSize -= in phFriNfc_MifStd_H_ChkRemainTLVs()
4224 Result = ((NdefMap->TLVStruct.NdefTLVFoundFlag == PH_FRINFC_MIFARESTD_FLAG1)? in phFriNfc_MifStd_H_ChkRemainTLVs()
4226 phFriNfc_MifStd_H_GetNxtTLV(NdefMap, &TempLength, &TL4bytesFlag)); in phFriNfc_MifStd_H_ChkRemainTLVs()
4229 Result = phFriNfc_MifStd_H_GetActCardLen(NdefMap); in phFriNfc_MifStd_H_ChkRemainTLVs()
4240 static void phFriNfc_MifStd_H_Get1kStTrail(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_Get1kStTrail() argument
4242 switch((NdefMap->StdMifareContainer.currentBlock % 4)) in phFriNfc_MifStd_H_Get1kStTrail()
4245 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL0] = in phFriNfc_MifStd_H_Get1kStTrail()
4246 (NdefMap->StdMifareContainer.currentBlock + in phFriNfc_MifStd_H_Get1kStTrail()
4251 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL0] = in phFriNfc_MifStd_H_Get1kStTrail()
4252 (NdefMap->StdMifareContainer.currentBlock + in phFriNfc_MifStd_H_Get1kStTrail()
4257 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL0] = in phFriNfc_MifStd_H_Get1kStTrail()
4258 (NdefMap->StdMifareContainer.currentBlock + in phFriNfc_MifStd_H_Get1kStTrail()
4263 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL0] = in phFriNfc_MifStd_H_Get1kStTrail()
4264 NdefMap->StdMifareContainer.currentBlock; in phFriNfc_MifStd_H_Get1kStTrail()
4269 static void phFriNfc_MifStd_H_Get4kStTrail(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_Get4kStTrail() argument
4271 switch((NdefMap->StdMifareContainer.currentBlock % 16)) in phFriNfc_MifStd_H_Get4kStTrail()
4274 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL0] = in phFriNfc_MifStd_H_Get4kStTrail()
4275 (NdefMap->StdMifareContainer.currentBlock + in phFriNfc_MifStd_H_Get4kStTrail()
4280 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL0] = in phFriNfc_MifStd_H_Get4kStTrail()
4281 (NdefMap->StdMifareContainer.currentBlock + in phFriNfc_MifStd_H_Get4kStTrail()
4286 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL0] = in phFriNfc_MifStd_H_Get4kStTrail()
4287 (NdefMap->StdMifareContainer.currentBlock + in phFriNfc_MifStd_H_Get4kStTrail()
4292 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL0] = in phFriNfc_MifStd_H_Get4kStTrail()
4293 (NdefMap->StdMifareContainer.currentBlock + in phFriNfc_MifStd_H_Get4kStTrail()
4298 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL0] = in phFriNfc_MifStd_H_Get4kStTrail()
4299 (NdefMap->StdMifareContainer.currentBlock + in phFriNfc_MifStd_H_Get4kStTrail()
4304 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL0] = in phFriNfc_MifStd_H_Get4kStTrail()
4305 (NdefMap->StdMifareContainer.currentBlock + in phFriNfc_MifStd_H_Get4kStTrail()
4310 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL0] = in phFriNfc_MifStd_H_Get4kStTrail()
4311 (NdefMap->StdMifareContainer.currentBlock + in phFriNfc_MifStd_H_Get4kStTrail()
4316 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL0] = in phFriNfc_MifStd_H_Get4kStTrail()
4317 (NdefMap->StdMifareContainer.currentBlock + in phFriNfc_MifStd_H_Get4kStTrail()
4322 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL0] = in phFriNfc_MifStd_H_Get4kStTrail()
4323 (NdefMap->StdMifareContainer.currentBlock + in phFriNfc_MifStd_H_Get4kStTrail()
4328 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL0] = in phFriNfc_MifStd_H_Get4kStTrail()
4329 (NdefMap->StdMifareContainer.currentBlock + in phFriNfc_MifStd_H_Get4kStTrail()
4334 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL0] = in phFriNfc_MifStd_H_Get4kStTrail()
4335 (NdefMap->StdMifareContainer.currentBlock + in phFriNfc_MifStd_H_Get4kStTrail()
4340 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL0] = in phFriNfc_MifStd_H_Get4kStTrail()
4341 (NdefMap->StdMifareContainer.currentBlock + in phFriNfc_MifStd_H_Get4kStTrail()
4346 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL0] = in phFriNfc_MifStd_H_Get4kStTrail()
4347 (NdefMap->StdMifareContainer.currentBlock + in phFriNfc_MifStd_H_Get4kStTrail()
4352 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL0] = in phFriNfc_MifStd_H_Get4kStTrail()
4353 (NdefMap->StdMifareContainer.currentBlock + in phFriNfc_MifStd_H_Get4kStTrail()
4358 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL0] = in phFriNfc_MifStd_H_Get4kStTrail()
4359 (NdefMap->StdMifareContainer.currentBlock + in phFriNfc_MifStd_H_Get4kStTrail()
4364 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL0] = in phFriNfc_MifStd_H_Get4kStTrail()
4365 NdefMap->StdMifareContainer.currentBlock; in phFriNfc_MifStd_H_Get4kStTrail()
4370 static NFCSTATUS phFriNfc_MifStd_H_ProChkNdef(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_ProChkNdef() argument
4375 if(NdefMap->StdMifareContainer.currentBlock == in phFriNfc_MifStd_H_ProChkNdef()
4379 phFriNfc_MifStd_H_fillAIDarray(NdefMap); in phFriNfc_MifStd_H_ProChkNdef()
4381 NdefMap->StdMifareContainer.currentBlock = PH_FRINFC_MIFARESTD_VAL2; in phFriNfc_MifStd_H_ProChkNdef()
4383 Result = ((NdefMap->StdMifareContainer.aidCompleteFlag == in phFriNfc_MifStd_H_ProChkNdef()
4386 phFriNfc_MifareStdMap_ChkNdef( NdefMap)); in phFriNfc_MifStd_H_ProChkNdef()
4388 else if(((NdefMap->CardType == PH_FRINFC_NDEFMAP_MIFARE_STD_1K_CARD) && in phFriNfc_MifStd_H_ProChkNdef()
4389 (NdefMap->StdMifareContainer.currentBlock == in phFriNfc_MifStd_H_ProChkNdef()
4391 (NdefMap->StdMifareContainer.currentBlock == in phFriNfc_MifStd_H_ProChkNdef()
4393 (NdefMap->CardType == in phFriNfc_MifStd_H_ProChkNdef()
4397 phFriNfc_MifStd_H_fillAIDarray(NdefMap); in phFriNfc_MifStd_H_ProChkNdef()
4399 NdefMap->StdMifareContainer.aidCompleteFlag = in phFriNfc_MifStd_H_ProChkNdef()
4402 else if((NdefMap->StdMifareContainer.currentBlock > in phFriNfc_MifStd_H_ProChkNdef()
4404 (NdefMap->CardType == in phFriNfc_MifStd_H_ProChkNdef()
4407 phFriNfc_MifStd_H_fillAIDarray(NdefMap); in phFriNfc_MifStd_H_ProChkNdef()
4410 Result = ((NdefMap->StdMifareContainer.aidCompleteFlag == in phFriNfc_MifStd_H_ProChkNdef()
4413 phFriNfc_MifStd4k_H_CheckNdef(NdefMap)); in phFriNfc_MifStd_H_ProChkNdef()
4425 if(NdefMap->StdMifareContainer.aidCompleteFlag == in phFriNfc_MifStd_H_ProChkNdef()
4428 NdefMap->StdMifareContainer.ChkNdefCompleteFlag = in phFriNfc_MifStd_H_ProChkNdef()
4435 phFriNfc_MifStd_H_ChkNdefCmpltSects(NdefMap); in phFriNfc_MifStd_H_ProChkNdef()
4436 if((NdefMap->StdMifareContainer.NoOfNdefCompBlocks == 0) || in phFriNfc_MifStd_H_ProChkNdef()
4437 (NdefMap->StdMifareContainer.NoOfNdefCompBlocks > 255)) in phFriNfc_MifStd_H_ProChkNdef()
4444 NdefMap->StdMifareContainer.aidCompleteFlag = in phFriNfc_MifStd_H_ProChkNdef()
4446 NdefMap->StdMifareContainer.NFCforumSectFlag = in phFriNfc_MifStd_H_ProChkNdef()
4448 NdefMap->StdMifareContainer.currentBlock = PH_FRINFC_MIFARESTD_BLK4; in phFriNfc_MifStd_H_ProChkNdef()
4449 Result = phFriNfc_MifStd_H_BlkChk(NdefMap); in phFriNfc_MifStd_H_ProChkNdef()
4451 Result:phFriNfc_MifStd_H_AuthSector(NdefMap)); in phFriNfc_MifStd_H_ProChkNdef()
4458 static NFCSTATUS phFriNfc_MifStd_H_ProAuth(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_ProAuth() argument
4461 if(NdefMap->TLVStruct.NdefTLVAuthFlag == in phFriNfc_MifStd_H_ProAuth()
4464 NdefMap->TLVStruct.NdefTLVAuthFlag = in phFriNfc_MifStd_H_ProAuth()
4466 NdefMap->StdMifareContainer.AuthDone = PH_FRINFC_MIFARESTD_FLAG1; in phFriNfc_MifStd_H_ProAuth()
4467 Result = phFriNfc_MifStd_H_RdtoWrNdefLen(NdefMap); in phFriNfc_MifStd_H_ProAuth()
4471 NdefMap->StdMifareContainer.AuthDone = 1; in phFriNfc_MifStd_H_ProAuth()
4472 NdefMap->StdMifareContainer.ReadAcsBitFlag = 1; in phFriNfc_MifStd_H_ProAuth()
4473 Result = phFriNfc_MifStd_H_RdAcsBit(NdefMap); in phFriNfc_MifStd_H_ProAuth()
4478 static NFCSTATUS phFriNfc_MifStd_H_Rd16Bytes(phFriNfc_NdefMap_t *NdefMap, in phFriNfc_MifStd_H_Rd16Bytes() argument
4482 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL0] = BlockNo; in phFriNfc_MifStd_H_Rd16Bytes()
4483 NdefMap->SendLength = MIFARE_MAX_SEND_BUF_TO_READ; in phFriNfc_MifStd_H_Rd16Bytes()
4484 *NdefMap->SendRecvLength = NdefMap->TempReceiveLength; in phFriNfc_MifStd_H_Rd16Bytes()
4486 NdefMap->Cmd.MfCmd = phHal_eMifareCmdListMifareRead; in phFriNfc_MifStd_H_Rd16Bytes()
4488 NdefMap->Cmd.MfCmd = phHal_eMifareRead; in phFriNfc_MifStd_H_Rd16Bytes()
4490 NdefMap->MapCompletionInfo.CompletionRoutine = phFriNfc_MifareStdMap_Process; in phFriNfc_MifStd_H_Rd16Bytes()
4491 NdefMap->MapCompletionInfo.Context = NdefMap; in phFriNfc_MifStd_H_Rd16Bytes()
4493 Result = phFriNfc_OvrHal_Transceive( NdefMap->LowerDevice, in phFriNfc_MifStd_H_Rd16Bytes()
4494 &NdefMap->MapCompletionInfo, in phFriNfc_MifStd_H_Rd16Bytes()
4495 NdefMap->psRemoteDevInfo, in phFriNfc_MifStd_H_Rd16Bytes()
4496 NdefMap->Cmd, in phFriNfc_MifStd_H_Rd16Bytes()
4497 &NdefMap->psDepAdditionalInfo, in phFriNfc_MifStd_H_Rd16Bytes()
4498 NdefMap->SendRecvBuf, in phFriNfc_MifStd_H_Rd16Bytes()
4499 NdefMap->SendLength, in phFriNfc_MifStd_H_Rd16Bytes()
4500 NdefMap->SendRecvBuf, in phFriNfc_MifStd_H_Rd16Bytes()
4501 NdefMap->SendRecvLength); in phFriNfc_MifStd_H_Rd16Bytes()
4505 static NFCSTATUS phFriNfc_MifStd_H_ProAcsBits(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_ProAcsBits() argument
4509 if(*NdefMap->SendRecvLength == PH_FRINFC_MIFARESTD_BYTES_READ) in phFriNfc_MifStd_H_ProAcsBits()
4511 if(NdefMap->StdMifareContainer.ReadAcsBitFlag == in phFriNfc_MifStd_H_ProAcsBits()
4515 Result = phFriNfc_MifStd_H_ChkAcsBit(NdefMap); in phFriNfc_MifStd_H_ProAcsBits()
4517 if((NdefMap->StdMifareContainer.ChkNdefFlag == in phFriNfc_MifStd_H_ProAcsBits()
4521 if(NdefMap->CardState == in phFriNfc_MifStd_H_ProAcsBits()
4524 NdefMap->StdMifareContainer.NoOfNdefCompBlocks = in phFriNfc_MifStd_H_ProAcsBits()
4525 ((NdefMap->StdMifareContainer.currentBlock >= in phFriNfc_MifStd_H_ProAcsBits()
4527 (NdefMap->StdMifareContainer.NoOfNdefCompBlocks - in phFriNfc_MifStd_H_ProAcsBits()
4529 (NdefMap->StdMifareContainer.NoOfNdefCompBlocks - in phFriNfc_MifStd_H_ProAcsBits()
4532 NdefMap->StdMifareContainer.ProprforumSectFlag = in phFriNfc_MifStd_H_ProAcsBits()
4533 ((NdefMap->StdMifareContainer.NFCforumSectFlag == in phFriNfc_MifStd_H_ProAcsBits()
4538 Result = phFriNfc_MifStd_H_ProStatNotValid(NdefMap, Result); in phFriNfc_MifStd_H_ProAcsBits()
4542 NdefMap->StdMifareContainer.NFCforumSectFlag = in phFriNfc_MifStd_H_ProAcsBits()
4543 (((NdefMap->StdMifareContainer.currentBlock == 64) && in phFriNfc_MifStd_H_ProAcsBits()
4544 (NdefMap->CardType == PH_FRINFC_NDEFMAP_MIFARE_STD_4K_CARD))? in phFriNfc_MifStd_H_ProAcsBits()
4545 NdefMap->StdMifareContainer.NFCforumSectFlag: in phFriNfc_MifStd_H_ProAcsBits()
4549 if(NdefMap->StdMifareContainer.ProprforumSectFlag != in phFriNfc_MifStd_H_ProAcsBits()
4552 NdefMap->StdMifareContainer.ReadAcsBitFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifStd_H_ProAcsBits()
4558 NdefMap->StdMifareContainer.ReadCompleteFlag = in phFriNfc_MifStd_H_ProAcsBits()
4559 (uint8_t)((((((NdefMap->StdMifareContainer.currentBlock + in phFriNfc_MifStd_H_ProAcsBits()
4562 (NdefMap->CardType == in phFriNfc_MifStd_H_ProAcsBits()
4564 (NdefMap->StdMifareContainer.ReadCompleteFlag == in phFriNfc_MifStd_H_ProAcsBits()
4566 (NdefMap->StdMifareContainer.ReadCompleteFlag == in phFriNfc_MifStd_H_ProAcsBits()
4571 NdefMap->StdMifareContainer.ReadCompleteFlag = in phFriNfc_MifStd_H_ProAcsBits()
4572 (uint8_t)((((((uint16_t)(NdefMap->StdMifareContainer.currentBlock + in phFriNfc_MifStd_H_ProAcsBits()
4575 (NdefMap->CardType == in phFriNfc_MifStd_H_ProAcsBits()
4577 (NdefMap->StdMifareContainer.ReadCompleteFlag == in phFriNfc_MifStd_H_ProAcsBits()
4579 (NdefMap->StdMifareContainer.ReadCompleteFlag == in phFriNfc_MifStd_H_ProAcsBits()
4584 NdefMap->StdMifareContainer.currentBlock = in phFriNfc_MifStd_H_ProAcsBits()
4585 ((NdefMap->StdMifareContainer.ReadCompleteFlag == in phFriNfc_MifStd_H_ProAcsBits()
4588 NdefMap->StdMifareContainer.currentBlock); in phFriNfc_MifStd_H_ProAcsBits()
4591 ((NdefMap->StdMifareContainer.ReadCompleteFlag == in phFriNfc_MifStd_H_ProAcsBits()
4593 phFriNfc_MifStd_H_BlkChk(NdefMap): in phFriNfc_MifStd_H_ProAcsBits()
4600 phFriNfc_MifStd_H_ChkRdWr(NdefMap)); in phFriNfc_MifStd_H_ProAcsBits()
4604 NdefMap->StdMifareContainer.ChkNdefFlag = in phFriNfc_MifStd_H_ProAcsBits()
4608 Result = phFriNfc_MifStd_H_ChkTLVs(NdefMap, &CRFlag); in phFriNfc_MifStd_H_ProAcsBits()
4624 static NFCSTATUS phFriNfc_MifStd_H_GPBChk(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_GPBChk() argument
4629 Result = phFriNfc_MapTool_ChkSpcVer(NdefMap, PH_FRINFC_MIFARESTD_VAL9); in phFriNfc_MifStd_H_GPBChk()
4637 if(((NdefMap->SendRecvBuf[ in phFriNfc_MifStd_H_GPBChk()
4641 ((NdefMap->SendRecvBuf[ in phFriNfc_MifStd_H_GPBChk()
4646 NdefMap->CardState = (((NdefMap->StdMifareContainer.ChkNdefFlag == in phFriNfc_MifStd_H_GPBChk()
4648 (NdefMap->StdMifareContainer.ReadNdefFlag == in phFriNfc_MifStd_H_GPBChk()
4650 (NdefMap->StdMifareContainer.WrNdefFlag == in phFriNfc_MifStd_H_GPBChk()
4655 else if(((NdefMap->SendRecvBuf[ in phFriNfc_MifStd_H_GPBChk()
4659 ((NdefMap->SendRecvBuf[ in phFriNfc_MifStd_H_GPBChk()
4666 NdefMap->CardState = PH_NDEFMAP_CARD_STATE_READ_ONLY; in phFriNfc_MifStd_H_GPBChk()
4670 NdefMap->CardState = PH_NDEFMAP_CARD_STATE_INVALID; in phFriNfc_MifStd_H_GPBChk()
4676 static NFCSTATUS phFriNfc_MifStd_H_ProStatNotValid(phFriNfc_NdefMap_t *NdefMap, in phFriNfc_MifStd_H_ProStatNotValid() argument
4683 if(NdefMap->StdMifareContainer.NFCforumSectFlag == in phFriNfc_MifStd_H_ProStatNotValid()
4686 NdefMap->StdMifareContainer.ProprforumSectFlag = in phFriNfc_MifStd_H_ProStatNotValid()
4688 if(NdefMap->StdMifareContainer.currentBlock < in phFriNfc_MifStd_H_ProStatNotValid()
4698 if(((NdefMap->StdMifareContainer.currentBlock < in phFriNfc_MifStd_H_ProStatNotValid()
4700 (NdefMap->CardType == PH_FRINFC_NDEFMAP_MIFARE_STD_1K_CARD)) || in phFriNfc_MifStd_H_ProStatNotValid()
4701 ((NdefMap->StdMifareContainer.currentBlock <= in phFriNfc_MifStd_H_ProStatNotValid()
4703 (NdefMap->CardType == PH_FRINFC_NDEFMAP_MIFARE_STD_4K_CARD))) in phFriNfc_MifStd_H_ProStatNotValid()
4708 else if((NdefMap->StdMifareContainer.currentBlock < in phFriNfc_MifStd_H_ProStatNotValid()
4710 (NdefMap->CardType == PH_FRINFC_NDEFMAP_MIFARE_STD_4K_CARD)) in phFriNfc_MifStd_H_ProStatNotValid()
4713 NdefMap->StdMifareContainer.currentBlock = in phFriNfc_MifStd_H_ProStatNotValid()
4718 if(((NdefMap->StdMifareContainer.currentBlock + in phFriNfc_MifStd_H_ProStatNotValid()
4721 (NdefMap->CardType == PH_FRINFC_NDEFMAP_MIFARE_STD_1K_CARD)) in phFriNfc_MifStd_H_ProStatNotValid()
4728 NdefMap->StdMifareContainer.remainingSize -= in phFriNfc_MifStd_H_ProStatNotValid()
4730 NdefMap->StdMifareContainer.currentBlock += in phFriNfc_MifStd_H_ProStatNotValid()
4732 Result = phFriNfc_MifStd_H_BlkChk(NdefMap); in phFriNfc_MifStd_H_ProStatNotValid()
4735 else if((NdefMap->StdMifareContainer.currentBlock + in phFriNfc_MifStd_H_ProStatNotValid()
4744 NdefMap->StdMifareContainer.remainingSize -= in phFriNfc_MifStd_H_ProStatNotValid()
4746 NdefMap->StdMifareContainer.currentBlock += in phFriNfc_MifStd_H_ProStatNotValid()
4748 Result = phFriNfc_MifStd_H_BlkChk(NdefMap); in phFriNfc_MifStd_H_ProStatNotValid()
4753 phFriNfc_MifStd_H_AuthSector(NdefMap)); in phFriNfc_MifStd_H_ProStatNotValid()
4755 else if((NdefMap->StdMifareContainer.ProprforumSectFlag == in phFriNfc_MifStd_H_ProStatNotValid()
4757 (NdefMap->StdMifareContainer.NFCforumSectFlag == in phFriNfc_MifStd_H_ProStatNotValid()
4769 NdefMap->StdMifareContainer.ProprforumSectFlag = in phFriNfc_MifStd_H_ProStatNotValid()
4771 switch(NdefMap->PrevOperation) in phFriNfc_MifStd_H_ProStatNotValid()
4780 if((NdefMap->TLVStruct.NdefTLVFoundFlag == in phFriNfc_MifStd_H_ProStatNotValid()
4782 (NdefMap->TLVStruct.NoLbytesinTLV == in phFriNfc_MifStd_H_ProStatNotValid()
4785 *NdefMap->NumOfBytesRead = NdefMap->ApduBuffIndex; in phFriNfc_MifStd_H_ProStatNotValid()
4799 NdefMap->StdMifareContainer.ReadWriteCompleteFlag = in phFriNfc_MifStd_H_ProStatNotValid()
4802 NdefMap->StdMifareContainer.TempBlockNo = in phFriNfc_MifStd_H_ProStatNotValid()
4803 NdefMap->StdMifareContainer.currentBlock; in phFriNfc_MifStd_H_ProStatNotValid()
4804 phFriNfc_MifStd_H_SetNdefBlkAuth(NdefMap); in phFriNfc_MifStd_H_ProStatNotValid()
4805 NdefMap->StdMifareContainer.currentBlock = in phFriNfc_MifStd_H_ProStatNotValid()
4806 NdefMap->TLVStruct.NdefTLVBlock; in phFriNfc_MifStd_H_ProStatNotValid()
4807 Result = phFriNfc_MifStd_H_RdtoWrNdefLen(NdefMap); in phFriNfc_MifStd_H_ProStatNotValid()
4814 static NFCSTATUS phFriNfc_MifStd_H_RdBeforeWr(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_RdBeforeWr() argument
4817 NdefMap->State = PH_FRINFC_NDEFMAP_STATE_RD_BEF_WR; in phFriNfc_MifStd_H_RdBeforeWr()
4818 NdefMap->PrevOperation = PH_FRINFC_NDEFMAP_WRITE_OPE; in phFriNfc_MifStd_H_RdBeforeWr()
4820 Result = phFriNfc_MifStd_H_Rd16Bytes(NdefMap, in phFriNfc_MifStd_H_RdBeforeWr()
4821 NdefMap->StdMifareContainer.currentBlock); in phFriNfc_MifStd_H_RdBeforeWr()
4825 static NFCSTATUS phFriNfc_MifStd_H_ProBytesToWr(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_ProBytesToWr() argument
4830 if(*NdefMap->SendRecvLength == PH_FRINFC_MIFARESTD_BYTES_READ) in phFriNfc_MifStd_H_ProBytesToWr()
4832 (void)memcpy(&NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL1], in phFriNfc_MifStd_H_ProBytesToWr()
4833 NdefMap->SendRecvBuf, in phFriNfc_MifStd_H_ProBytesToWr()
4837 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL0] = in phFriNfc_MifStd_H_ProBytesToWr()
4838 NdefMap->StdMifareContainer.currentBlock; in phFriNfc_MifStd_H_ProBytesToWr()
4840 TempLength = ((NdefMap->StdMifareContainer.currentBlock == in phFriNfc_MifStd_H_ProBytesToWr()
4841 NdefMap->TLVStruct.NdefTLVBlock)? in phFriNfc_MifStd_H_ProBytesToWr()
4842 phFriNfc_MifStd_H_UpdateTLV(NdefMap): in phFriNfc_MifStd_H_ProBytesToWr()
4843 phFriNfc_MifStd_H_UpdRemTLV(NdefMap)); in phFriNfc_MifStd_H_ProBytesToWr()
4845 NdefMap->StdMifareContainer.remainingSize -= in phFriNfc_MifStd_H_ProBytesToWr()
4846 ((NdefMap->StdMifareContainer.remSizeUpdFlag == in phFriNfc_MifStd_H_ProBytesToWr()
4851 NdefMap->StdMifareContainer.remSizeUpdFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifStd_H_ProBytesToWr()
4852 NdefMap->State = PH_FRINFC_NDEFMAP_STATE_WR_TLV; in phFriNfc_MifStd_H_ProBytesToWr()
4854 phFriNfc_MifStd_H_WrTLV(NdefMap): in phFriNfc_MifStd_H_ProBytesToWr()
4855 phFriNfc_MifStd_H_fillSendBuf(NdefMap, TempLength)); in phFriNfc_MifStd_H_ProBytesToWr()
4866 static uint8_t phFriNfc_MifStd_H_UpdateTLV(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_UpdateTLV() argument
4869 TempLength = (uint8_t)(NdefMap->TLVStruct.NdefTLVByte + PH_FRINFC_MIFARESTD_VAL1); in phFriNfc_MifStd_H_UpdateTLV()
4871 if(NdefMap->TLVStruct.NULLTLVCount >= 2) in phFriNfc_MifStd_H_UpdateTLV()
4876 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NDEFTLV_T; in phFriNfc_MifStd_H_UpdateTLV()
4880 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NDEFTLV_T; in phFriNfc_MifStd_H_UpdateTLV()
4882 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NDEFTLV_L0; in phFriNfc_MifStd_H_UpdateTLV()
4891 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NULLTLV_T; in phFriNfc_MifStd_H_UpdateTLV()
4895 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NULLTLV_T; in phFriNfc_MifStd_H_UpdateTLV()
4897 NdefMap->TLVStruct.prevLenByteValue = in phFriNfc_MifStd_H_UpdateTLV()
4898 (uint16_t)((NdefMap->SendRecvBuf[TempLength] >= in phFriNfc_MifStd_H_UpdateTLV()
4901 NdefMap->SendRecvBuf[TempLength]); in phFriNfc_MifStd_H_UpdateTLV()
4902 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NULLTLV_T; in phFriNfc_MifStd_H_UpdateTLV()
4906 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NULLTLV_T; in phFriNfc_MifStd_H_UpdateTLV()
4908 NdefMap->TLVStruct.prevLenByteValue = in phFriNfc_MifStd_H_UpdateTLV()
4909 (uint16_t)((NdefMap->SendRecvBuf[TempLength] >= in phFriNfc_MifStd_H_UpdateTLV()
4911 NdefMap->SendRecvBuf[(TempLength + in phFriNfc_MifStd_H_UpdateTLV()
4913 NdefMap->SendRecvBuf[TempLength]); in phFriNfc_MifStd_H_UpdateTLV()
4914 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NULLTLV_T; in phFriNfc_MifStd_H_UpdateTLV()
4916 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NDEFTLV_T; in phFriNfc_MifStd_H_UpdateTLV()
4920 NdefMap->TLVStruct.prevLenByteValue = in phFriNfc_MifStd_H_UpdateTLV()
4921 NdefMap->SendRecvBuf[TempLength]; in phFriNfc_MifStd_H_UpdateTLV()
4922 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NULLTLV_T; in phFriNfc_MifStd_H_UpdateTLV()
4924 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NULLTLV_T; in phFriNfc_MifStd_H_UpdateTLV()
4926 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NDEFTLV_T; in phFriNfc_MifStd_H_UpdateTLV()
4928 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NDEFTLV_L0; in phFriNfc_MifStd_H_UpdateTLV()
4936 static NFCSTATUS phFriNfc_MifStd_H_fillSendBuf(phFriNfc_NdefMap_t *NdefMap, in phFriNfc_MifStd_H_fillSendBuf() argument
4946 RemainingBytes = (uint16_t)((NdefMap->StdMifareContainer.remainingSize in phFriNfc_MifStd_H_fillSendBuf()
4947 < (uint16_t)(NdefMap->ApduBufferSize - in phFriNfc_MifStd_H_fillSendBuf()
4948 NdefMap->ApduBuffIndex))? in phFriNfc_MifStd_H_fillSendBuf()
4949 NdefMap->StdMifareContainer.remainingSize: in phFriNfc_MifStd_H_fillSendBuf()
4950 (NdefMap->ApduBufferSize - in phFriNfc_MifStd_H_fillSendBuf()
4951 NdefMap->ApduBuffIndex)); in phFriNfc_MifStd_H_fillSendBuf()
4953 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL0] = in phFriNfc_MifStd_H_fillSendBuf()
4954 NdefMap->StdMifareContainer.currentBlock; in phFriNfc_MifStd_H_fillSendBuf()
4959 NdefMap->StdMifareContainer.internalLength))? in phFriNfc_MifStd_H_fillSendBuf()
4962 NdefMap->StdMifareContainer.internalLength)); in phFriNfc_MifStd_H_fillSendBuf()
4964 if(NdefMap->StdMifareContainer.internalLength > in phFriNfc_MifStd_H_fillSendBuf()
4968 (void)memcpy(&(NdefMap->SendRecvBuf[ in phFriNfc_MifStd_H_fillSendBuf()
4970 NdefMap->StdMifareContainer.internalBuf, in phFriNfc_MifStd_H_fillSendBuf()
4971 NdefMap->StdMifareContainer.internalLength); in phFriNfc_MifStd_H_fillSendBuf()
4975 (void)memcpy(&(NdefMap->SendRecvBuf[ in phFriNfc_MifStd_H_fillSendBuf()
4977 NdefMap->StdMifareContainer.internalLength)]), in phFriNfc_MifStd_H_fillSendBuf()
4978 &(NdefMap->ApduBuffer[NdefMap->ApduBuffIndex]), in phFriNfc_MifStd_H_fillSendBuf()
4982 NdefMap->NumOfBytesWritten = BytesToWrite; in phFriNfc_MifStd_H_fillSendBuf()
4986 *NdefMap->DataCount = in phFriNfc_MifStd_H_fillSendBuf()
4987 ((BytesToWrite + NdefMap->StdMifareContainer.internalLength in phFriNfc_MifStd_H_fillSendBuf()
4992 if((BytesToWrite + NdefMap->StdMifareContainer.internalLength + in phFriNfc_MifStd_H_fillSendBuf()
4996 NdefMap->StdMifareContainer.internalLength + in phFriNfc_MifStd_H_fillSendBuf()
5001 NdefMap->SendRecvBuf[index] = (uint8_t)((index == in phFriNfc_MifStd_H_fillSendBuf()
5003 NdefMap->StdMifareContainer.internalLength))? in phFriNfc_MifStd_H_fillSendBuf()
5007 NdefMap->TLVStruct.SetTermTLVFlag = PH_FRINFC_MIFARESTD_FLAG1; in phFriNfc_MifStd_H_fillSendBuf()
5012 NdefMap->TLVStruct.SetTermTLVFlag = PH_FRINFC_MIFARESTD_FLAG1; in phFriNfc_MifStd_H_fillSendBuf()
5018 (void)memcpy(NdefMap->StdMifareContainer.Buffer, in phFriNfc_MifStd_H_fillSendBuf()
5019 &(NdefMap->SendRecvBuf[ in phFriNfc_MifStd_H_fillSendBuf()
5023 NdefMap->State = PH_FRINFC_NDEFMAP_STATE_WR_TLV; in phFriNfc_MifStd_H_fillSendBuf()
5024 Result = phFriNfc_MifStd_H_WrTLV(NdefMap); in phFriNfc_MifStd_H_fillSendBuf()
5028 static NFCSTATUS phFriNfc_MifStd_H_WrTLV(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_WrTLV() argument
5033 NdefMap->psDepAdditionalInfo.DepFlags.MetaChaining = 0; in phFriNfc_MifStd_H_WrTLV()
5034 NdefMap->psDepAdditionalInfo.DepFlags.NADPresent = 0; in phFriNfc_MifStd_H_WrTLV()
5035 NdefMap->psDepAdditionalInfo.NAD = 0; in phFriNfc_MifStd_H_WrTLV()
5036 NdefMap->MapCompletionInfo.CompletionRoutine = phFriNfc_MifareStdMap_Process; in phFriNfc_MifStd_H_WrTLV()
5037 NdefMap->MapCompletionInfo.Context = NdefMap; in phFriNfc_MifStd_H_WrTLV()
5039 NdefMap->SendLength = MIFARE_MAX_SEND_BUF_TO_WRITE; in phFriNfc_MifStd_H_WrTLV()
5042 NdefMap->Cmd.MfCmd = phHal_eMifareCmdListMifareWrite16; in phFriNfc_MifStd_H_WrTLV()
5044 NdefMap->Cmd.MfCmd = phHal_eMifareWrite16; in phFriNfc_MifStd_H_WrTLV()
5047 *NdefMap->SendRecvLength = NdefMap->TempReceiveLength; in phFriNfc_MifStd_H_WrTLV()
5049 Result = phFriNfc_OvrHal_Transceive( NdefMap->LowerDevice, in phFriNfc_MifStd_H_WrTLV()
5050 &NdefMap->MapCompletionInfo, in phFriNfc_MifStd_H_WrTLV()
5051 NdefMap->psRemoteDevInfo, in phFriNfc_MifStd_H_WrTLV()
5052 NdefMap->Cmd, in phFriNfc_MifStd_H_WrTLV()
5053 &NdefMap->psDepAdditionalInfo, in phFriNfc_MifStd_H_WrTLV()
5054 NdefMap->SendRecvBuf, in phFriNfc_MifStd_H_WrTLV()
5055 NdefMap->SendLength, in phFriNfc_MifStd_H_WrTLV()
5056 NdefMap->SendRecvBuf, in phFriNfc_MifStd_H_WrTLV()
5057 NdefMap->SendRecvLength); in phFriNfc_MifStd_H_WrTLV()
5063 static NFCSTATUS phFriNfc_MifStd_H_ProWrTLV(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_ProWrTLV() argument
5069 NdefMap->TLVStruct.NdefTLVByte) == in phFriNfc_MifStd_H_ProWrTLV()
5071 (NdefMap->TLVStruct.NULLTLVCount >= in phFriNfc_MifStd_H_ProWrTLV()
5074 NdefMap->TLVStruct.NdefTLVByte) <= in phFriNfc_MifStd_H_ProWrTLV()
5076 (NdefMap->TLVStruct.NULLTLVCount == in phFriNfc_MifStd_H_ProWrTLV()
5078 (NdefMap->StdMifareContainer.currentBlock == in phFriNfc_MifStd_H_ProWrTLV()
5079 NdefMap->TLVStruct.NdefTLVBlock)) in phFriNfc_MifStd_H_ProWrTLV()
5083 NdefMap->StdMifareContainer.RdBeforeWrFlag = PH_FRINFC_MIFARESTD_FLAG1; in phFriNfc_MifStd_H_ProWrTLV()
5084 NdefMap->StdMifareContainer.currentBlock++; in phFriNfc_MifStd_H_ProWrTLV()
5085 NdefMap->StdMifareContainer.NdefBlocks++; in phFriNfc_MifStd_H_ProWrTLV()
5086 Result = phFriNfc_MifStd_H_BlkChk(NdefMap); in phFriNfc_MifStd_H_ProWrTLV()
5089 Result = ((NdefMap->StdMifareContainer.AuthDone == in phFriNfc_MifStd_H_ProWrTLV()
5091 phFriNfc_MifStd_H_AuthSector(NdefMap): in phFriNfc_MifStd_H_ProWrTLV()
5092 phFriNfc_MifStd_H_RdBeforeWr(NdefMap)); in phFriNfc_MifStd_H_ProWrTLV()
5097 NdefMap->StdMifareContainer.RdBeforeWrFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifStd_H_ProWrTLV()
5098 if(NdefMap->ApduBuffIndex < in phFriNfc_MifStd_H_ProWrTLV()
5099 (uint16_t)NdefMap->ApduBufferSize) in phFriNfc_MifStd_H_ProWrTLV()
5101 if(*NdefMap->DataCount < PH_FRINFC_MIFARESTD_BLOCK_BYTES) in phFriNfc_MifStd_H_ProWrTLV()
5104 NdefMap->StdMifareContainer.internalLength = in phFriNfc_MifStd_H_ProWrTLV()
5105 *NdefMap->DataCount; in phFriNfc_MifStd_H_ProWrTLV()
5109 (void)memcpy( NdefMap->StdMifareContainer.internalBuf, in phFriNfc_MifStd_H_ProWrTLV()
5110 NdefMap->StdMifareContainer.Buffer, in phFriNfc_MifStd_H_ProWrTLV()
5111 NdefMap->StdMifareContainer.internalLength); in phFriNfc_MifStd_H_ProWrTLV()
5115 NdefMap->ApduBuffIndex += NdefMap->NumOfBytesWritten; in phFriNfc_MifStd_H_ProWrTLV()
5117 NdefMap->StdMifareContainer.remainingSize -= in phFriNfc_MifStd_H_ProWrTLV()
5118 NdefMap->NumOfBytesWritten; in phFriNfc_MifStd_H_ProWrTLV()
5121 if((NdefMap->StdMifareContainer.remainingSize == in phFriNfc_MifStd_H_ProWrTLV()
5123 (NdefMap->ApduBuffIndex == NdefMap->ApduBufferSize)) in phFriNfc_MifStd_H_ProWrTLV()
5125 NdefMap->StdMifareContainer.ReadWriteCompleteFlag = in phFriNfc_MifStd_H_ProWrTLV()
5126 (uint8_t)((NdefMap->StdMifareContainer.remainingSize == 0)? in phFriNfc_MifStd_H_ProWrTLV()
5129 if(NdefMap->StdMifareContainer.internalLength == in phFriNfc_MifStd_H_ProWrTLV()
5132 NdefMap->StdMifareContainer.currentBlock++; in phFriNfc_MifStd_H_ProWrTLV()
5135 Result = phFriNfc_MifStd_H_BlkChk(NdefMap); in phFriNfc_MifStd_H_ProWrTLV()
5136 NdefMap->StdMifareContainer.NdefBlocks++; in phFriNfc_MifStd_H_ProWrTLV()
5139 NdefMap->TLVStruct.SetTermTLVFlag = in phFriNfc_MifStd_H_ProWrTLV()
5140 (uint8_t)(((NdefMap->StdMifareContainer.remainingSize == in phFriNfc_MifStd_H_ProWrTLV()
5142 (NdefMap->TLVStruct.SetTermTLVFlag == in phFriNfc_MifStd_H_ProWrTLV()
5150 NdefMap->StdMifareContainer.currentBlock++; in phFriNfc_MifStd_H_ProWrTLV()
5153 Result = phFriNfc_MifStd_H_BlkChk(NdefMap); in phFriNfc_MifStd_H_ProWrTLV()
5156 NdefMap->StdMifareContainer.NdefBlocks++; in phFriNfc_MifStd_H_ProWrTLV()
5157 Result = ((NdefMap->StdMifareContainer.AuthDone == in phFriNfc_MifStd_H_ProWrTLV()
5159 phFriNfc_MifStd_H_WrABlock(NdefMap): in phFriNfc_MifStd_H_ProWrTLV()
5160 phFriNfc_MifStd_H_AuthSector(NdefMap)); in phFriNfc_MifStd_H_ProWrTLV()
5167 (NdefMap->TLVStruct.SetTermTLVFlag != in phFriNfc_MifStd_H_ProWrTLV()
5169 (NdefMap->StdMifareContainer.remainingSize > in phFriNfc_MifStd_H_ProWrTLV()
5172 Result = phFriNfc_MifStd_H_WrTermTLV(NdefMap); in phFriNfc_MifStd_H_ProWrTLV()
5177 (NdefMap->TLVStruct.SetTermTLVFlag == in phFriNfc_MifStd_H_ProWrTLV()
5181 NdefMap->StdMifareContainer.TempBlockNo = in phFriNfc_MifStd_H_ProWrTLV()
5182 NdefMap->StdMifareContainer.currentBlock; in phFriNfc_MifStd_H_ProWrTLV()
5183 phFriNfc_MifStd_H_SetNdefBlkAuth(NdefMap); in phFriNfc_MifStd_H_ProWrTLV()
5184 NdefMap->StdMifareContainer.currentBlock = in phFriNfc_MifStd_H_ProWrTLV()
5185 NdefMap->TLVStruct.NdefTLVBlock; in phFriNfc_MifStd_H_ProWrTLV()
5186 Result = phFriNfc_MifStd_H_RdtoWrNdefLen(NdefMap); in phFriNfc_MifStd_H_ProWrTLV()
5192 static uint8_t phFriNfc_MifStd_H_UpdRemTLV(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_UpdRemTLV() argument
5195 if(NdefMap->TLVStruct.NULLTLVCount >= in phFriNfc_MifStd_H_UpdRemTLV()
5198 NdefMap->TLVStruct.prevLenByteValue = NdefMap->SendRecvBuf[TempLength]; in phFriNfc_MifStd_H_UpdRemTLV()
5199 NdefMap->SendRecvBuf[TempLength] = in phFriNfc_MifStd_H_UpdRemTLV()
5205 NdefMap->TLVStruct.NdefTLVByte)) in phFriNfc_MifStd_H_UpdRemTLV()
5208 NdefMap->TLVStruct.prevLenByteValue = in phFriNfc_MifStd_H_UpdRemTLV()
5209 (((NdefMap->SendRecvBuf[TempLength] == in phFriNfc_MifStd_H_UpdRemTLV()
5211 (((uint16_t)NdefMap->SendRecvBuf[(TempLength + PH_FRINFC_MIFARESTD_VAL1)] in phFriNfc_MifStd_H_UpdRemTLV()
5213 NdefMap->SendRecvBuf[(TempLength + PH_FRINFC_MIFARESTD_VAL2)]): in phFriNfc_MifStd_H_UpdRemTLV()
5214 NdefMap->SendRecvBuf[TempLength]); in phFriNfc_MifStd_H_UpdRemTLV()
5215 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NULLTLV_T; in phFriNfc_MifStd_H_UpdRemTLV()
5217 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NDEFTLV_T; in phFriNfc_MifStd_H_UpdRemTLV()
5219 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NDEFTLV_L0; in phFriNfc_MifStd_H_UpdRemTLV()
5223 NdefMap->TLVStruct.prevLenByteValue = in phFriNfc_MifStd_H_UpdRemTLV()
5224 (((NdefMap->SendRecvBuf[TempLength] == in phFriNfc_MifStd_H_UpdRemTLV()
5226 (((uint16_t)NdefMap->SendRecvBuf[TempLength] << in phFriNfc_MifStd_H_UpdRemTLV()
5228 NdefMap->SendRecvBuf[(TempLength + PH_FRINFC_MIFARESTD_VAL1)]): in phFriNfc_MifStd_H_UpdRemTLV()
5229 NdefMap->SendRecvBuf[TempLength]); in phFriNfc_MifStd_H_UpdRemTLV()
5230 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NDEFTLV_T; in phFriNfc_MifStd_H_UpdRemTLV()
5232 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NDEFTLV_L0; in phFriNfc_MifStd_H_UpdRemTLV()
5237 NdefMap->TLVStruct.prevLenByteValue = in phFriNfc_MifStd_H_UpdRemTLV()
5238 ((NdefMap->TLVStruct.prevLenByteValue << in phFriNfc_MifStd_H_UpdRemTLV()
5240 + NdefMap->SendRecvBuf[TempLength]); in phFriNfc_MifStd_H_UpdRemTLV()
5241 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NDEFTLV_L0; in phFriNfc_MifStd_H_UpdRemTLV()
5248 static void phFriNfc_MifStd_H_fillTLV1(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_fillTLV1() argument
5250 uint8_t TempLength = (uint8_t)(NdefMap->TLVStruct.NdefTLVByte + in phFriNfc_MifStd_H_fillTLV1()
5253 NdefMap->TLVStruct.prevLenByteValue = in phFriNfc_MifStd_H_fillTLV1()
5254 ((NdefMap->Offset == PH_FRINFC_NDEFMAP_SEEK_CUR)? in phFriNfc_MifStd_H_fillTLV1()
5255 (NdefMap->TLVStruct.prevLenByteValue + in phFriNfc_MifStd_H_fillTLV1()
5256 NdefMap->ApduBuffIndex): in phFriNfc_MifStd_H_fillTLV1()
5257 NdefMap->ApduBuffIndex); in phFriNfc_MifStd_H_fillTLV1()
5259 NdefMap->StdMifareContainer.RdAfterWrFlag = PH_FRINFC_MIFARESTD_FLAG1; in phFriNfc_MifStd_H_fillTLV1()
5260 switch(NdefMap->TLVStruct.NdefTLVByte) in phFriNfc_MifStd_H_fillTLV1()
5263 if(NdefMap->TLVStruct.prevLenByteValue >= in phFriNfc_MifStd_H_fillTLV1()
5266 NdefMap->SendRecvBuf[TempLength] = in phFriNfc_MifStd_H_fillTLV1()
5267 (uint8_t)(NdefMap->TLVStruct.prevLenByteValue >> in phFriNfc_MifStd_H_fillTLV1()
5269 NdefMap->SendRecvBuf[(TempLength + in phFriNfc_MifStd_H_fillTLV1()
5271 (uint8_t)NdefMap->TLVStruct.prevLenByteValue; in phFriNfc_MifStd_H_fillTLV1()
5275 NdefMap->SendRecvBuf[TempLength] = in phFriNfc_MifStd_H_fillTLV1()
5277 NdefMap->SendRecvBuf[(TempLength + in phFriNfc_MifStd_H_fillTLV1()
5279 (uint8_t)NdefMap->TLVStruct.prevLenByteValue; in phFriNfc_MifStd_H_fillTLV1()
5281 NdefMap->StdMifareContainer.RdAfterWrFlag = in phFriNfc_MifStd_H_fillTLV1()
5287 if(NdefMap->TLVStruct.prevLenByteValue >= in phFriNfc_MifStd_H_fillTLV1()
5290 NdefMap->SendRecvBuf[TempLength - PH_FRINFC_MIFARESTD_VAL1] = in phFriNfc_MifStd_H_fillTLV1()
5292 NdefMap->SendRecvBuf[TempLength] = in phFriNfc_MifStd_H_fillTLV1()
5293 (uint8_t)(NdefMap->TLVStruct.prevLenByteValue >> in phFriNfc_MifStd_H_fillTLV1()
5295 NdefMap->SendRecvBuf[(TempLength + in phFriNfc_MifStd_H_fillTLV1()
5297 (uint8_t)NdefMap->TLVStruct.prevLenByteValue; in phFriNfc_MifStd_H_fillTLV1()
5301 NdefMap->SendRecvBuf[TempLength] = in phFriNfc_MifStd_H_fillTLV1()
5303 NdefMap->SendRecvBuf[(TempLength + in phFriNfc_MifStd_H_fillTLV1()
5305 (uint8_t)NdefMap->TLVStruct.prevLenByteValue; in phFriNfc_MifStd_H_fillTLV1()
5306 NdefMap->StdMifareContainer.RdAfterWrFlag = in phFriNfc_MifStd_H_fillTLV1()
5313 if(NdefMap->TLVStruct.prevLenByteValue >= in phFriNfc_MifStd_H_fillTLV1()
5317 NdefMap->TLVStruct.NULLTLVCount = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifStd_H_fillTLV1()
5318 NdefMap->TLVStruct.NdefTLVBlock = in phFriNfc_MifStd_H_fillTLV1()
5319 NdefMap->StdMifareContainer.currentBlock; in phFriNfc_MifStd_H_fillTLV1()
5320 NdefMap->TLVStruct.NdefTLVByte = in phFriNfc_MifStd_H_fillTLV1()
5323 NdefMap->SendRecvBuf[(TempLength - PH_FRINFC_MIFARESTD_VAL2)] = in phFriNfc_MifStd_H_fillTLV1()
5325 NdefMap->SendRecvBuf[(TempLength - PH_FRINFC_MIFARESTD_VAL1)] = in phFriNfc_MifStd_H_fillTLV1()
5327 NdefMap->SendRecvBuf[TempLength] = in phFriNfc_MifStd_H_fillTLV1()
5328 (uint8_t)(NdefMap->TLVStruct.prevLenByteValue >> in phFriNfc_MifStd_H_fillTLV1()
5333 NdefMap->SendRecvBuf[TempLength] = in phFriNfc_MifStd_H_fillTLV1()
5340 if(NdefMap->TLVStruct.prevLenByteValue >= in phFriNfc_MifStd_H_fillTLV1()
5344 NdefMap->TLVStruct.NULLTLVCount = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifStd_H_fillTLV1()
5345 NdefMap->TLVStruct.NdefTLVBlock = in phFriNfc_MifStd_H_fillTLV1()
5346 NdefMap->StdMifareContainer.currentBlock; in phFriNfc_MifStd_H_fillTLV1()
5347 NdefMap->TLVStruct.NdefTLVByte = in phFriNfc_MifStd_H_fillTLV1()
5350 NdefMap->SendRecvBuf[(TempLength - PH_FRINFC_MIFARESTD_VAL2)] = in phFriNfc_MifStd_H_fillTLV1()
5352 NdefMap->SendRecvBuf[(TempLength - PH_FRINFC_MIFARESTD_VAL1)] = in phFriNfc_MifStd_H_fillTLV1()
5354 NdefMap->SendRecvBuf[TempLength] = in phFriNfc_MifStd_H_fillTLV1()
5355 (uint8_t)(NdefMap->TLVStruct.prevLenByteValue >> in phFriNfc_MifStd_H_fillTLV1()
5357 NdefMap->SendRecvBuf[(TempLength + PH_FRINFC_MIFARESTD_VAL1)] = in phFriNfc_MifStd_H_fillTLV1()
5358 (uint8_t)NdefMap->TLVStruct.prevLenByteValue; in phFriNfc_MifStd_H_fillTLV1()
5362 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NDEFTLV_T; in phFriNfc_MifStd_H_fillTLV1()
5363 NdefMap->SendRecvBuf[(TempLength + PH_FRINFC_MIFARESTD_VAL1)] = in phFriNfc_MifStd_H_fillTLV1()
5364 (uint8_t)NdefMap->TLVStruct.prevLenByteValue; in phFriNfc_MifStd_H_fillTLV1()
5366 NdefMap->StdMifareContainer.RdAfterWrFlag = in phFriNfc_MifStd_H_fillTLV1()
5372 static void phFriNfc_MifStd_H_fillTLV2(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_fillTLV2() argument
5374 uint8_t TempLength = (uint8_t)(NdefMap->TLVStruct.NdefTLVByte + in phFriNfc_MifStd_H_fillTLV2()
5377 NdefMap->TLVStruct.prevLenByteValue = ((NdefMap->Offset == in phFriNfc_MifStd_H_fillTLV2()
5379 (NdefMap->TLVStruct.prevLenByteValue + in phFriNfc_MifStd_H_fillTLV2()
5380 NdefMap->ApduBuffIndex): in phFriNfc_MifStd_H_fillTLV2()
5381 NdefMap->ApduBuffIndex); in phFriNfc_MifStd_H_fillTLV2()
5382 NdefMap->StdMifareContainer.RdAfterWrFlag = PH_FRINFC_MIFARESTD_FLAG1; in phFriNfc_MifStd_H_fillTLV2()
5383 switch(NdefMap->TLVStruct.NdefTLVByte) in phFriNfc_MifStd_H_fillTLV2()
5386 if(NdefMap->TLVStruct.prevLenByteValue >= in phFriNfc_MifStd_H_fillTLV2()
5389 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NDEFTLV_T; in phFriNfc_MifStd_H_fillTLV2()
5391 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NDEFTLV_L; in phFriNfc_MifStd_H_fillTLV2()
5393 NdefMap->SendRecvBuf[TempLength] = (uint8_t)(NdefMap->TLVStruct.prevLenByteValue >> in phFriNfc_MifStd_H_fillTLV2()
5398 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NULLTLV_T; in phFriNfc_MifStd_H_fillTLV2()
5400 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NULLTLV_T; in phFriNfc_MifStd_H_fillTLV2()
5404 NdefMap->TLVStruct.NULLTLVCount = PH_FRINFC_MIFARESTD_VAL2; in phFriNfc_MifStd_H_fillTLV2()
5405 NdefMap->TLVStruct.NdefTLVBlock = in phFriNfc_MifStd_H_fillTLV2()
5406 NdefMap->StdMifareContainer.currentBlock; in phFriNfc_MifStd_H_fillTLV2()
5407 NdefMap->TLVStruct.NdefTLVByte = in phFriNfc_MifStd_H_fillTLV2()
5410 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NDEFTLV_T; in phFriNfc_MifStd_H_fillTLV2()
5415 if(NdefMap->TLVStruct.prevLenByteValue >= in phFriNfc_MifStd_H_fillTLV2()
5418 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NDEFTLV_T; in phFriNfc_MifStd_H_fillTLV2()
5420 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NDEFTLV_L; in phFriNfc_MifStd_H_fillTLV2()
5424 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NULLTLV_T; in phFriNfc_MifStd_H_fillTLV2()
5426 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NULLTLV_T; in phFriNfc_MifStd_H_fillTLV2()
5431 if(NdefMap->TLVStruct.prevLenByteValue >= in phFriNfc_MifStd_H_fillTLV2()
5434 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NDEFTLV_T; in phFriNfc_MifStd_H_fillTLV2()
5438 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NULLTLV_T; in phFriNfc_MifStd_H_fillTLV2()
5443 if(NdefMap->TLVStruct.prevLenByteValue >= in phFriNfc_MifStd_H_fillTLV2()
5446 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NDEFTLV_T; in phFriNfc_MifStd_H_fillTLV2()
5448 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NDEFTLV_L; in phFriNfc_MifStd_H_fillTLV2()
5450 NdefMap->SendRecvBuf[TempLength] = (uint8_t)(NdefMap->TLVStruct.prevLenByteValue >> in phFriNfc_MifStd_H_fillTLV2()
5453 NdefMap->SendRecvBuf[TempLength] = in phFriNfc_MifStd_H_fillTLV2()
5454 (uint8_t)NdefMap->TLVStruct.prevLenByteValue; in phFriNfc_MifStd_H_fillTLV2()
5458 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NULLTLV_T; in phFriNfc_MifStd_H_fillTLV2()
5460 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NULLTLV_T; in phFriNfc_MifStd_H_fillTLV2()
5464 NdefMap->TLVStruct.NULLTLVCount = PH_FRINFC_MIFARESTD_VAL2; in phFriNfc_MifStd_H_fillTLV2()
5465 NdefMap->TLVStruct.NdefTLVBlock = in phFriNfc_MifStd_H_fillTLV2()
5466 NdefMap->StdMifareContainer.currentBlock; in phFriNfc_MifStd_H_fillTLV2()
5467 NdefMap->TLVStruct.NdefTLVByte = in phFriNfc_MifStd_H_fillTLV2()
5470 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NDEFTLV_T; in phFriNfc_MifStd_H_fillTLV2()
5472 NdefMap->SendRecvBuf[TempLength] = in phFriNfc_MifStd_H_fillTLV2()
5473 (uint8_t)NdefMap->TLVStruct.prevLenByteValue; in phFriNfc_MifStd_H_fillTLV2()
5475 NdefMap->StdMifareContainer.RdAfterWrFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifStd_H_fillTLV2()
5480 static NFCSTATUS phFriNfc_MifStd_H_CallWrNdefLen(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_CallWrNdefLen() argument
5483 if(NdefMap->TLVStruct.NULLTLVCount >= PH_FRINFC_MIFARESTD_VAL2) in phFriNfc_MifStd_H_CallWrNdefLen()
5485 if((NdefMap->TLVStruct.NdefTLVByte == PH_FRINFC_MIFARESTD_VAL0) || in phFriNfc_MifStd_H_CallWrNdefLen()
5486 (NdefMap->TLVStruct.NdefTLVByte == PH_FRINFC_MIFARESTD_VAL1) ) in phFriNfc_MifStd_H_CallWrNdefLen()
5490 NdefMap->StdMifareContainer.currentBlock--; in phFriNfc_MifStd_H_CallWrNdefLen()
5491 Result = phFriNfc_MifStd_H_BlkChk_1(NdefMap); in phFriNfc_MifStd_H_CallWrNdefLen()
5498 NdefMap->StdMifareContainer.currentBlock++; in phFriNfc_MifStd_H_CallWrNdefLen()
5499 Result = phFriNfc_MifStd_H_BlkChk(NdefMap); in phFriNfc_MifStd_H_CallWrNdefLen()
5504 if((NdefMap->TLVStruct.NdefTLVByte == PH_FRINFC_MIFARESTD_VAL13) || in phFriNfc_MifStd_H_CallWrNdefLen()
5505 (NdefMap->TLVStruct.NdefTLVByte == PH_FRINFC_MIFARESTD_VAL14) || in phFriNfc_MifStd_H_CallWrNdefLen()
5506 (NdefMap->TLVStruct.NdefTLVByte == PH_FRINFC_MIFARESTD_VAL15)) in phFriNfc_MifStd_H_CallWrNdefLen()
5510 NdefMap->StdMifareContainer.currentBlock++; in phFriNfc_MifStd_H_CallWrNdefLen()
5511 Result = phFriNfc_MifStd_H_BlkChk(NdefMap); in phFriNfc_MifStd_H_CallWrNdefLen()
5516 phFriNfc_MifStd_H_RdtoWrNdefLen(NdefMap): in phFriNfc_MifStd_H_CallWrNdefLen()
5521 static NFCSTATUS phFriNfc_MifStd_H_BlkChk_1(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_BlkChk_1() argument
5531 SectorID = phFriNfc_MifStd_H_GetSect(NdefMap->StdMifareContainer.currentBlock); in phFriNfc_MifStd_H_BlkChk_1()
5535 if((NdefMap->StdMifareContainer.aid[SectorID] == in phFriNfc_MifStd_H_BlkChk_1()
5538 (NdefMap->CardType == PH_FRINFC_NDEFMAP_MIFARE_STD_1K_CARD)) || in phFriNfc_MifStd_H_BlkChk_1()
5540 (NdefMap->CardType == PH_FRINFC_NDEFMAP_MIFARE_STD_4K_CARD)))) in phFriNfc_MifStd_H_BlkChk_1()
5542 if(NdefMap->StdMifareContainer.currentBlock > 128) in phFriNfc_MifStd_H_BlkChk_1()
5544 NdefMap->TLVStruct.NdefTLVAuthFlag = in phFriNfc_MifStd_H_BlkChk_1()
5545 ((((NdefMap->StdMifareContainer.currentBlock + in phFriNfc_MifStd_H_BlkChk_1()
5552 NdefMap->StdMifareContainer.currentBlock -= in phFriNfc_MifStd_H_BlkChk_1()
5553 ((((NdefMap->StdMifareContainer.currentBlock + in phFriNfc_MifStd_H_BlkChk_1()
5563 NdefMap->TLVStruct.NdefTLVAuthFlag = in phFriNfc_MifStd_H_BlkChk_1()
5564 ((((NdefMap->StdMifareContainer.currentBlock + in phFriNfc_MifStd_H_BlkChk_1()
5571 NdefMap->StdMifareContainer.currentBlock -= in phFriNfc_MifStd_H_BlkChk_1()
5572 ((((NdefMap->StdMifareContainer.currentBlock + in phFriNfc_MifStd_H_BlkChk_1()
5591 static void phFriNfc_MifStd_H_fillTLV1_1(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_fillTLV1_1() argument
5593 switch(NdefMap->TLVStruct.NdefTLVByte) in phFriNfc_MifStd_H_fillTLV1_1()
5599 NdefMap->TLVStruct.NULLTLVCount = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifStd_H_fillTLV1_1()
5600 NdefMap->TLVStruct.NdefTLVBlock = in phFriNfc_MifStd_H_fillTLV1_1()
5601 NdefMap->StdMifareContainer.currentBlock; in phFriNfc_MifStd_H_fillTLV1_1()
5602 NdefMap->TLVStruct.NdefTLVByte = PH_FRINFC_MIFARESTD_VAL14; in phFriNfc_MifStd_H_fillTLV1_1()
5604 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL15] = in phFriNfc_MifStd_H_fillTLV1_1()
5606 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL16] = in phFriNfc_MifStd_H_fillTLV1_1()
5614 NdefMap->TLVStruct.NULLTLVCount = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifStd_H_fillTLV1_1()
5615 NdefMap->TLVStruct.NdefTLVBlock = in phFriNfc_MifStd_H_fillTLV1_1()
5616 NdefMap->StdMifareContainer.currentBlock; in phFriNfc_MifStd_H_fillTLV1_1()
5617 NdefMap->TLVStruct.NdefTLVByte = in phFriNfc_MifStd_H_fillTLV1_1()
5619 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL16] = PH_FRINFC_MIFARESTD_NDEFTLV_T; in phFriNfc_MifStd_H_fillTLV1_1()
5626 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL1] = in phFriNfc_MifStd_H_fillTLV1_1()
5627 (uint8_t)NdefMap->TLVStruct.prevLenByteValue; in phFriNfc_MifStd_H_fillTLV1_1()
5630 NdefMap->StdMifareContainer.RdAfterWrFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifStd_H_fillTLV1_1()
5633 static void phFriNfc_MifStd_H_fillTLV2_1(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_fillTLV2_1() argument
5636 switch(NdefMap->TLVStruct.NdefTLVByte) in phFriNfc_MifStd_H_fillTLV2_1()
5641 NdefMap->SendRecvBuf[TempLength] = in phFriNfc_MifStd_H_fillTLV2_1()
5642 (uint8_t)NdefMap->TLVStruct.prevLenByteValue; in phFriNfc_MifStd_H_fillTLV2_1()
5648 if(NdefMap->TLVStruct.prevLenByteValue >= in phFriNfc_MifStd_H_fillTLV2_1()
5651 NdefMap->SendRecvBuf[TempLength] = in phFriNfc_MifStd_H_fillTLV2_1()
5652 (uint8_t)(NdefMap->TLVStruct.prevLenByteValue >> in phFriNfc_MifStd_H_fillTLV2_1()
5655 NdefMap->SendRecvBuf[TempLength] = in phFriNfc_MifStd_H_fillTLV2_1()
5656 (uint8_t)NdefMap->TLVStruct.prevLenByteValue; in phFriNfc_MifStd_H_fillTLV2_1()
5660 NdefMap->TLVStruct.NULLTLVCount = PH_FRINFC_MIFARESTD_VAL2; in phFriNfc_MifStd_H_fillTLV2_1()
5661 NdefMap->TLVStruct.NdefTLVBlock = in phFriNfc_MifStd_H_fillTLV2_1()
5662 NdefMap->StdMifareContainer.currentBlock; in phFriNfc_MifStd_H_fillTLV2_1()
5663 NdefMap->TLVStruct.NdefTLVByte = in phFriNfc_MifStd_H_fillTLV2_1()
5665 NdefMap->SendRecvBuf[TempLength] = PH_FRINFC_MIFARESTD_NDEFTLV_T; in phFriNfc_MifStd_H_fillTLV2_1()
5667 NdefMap->SendRecvBuf[TempLength] = in phFriNfc_MifStd_H_fillTLV2_1()
5668 (uint8_t)NdefMap->TLVStruct.prevLenByteValue; in phFriNfc_MifStd_H_fillTLV2_1()
5674 if(NdefMap->TLVStruct.prevLenByteValue >= in phFriNfc_MifStd_H_fillTLV2_1()
5679 NdefMap->SendRecvBuf[TempLength] = in phFriNfc_MifStd_H_fillTLV2_1()
5682 NdefMap->SendRecvBuf[TempLength] = in phFriNfc_MifStd_H_fillTLV2_1()
5683 (uint8_t)(NdefMap->TLVStruct.prevLenByteValue >> in phFriNfc_MifStd_H_fillTLV2_1()
5686 NdefMap->SendRecvBuf[TempLength] = in phFriNfc_MifStd_H_fillTLV2_1()
5687 (uint8_t)NdefMap->TLVStruct.prevLenByteValue; in phFriNfc_MifStd_H_fillTLV2_1()
5691 NdefMap->SendRecvBuf[TempLength] = in phFriNfc_MifStd_H_fillTLV2_1()
5694 NdefMap->TLVStruct.NULLTLVCount = PH_FRINFC_MIFARESTD_VAL2; in phFriNfc_MifStd_H_fillTLV2_1()
5695 NdefMap->TLVStruct.NdefTLVBlock = in phFriNfc_MifStd_H_fillTLV2_1()
5696 NdefMap->StdMifareContainer.currentBlock; in phFriNfc_MifStd_H_fillTLV2_1()
5697 NdefMap->TLVStruct.NdefTLVByte = in phFriNfc_MifStd_H_fillTLV2_1()
5699 NdefMap->SendRecvBuf[TempLength] = in phFriNfc_MifStd_H_fillTLV2_1()
5702 NdefMap->SendRecvBuf[TempLength] = in phFriNfc_MifStd_H_fillTLV2_1()
5703 (uint8_t)NdefMap->TLVStruct.prevLenByteValue; in phFriNfc_MifStd_H_fillTLV2_1()
5707 NdefMap->StdMifareContainer.RdAfterWrFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifStd_H_fillTLV2_1()
5710 static NFCSTATUS phFriNfc_MifStd_H_RdTLV(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_RdTLV() argument
5713 NdefMap->State = PH_FRINFC_NDEFMAP_STATE_RD_TLV; in phFriNfc_MifStd_H_RdTLV()
5714 NdefMap->PrevOperation = PH_FRINFC_NDEFMAP_READ_OPE; in phFriNfc_MifStd_H_RdTLV()
5716 Result = phFriNfc_MifStd_H_Rd16Bytes(NdefMap, in phFriNfc_MifStd_H_RdTLV()
5717 NdefMap->StdMifareContainer.currentBlock); in phFriNfc_MifStd_H_RdTLV()
5721 static NFCSTATUS phFriNfc_MifStd_H_ProRdTLV(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_ProRdTLV() argument
5738 TempLength = (uint8_t)((NdefMap->TLVStruct.BytesRemainLinTLV <= 0xFE)? in phFriNfc_MifStd_H_ProRdTLV()
5739 ((NdefMap->TLVStruct.NdefTLVByte + in phFriNfc_MifStd_H_ProRdTLV()
5742 ((NdefMap->TLVStruct.NdefTLVByte + in phFriNfc_MifStd_H_ProRdTLV()
5746 if((*NdefMap->SendRecvLength == PH_FRINFC_MIFARESTD_BYTES_READ) && in phFriNfc_MifStd_H_ProRdTLV()
5747 (NdefMap->ApduBuffIndex < NdefMap->ApduBufferSize)) in phFriNfc_MifStd_H_ProRdTLV()
5749 if(NdefMap->TLVStruct.BytesRemainLinTLV != 0) in phFriNfc_MifStd_H_ProRdTLV()
5753 Result = phFriNfc_MifStd_H_RemainTLV(NdefMap, &NDEFFlag, &TempLength); in phFriNfc_MifStd_H_ProRdTLV()
5759 static NFCSTATUS phFriNfc_MifStd_H_WrTermTLV(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_WrTermTLV() argument
5765 NdefMap->State = PH_FRINFC_NDEFMAP_STATE_TERM_TLV; in phFriNfc_MifStd_H_WrTermTLV()
5767 NdefMap->SendRecvBuf[index] = in phFriNfc_MifStd_H_WrTermTLV()
5768 NdefMap->StdMifareContainer.currentBlock; in phFriNfc_MifStd_H_WrTermTLV()
5770 NdefMap->SendRecvBuf[index] = PH_FRINFC_MIFARESTD_TERMTLV_T; in phFriNfc_MifStd_H_WrTermTLV()
5775 NdefMap->SendRecvBuf[index] = PH_FRINFC_MIFARESTD_NULLTLV_T; in phFriNfc_MifStd_H_WrTermTLV()
5779 NdefMap->TLVStruct.SetTermTLVFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifStd_H_WrTermTLV()
5781 Result = phFriNfc_MifStd_H_WrTLV(NdefMap); in phFriNfc_MifStd_H_WrTermTLV()
5787 static NFCSTATUS phFriNfc_MifStd_H_ProWrABlock(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_ProWrABlock() argument
5791 NdefMap->StdMifareContainer.WrLength = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifStd_H_ProWrABlock()
5792 if(NdefMap->ApduBuffIndex < in phFriNfc_MifStd_H_ProWrABlock()
5793 (uint16_t)NdefMap->ApduBufferSize) in phFriNfc_MifStd_H_ProWrABlock()
5796 if(NdefMap->StdMifareContainer.RemainingBufFlag == in phFriNfc_MifStd_H_ProWrABlock()
5800 NdefMap->StdMifareContainer.internalLength = in phFriNfc_MifStd_H_ProWrABlock()
5801 *NdefMap->DataCount; in phFriNfc_MifStd_H_ProWrABlock()
5805 (void)memcpy( NdefMap->StdMifareContainer.internalBuf, in phFriNfc_MifStd_H_ProWrABlock()
5806 NdefMap->StdMifareContainer.Buffer, in phFriNfc_MifStd_H_ProWrABlock()
5807 NdefMap->StdMifareContainer.internalLength); in phFriNfc_MifStd_H_ProWrABlock()
5810 NdefMap->ApduBuffIndex += NdefMap->NumOfBytesWritten; in phFriNfc_MifStd_H_ProWrABlock()
5812 NdefMap->StdMifareContainer.remainingSize -= in phFriNfc_MifStd_H_ProWrABlock()
5813 NdefMap->NumOfBytesWritten; in phFriNfc_MifStd_H_ProWrABlock()
5815 NdefMap->StdMifareContainer.RemainingBufFlag = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifStd_H_ProWrABlock()
5817 NdefMap->StdMifareContainer.ReadWriteCompleteFlag = in phFriNfc_MifStd_H_ProWrABlock()
5818 (uint8_t)((NdefMap->StdMifareContainer.remainingSize == in phFriNfc_MifStd_H_ProWrABlock()
5823 NdefMap->TLVStruct.SetTermTLVFlag = in phFriNfc_MifStd_H_ProWrABlock()
5824 (uint8_t)(((NdefMap->StdMifareContainer.remainingSize == in phFriNfc_MifStd_H_ProWrABlock()
5826 (NdefMap->TLVStruct.SetTermTLVFlag == in phFriNfc_MifStd_H_ProWrABlock()
5832 else if(NdefMap->StdMifareContainer.internalBufFlag == in phFriNfc_MifStd_H_ProWrABlock()
5835 (void)memcpy(NdefMap->StdMifareContainer.internalBuf, in phFriNfc_MifStd_H_ProWrABlock()
5836 NdefMap->StdMifareContainer.Buffer, in phFriNfc_MifStd_H_ProWrABlock()
5837 *NdefMap->DataCount); in phFriNfc_MifStd_H_ProWrABlock()
5839 NdefMap->StdMifareContainer.internalLength = in phFriNfc_MifStd_H_ProWrABlock()
5840 *NdefMap->DataCount; in phFriNfc_MifStd_H_ProWrABlock()
5843 NdefMap->ApduBuffIndex += in phFriNfc_MifStd_H_ProWrABlock()
5844 NdefMap->NumOfBytesWritten; in phFriNfc_MifStd_H_ProWrABlock()
5846 NdefMap->StdMifareContainer.remainingSize -= in phFriNfc_MifStd_H_ProWrABlock()
5847 NdefMap->NumOfBytesWritten; in phFriNfc_MifStd_H_ProWrABlock()
5849 NdefMap->StdMifareContainer.internalBufFlag = in phFriNfc_MifStd_H_ProWrABlock()
5852 NdefMap->StdMifareContainer.ReadWriteCompleteFlag = in phFriNfc_MifStd_H_ProWrABlock()
5853 (uint8_t)(((NdefMap->StdMifareContainer.remainingSize == in phFriNfc_MifStd_H_ProWrABlock()
5855 (NdefMap->StdMifareContainer.internalLength == in phFriNfc_MifStd_H_ProWrABlock()
5860 NdefMap->TLVStruct.SetTermTLVFlag = in phFriNfc_MifStd_H_ProWrABlock()
5861 (uint8_t)(((NdefMap->StdMifareContainer.remainingSize == in phFriNfc_MifStd_H_ProWrABlock()
5863 (NdefMap->TLVStruct.SetTermTLVFlag == in phFriNfc_MifStd_H_ProWrABlock()
5870 NdefMap->StdMifareContainer.internalLength = 0; in phFriNfc_MifStd_H_ProWrABlock()
5872 NdefMap->ApduBuffIndex += in phFriNfc_MifStd_H_ProWrABlock()
5873 NdefMap->NumOfBytesWritten; in phFriNfc_MifStd_H_ProWrABlock()
5874 NdefMap->StdMifareContainer.remainingSize -= in phFriNfc_MifStd_H_ProWrABlock()
5875 NdefMap->NumOfBytesWritten; in phFriNfc_MifStd_H_ProWrABlock()
5878 if((NdefMap->StdMifareContainer.remainingSize == in phFriNfc_MifStd_H_ProWrABlock()
5880 (NdefMap->ApduBuffIndex == NdefMap->ApduBufferSize)) in phFriNfc_MifStd_H_ProWrABlock()
5882 NdefMap->StdMifareContainer.ReadWriteCompleteFlag = in phFriNfc_MifStd_H_ProWrABlock()
5883 (uint8_t)((NdefMap->StdMifareContainer.remainingSize == 0)? in phFriNfc_MifStd_H_ProWrABlock()
5886 if(NdefMap->StdMifareContainer.internalLength == in phFriNfc_MifStd_H_ProWrABlock()
5889 NdefMap->StdMifareContainer.currentBlock++; in phFriNfc_MifStd_H_ProWrABlock()
5892 Result = ((NdefMap->StdMifareContainer.remainingSize == 0)? in phFriNfc_MifStd_H_ProWrABlock()
5894 phFriNfc_MifStd_H_BlkChk(NdefMap)); in phFriNfc_MifStd_H_ProWrABlock()
5895 NdefMap->StdMifareContainer.NdefBlocks++; in phFriNfc_MifStd_H_ProWrABlock()
5897 NdefMap->TLVStruct.SetTermTLVFlag = in phFriNfc_MifStd_H_ProWrABlock()
5898 (uint8_t)(((NdefMap->StdMifareContainer.remainingSize == in phFriNfc_MifStd_H_ProWrABlock()
5900 (NdefMap->TLVStruct.SetTermTLVFlag == in phFriNfc_MifStd_H_ProWrABlock()
5907 NdefMap->StdMifareContainer.currentBlock++; in phFriNfc_MifStd_H_ProWrABlock()
5908 NdefMap->StdMifareContainer.WrLength = in phFriNfc_MifStd_H_ProWrABlock()
5909 (uint16_t)(NdefMap->ApduBufferSize - NdefMap->ApduBuffIndex); in phFriNfc_MifStd_H_ProWrABlock()
5912 Result = phFriNfc_MifStd_H_BlkChk(NdefMap); in phFriNfc_MifStd_H_ProWrABlock()
5915 NdefMap->StdMifareContainer.NdefBlocks++; in phFriNfc_MifStd_H_ProWrABlock()
5916 Result = ((NdefMap->StdMifareContainer.AuthDone == in phFriNfc_MifStd_H_ProWrABlock()
5918 phFriNfc_MifStd_H_WrABlock(NdefMap): in phFriNfc_MifStd_H_ProWrABlock()
5919 phFriNfc_MifStd_H_AuthSector(NdefMap)); in phFriNfc_MifStd_H_ProWrABlock()
5931 (NdefMap->TLVStruct.SetTermTLVFlag != in phFriNfc_MifStd_H_ProWrABlock()
5933 (NdefMap->StdMifareContainer.remainingSize > in phFriNfc_MifStd_H_ProWrABlock()
5936 Result = phFriNfc_MifStd_H_WrTermTLV(NdefMap); in phFriNfc_MifStd_H_ProWrABlock()
5941 (NdefMap->TLVStruct.SetTermTLVFlag == in phFriNfc_MifStd_H_ProWrABlock()
5945 NdefMap->StdMifareContainer.TempBlockNo = in phFriNfc_MifStd_H_ProWrABlock()
5946 NdefMap->StdMifareContainer.currentBlock; in phFriNfc_MifStd_H_ProWrABlock()
5947 phFriNfc_MifStd_H_SetNdefBlkAuth(NdefMap); in phFriNfc_MifStd_H_ProWrABlock()
5948 NdefMap->StdMifareContainer.currentBlock = in phFriNfc_MifStd_H_ProWrABlock()
5949 NdefMap->TLVStruct.NdefTLVBlock; in phFriNfc_MifStd_H_ProWrABlock()
5950 Result = phFriNfc_MifStd_H_RdtoWrNdefLen(NdefMap); in phFriNfc_MifStd_H_ProWrABlock()
5956 static NFCSTATUS phFriNfc_MifStd_H_CallDisCon(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_CallDisCon() argument
5960 NdefMap->State = PH_FRINFC_NDEFMAP_STATE_DISCONNECT; in phFriNfc_MifStd_H_CallDisCon()
5961 NdefMap->MapCompletionInfo.CompletionRoutine = phFriNfc_MifareStdMap_Process; in phFriNfc_MifStd_H_CallDisCon()
5962 NdefMap->MapCompletionInfo.Context = NdefMap; in phFriNfc_MifStd_H_CallDisCon()
5966 Result = phFriNfc_OvrHal_Disconnect( NdefMap->LowerDevice, in phFriNfc_MifStd_H_CallDisCon()
5967 &NdefMap->MapCompletionInfo, in phFriNfc_MifStd_H_CallDisCon()
5968 NdefMap->psRemoteDevInfo); in phFriNfc_MifStd_H_CallDisCon()
5971 Result = phFriNfc_OvrHal_Reconnect( NdefMap->LowerDevice, in phFriNfc_MifStd_H_CallDisCon()
5972 &NdefMap->MapCompletionInfo, in phFriNfc_MifStd_H_CallDisCon()
5973 NdefMap->psRemoteDevInfo); in phFriNfc_MifStd_H_CallDisCon()
5980 static NFCSTATUS phFriNfc_MifStd_H_CallPoll(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_CallPoll() argument
5984 NdefMap->State = PH_FRINFC_NDEFMAP_STATE_POLL; in phFriNfc_MifStd_H_CallPoll()
5986 NdefMap->OpModeType[PH_FRINFC_MIFARESTD_VAL0] = phHal_eOpModesMifare; in phFriNfc_MifStd_H_CallPoll()
5987 NdefMap->OpModeType[PH_FRINFC_MIFARESTD_VAL1] = phHal_eOpModesArrayTerminator; in phFriNfc_MifStd_H_CallPoll()
5990 NdefMap->NoOfDevices = PH_FRINFC_MIFARESTD_VAL1; in phFriNfc_MifStd_H_CallPoll()
5993 Result = phFriNfc_OvrHal_Poll( NdefMap->LowerDevice, in phFriNfc_MifStd_H_CallPoll()
5994 &NdefMap->MapCompletionInfo, in phFriNfc_MifStd_H_CallPoll()
5995 NdefMap->OpModeType, in phFriNfc_MifStd_H_CallPoll()
5996 NdefMap->psRemoteDevInfo, in phFriNfc_MifStd_H_CallPoll()
5997 &NdefMap->NoOfDevices, in phFriNfc_MifStd_H_CallPoll()
5998 NdefMap->StdMifareContainer.DevInputParam); in phFriNfc_MifStd_H_CallPoll()
6003 static NFCSTATUS phFriNfc_MifStd_H_CallConnect(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_CallConnect() argument
6007 NdefMap->State = PH_FRINFC_NDEFMAP_STATE_CONNECT; in phFriNfc_MifStd_H_CallConnect()
6010 Result = phFriNfc_OvrHal_Connect( NdefMap->LowerDevice, in phFriNfc_MifStd_H_CallConnect()
6011 &NdefMap->MapCompletionInfo, in phFriNfc_MifStd_H_CallConnect()
6012 NdefMap->psRemoteDevInfo, in phFriNfc_MifStd_H_CallConnect()
6013 NdefMap->StdMifareContainer.DevInputParam); in phFriNfc_MifStd_H_CallConnect()
6017 static void phFriNfc_MifStd1k_H_BlkChk(phFriNfc_NdefMap_t *NdefMap, in phFriNfc_MifStd1k_H_BlkChk() argument
6022 if(((NdefMap->StdMifareContainer.currentBlock + PH_FRINFC_MIFARESTD_INC_1) % in phFriNfc_MifStd1k_H_BlkChk()
6025 NdefMap->StdMifareContainer.currentBlock++; in phFriNfc_MifStd1k_H_BlkChk()
6029 if(NdefMap->StdMifareContainer.aid[SectorID] == in phFriNfc_MifStd1k_H_BlkChk()
6036 if((NdefMap->StdMifareContainer.currentBlock == in phFriNfc_MifStd1k_H_BlkChk()
6038 (NdefMap->StdMifareContainer.internalLength == 0)) in phFriNfc_MifStd1k_H_BlkChk()
6040 NdefMap->StdMifareContainer.AuthDone = 0; in phFriNfc_MifStd1k_H_BlkChk()
6046 NdefMap->StdMifareContainer.currentBlock += PH_FRINFC_MIFARESTD_BLK4; in phFriNfc_MifStd1k_H_BlkChk()
6062 phFriNfc_NdefMap_t *NdefMap, in phFriNfc_MifareStdMap_ConvertToReadOnly() argument
6068 if ( NdefMap == NULL) in phFriNfc_MifareStdMap_ConvertToReadOnly()
6072 else if ( PH_NDEFMAP_CARD_STATE_INVALID == NdefMap->CardState ) in phFriNfc_MifareStdMap_ConvertToReadOnly()
6080 if( PH_FRINFC_NDEFMAP_MIFARE_STD_1K_CARD == NdefMap->CardType ) in phFriNfc_MifareStdMap_ConvertToReadOnly()
6084 else if ( PH_FRINFC_NDEFMAP_MIFARE_STD_4K_CARD == NdefMap->CardType ) in phFriNfc_MifareStdMap_ConvertToReadOnly()
6092 memset (NdefMap->StdMifareContainer.UserScrtKeyB, PH_FRINFC_MFSTD_FMT_DEFAULT_KEY, in phFriNfc_MifareStdMap_ConvertToReadOnly()
6097 … memcpy (NdefMap->StdMifareContainer.UserScrtKeyB, ScrtKeyB, PH_FRINFC_MIFARESTD_KEY_LEN); in phFriNfc_MifareStdMap_ConvertToReadOnly()
6100 NdefMap->StdMifareContainer.TotalNoSectors = totalNoSectors; in phFriNfc_MifareStdMap_ConvertToReadOnly()
6107 NdefMap->TLVStruct.NdefTLVFoundFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_ConvertToReadOnly()
6108 NdefMap->StdMifareContainer.RdBeforeWrFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_ConvertToReadOnly()
6109 NdefMap->StdMifareContainer.WrNdefFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_ConvertToReadOnly()
6110 NdefMap->StdMifareContainer.internalLength = PH_FRINFC_MIFARESTD_VAL0; in phFriNfc_MifareStdMap_ConvertToReadOnly()
6111 NdefMap->StdMifareContainer.RdAfterWrFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_ConvertToReadOnly()
6112 NdefMap->StdMifareContainer.AuthDone = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_ConvertToReadOnly()
6113 NdefMap->StdMifareContainer.NFCforumSectFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_ConvertToReadOnly()
6114 NdefMap->StdMifareContainer.WriteAcsBitFlag = PH_FRINFC_MIFARESTD_FLAG0; in phFriNfc_MifareStdMap_ConvertToReadOnly()
6117 for(NdefMap->StdMifareContainer.ReadOnlySectorIndex = PH_FRINFC_MIFARESTD_FLAG1; in phFriNfc_MifareStdMap_ConvertToReadOnly()
6118 NdefMap->StdMifareContainer.ReadOnlySectorIndex < totalNoSectors; in phFriNfc_MifareStdMap_ConvertToReadOnly()
6119 NdefMap->StdMifareContainer.ReadOnlySectorIndex++) in phFriNfc_MifareStdMap_ConvertToReadOnly()
6122 … if( PH_FRINFC_MIFARESTD_SECTOR_NO16 == NdefMap->StdMifareContainer.ReadOnlySectorIndex ) in phFriNfc_MifareStdMap_ConvertToReadOnly()
6129NdefMap->StdMifareContainer.aid[NdefMap->StdMifareContainer.ReadOnlySectorIndex]) in phFriNfc_MifareStdMap_ConvertToReadOnly()
6135NdefMap->StdMifareContainer.aid[NdefMap->StdMifareContainer.ReadOnlySectorIndex]) in phFriNfc_MifareStdMap_ConvertToReadOnly()
6139 … phFriNfc_MifStd_H_GetSectorTrailerBlkNo(NdefMap->StdMifareContainer.ReadOnlySectorIndex); in phFriNfc_MifareStdMap_ConvertToReadOnly()
6140 NdefMap->StdMifareContainer.currentBlock = sectorTrailerBlockNo; in phFriNfc_MifareStdMap_ConvertToReadOnly()
6141 NdefMap->StdMifareContainer.SectorTrailerBlockNo = sectorTrailerBlockNo; in phFriNfc_MifareStdMap_ConvertToReadOnly()
6145 result = phFriNfc_MifStd_H_AuthSector(NdefMap); in phFriNfc_MifareStdMap_ConvertToReadOnly()
6155 if(NdefMap->StdMifareContainer.ReadOnlySectorIndex == totalNoSectors && in phFriNfc_MifareStdMap_ConvertToReadOnly()
6186 static NFCSTATUS phFriNfc_MifStd_H_ProSectorTrailorAcsBits(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_ProSectorTrailorAcsBits() argument
6190 if(*NdefMap->SendRecvLength == PH_FRINFC_MIFARESTD_BYTES_READ) in phFriNfc_MifStd_H_ProSectorTrailorAcsBits()
6192 if(NdefMap->StdMifareContainer.ReadAcsBitFlag == in phFriNfc_MifStd_H_ProSectorTrailorAcsBits()
6196 Result = phFriNfc_MifStd_H_ChkAcsBit(NdefMap); in phFriNfc_MifStd_H_ProSectorTrailorAcsBits()
6200 if(NdefMap->CardState == PH_NDEFMAP_CARD_STATE_READ_ONLY) in phFriNfc_MifStd_H_ProSectorTrailorAcsBits()
6203 Result = phFriNfc_MifStd_H_ProWrSectorTrailor(NdefMap); in phFriNfc_MifStd_H_ProSectorTrailorAcsBits()
6208 Result = phFriNfc_MifStd_H_WrSectorTrailorBlock(NdefMap); in phFriNfc_MifStd_H_ProSectorTrailorAcsBits()
6224 static NFCSTATUS phFriNfc_MifStd_H_WrSectorTrailorBlock(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_WrSectorTrailorBlock() argument
6229 NdefMap->psDepAdditionalInfo.DepFlags.MetaChaining = 0; in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6230 NdefMap->psDepAdditionalInfo.DepFlags.NADPresent = 0; in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6231 NdefMap->psDepAdditionalInfo.NAD = 0; in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6232 NdefMap->MapCompletionInfo.CompletionRoutine = phFriNfc_MifareStdMap_Process; in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6233 NdefMap->MapCompletionInfo.Context = NdefMap; in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6234 NdefMap->PrevOperation = PH_FRINFC_NDEFMAP_WRITE_OPE; in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6237 NdefMap->State = PH_FRINFC_NDEFMAP_STATE_WRITE_SEC; in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6240 if(NdefMap->SendRecvBuf != NULL) in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6242 NdefMap->SendRecvBuf[10] = 0x00; in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6243NdefMap->SendRecvBuf[10] = NdefMap->SendRecvBuf[9] | PH_FRINFC_MIFARESTD_MASK_GPB_WR; /* WR bits 1… in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6247 NdefMap->SendRecvBuf[1] = PH_FRINFC_NDEFMAP_MIFARESTD_AUTH_NDEFSECT1; /* 0xD3 */ in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6248 NdefMap->SendRecvBuf[2] = PH_FRINFC_NDEFMAP_MIFARESTD_AUTH_NDEFSECT2; /* 0xF7 */ in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6249 NdefMap->SendRecvBuf[3] = PH_FRINFC_NDEFMAP_MIFARESTD_AUTH_NDEFSECT1; /* 0xD3 */ in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6250 NdefMap->SendRecvBuf[4] = PH_FRINFC_NDEFMAP_MIFARESTD_AUTH_NDEFSECT2; /* 0xF7 */ in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6251 NdefMap->SendRecvBuf[5] = PH_FRINFC_NDEFMAP_MIFARESTD_AUTH_NDEFSECT1; /* 0xD3 */ in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6252 NdefMap->SendRecvBuf[6] = PH_FRINFC_NDEFMAP_MIFARESTD_AUTH_NDEFSECT2; /* 0xF7 */ in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6254 NdefMap->SendRecvBuf[7] = PH_FRINFC_MIFARESTD_NFCSECT_RDACS_BYTE6;/* 0x07 */ in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6255 NdefMap->SendRecvBuf[8] = PH_FRINFC_MIFARESTD_NFCSECT_RDACS_BYTE7;/* 0x8F */ in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6256 NdefMap->SendRecvBuf[9] = PH_FRINFC_MIFARESTD_NFCSECT_RDACS_BYTE8;/* 0x0F */ in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6258 NdefMap->SendRecvBuf[11] = NdefMap->StdMifareContainer.UserScrtKeyB[0]; in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6259 NdefMap->SendRecvBuf[12] = NdefMap->StdMifareContainer.UserScrtKeyB[1]; in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6260 NdefMap->SendRecvBuf[13] = NdefMap->StdMifareContainer.UserScrtKeyB[2]; in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6261 NdefMap->SendRecvBuf[14] = NdefMap->StdMifareContainer.UserScrtKeyB[3]; in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6262 NdefMap->SendRecvBuf[15] = NdefMap->StdMifareContainer.UserScrtKeyB[4]; in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6263 NdefMap->SendRecvBuf[16] = NdefMap->StdMifareContainer.UserScrtKeyB[5]; in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6266 NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL0] = NdefMap->StdMifareContainer.currentBlock; in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6269 (void)memcpy(NdefMap->StdMifareContainer.Buffer, in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6270 &(NdefMap->SendRecvBuf[PH_FRINFC_MIFARESTD_VAL1]), in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6274 NdefMap->SendLength = MIFARE_MAX_SEND_BUF_TO_WRITE; in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6276 NdefMap->Cmd.MfCmd = phHal_eMifareCmdListMifareWrite16; in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6278 NdefMap->Cmd.MfCmd = phHal_eMifareWrite16; in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6280 *NdefMap->SendRecvLength = NdefMap->TempReceiveLength; in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6283 status = phFriNfc_OvrHal_Transceive(NdefMap->LowerDevice, in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6284 &NdefMap->MapCompletionInfo, in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6285 NdefMap->psRemoteDevInfo, in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6286 NdefMap->Cmd, in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6287 &NdefMap->psDepAdditionalInfo, in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6288 NdefMap->SendRecvBuf, in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6289 NdefMap->SendLength, in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6290 NdefMap->SendRecvBuf, in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6291 NdefMap->SendRecvLength); in phFriNfc_MifStd_H_WrSectorTrailorBlock()
6308 static NFCSTATUS phFriNfc_MifStd_H_ProWrSectorTrailor(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifStd_H_ProWrSectorTrailor() argument
6314 NdefMap->StdMifareContainer.ReadOnlySectorIndex++; in phFriNfc_MifStd_H_ProWrSectorTrailor()
6317 if(PH_FRINFC_MIFARESTD_SECTOR_NO16 == NdefMap->StdMifareContainer.ReadOnlySectorIndex ) in phFriNfc_MifStd_H_ProWrSectorTrailor()
6319 NdefMap->StdMifareContainer.ReadOnlySectorIndex++; in phFriNfc_MifStd_H_ProWrSectorTrailor()
6325 …if (NdefMap->StdMifareContainer.ReadOnlySectorIndex >= NdefMap->StdMifareContainer.TotalNoSectors … in phFriNfc_MifStd_H_ProWrSectorTrailor()
6327 NdefMap->StdMifareContainer.aid[NdefMap->StdMifareContainer.ReadOnlySectorIndex]) in phFriNfc_MifStd_H_ProWrSectorTrailor()
6331 …else if(PH_FRINFC_MIFARESTD_NDEF_COMP == NdefMap->StdMifareContainer.aid[NdefMap->StdMifareContai… in phFriNfc_MifStd_H_ProWrSectorTrailor()
6334 …sectorTrailerBlockNo = phFriNfc_MifStd_H_GetSectorTrailerBlkNo(NdefMap->StdMifareContainer.ReadOnl… in phFriNfc_MifStd_H_ProWrSectorTrailor()
6335 NdefMap->StdMifareContainer.currentBlock = sectorTrailerBlockNo; in phFriNfc_MifStd_H_ProWrSectorTrailor()
6336 NdefMap->StdMifareContainer.SectorTrailerBlockNo = sectorTrailerBlockNo; in phFriNfc_MifStd_H_ProWrSectorTrailor()
6338 status = phFriNfc_MifStd_H_AuthSector(NdefMap); in phFriNfc_MifStd_H_ProWrSectorTrailor()