• Home
  • Raw
  • Download

Lines Matching refs:NdefMap

51 static void phFriNfc_MifareUL_H_Complete(phFriNfc_NdefMap_t  *NdefMap,
58 static NFCSTATUS phFriNfc_MfUL_H_Rd16Bytes( phFriNfc_NdefMap_t *NdefMap);
64 static NFCSTATUS phFriNfc_MfUL_H_findNDEFTLV(phFriNfc_NdefMap_t *NdefMap,
71 static NFCSTATUS phFriNfc_MfUL_H_Chk16Bytes(phFriNfc_NdefMap_t *NdefMap,
79 static NFCSTATUS phFriNfc_MfUL_H_RdCardfindNdefTLV( phFriNfc_NdefMap_t *NdefMap,
86 static NFCSTATUS phFriNfc_MfUL_H_ChkRemainTLV(phFriNfc_NdefMap_t *NdefMap,
94 static void phFriNfc_MfUL_H_UpdateLen(phFriNfc_NdefMap_t *NdefMap,
101 static NFCSTATUS phFriNfc_MfUL_H_NxtOp(phFriNfc_NdefMap_t *NdefMap,
108 static NFCSTATUS phFriNfc_MfUL_H_CopyRdBytes(phFriNfc_NdefMap_t *NdefMap);
114 static NFCSTATUS phFriNfc_MfUL_H_CpDataToUserBuf(phFriNfc_NdefMap_t *NdefMap);
120 static NFCSTATUS phFriNfc_MfUL_H_Wr4bytes(phFriNfc_NdefMap_t *NdefMap);
126 static NFCSTATUS phFriNfc_MfUL_H_ChkCCBytes(phFriNfc_NdefMap_t *NdefMap);
132 static NFCSTATUS phFriNfc_MfUL_H_RdBeforeWrite(phFriNfc_NdefMap_t *NdefMap);
138 static NFCSTATUS phFriNfc_MfUL_H_CallWrOp(phFriNfc_NdefMap_t *NdefMap);
144 static NFCSTATUS phFriNfc_MfUL_H_ProWrittenBytes(phFriNfc_NdefMap_t *NdefMap);
150 static NFCSTATUS phFriNfc_MfUL_H_fillSendBufToWr(phFriNfc_NdefMap_t *NdefMap);
156 static NFCSTATUS phFriNfc_MfUL_H_UpdateWrLen(phFriNfc_NdefMap_t *NdefMap);
162 static NFCSTATUS phFriNfc_MfUL_H_WrTermTLV(phFriNfc_NdefMap_t *NdefMap);
168 phFriNfc_NdefMap_t *NdefMap);
175 static NFCSTATUS phFriNfc_MfUL_H_SelectSector(phFriNfc_NdefMap_t *NdefMap,
193 phFriNfc_MfUL_CalcByteNum(phFriNfc_NdefMap_t *NdefMap);
200 NFCSTATUS phFriNfc_MifareUL_H_Reset(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifareUL_H_Reset() argument
204 if ( NdefMap == NULL) in phFriNfc_MifareUL_H_Reset()
211 NdefMap->TLVStruct.NdefTLVBlock = PH_FRINFC_NDEFMAP_MFUL_VAL4; in phFriNfc_MifareUL_H_Reset()
212 NdefMap->TLVStruct.BytesRemainLinTLV = PH_FRINFC_NDEFMAP_MFUL_VAL0; in phFriNfc_MifareUL_H_Reset()
213 NdefMap->TLVStruct.NdefTLVByte = PH_FRINFC_NDEFMAP_MFUL_VAL0; in phFriNfc_MifareUL_H_Reset()
214 NdefMap->TLVStruct.NoLbytesinTLV = PH_FRINFC_NDEFMAP_MFUL_VAL0; in phFriNfc_MifareUL_H_Reset()
215 NdefMap->TLVStruct.prevLenByteValue = PH_FRINFC_NDEFMAP_MFUL_VAL0; in phFriNfc_MifareUL_H_Reset()
216 NdefMap->TLVStruct.NdefTLVFoundFlag = PH_FRINFC_NDEFMAP_MFUL_FLAG0; in phFriNfc_MifareUL_H_Reset()
217 NdefMap->TLVStruct.TcheckedinTLVFlag = PH_FRINFC_NDEFMAP_MFUL_FLAG0; in phFriNfc_MifareUL_H_Reset()
218 NdefMap->TLVStruct.ActualSize = PH_FRINFC_NDEFMAP_MFUL_VAL0; in phFriNfc_MifareUL_H_Reset()
219 NdefMap->TLVStruct.SetTermTLVFlag = PH_FRINFC_NDEFMAP_MFUL_FLAG0; in phFriNfc_MifareUL_H_Reset()
220 NdefMap->TLVStruct.WrLenFlag = PH_FRINFC_NDEFMAP_MFUL_FLAG0; in phFriNfc_MifareUL_H_Reset()
223 NdefMap->MifareULContainer.ByteNumber = PH_FRINFC_NDEFMAP_MFUL_VAL0; in phFriNfc_MifareUL_H_Reset()
224 NdefMap->MifareULContainer.CRindex = PH_FRINFC_NDEFMAP_MFUL_VAL0; in phFriNfc_MifareUL_H_Reset()
225 NdefMap->MifareULContainer.CurrentSector = PH_FRINFC_NDEFMAP_MFUL_VAL0; in phFriNfc_MifareUL_H_Reset()
226 NdefMap->MifareULContainer.CurrentBlock = PH_FRINFC_NDEFMAP_MFUL_VAL0; in phFriNfc_MifareUL_H_Reset()
227 NdefMap->MifareULContainer.InternalLength = PH_FRINFC_NDEFMAP_MFUL_VAL0; in phFriNfc_MifareUL_H_Reset()
228 NdefMap->MifareULContainer.ReadBufIndex = PH_FRINFC_NDEFMAP_MFUL_VAL0; in phFriNfc_MifareUL_H_Reset()
229 NdefMap->MifareULContainer.ReadWriteCompleteFlag = PH_FRINFC_NDEFMAP_MFUL_FLAG0; in phFriNfc_MifareUL_H_Reset()
230 NdefMap->MifareULContainer.RemainingSize = PH_FRINFC_NDEFMAP_MFUL_VAL0; in phFriNfc_MifareUL_H_Reset()
233 (void)memset(NdefMap->TLVStruct.NdefTLVBuffer, in phFriNfc_MifareUL_H_Reset()
236 (void)memset(NdefMap->MifareULContainer.Buffer, in phFriNfc_MifareUL_H_Reset()
239 (void)memset(NdefMap->MifareULContainer.InternalBuf, in phFriNfc_MifareUL_H_Reset()
242 (void)memset(NdefMap->MifareULContainer.ReadBuf, in phFriNfc_MifareUL_H_Reset()
257 NFCSTATUS phFriNfc_MifareUL_RdNdef( phFriNfc_NdefMap_t *NdefMap, in phFriNfc_MifareUL_RdNdef() argument
265 if((NdefMap != NULL) && (PacketData != NULL) && (PacketDataLength != NULL) && in phFriNfc_MifareUL_RdNdef()
268 (NdefMap->CompletionRoutine->CompletionRoutine != NULL) && in phFriNfc_MifareUL_RdNdef()
269 (NdefMap->CompletionRoutine->Context != NULL ) && in phFriNfc_MifareUL_RdNdef()
270 ((NdefMap->CardState != PH_NDEFMAP_CARD_STATE_INITIALIZED) && in phFriNfc_MifareUL_RdNdef()
271 (NdefMap->CardState != PH_NDEFMAP_CARD_STATE_INVALID))) in phFriNfc_MifareUL_RdNdef()
274 NdefMap->ApduBuffer = PacketData; in phFriNfc_MifareUL_RdNdef()
276 NdefMap->ApduBufferSize = *PacketDataLength ; in phFriNfc_MifareUL_RdNdef()
278 NdefMap->NumOfBytesRead = PacketDataLength ; in phFriNfc_MifareUL_RdNdef()
279 *NdefMap->NumOfBytesRead = 0; in phFriNfc_MifareUL_RdNdef()
281 if( (Offset == PH_FRINFC_NDEFMAP_SEEK_BEGIN) || ( NdefMap->PrevOperation == in phFriNfc_MifareUL_RdNdef()
284 NdefMap->MifareULContainer.CurrentBlock = PH_FRINFC_NDEFMAP_MFUL_BLOCK4; in phFriNfc_MifareUL_RdNdef()
285 NdefMap->TLVStruct.NdefTLVFoundFlag = PH_FRINFC_NDEFMAP_MFUL_FLAG0; in phFriNfc_MifareUL_RdNdef()
286 NdefMap->TLVStruct.NdefTLVByte = PH_FRINFC_NDEFMAP_MFUL_FLAG0; in phFriNfc_MifareUL_RdNdef()
287 NdefMap->TLVStruct.NdefTLVBlock = PH_FRINFC_NDEFMAP_MFUL_BLOCK4; in phFriNfc_MifareUL_RdNdef()
288 NdefMap->MifareULContainer.RemainingSize = NdefMap->CardMemSize; in phFriNfc_MifareUL_RdNdef()
289 NdefMap->TLVStruct.TcheckedinTLVFlag = PH_FRINFC_NDEFMAP_MFUL_FLAG0; in phFriNfc_MifareUL_RdNdef()
290 NdefMap->TLVStruct.NoLbytesinTLV = PH_FRINFC_NDEFMAP_MFUL_VAL0; in phFriNfc_MifareUL_RdNdef()
291 NdefMap->MifareULContainer.ReadBufIndex = PH_FRINFC_NDEFMAP_MFUL_VAL0; in phFriNfc_MifareUL_RdNdef()
292 NdefMap->MifareULContainer.ReadWriteCompleteFlag = PH_FRINFC_NDEFMAP_MFUL_FLAG0; in phFriNfc_MifareUL_RdNdef()
295 NdefMap->PrevOperation = PH_FRINFC_NDEFMAP_READ_OPE; in phFriNfc_MifareUL_RdNdef()
296 NdefMap->MifareULContainer.CRindex = PH_FRINFC_NDEFMAP_CR_RD_NDEF; in phFriNfc_MifareUL_RdNdef()
299 (NdefMap->MifareULContainer.ReadWriteCompleteFlag == in phFriNfc_MifareUL_RdNdef()
310 NdefMap->Offset = (((Offset != PH_FRINFC_NDEFMAP_SEEK_BEGIN) && in phFriNfc_MifareUL_RdNdef()
311 ( NdefMap->PrevOperation != PH_FRINFC_NDEFMAP_READ_OPE))? in phFriNfc_MifareUL_RdNdef()
315 Result = ((NdefMap->Offset == PH_FRINFC_NDEFMAP_SEEK_BEGIN)? in phFriNfc_MifareUL_RdNdef()
316 phFriNfc_MfUL_H_RdCardfindNdefTLV(NdefMap, NdefMap->MifareULContainer.CurrentBlock): in phFriNfc_MifareUL_RdNdef()
317 phFriNfc_MfUL_H_CpDataToUserBuf(NdefMap)); in phFriNfc_MifareUL_RdNdef()
333 NFCSTATUS phFriNfc_MifareUL_WrNdef( phFriNfc_NdefMap_t *NdefMap, in phFriNfc_MifareUL_WrNdef() argument
343 if((NdefMap != NULL) && (PacketData != NULL) && (PacketDataLength != NULL) && in phFriNfc_MifareUL_WrNdef()
346 (NdefMap->CompletionRoutine->CompletionRoutine != NULL) && in phFriNfc_MifareUL_WrNdef()
347 (NdefMap->CompletionRoutine->Context != NULL ) && in phFriNfc_MifareUL_WrNdef()
348 ((NdefMap->CardState != PH_NDEFMAP_CARD_STATE_READ_ONLY) && in phFriNfc_MifareUL_WrNdef()
349 (NdefMap->CardState != PH_NDEFMAP_CARD_STATE_INVALID))) in phFriNfc_MifareUL_WrNdef()
351 NdefMap->MifareULContainer.CRindex = PH_FRINFC_NDEFMAP_CR_WR_NDEF; in phFriNfc_MifareUL_WrNdef()
353 NdefMap->ApduBuffer = PacketData; in phFriNfc_MifareUL_WrNdef()
355 NdefMap->ApduBufferSize = *PacketDataLength ; in phFriNfc_MifareUL_WrNdef()
357 NdefMap->WrNdefPacketLength = PacketDataLength ; in phFriNfc_MifareUL_WrNdef()
358 *NdefMap->WrNdefPacketLength = 0; in phFriNfc_MifareUL_WrNdef()
360 if( (Offset == PH_FRINFC_NDEFMAP_SEEK_BEGIN) || ( NdefMap->PrevOperation == in phFriNfc_MifareUL_WrNdef()
363 NdefMap->MifareULContainer.CurrentSector = NdefMap->TLVStruct.NdefTLVSector; in phFriNfc_MifareUL_WrNdef()
364 NdefMap->MifareULContainer.CurrentBlock = NdefMap->TLVStruct.NdefTLVBlock; in phFriNfc_MifareUL_WrNdef()
365 NdefMap->TLVStruct.TcheckedinTLVFlag = PH_FRINFC_NDEFMAP_MFUL_FLAG0; in phFriNfc_MifareUL_WrNdef()
366 NdefMap->TLVStruct.NoLbytesinTLV = PH_FRINFC_NDEFMAP_MFUL_VAL0; in phFriNfc_MifareUL_WrNdef()
367 NdefMap->MifareULContainer.ReadBufIndex = PH_FRINFC_NDEFMAP_MFUL_VAL0; in phFriNfc_MifareUL_WrNdef()
368 NdefMap->MifareULContainer.ReadWriteCompleteFlag = PH_FRINFC_NDEFMAP_MFUL_FLAG0; in phFriNfc_MifareUL_WrNdef()
369 NdefMap->TLVStruct.WrLenFlag = PH_FRINFC_NDEFMAP_MFUL_FLAG0; in phFriNfc_MifareUL_WrNdef()
370 NdefMap->MifareULContainer.InternalLength = PH_FRINFC_NDEFMAP_MFUL_VAL0; in phFriNfc_MifareUL_WrNdef()
371 NdefMap->MifareULContainer.RemainingSize = in phFriNfc_MifareUL_WrNdef()
372 (NdefMap->CardMemSize - in phFriNfc_MifareUL_WrNdef()
373 (((NdefMap->TLVStruct.NdefTLVBlock - in phFriNfc_MifareUL_WrNdef()
376 NdefMap->TLVStruct.NdefTLVByte + in phFriNfc_MifareUL_WrNdef()
379 NdefMap->PrevOperation = PH_FRINFC_NDEFMAP_WRITE_OPE; in phFriNfc_MifareUL_WrNdef()
380 NdefMap->MifareULContainer.CRindex = PH_FRINFC_NDEFMAP_CR_WR_NDEF; in phFriNfc_MifareUL_WrNdef()
383 (NdefMap->MifareULContainer.ReadWriteCompleteFlag == in phFriNfc_MifareUL_WrNdef()
394 NdefMap->Offset = (((Offset != PH_FRINFC_NDEFMAP_SEEK_BEGIN) && in phFriNfc_MifareUL_WrNdef()
395 ( NdefMap->PrevOperation == PH_FRINFC_NDEFMAP_READ_OPE))? in phFriNfc_MifareUL_WrNdef()
399 if (NdefMap->TLVStruct.NdefTLVSector == 1) in phFriNfc_MifareUL_WrNdef()
401 NdefMap->MifareULContainer.CurrentSector = 1; in phFriNfc_MifareUL_WrNdef()
404 Result = phFriNfc_MfUL_H_SelectSector(NdefMap, in phFriNfc_MifareUL_WrNdef()
405 NdefMap->MifareULContainer.CurrentSector, 1, in phFriNfc_MifareUL_WrNdef()
411 Result = ((NdefMap->Offset == PH_FRINFC_NDEFMAP_SEEK_BEGIN)? in phFriNfc_MifareUL_WrNdef()
412 phFriNfc_MfUL_H_RdBeforeWrite(NdefMap): in phFriNfc_MifareUL_WrNdef()
413 phFriNfc_MfUL_H_fillSendBufToWr(NdefMap)); in phFriNfc_MifareUL_WrNdef()
431 NFCSTATUS phFriNfc_MifareUL_ChkNdef( phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MifareUL_ChkNdef() argument
438 NdefMap->psDepAdditionalInfo.DepFlags.MetaChaining = 0; in phFriNfc_MifareUL_ChkNdef()
439 NdefMap->psDepAdditionalInfo.DepFlags.NADPresent = 0; in phFriNfc_MifareUL_ChkNdef()
440 NdefMap->psDepAdditionalInfo.NAD = 0; in phFriNfc_MifareUL_ChkNdef()
448 pSensRes[0] = NdefMap->psRemoteDevInfo->RemoteDevInfo.Iso14443A_Info.AtqA[0]; in phFriNfc_MifareUL_ChkNdef()
450 NdefMap->TLVStruct.NdefTLVBlock = PH_FRINFC_NDEFMAP_MFUL_VAL4; in phFriNfc_MifareUL_ChkNdef()
452 NdefMap->MifareULContainer.CurrentBlock = PH_FRINFC_NDEFMAP_MFUL_BLOCK2; in phFriNfc_MifareUL_ChkNdef()
454 NdefMap->MifareULContainer.CurrentBlock = PH_FRINFC_NDEFMAP_MFUL_BLOCK3; in phFriNfc_MifareUL_ChkNdef()
456 NdefMap->MifareULContainer.CRindex = PH_FRINFC_NDEFMAP_CR_CHK_NDEF; in phFriNfc_MifareUL_ChkNdef()
461 NdefMap->PrevOperation = PH_FRINFC_NDEFMAP_CHECK_OPE; in phFriNfc_MifareUL_ChkNdef()
463 NdefMap->SendRecvBuf[index] = NdefMap->MifareULContainer.CurrentBlock; in phFriNfc_MifareUL_ChkNdef()
466 NdefMap->SendLength = PH_FRINFC_NDEFMAP_MFUL_MAX_SEND_BUF_TO_READ; in phFriNfc_MifareUL_ChkNdef()
469 NdefMap->State = PH_FRINFC_NDEFMAP_MFUL_STATE_CHK_NDEF_COMP; in phFriNfc_MifareUL_ChkNdef()
472 NdefMap->CardType = PH_FRINFC_NDEFMAP_MIFARE_UL_CARD; in phFriNfc_MifareUL_ChkNdef()
479 NdefMap->Cmd.MfCmd = phHal_eMifareRead; in phFriNfc_MifareUL_ChkNdef()
482 NdefMap->MapCompletionInfo.CompletionRoutine = phFriNfc_MifareUL_Process; in phFriNfc_MifareUL_ChkNdef()
483 NdefMap->MapCompletionInfo.Context = NdefMap; in phFriNfc_MifareUL_ChkNdef()
486 *NdefMap->SendRecvLength = PH_FRINFC_NDEFMAP_MF_READ_BLOCK_SIZE; in phFriNfc_MifareUL_ChkNdef()
490 status = phFriNfc_OvrHal_Transceive(NdefMap->LowerDevice, in phFriNfc_MifareUL_ChkNdef()
491 &NdefMap->MapCompletionInfo, in phFriNfc_MifareUL_ChkNdef()
492 NdefMap->psRemoteDevInfo, in phFriNfc_MifareUL_ChkNdef()
493 NdefMap->Cmd, in phFriNfc_MifareUL_ChkNdef()
494 &NdefMap->psDepAdditionalInfo, in phFriNfc_MifareUL_ChkNdef()
495 NdefMap->SendRecvBuf, in phFriNfc_MifareUL_ChkNdef()
496 NdefMap->SendLength, in phFriNfc_MifareUL_ChkNdef()
497 NdefMap->SendRecvBuf, in phFriNfc_MifareUL_ChkNdef()
498 NdefMap->SendRecvLength); in phFriNfc_MifareUL_ChkNdef()
508 phFriNfc_MfUL_CalcByteNum(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MfUL_CalcByteNum() argument
516 if ((NdefMap->MifareULContainer.ReadBuf[i] == in phFriNfc_MfUL_CalcByteNum()
518 ((NdefMap->MifareULContainer.ReadBuf[i + 1] == in phFriNfc_MfUL_CalcByteNum()
519 NdefMap->TLVStruct.ActualSize) || in phFriNfc_MfUL_CalcByteNum()
520 (NdefMap->MifareULContainer.ReadBuf[i + 1] == 0xFF))) in phFriNfc_MfUL_CalcByteNum()
522 if (NdefMap->MifareULContainer.ReadBuf[i + 1] == 0xFF) in phFriNfc_MfUL_CalcByteNum()
524 TemLength = NdefMap->MifareULContainer.ReadBuf[i + 2] | in phFriNfc_MfUL_CalcByteNum()
525 ((uint16_t)NdefMap->MifareULContainer.ReadBuf[i + 3] << 8); in phFriNfc_MfUL_CalcByteNum()
527 if (TemLength == NdefMap->TLVStruct.ActualSize) in phFriNfc_MfUL_CalcByteNum()
529 NdefMap->MifareULContainer.ByteNumber = i + 1; in phFriNfc_MfUL_CalcByteNum()
535 NdefMap->MifareULContainer.ByteNumber = i + 1; in phFriNfc_MfUL_CalcByteNum()
554 phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MfUL_H_ChkLockBits() argument
558 if (((NdefMap->SendRecvBuf[index] & in phFriNfc_MfUL_H_ChkLockBits()
561 (NdefMap->SendRecvBuf[(index + 1)] & MIF_UL_LOCK_BIT_CHECK))) in phFriNfc_MfUL_H_ChkLockBits()
563 NdefMap->CardState = PH_NDEFMAP_CARD_STATE_READ_ONLY; in phFriNfc_MfUL_H_ChkLockBits()
586 phFriNfc_NdefMap_t *NdefMap; in phFriNfc_MifareUL_Process() local
595 NdefMap = (phFriNfc_NdefMap_t *)Context; in phFriNfc_MifareUL_Process()
599 switch (NdefMap->State) in phFriNfc_MifareUL_Process()
602 if (*NdefMap->SendRecvLength == in phFriNfc_MifareUL_Process()
606 Status = phFriNfc_MfUL_H_ChkCCBytes(NdefMap); in phFriNfc_MifareUL_Process()
616 phFriNfc_MfUL_H_ChkLockBits(NdefMap); in phFriNfc_MifareUL_Process()
622 NdefMap->MifareULContainer.CurrentBlock = PH_FRINFC_NDEFMAP_MFUL_BLOCK4; in phFriNfc_MifareUL_Process()
625 phFriNfc_MfUL_H_RdCardfindNdefTLV(NdefMap, in phFriNfc_MifareUL_Process()
626 NdefMap->MifareULContainer.CurrentBlock)); in phFriNfc_MifareUL_Process()
636 NdefMap->CardState = PH_NDEFMAP_CARD_STATE_INVALID; in phFriNfc_MifareUL_Process()
645 if (*NdefMap->SendRecvLength == in phFriNfc_MifareUL_Process()
648 if(NdefMap->MifareULContainer.ReadBufIndex < in phFriNfc_MifareUL_Process()
649 (NdefMap->TLVStruct.ActualSize + (((NdefMap->TLVStruct.NdefTLVBlock - in phFriNfc_MifareUL_Process()
651 … * PH_FRINFC_NDEFMAP_MFUL_VAL4) + (NdefMap->TLVStruct.NdefTLVByte - 1) + 4))) in phFriNfc_MifareUL_Process()
654 Status = phFriNfc_MfUL_H_CopyRdBytes(NdefMap); in phFriNfc_MifareUL_Process()
659 if(NdefMap->MifareULContainer.ReadBufIndex >= in phFriNfc_MifareUL_Process()
660 (NdefMap->TLVStruct.ActualSize + (((NdefMap->TLVStruct.NdefTLVBlock - in phFriNfc_MifareUL_Process()
662 … * PH_FRINFC_NDEFMAP_MFUL_VAL4) + (NdefMap->TLVStruct.NdefTLVByte - 1) + 4))) in phFriNfc_MifareUL_Process()
665 phFriNfc_MfUL_CalcByteNum(NdefMap); in phFriNfc_MifareUL_Process()
669 if ((NdefMap->MifareULContainer.ReadBuf[i] == in phFriNfc_MifareUL_Process()
671 ((NdefMap->MifareULContainer.ReadBuf[i + 1] == in phFriNfc_MifareUL_Process()
672 NdefMap->TLVStruct.ActualSize) || in phFriNfc_MifareUL_Process()
673 (NdefMap->MifareULContainer.ReadBuf[i + 1] == 0xFF))) in phFriNfc_MifareUL_Process()
675 if (NdefMap->MifareULContainer.ReadBuf[i + 1] == 0xFF) in phFriNfc_MifareUL_Process()
677 TemLength = NdefMap->MifareULContainer.ReadBuf[i + 2] | in phFriNfc_MifareUL_Process()
678 … ((uint16_t)NdefMap->MifareULContainer.ReadBuf[i + 3] << 8); in phFriNfc_MifareUL_Process()
680 if (TemLength == NdefMap->TLVStruct.ActualSize) in phFriNfc_MifareUL_Process()
682 NdefMap->MifareULContainer.ByteNumber = i + 1; in phFriNfc_MifareUL_Process()
688 NdefMap->MifareULContainer.ByteNumber = i + 1; in phFriNfc_MifareUL_Process()
695 if (NdefMap->MifareULContainer.ReadBuf in phFriNfc_MifareUL_Process()
696 [NdefMap->MifareULContainer.ByteNumber] == 0xFF) in phFriNfc_MifareUL_Process()
698 NdefMap->MifareULContainer.ByteNumber = in phFriNfc_MifareUL_Process()
699 NdefMap->MifareULContainer.ByteNumber + 3; in phFriNfc_MifareUL_Process()
703 NdefMap->MifareULContainer.ByteNumber = in phFriNfc_MifareUL_Process()
704 NdefMap->MifareULContainer.ByteNumber + 1; in phFriNfc_MifareUL_Process()
707 Status = phFriNfc_MfUL_H_CpDataToUserBuf(NdefMap); in phFriNfc_MifareUL_Process()
708 if (NdefMap->MifareULContainer.CurrentSector > 0) in phFriNfc_MifareUL_Process()
710 NdefMap->MifareULContainer.CurrentSector = 0; in phFriNfc_MifareUL_Process()
711 NdefMap->PrevState = PH_FRINFC_NDEFMAP_MFUL_STATE_READ; in phFriNfc_MifareUL_Process()
713 Status = phFriNfc_MfUL_H_SelectSector(NdefMap, in phFriNfc_MifareUL_Process()
714 NdefMap->MifareULContainer.CurrentSector, 1, in phFriNfc_MifareUL_Process()
727 Status = phFriNfc_MfUL_H_Rd16Bytes(NdefMap); in phFriNfc_MifareUL_Process()
749 Status = phFriNfc_MfUL_H_ProWrittenBytes(NdefMap); in phFriNfc_MifareUL_Process()
756 if (*NdefMap->SendRecvLength == in phFriNfc_MifareUL_Process()
759 switch(NdefMap->PrevOperation) in phFriNfc_MifareUL_Process()
764 if(NdefMap->TLVStruct.NoLbytesinTLV > in phFriNfc_MifareUL_Process()
767 Status = phFriNfc_MfUL_H_ChkRemainTLV(NdefMap, &CRFlag); in phFriNfc_MifareUL_Process()
771 if(NdefMap->TLVStruct.NdefTLVFoundFlag != in phFriNfc_MifareUL_Process()
775 Status = phFriNfc_MfUL_H_findNDEFTLV(NdefMap, &CRFlag); in phFriNfc_MifareUL_Process()
781 if((NdefMap->TLVStruct.NdefTLVFoundFlag == in phFriNfc_MifareUL_Process()
783 (NdefMap->TLVStruct.NoLbytesinTLV == in phFriNfc_MifareUL_Process()
790 if (NdefMap->MifareULContainer.CurrentSector > 0) in phFriNfc_MifareUL_Process()
792 NdefMap->MifareULContainer.CurrentSector = 0; in phFriNfc_MifareUL_Process()
793 NdefMap->PrevState = PH_FRINFC_NDEFMAP_MFUL_STATE_FND_NDEF_COMP; in phFriNfc_MifareUL_Process()
795 Status = phFriNfc_MfUL_H_SelectSector(NdefMap, in phFriNfc_MifareUL_Process()
796 NdefMap->MifareULContainer.CurrentSector, 1, in phFriNfc_MifareUL_Process()
805 Status = phFriNfc_MfUL_H_NxtOp(NdefMap, &CRFlag); in phFriNfc_MifareUL_Process()
813 NdefMap->PrevOperation)) in phFriNfc_MifareUL_Process()
815 NdefMap->CardState = PH_NDEFMAP_CARD_STATE_INVALID; in phFriNfc_MifareUL_Process()
822 Status = ((NdefMap->TLVStruct.WrLenFlag == in phFriNfc_MifareUL_Process()
824 phFriNfc_MfUL_H_UpdateWrLen(NdefMap): in phFriNfc_MifareUL_Process()
825 phFriNfc_MfUL_H_CallWrOp(NdefMap)); in phFriNfc_MifareUL_Process()
842 Status = phFriNfc_MfUL_H_UpdateWrLen(NdefMap); in phFriNfc_MifareUL_Process()
849 if(((((NdefMap->TLVStruct.NdefTLVByte - in phFriNfc_MifareUL_Process()
852 (NdefMap->MifareULContainer.CurrentBlock == in phFriNfc_MifareUL_Process()
853 (NdefMap->TLVStruct.NdefTLVBlock + in phFriNfc_MifareUL_Process()
855 (((NdefMap->TLVStruct.NdefTLVByte - in phFriNfc_MifareUL_Process()
858 NdefMap->MifareULContainer.CurrentBlock == in phFriNfc_MifareUL_Process()
859 NdefMap->TLVStruct.NdefTLVBlock)))) in phFriNfc_MifareUL_Process()
861 (void)memcpy(NdefMap->MifareULContainer.InternalBuf, in phFriNfc_MifareUL_Process()
862 NdefMap->MifareULContainer.Buffer, in phFriNfc_MifareUL_Process()
863 NdefMap->MifareULContainer.InternalLength); in phFriNfc_MifareUL_Process()
865 (void)memcpy(NdefMap->TLVStruct.NdefTLVBuffer, in phFriNfc_MifareUL_Process()
866 NdefMap->MifareULContainer.Buffer, in phFriNfc_MifareUL_Process()
869 NdefMap->CardState =(uint8_t) ((NdefMap->CardState == in phFriNfc_MifareUL_Process()
872 NdefMap->CardState); in phFriNfc_MifareUL_Process()
873 NdefMap->ApduBuffIndex = PH_FRINFC_NDEFMAP_MFUL_VAL0; in phFriNfc_MifareUL_Process()
874 NdefMap->NumOfBytesWritten = PH_FRINFC_NDEFMAP_MFUL_VAL0; in phFriNfc_MifareUL_Process()
876 if (NdefMap->MifareULContainer.CurrentSector > 0) in phFriNfc_MifareUL_Process()
879 NdefMap->MifareULContainer.CurrentSector = 0; in phFriNfc_MifareUL_Process()
880 NdefMap->PrevState = PH_FRINFC_NDEFMAP_MFUL_STATE_WR_LEN_TLV; in phFriNfc_MifareUL_Process()
882 Status = phFriNfc_MfUL_H_SelectSector(NdefMap, in phFriNfc_MifareUL_Process()
883 NdefMap->MifareULContainer.CurrentSector, 1, in phFriNfc_MifareUL_Process()
898 if (*NdefMap->SendRecvLength == in phFriNfc_MifareUL_Process()
901 if (NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_VAL0] == 0x0A) in phFriNfc_MifareUL_Process()
904 Status = phFriNfc_MfUL_H_SelectSector(NdefMap, in phFriNfc_MifareUL_Process()
905 NdefMap->MifareULContainer.CurrentSector, 2, in phFriNfc_MifareUL_Process()
928 NdefMap->MifareULContainer.CurrentBlock += in phFriNfc_MifareUL_Process()
931 Status = phFriNfc_MfUL_H_RdCardfindNdefTLV(NdefMap, in phFriNfc_MifareUL_Process()
932 NdefMap->MifareULContainer.CurrentBlock); in phFriNfc_MifareUL_Process()
938 if (*NdefMap->SendRecvLength == in phFriNfc_MifareUL_Process()
941 if (NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_VAL0] == 0x0A) in phFriNfc_MifareUL_Process()
944 Status = phFriNfc_MfUL_H_SelectSector(NdefMap, in phFriNfc_MifareUL_Process()
945 NdefMap->MifareULContainer.CurrentSector, 2, in phFriNfc_MifareUL_Process()
969 if (NdefMap->MifareULContainer.CurrentBlock == 0xFF) in phFriNfc_MifareUL_Process()
971 NdefMap->MifareULContainer.CurrentBlock = 0; in phFriNfc_MifareUL_Process()
975 NdefMap->MifareULContainer.CurrentBlock = in phFriNfc_MifareUL_Process()
976 (NdefMap->TLVStruct.NdefTLVBlock / 4) * 4; in phFriNfc_MifareUL_Process()
979 Status = phFriNfc_MfUL_H_Rd16Bytes(NdefMap); in phFriNfc_MifareUL_Process()
988 if (*NdefMap->SendRecvLength == in phFriNfc_MifareUL_Process()
991 if (NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_VAL0] == 0x0A) in phFriNfc_MifareUL_Process()
994 Status = phFriNfc_MfUL_H_SelectSector(NdefMap, in phFriNfc_MifareUL_Process()
995 NdefMap->MifareULContainer.CurrentSector, 2, in phFriNfc_MifareUL_Process()
1018 NdefMap->MifareULContainer.CurrentBlock = 0; in phFriNfc_MifareUL_Process()
1019 Status = phFriNfc_MfUL_H_fillSendBufToWr(NdefMap); in phFriNfc_MifareUL_Process()
1022 (NdefMap->TLVStruct.SetTermTLVFlag != in phFriNfc_MifareUL_Process()
1024 (NdefMap->MifareULContainer.RemainingSize > in phFriNfc_MifareUL_Process()
1027 Status = phFriNfc_MfUL_H_WrTermTLV(NdefMap); in phFriNfc_MifareUL_Process()
1032 (NdefMap->TLVStruct.SetTermTLVFlag == in phFriNfc_MifareUL_Process()
1035 Status = phFriNfc_MfUL_H_UpdateWrLen(NdefMap); in phFriNfc_MifareUL_Process()
1047 if (*NdefMap->SendRecvLength == in phFriNfc_MifareUL_Process()
1050 if (NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_VAL0] == 0x0A) in phFriNfc_MifareUL_Process()
1053 Status = phFriNfc_MfUL_H_SelectSector(NdefMap, in phFriNfc_MifareUL_Process()
1054 NdefMap->MifareULContainer.CurrentSector, 2, in phFriNfc_MifareUL_Process()
1077 Status = ((NdefMap->Offset == PH_FRINFC_NDEFMAP_SEEK_BEGIN)? in phFriNfc_MifareUL_Process()
1078 phFriNfc_MfUL_H_RdBeforeWrite(NdefMap): in phFriNfc_MifareUL_Process()
1079 phFriNfc_MfUL_H_fillSendBufToWr(NdefMap)); in phFriNfc_MifareUL_Process()
1091 if (*NdefMap->SendRecvLength == in phFriNfc_MifareUL_Process()
1094 if (NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_VAL0] == 0x0A) in phFriNfc_MifareUL_Process()
1097 Status = phFriNfc_MfUL_H_SelectSector(NdefMap, in phFriNfc_MifareUL_Process()
1098 NdefMap->MifareULContainer.CurrentSector, 2, in phFriNfc_MifareUL_Process()
1121 NdefMap->MifareULContainer.CurrentBlock = 0; in phFriNfc_MifareUL_Process()
1123 NdefMap->SendRecvBuf[index] = in phFriNfc_MifareUL_Process()
1124 NdefMap->MifareULContainer.CurrentBlock; in phFriNfc_MifareUL_Process()
1126 NdefMap->SendRecvBuf[index] = in phFriNfc_MifareUL_Process()
1130 if((((NdefMap->TLVStruct.NdefTLVByte - in phFriNfc_MifareUL_Process()
1132 ((NdefMap->TLVStruct.NdefTLVByte - PH_FRINFC_NDEFMAP_MFUL_VAL1) in phFriNfc_MifareUL_Process()
1136 … TemLength = (((NdefMap->TLVStruct.NdefTLVByte - PH_FRINFC_NDEFMAP_MFUL_VAL1) == in phFriNfc_MifareUL_Process()
1141 if(NdefMap->ApduBufferSize >= TemLength) in phFriNfc_MifareUL_Process()
1144 (void)memcpy(&(NdefMap->SendRecvBuf[ in phFriNfc_MifareUL_Process()
1146 &(NdefMap->ApduBuffer[ in phFriNfc_MifareUL_Process()
1147 NdefMap->ApduBuffIndex]), in phFriNfc_MifareUL_Process()
1151 NdefMap->NumOfBytesWritten = TemLength; in phFriNfc_MifareUL_Process()
1155 *NdefMap->DataCount = (index - PH_FRINFC_NDEFMAP_MFUL_VAL1); in phFriNfc_MifareUL_Process()
1160 (void)memcpy(&(NdefMap->SendRecvBuf[ in phFriNfc_MifareUL_Process()
1162 &(NdefMap->ApduBuffer[ in phFriNfc_MifareUL_Process()
1163 NdefMap->ApduBuffIndex]), in phFriNfc_MifareUL_Process()
1164 (uint16_t)NdefMap->ApduBufferSize); in phFriNfc_MifareUL_Process()
1167 NdefMap->NumOfBytesWritten = (uint16_t)NdefMap->ApduBufferSize; in phFriNfc_MifareUL_Process()
1169 index= index +(uint8_t)NdefMap->ApduBufferSize; in phFriNfc_MifareUL_Process()
1171 *NdefMap->DataCount = (index - PH_FRINFC_NDEFMAP_MFUL_VAL1); in phFriNfc_MifareUL_Process()
1175 NdefMap->SendRecvBuf[i] = (uint8_t)((i == index)? in phFriNfc_MifareUL_Process()
1178 NdefMap->TLVStruct.SetTermTLVFlag = PH_FRINFC_NDEFMAP_MFUL_FLAG1; in phFriNfc_MifareUL_Process()
1184 (void)memcpy(NdefMap->MifareULContainer.Buffer, in phFriNfc_MifareUL_Process()
1185 &(NdefMap->SendRecvBuf[ in phFriNfc_MifareUL_Process()
1190 (void)memcpy(NdefMap->TLVStruct.NdefTLVBuffer, in phFriNfc_MifareUL_Process()
1191 NdefMap->MifareULContainer.Buffer, in phFriNfc_MifareUL_Process()
1196 NdefMap->State = PH_FRINFC_NDEFMAP_MFUL_STATE_WRITE; in phFriNfc_MifareUL_Process()
1198 Status = phFriNfc_MfUL_H_Wr4bytes(NdefMap); in phFriNfc_MifareUL_Process()
1210 if (*NdefMap->SendRecvLength == in phFriNfc_MifareUL_Process()
1213 if (NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_VAL0] == 0x0A) in phFriNfc_MifareUL_Process()
1216 Status = phFriNfc_MfUL_H_SelectSector(NdefMap, in phFriNfc_MifareUL_Process()
1217 NdefMap->MifareULContainer.CurrentSector, 2, in phFriNfc_MifareUL_Process()
1240 if (NdefMap->PrevState == PH_FRINFC_NDEFMAP_MFUL_STATE_FND_NDEF_COMP) in phFriNfc_MifareUL_Process()
1242 Status = phFriNfc_MfUL_H_NxtOp(NdefMap, &CRFlag); in phFriNfc_MifareUL_Process()
1244 else if (NdefMap->PrevState == PH_FRINFC_NDEFMAP_MFUL_STATE_READ) in phFriNfc_MifareUL_Process()
1248 else if (NdefMap->PrevState == PH_FRINFC_NDEFMAP_MFUL_STATE_WRITE) in phFriNfc_MifareUL_Process()
1250 Status = phFriNfc_MfUL_H_UpdateWrLen(NdefMap); in phFriNfc_MifareUL_Process()
1255 else if (NdefMap->PrevState == PH_FRINFC_NDEFMAP_MFUL_STATE_WR_LEN_TLV) in phFriNfc_MifareUL_Process()
1273 phFriNfc_MifareUL_H_Complete(NdefMap, Status); in phFriNfc_MifareUL_Process()
1279 phFriNfc_MifareUL_H_Complete(NdefMap, Status); in phFriNfc_MifareUL_Process()
1284 phFriNfc_MifareUL_H_Complete(NdefMap,Status); in phFriNfc_MifareUL_Process()
1288 static NFCSTATUS phFriNfc_MfUL_H_ChkCCBytes(phFriNfc_NdefMap_t *NdefMap ) in phFriNfc_MfUL_H_ChkCCBytes() argument
1294 switch(NdefMap->SendRecvBuf[7]) in phFriNfc_MfUL_H_ChkCCBytes()
1296 switch(NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_BYTE3]) in phFriNfc_MfUL_H_ChkCCBytes()
1302 NdefMap->CardState = PH_NDEFMAP_CARD_STATE_INITIALIZED; in phFriNfc_MfUL_H_ChkCCBytes()
1306 NdefMap->CardState = PH_NDEFMAP_CARD_STATE_READ_ONLY; in phFriNfc_MfUL_H_ChkCCBytes()
1310 NdefMap->CardState = PH_NDEFMAP_CARD_STATE_INVALID; in phFriNfc_MfUL_H_ChkCCBytes()
1318 if(( NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_BYTE4] == in phFriNfc_MfUL_H_ChkCCBytes()
1320 if(( NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_BYTE0] == in phFriNfc_MfUL_H_ChkCCBytes()
1323 (NdefMap->CardState == PH_NDEFMAP_CARD_STATE_INITIALIZED) || in phFriNfc_MfUL_H_ChkCCBytes()
1324 (NdefMap->CardState == PH_NDEFMAP_CARD_STATE_READ_ONLY))) in phFriNfc_MfUL_H_ChkCCBytes()
1327 Result =phFriNfc_MapTool_ChkSpcVer( NdefMap, in phFriNfc_MfUL_H_ChkCCBytes()
1341 if (NdefMap->SendRecvBuf[6] == 0x06) in phFriNfc_MfUL_H_ChkCCBytes()
1343 NdefMap->CardType = PH_FRINFC_NDEFMAP_MIFARE_UL_CARD; in phFriNfc_MfUL_H_ChkCCBytes()
1345 else if (NdefMap->SendRecvBuf[6] == 0x12) in phFriNfc_MfUL_H_ChkCCBytes()
1348 NdefMap->CardType = PH_FRINFC_NDEFMAP_MIFARE_UL_CARD; in phFriNfc_MfUL_H_ChkCCBytes()
1353 if (NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_BYTE2] == 0x06) in phFriNfc_MfUL_H_ChkCCBytes()
1355 NdefMap->CardType = PH_FRINFC_NDEFMAP_MIFARE_UL_CARD; in phFriNfc_MfUL_H_ChkCCBytes()
1357 else if (NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_BYTE2] == 0x12) in phFriNfc_MfUL_H_ChkCCBytes()
1360 NdefMap->CardType = PH_FRINFC_NDEFMAP_MIFARE_UL_CARD; in phFriNfc_MfUL_H_ChkCCBytes()
1375 Result = ((( NdefMap->SendRecvBuf[6] != in phFriNfc_MfUL_H_ChkCCBytes()
1377 Result = ((( NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_BYTE2] != in phFriNfc_MfUL_H_ChkCCBytes()
1386 NdefMap->MifareULContainer.RemainingSize = in phFriNfc_MfUL_H_ChkCCBytes()
1387 NdefMap->CardMemSize = ((Result == NFCSTATUS_SUCCESS)? in phFriNfc_MfUL_H_ChkCCBytes()
1389 (NdefMap->SendRecvBuf[6] * in phFriNfc_MfUL_H_ChkCCBytes()
1391 (NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_BYTE2] * in phFriNfc_MfUL_H_ChkCCBytes()
1394 NdefMap->CardMemSize); in phFriNfc_MfUL_H_ChkCCBytes()
1396 if (NdefMap->CardMemSize > 256) in phFriNfc_MfUL_H_ChkCCBytes()
1398 NdefMap->CardMemSize = NdefMap->CardMemSize - 2; in phFriNfc_MfUL_H_ChkCCBytes()
1399 NdefMap->MifareULContainer.RemainingSize = NdefMap->CardMemSize; in phFriNfc_MfUL_H_ChkCCBytes()
1405 NdefMap->CardState = PH_NDEFMAP_CARD_STATE_INVALID; in phFriNfc_MfUL_H_ChkCCBytes()
1420 static void phFriNfc_MifareUL_H_Complete(phFriNfc_NdefMap_t *NdefMap, in phFriNfc_MifareUL_H_Complete() argument
1423 if(NdefMap!=NULL) in phFriNfc_MifareUL_H_Complete()
1425 if((PH_FRINFC_NDEFMAP_MFUL_STATE_WRITE == NdefMap->State) in phFriNfc_MifareUL_H_Complete()
1428 *NdefMap->WrNdefPacketLength = 0; in phFriNfc_MifareUL_H_Complete()
1431 NdefMap->State = PH_FRINFC_NDEFMAP_STATE_RESET_INIT; in phFriNfc_MifareUL_H_Complete()
1434 NdefMap->CompletionRoutine[NdefMap->MifareULContainer.CRindex]. in phFriNfc_MifareUL_H_Complete()
1435 CompletionRoutine(NdefMap->CompletionRoutine->Context, Status); in phFriNfc_MifareUL_H_Complete()
1439 static NFCSTATUS phFriNfc_MfUL_H_Rd16Bytes( phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MfUL_H_Rd16Bytes() argument
1444 NdefMap->State = PH_FRINFC_NDEFMAP_MFUL_STATE_READ; in phFriNfc_MfUL_H_Rd16Bytes()
1447 NdefMap->PrevOperation = PH_FRINFC_NDEFMAP_READ_OPE; in phFriNfc_MfUL_H_Rd16Bytes()
1450 if(NdefMap->ApduBuffIndex < NdefMap->ApduBufferSize) in phFriNfc_MfUL_H_Rd16Bytes()
1453 NdefMap->psDepAdditionalInfo.DepFlags.MetaChaining = PH_FRINFC_NDEFMAP_MFUL_VAL0; in phFriNfc_MfUL_H_Rd16Bytes()
1454 NdefMap->psDepAdditionalInfo.DepFlags.NADPresent = PH_FRINFC_NDEFMAP_MFUL_VAL0; in phFriNfc_MfUL_H_Rd16Bytes()
1455 NdefMap->psDepAdditionalInfo.NAD = PH_FRINFC_NDEFMAP_MFUL_VAL0; in phFriNfc_MfUL_H_Rd16Bytes()
1456 NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_VAL0] = in phFriNfc_MfUL_H_Rd16Bytes()
1457 NdefMap->MifareULContainer.CurrentBlock; in phFriNfc_MfUL_H_Rd16Bytes()
1458 NdefMap->SendLength = PH_FRINFC_NDEFMAP_MFUL_VAL1; in phFriNfc_MfUL_H_Rd16Bytes()
1459 *NdefMap->SendRecvLength = NdefMap->TempReceiveLength; in phFriNfc_MfUL_H_Rd16Bytes()
1465 NdefMap->Cmd.MfCmd = phHal_eMifareRead; in phFriNfc_MfUL_H_Rd16Bytes()
1468 Result = phFriNfc_OvrHal_Transceive( NdefMap->LowerDevice, in phFriNfc_MfUL_H_Rd16Bytes()
1469 &NdefMap->MapCompletionInfo, in phFriNfc_MfUL_H_Rd16Bytes()
1470 NdefMap->psRemoteDevInfo, in phFriNfc_MfUL_H_Rd16Bytes()
1471 NdefMap->Cmd, in phFriNfc_MfUL_H_Rd16Bytes()
1472 &NdefMap->psDepAdditionalInfo, in phFriNfc_MfUL_H_Rd16Bytes()
1473 NdefMap->SendRecvBuf, in phFriNfc_MfUL_H_Rd16Bytes()
1474 NdefMap->SendLength, in phFriNfc_MfUL_H_Rd16Bytes()
1475 NdefMap->SendRecvBuf, in phFriNfc_MfUL_H_Rd16Bytes()
1476 NdefMap->SendRecvLength); in phFriNfc_MfUL_H_Rd16Bytes()
1481 static NFCSTATUS phFriNfc_MfUL_H_Wr4bytes( phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MfUL_H_Wr4bytes() argument
1486 *NdefMap->SendRecvLength = NdefMap->TempReceiveLength; in phFriNfc_MfUL_H_Wr4bytes()
1488 NdefMap->PrevOperation = PH_FRINFC_NDEFMAP_WRITE_OPE; in phFriNfc_MfUL_H_Wr4bytes()
1495 NdefMap->Cmd.MfCmd = phHal_eMifareWrite4; in phFriNfc_MfUL_H_Wr4bytes()
1498 NdefMap->MapCompletionInfo.CompletionRoutine = phFriNfc_MifareUL_Process; in phFriNfc_MfUL_H_Wr4bytes()
1499 NdefMap->MapCompletionInfo.Context = NdefMap; in phFriNfc_MfUL_H_Wr4bytes()
1501 NdefMap->SendLength = PH_FRINFC_NDEFMAP_MFUL_WR_A_BLK; in phFriNfc_MfUL_H_Wr4bytes()
1503 Result = phFriNfc_OvrHal_Transceive(NdefMap->LowerDevice, in phFriNfc_MfUL_H_Wr4bytes()
1504 &NdefMap->MapCompletionInfo, in phFriNfc_MfUL_H_Wr4bytes()
1505 NdefMap->psRemoteDevInfo, in phFriNfc_MfUL_H_Wr4bytes()
1506 NdefMap->Cmd, in phFriNfc_MfUL_H_Wr4bytes()
1507 &NdefMap->psDepAdditionalInfo, in phFriNfc_MfUL_H_Wr4bytes()
1508 NdefMap->SendRecvBuf, in phFriNfc_MfUL_H_Wr4bytes()
1509 NdefMap->SendLength, in phFriNfc_MfUL_H_Wr4bytes()
1510 NdefMap->SendRecvBuf, in phFriNfc_MfUL_H_Wr4bytes()
1511 NdefMap->SendRecvLength); in phFriNfc_MfUL_H_Wr4bytes()
1515 static NFCSTATUS phFriNfc_MfUL_H_findNDEFTLV(phFriNfc_NdefMap_t *NdefMap, in phFriNfc_MfUL_H_findNDEFTLV() argument
1522 Temp16Bytes = ((NdefMap->TLVStruct.NdefTLVByte > PH_FRINFC_NDEFMAP_MFUL_VAL0)? in phFriNfc_MfUL_H_findNDEFTLV()
1523 (NdefMap->TLVStruct.NdefTLVByte - PH_FRINFC_NDEFMAP_MFUL_VAL1): in phFriNfc_MfUL_H_findNDEFTLV()
1524 NdefMap->TLVStruct.NdefTLVByte); in phFriNfc_MfUL_H_findNDEFTLV()
1527 if(NdefMap->SendRecvBuf[Temp16Bytes] == in phFriNfc_MfUL_H_findNDEFTLV()
1530 NdefMap->MifareULContainer.RemainingSize -= in phFriNfc_MfUL_H_findNDEFTLV()
1536 if (NdefMap->MifareULContainer.RemainingSize == in phFriNfc_MfUL_H_findNDEFTLV()
1548 Result = ((NdefMap->MifareULContainer.RemainingSize == in phFriNfc_MfUL_H_findNDEFTLV()
1559 Result = phFriNfc_MfUL_H_Chk16Bytes(NdefMap, in phFriNfc_MfUL_H_findNDEFTLV()
1563 NdefMap->TLVStruct.NdefTLVBlock = in phFriNfc_MfUL_H_findNDEFTLV()
1564 NdefMap->TLVStruct.NdefTLVBlock + PH_FRINFC_NDEFMAP_MFUL_VAL4; in phFriNfc_MfUL_H_findNDEFTLV()
1571 Result = ((NdefMap->SendRecvBuf[Temp16Bytes] == in phFriNfc_MfUL_H_findNDEFTLV()
1584 if ((NdefMap->SendRecvBuf[Temp16Bytes] == in phFriNfc_MfUL_H_findNDEFTLV()
1586 (NdefMap->SendRecvBuf[Temp16Bytes] == in phFriNfc_MfUL_H_findNDEFTLV()
1588 (NdefMap->SendRecvBuf[Temp16Bytes] == in phFriNfc_MfUL_H_findNDEFTLV()
1592 NdefMap->TLVStruct.NdefTLVByte = in phFriNfc_MfUL_H_findNDEFTLV()
1597 Result = phFriNfc_MfUL_H_Chk16Bytes(NdefMap, in phFriNfc_MfUL_H_findNDEFTLV()
1601 NdefMap->TLVStruct.TcheckedinTLVFlag = in phFriNfc_MfUL_H_findNDEFTLV()
1603 NdefMap->TLVStruct.NoLbytesinTLV = in phFriNfc_MfUL_H_findNDEFTLV()
1608 NdefMap->MifareULContainer.RemainingSize -= in phFriNfc_MfUL_H_findNDEFTLV()
1611 if(NdefMap->MifareULContainer.RemainingSize == in phFriNfc_MfUL_H_findNDEFTLV()
1619 Result = phFriNfc_MfUL_H_Chk16Bytes(NdefMap, in phFriNfc_MfUL_H_findNDEFTLV()
1623 NdefMap->TLVStruct.TcheckedinTLVFlag = in phFriNfc_MfUL_H_findNDEFTLV()
1625 NdefMap->TLVStruct.NoLbytesinTLV = in phFriNfc_MfUL_H_findNDEFTLV()
1633 if((NdefMap->SendRecvBuf[Temp16Bytes] == in phFriNfc_MfUL_H_findNDEFTLV()
1635 ((NdefMap->SendRecvBuf[Temp16Bytes] == in phFriNfc_MfUL_H_findNDEFTLV()
1637 (NdefMap->TLVStruct.NdefTLVFoundFlag != in phFriNfc_MfUL_H_findNDEFTLV()
1650 NdefMap->TLVStruct.BytesRemainLinTLV = in phFriNfc_MfUL_H_findNDEFTLV()
1651 NdefMap->SendRecvBuf[Temp16Bytes]; in phFriNfc_MfUL_H_findNDEFTLV()
1653 NdefMap->TLVStruct.ActualSize = in phFriNfc_MfUL_H_findNDEFTLV()
1654 NdefMap->SendRecvBuf[Temp16Bytes]; in phFriNfc_MfUL_H_findNDEFTLV()
1656 if((NdefMap->MifareULContainer.RemainingSize < in phFriNfc_MfUL_H_findNDEFTLV()
1657 NdefMap->SendRecvBuf[Temp16Bytes]) || in phFriNfc_MfUL_H_findNDEFTLV()
1658 (NdefMap->MifareULContainer.RemainingSize < in phFriNfc_MfUL_H_findNDEFTLV()
1660 (NdefMap->TLVStruct.BytesRemainLinTLV > in phFriNfc_MfUL_H_findNDEFTLV()
1661 (NdefMap->MifareULContainer.RemainingSize)) || in phFriNfc_MfUL_H_findNDEFTLV()
1662 ((NdefMap->TLVStruct.BytesRemainLinTLV == in phFriNfc_MfUL_H_findNDEFTLV()
1664 (NdefMap->PrevOperation == PH_FRINFC_NDEFMAP_READ_OPE))) in phFriNfc_MfUL_H_findNDEFTLV()
1673 if(NdefMap->TLVStruct.NdefTLVFoundFlag != in phFriNfc_MfUL_H_findNDEFTLV()
1676 NdefMap->TLVStruct.NdefTLVByte = in phFriNfc_MfUL_H_findNDEFTLV()
1678 NdefMap->SendRecvBuf[Temp16Bytes]) % in phFriNfc_MfUL_H_findNDEFTLV()
1682 NdefMap->TLVStruct.NdefTLVBlock = in phFriNfc_MfUL_H_findNDEFTLV()
1683 (uint8_t)(NdefMap->TLVStruct.NdefTLVBlock in phFriNfc_MfUL_H_findNDEFTLV()
1685 NdefMap->SendRecvBuf[Temp16Bytes] + 1)/ in phFriNfc_MfUL_H_findNDEFTLV()
1688 NdefMap->TLVStruct.NdefTLVBlock = in phFriNfc_MfUL_H_findNDEFTLV()
1689 … (uint8_t)(((NdefMap->TLVStruct.NdefTLVBlock / PH_FRINFC_NDEFMAP_MFUL_VAL4) * in phFriNfc_MfUL_H_findNDEFTLV()
1691 … + ((Temp16Bytes + NdefMap->SendRecvBuf[Temp16Bytes] + 1)/ in phFriNfc_MfUL_H_findNDEFTLV()
1696 NdefMap->SendRecvBuf[Temp16Bytes]); in phFriNfc_MfUL_H_findNDEFTLV()
1698 NdefMap->MifareULContainer.RemainingSize = in phFriNfc_MfUL_H_findNDEFTLV()
1699 (NdefMap->MifareULContainer.RemainingSize - in phFriNfc_MfUL_H_findNDEFTLV()
1700 (NdefMap->SendRecvBuf[Temp16Bytes] in phFriNfc_MfUL_H_findNDEFTLV()
1712 phFriNfc_MfUL_H_RdCardfindNdefTLV(NdefMap, in phFriNfc_MfUL_H_findNDEFTLV()
1713 NdefMap->TLVStruct.NdefTLVBlock): in phFriNfc_MfUL_H_findNDEFTLV()
1729 NdefMap->MifareULContainer.RemainingSize = in phFriNfc_MfUL_H_findNDEFTLV()
1730 (NdefMap->MifareULContainer.RemainingSize - in phFriNfc_MfUL_H_findNDEFTLV()
1731 (NdefMap->SendRecvBuf[Temp16Bytes + 1] in phFriNfc_MfUL_H_findNDEFTLV()
1734 NdefMap->TLVStruct.NdefTLVBlock = in phFriNfc_MfUL_H_findNDEFTLV()
1735 (uint8_t)(NdefMap->TLVStruct.NdefTLVBlock in phFriNfc_MfUL_H_findNDEFTLV()
1737 NdefMap->SendRecvBuf[Temp16Bytes + 1] + 2)/ in phFriNfc_MfUL_H_findNDEFTLV()
1742 NdefMap->SendRecvBuf[Temp16Bytes + 1] + 2; in phFriNfc_MfUL_H_findNDEFTLV()
1749 NdefMap->TLVStruct.NdefTLVFoundFlag = in phFriNfc_MfUL_H_findNDEFTLV()
1750 ((NdefMap->SendRecvBuf[Temp16Bytes] == in phFriNfc_MfUL_H_findNDEFTLV()
1755 if(NdefMap->TLVStruct.NdefTLVFoundFlag == in phFriNfc_MfUL_H_findNDEFTLV()
1759 NdefMap->SendRecvBuf[Temp16Bytes]); in phFriNfc_MfUL_H_findNDEFTLV()
1761 NdefMap->TLVStruct.NdefTLVByte = in phFriNfc_MfUL_H_findNDEFTLV()
1766 NdefMap->TLVStruct.NdefTLVBlock = in phFriNfc_MfUL_H_findNDEFTLV()
1767 (uint8_t)(((NdefMap->TLVStruct.NdefTLVBlock /4) * 4) in phFriNfc_MfUL_H_findNDEFTLV()
1771 NdefMap->TLVStruct.NdefTLVSector = NdefMap->MifareULContainer.CurrentSector; in phFriNfc_MfUL_H_findNDEFTLV()
1791 NdefMap->MifareULContainer.RemainingSize -= in phFriNfc_MfUL_H_findNDEFTLV()
1793 if (NdefMap->MifareULContainer.RemainingSize == in phFriNfc_MfUL_H_findNDEFTLV()
1803 Result = phFriNfc_MfUL_H_Chk16Bytes(NdefMap, in phFriNfc_MfUL_H_findNDEFTLV()
1815 Result = phFriNfc_MfUL_H_Chk16Bytes(NdefMap, in phFriNfc_MfUL_H_findNDEFTLV()
1819 NdefMap->TLVStruct.TcheckedinTLVFlag = in phFriNfc_MfUL_H_findNDEFTLV()
1821 NdefMap->TLVStruct.NoLbytesinTLV = in phFriNfc_MfUL_H_findNDEFTLV()
1826 NdefMap->MifareULContainer.RemainingSize -= in phFriNfc_MfUL_H_findNDEFTLV()
1829 if(NdefMap->MifareULContainer.RemainingSize == in phFriNfc_MfUL_H_findNDEFTLV()
1837 Result = phFriNfc_MfUL_H_Chk16Bytes(NdefMap, in phFriNfc_MfUL_H_findNDEFTLV()
1841 NdefMap->TLVStruct.TcheckedinTLVFlag = in phFriNfc_MfUL_H_findNDEFTLV()
1843 NdefMap->TLVStruct.NoLbytesinTLV = in phFriNfc_MfUL_H_findNDEFTLV()
1850 if((NdefMap->SendRecvBuf[Temp16Bytes] == in phFriNfc_MfUL_H_findNDEFTLV()
1852 ((NdefMap->SendRecvBuf[Temp16Bytes] == in phFriNfc_MfUL_H_findNDEFTLV()
1854 (NdefMap->TLVStruct.NdefTLVFoundFlag != in phFriNfc_MfUL_H_findNDEFTLV()
1868 Result = phFriNfc_MfUL_H_Chk16Bytes(NdefMap, in phFriNfc_MfUL_H_findNDEFTLV()
1872 NdefMap->TLVStruct.TcheckedinTLVFlag = in phFriNfc_MfUL_H_findNDEFTLV()
1874 NdefMap->TLVStruct.NoLbytesinTLV = in phFriNfc_MfUL_H_findNDEFTLV()
1880 ShiftLength = (uint16_t) NdefMap->SendRecvBuf[Temp16Bytes]; in phFriNfc_MfUL_H_findNDEFTLV()
1881 NdefMap->MifareULContainer.RemainingSize--; in phFriNfc_MfUL_H_findNDEFTLV()
1884 Result = phFriNfc_MfUL_H_Chk16Bytes(NdefMap, in phFriNfc_MfUL_H_findNDEFTLV()
1888 NdefMap->TLVStruct.TcheckedinTLVFlag = in phFriNfc_MfUL_H_findNDEFTLV()
1890 NdefMap->TLVStruct.NoLbytesinTLV = in phFriNfc_MfUL_H_findNDEFTLV()
1892 NdefMap->TLVStruct.prevLenByteValue = in phFriNfc_MfUL_H_findNDEFTLV()
1893 NdefMap->SendRecvBuf[Temp16Bytes - 1]; in phFriNfc_MfUL_H_findNDEFTLV()
1899 (uint16_t) (NdefMap->SendRecvBuf[Temp16Bytes] in phFriNfc_MfUL_H_findNDEFTLV()
1904 if(ShiftLength > (NdefMap->MifareULContainer.RemainingSize)) in phFriNfc_MfUL_H_findNDEFTLV()
1925 NdefMap->TLVStruct.ActualSize = in phFriNfc_MfUL_H_findNDEFTLV()
1926 NdefMap->TLVStruct.BytesRemainLinTLV = ShiftLength; in phFriNfc_MfUL_H_findNDEFTLV()
1928 NdefMap->TLVStruct.NdefTLVFoundFlag = 1; in phFriNfc_MfUL_H_findNDEFTLV()
1930 NdefMap->TLVStruct.NdefTLVSector = NdefMap->MifareULContainer.CurrentSector; in phFriNfc_MfUL_H_findNDEFTLV()
1933 Result = ((NdefMap->TLVStruct.NoLbytesinTLV == in phFriNfc_MfUL_H_findNDEFTLV()
1935 phFriNfc_MapTool_SetCardState( NdefMap, ShiftLength): in phFriNfc_MfUL_H_findNDEFTLV()
1945 NdefMap->TLVStruct.BytesRemainLinTLV = in phFriNfc_MfUL_H_findNDEFTLV()
1946 NdefMap->SendRecvBuf[Temp16Bytes]; in phFriNfc_MfUL_H_findNDEFTLV()
1948 NdefMap->TLVStruct.ActualSize = in phFriNfc_MfUL_H_findNDEFTLV()
1949 NdefMap->SendRecvBuf[Temp16Bytes]; in phFriNfc_MfUL_H_findNDEFTLV()
1951 if((NdefMap->MifareULContainer.RemainingSize < in phFriNfc_MfUL_H_findNDEFTLV()
1952 NdefMap->SendRecvBuf[Temp16Bytes]) || in phFriNfc_MfUL_H_findNDEFTLV()
1953 (NdefMap->MifareULContainer.RemainingSize < in phFriNfc_MfUL_H_findNDEFTLV()
1955 (NdefMap->TLVStruct.BytesRemainLinTLV > in phFriNfc_MfUL_H_findNDEFTLV()
1956 (NdefMap->MifareULContainer.RemainingSize)) || in phFriNfc_MfUL_H_findNDEFTLV()
1957 ((NdefMap->TLVStruct.BytesRemainLinTLV == in phFriNfc_MfUL_H_findNDEFTLV()
1959 (NdefMap->PrevOperation == PH_FRINFC_NDEFMAP_READ_OPE))) in phFriNfc_MfUL_H_findNDEFTLV()
1968 if(NdefMap->TLVStruct.NdefTLVFoundFlag != in phFriNfc_MfUL_H_findNDEFTLV()
1971 NdefMap->TLVStruct.NdefTLVByte = in phFriNfc_MfUL_H_findNDEFTLV()
1973 NdefMap->SendRecvBuf[Temp16Bytes]) % in phFriNfc_MfUL_H_findNDEFTLV()
1976 NdefMap->TLVStruct.NdefTLVBlock = in phFriNfc_MfUL_H_findNDEFTLV()
1977 (uint8_t)(NdefMap->TLVStruct.NdefTLVBlock in phFriNfc_MfUL_H_findNDEFTLV()
1979 NdefMap->SendRecvBuf[Temp16Bytes] + 1)/ in phFriNfc_MfUL_H_findNDEFTLV()
1983 NdefMap->SendRecvBuf[Temp16Bytes]); in phFriNfc_MfUL_H_findNDEFTLV()
1985 NdefMap->MifareULContainer.RemainingSize = in phFriNfc_MfUL_H_findNDEFTLV()
1986 (NdefMap->MifareULContainer.RemainingSize - in phFriNfc_MfUL_H_findNDEFTLV()
1987 (NdefMap->SendRecvBuf[Temp16Bytes] in phFriNfc_MfUL_H_findNDEFTLV()
1999 phFriNfc_MfUL_H_RdCardfindNdefTLV(NdefMap, in phFriNfc_MfUL_H_findNDEFTLV()
2000 NdefMap->TLVStruct.NdefTLVBlock): in phFriNfc_MfUL_H_findNDEFTLV()
2010 if(NdefMap->TLVStruct.NdefTLVFoundFlag == in phFriNfc_MfUL_H_findNDEFTLV()
2014 NdefMap->TLVStruct.NdefTLVBlock = in phFriNfc_MfUL_H_findNDEFTLV()
2015 (uint8_t)(NdefMap->TLVStruct.NdefTLVBlock in phFriNfc_MfUL_H_findNDEFTLV()
2019 NdefMap->MifareULContainer.RemainingSize = in phFriNfc_MfUL_H_findNDEFTLV()
2020 (NdefMap->MifareULContainer.RemainingSize - in phFriNfc_MfUL_H_findNDEFTLV()
2022 ShiftLength = NdefMap->SendRecvBuf[Temp16Bytes]; in phFriNfc_MfUL_H_findNDEFTLV()
2023 Result = ((NdefMap->TLVStruct.NoLbytesinTLV == in phFriNfc_MfUL_H_findNDEFTLV()
2025 phFriNfc_MapTool_SetCardState( NdefMap, ShiftLength): in phFriNfc_MfUL_H_findNDEFTLV()
2038 static NFCSTATUS phFriNfc_MfUL_H_Chk16Bytes(phFriNfc_NdefMap_t *NdefMap, in phFriNfc_MfUL_H_Chk16Bytes() argument
2046 localCurrentBlock = NdefMap->MifareULContainer.CurrentBlock + in phFriNfc_MfUL_H_Chk16Bytes()
2051 NdefMap->MifareULContainer.CurrentBlock += in phFriNfc_MfUL_H_Chk16Bytes()
2054 Result = phFriNfc_MfUL_H_RdCardfindNdefTLV(NdefMap, in phFriNfc_MfUL_H_Chk16Bytes()
2055 NdefMap->MifareULContainer.CurrentBlock); in phFriNfc_MfUL_H_Chk16Bytes()
2060 NdefMap->MifareULContainer.CurrentSector++; in phFriNfc_MfUL_H_Chk16Bytes()
2062 Result = phFriNfc_MfUL_H_SelectSector(NdefMap, in phFriNfc_MfUL_H_Chk16Bytes()
2063 NdefMap->MifareULContainer.CurrentSector, 1, in phFriNfc_MfUL_H_Chk16Bytes()
2116 static NFCSTATUS phFriNfc_MfUL_H_SelectSector(phFriNfc_NdefMap_t *NdefMap, in phFriNfc_MfUL_H_SelectSector() argument
2125 NdefMap->psDepAdditionalInfo.DepFlags.MetaChaining = PH_FRINFC_NDEFMAP_MFUL_VAL0; in phFriNfc_MfUL_H_SelectSector()
2126 NdefMap->psDepAdditionalInfo.DepFlags.NADPresent = PH_FRINFC_NDEFMAP_MFUL_VAL0; in phFriNfc_MfUL_H_SelectSector()
2127 NdefMap->psDepAdditionalInfo.NAD = PH_FRINFC_NDEFMAP_MFUL_VAL0; in phFriNfc_MfUL_H_SelectSector()
2129 NdefMap->State = NextState; in phFriNfc_MfUL_H_SelectSector()
2133 NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_VAL0] = 0x00; in phFriNfc_MfUL_H_SelectSector()
2134 NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_VAL1] = 0x00; in phFriNfc_MfUL_H_SelectSector()
2135 NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_VAL2] = 0xC2; in phFriNfc_MfUL_H_SelectSector()
2136 NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_VAL3] = 0xFF; in phFriNfc_MfUL_H_SelectSector()
2137NdefMap->SendLength = PH_FRINFC_NDEFMAP_MFUL_VAL4; in phFriNfc_MfUL_H_SelectSector()
2141 NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_VAL0] = 0x00; in phFriNfc_MfUL_H_SelectSector()
2142 NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_VAL1] = 0x00; in phFriNfc_MfUL_H_SelectSector()
2143 NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_VAL2] = SectorNo; in phFriNfc_MfUL_H_SelectSector()
2144 NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_VAL3] = 0; in phFriNfc_MfUL_H_SelectSector()
2145 NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_VAL4] = 0; in phFriNfc_MfUL_H_SelectSector()
2146 NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_VAL5] = 0; in phFriNfc_MfUL_H_SelectSector()
2147 NdefMap->SendLength = PH_FRINFC_NDEFMAP_MFUL_VAL5 + 1; in phFriNfc_MfUL_H_SelectSector()
2152 phFriNfc_MfUL_H_ComputeCrc(CRC_A, &NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_VAL2], in phFriNfc_MfUL_H_SelectSector()
2153 NdefMap->SendLength - 2, in phFriNfc_MfUL_H_SelectSector()
2154 &NdefMap->SendRecvBuf[NdefMap->SendLength], in phFriNfc_MfUL_H_SelectSector()
2155 &NdefMap->SendRecvBuf[NdefMap->SendLength + 1]); in phFriNfc_MfUL_H_SelectSector()
2157 NdefMap->SendLength += PH_FRINFC_NDEFMAP_MFUL_VAL2; in phFriNfc_MfUL_H_SelectSector()
2160 *NdefMap->SendRecvLength = NdefMap->TempReceiveLength; in phFriNfc_MfUL_H_SelectSector()
2162 NdefMap->Cmd.MfCmd = phHal_eMifareRaw; in phFriNfc_MfUL_H_SelectSector()
2165 Result = phFriNfc_OvrHal_Transceive( NdefMap->LowerDevice, in phFriNfc_MfUL_H_SelectSector()
2166 &NdefMap->MapCompletionInfo, in phFriNfc_MfUL_H_SelectSector()
2167 NdefMap->psRemoteDevInfo, in phFriNfc_MfUL_H_SelectSector()
2168 NdefMap->Cmd, in phFriNfc_MfUL_H_SelectSector()
2169 &NdefMap->psDepAdditionalInfo, in phFriNfc_MfUL_H_SelectSector()
2170 NdefMap->SendRecvBuf, in phFriNfc_MfUL_H_SelectSector()
2171 NdefMap->SendLength, in phFriNfc_MfUL_H_SelectSector()
2172 NdefMap->SendRecvBuf, in phFriNfc_MfUL_H_SelectSector()
2173 NdefMap->SendRecvLength); in phFriNfc_MfUL_H_SelectSector()
2178 static NFCSTATUS phFriNfc_MfUL_H_RdCardfindNdefTLV( phFriNfc_NdefMap_t *NdefMap, in phFriNfc_MfUL_H_RdCardfindNdefTLV() argument
2182 NdefMap->State = PH_FRINFC_NDEFMAP_MFUL_STATE_FND_NDEF_COMP; in phFriNfc_MfUL_H_RdCardfindNdefTLV()
2184 NdefMap->psDepAdditionalInfo.DepFlags.MetaChaining = PH_FRINFC_NDEFMAP_MFUL_VAL0; in phFriNfc_MfUL_H_RdCardfindNdefTLV()
2185 NdefMap->psDepAdditionalInfo.DepFlags.NADPresent = PH_FRINFC_NDEFMAP_MFUL_VAL0; in phFriNfc_MfUL_H_RdCardfindNdefTLV()
2186 NdefMap->psDepAdditionalInfo.NAD = PH_FRINFC_NDEFMAP_MFUL_VAL0; in phFriNfc_MfUL_H_RdCardfindNdefTLV()
2187 NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_VAL0] = in phFriNfc_MfUL_H_RdCardfindNdefTLV()
2189 NdefMap->SendLength = PH_FRINFC_NDEFMAP_MFUL_VAL1; in phFriNfc_MfUL_H_RdCardfindNdefTLV()
2190 *NdefMap->SendRecvLength = NdefMap->TempReceiveLength; in phFriNfc_MfUL_H_RdCardfindNdefTLV()
2196 NdefMap->Cmd.MfCmd = phHal_eMifareRead; in phFriNfc_MfUL_H_RdCardfindNdefTLV()
2199 Result = phFriNfc_OvrHal_Transceive( NdefMap->LowerDevice, in phFriNfc_MfUL_H_RdCardfindNdefTLV()
2200 &NdefMap->MapCompletionInfo, in phFriNfc_MfUL_H_RdCardfindNdefTLV()
2201 NdefMap->psRemoteDevInfo, in phFriNfc_MfUL_H_RdCardfindNdefTLV()
2202 NdefMap->Cmd, in phFriNfc_MfUL_H_RdCardfindNdefTLV()
2203 &NdefMap->psDepAdditionalInfo, in phFriNfc_MfUL_H_RdCardfindNdefTLV()
2204 NdefMap->SendRecvBuf, in phFriNfc_MfUL_H_RdCardfindNdefTLV()
2205 NdefMap->SendLength, in phFriNfc_MfUL_H_RdCardfindNdefTLV()
2206 NdefMap->SendRecvBuf, in phFriNfc_MfUL_H_RdCardfindNdefTLV()
2207 NdefMap->SendRecvLength); in phFriNfc_MfUL_H_RdCardfindNdefTLV()
2211 static NFCSTATUS phFriNfc_MfUL_H_ChkRemainTLV(phFriNfc_NdefMap_t *NdefMap, in phFriNfc_MfUL_H_ChkRemainTLV() argument
2218 switch(NdefMap->TLVStruct.NoLbytesinTLV) in phFriNfc_MfUL_H_ChkRemainTLV()
2222 ShiftLength = ((NdefMap->TLVStruct.NoLbytesinTLV == in phFriNfc_MfUL_H_ChkRemainTLV()
2224 NdefMap->TLVStruct.prevLenByteValue: in phFriNfc_MfUL_H_ChkRemainTLV()
2225 NdefMap->SendRecvBuf[TempLength]); in phFriNfc_MfUL_H_ChkRemainTLV()
2226 ShiftLength = ((NdefMap->TLVStruct.NoLbytesinTLV == in phFriNfc_MfUL_H_ChkRemainTLV()
2228 (((uint16_t)(NdefMap->SendRecvBuf[TempLength]) << in phFriNfc_MfUL_H_ChkRemainTLV()
2231 (((uint16_t)(NdefMap->SendRecvBuf[(TempLength + in phFriNfc_MfUL_H_ChkRemainTLV()
2236 NdefMap->MifareULContainer.RemainingSize -= in phFriNfc_MfUL_H_ChkRemainTLV()
2239 NdefMap->TLVStruct.ActualSize = in phFriNfc_MfUL_H_ChkRemainTLV()
2240 NdefMap->TLVStruct.BytesRemainLinTLV = ShiftLength; in phFriNfc_MfUL_H_ChkRemainTLV()
2246 Result = ((((NdefMap->MifareULContainer.RemainingSize)<= in phFriNfc_MfUL_H_ChkRemainTLV()
2255 phFriNfc_MapTool_SetCardState( NdefMap, ShiftLength): in phFriNfc_MfUL_H_ChkRemainTLV()
2267 NdefMap->MifareULContainer.RemainingSize= NdefMap->MifareULContainer.RemainingSize- in phFriNfc_MfUL_H_ChkRemainTLV()
2268 NdefMap->TLVStruct.NoLbytesinTLV; in phFriNfc_MfUL_H_ChkRemainTLV()
2287 if((NdefMap->SendRecvBuf[TempLength] == in phFriNfc_MfUL_H_ChkRemainTLV()
2289 ((NdefMap->SendRecvBuf[TempLength] == in phFriNfc_MfUL_H_ChkRemainTLV()
2291 (NdefMap->TLVStruct.NdefTLVFoundFlag != in phFriNfc_MfUL_H_ChkRemainTLV()
2304 ShiftLength = NdefMap->SendRecvBuf[(TempLength + PH_FRINFC_NDEFMAP_MFUL_VAL1)]; in phFriNfc_MfUL_H_ChkRemainTLV()
2305 … ShiftLength = (((uint16_t)(NdefMap->SendRecvBuf[(TempLength + PH_FRINFC_NDEFMAP_MFUL_VAL2)]) in phFriNfc_MfUL_H_ChkRemainTLV()
2308 Result = ((ShiftLength > (NdefMap->MifareULContainer.RemainingSize))? in phFriNfc_MfUL_H_ChkRemainTLV()
2315 phFriNfc_MapTool_SetCardState( NdefMap, ShiftLength): in phFriNfc_MfUL_H_ChkRemainTLV()
2318 NdefMap->TLVStruct.ActualSize = in phFriNfc_MfUL_H_ChkRemainTLV()
2319 NdefMap->TLVStruct.BytesRemainLinTLV = ShiftLength; in phFriNfc_MfUL_H_ChkRemainTLV()
2324NdefMap->MifareULContainer.RemainingSize= NdefMap->MifareULContainer.RemainingSize- in phFriNfc_MfUL_H_ChkRemainTLV()
2325 NdefMap->TLVStruct.NoLbytesinTLV; in phFriNfc_MfUL_H_ChkRemainTLV()
2347 Result = ((NdefMap->SendRecvBuf[TempLength] > in phFriNfc_MfUL_H_ChkRemainTLV()
2348 NdefMap->MifareULContainer.RemainingSize)? in phFriNfc_MfUL_H_ChkRemainTLV()
2353 NdefMap->TLVStruct.ActualSize = in phFriNfc_MfUL_H_ChkRemainTLV()
2354 NdefMap->TLVStruct.BytesRemainLinTLV = in phFriNfc_MfUL_H_ChkRemainTLV()
2355 NdefMap->SendRecvBuf[TempLength]; in phFriNfc_MfUL_H_ChkRemainTLV()
2356 NdefMap->MifareULContainer.RemainingSize--; in phFriNfc_MfUL_H_ChkRemainTLV()
2359 (NdefMap->TLVStruct.NdefTLVFoundFlag != in phFriNfc_MfUL_H_ChkRemainTLV()
2362 phFriNfc_MfUL_H_UpdateLen(NdefMap, in phFriNfc_MfUL_H_ChkRemainTLV()
2363 (uint16_t)NdefMap->SendRecvBuf[TempLength]); in phFriNfc_MfUL_H_ChkRemainTLV()
2365 NdefMap->MifareULContainer.CurrentBlock = in phFriNfc_MfUL_H_ChkRemainTLV()
2366 NdefMap->TLVStruct.NdefTLVBlock; in phFriNfc_MfUL_H_ChkRemainTLV()
2367 TempLength=TempLength+(NdefMap->SendRecvBuf[TempLength]); in phFriNfc_MfUL_H_ChkRemainTLV()
2369 phFriNfc_MfUL_H_findNDEFTLV(NdefMap, CRFlag): in phFriNfc_MfUL_H_ChkRemainTLV()
2370 phFriNfc_MfUL_H_RdCardfindNdefTLV(NdefMap, in phFriNfc_MfUL_H_ChkRemainTLV()
2371 NdefMap->TLVStruct.NdefTLVBlock)); in phFriNfc_MfUL_H_ChkRemainTLV()
2376 NdefMap->TLVStruct.NoLbytesinTLV = PH_FRINFC_NDEFMAP_MFUL_VAL0; in phFriNfc_MfUL_H_ChkRemainTLV()
2378 Result = phFriNfc_MapTool_SetCardState( NdefMap, NdefMap->TLVStruct.ActualSize); in phFriNfc_MfUL_H_ChkRemainTLV()
2383 static void phFriNfc_MfUL_H_UpdateLen(phFriNfc_NdefMap_t *NdefMap, in phFriNfc_MfUL_H_UpdateLen() argument
2386 NdefMap->MifareULContainer.RemainingSize= NdefMap->MifareULContainer.RemainingSize-DataLen; in phFriNfc_MfUL_H_UpdateLen()
2387 NdefMap->TLVStruct.NdefTLVByte = ((DataLen % in phFriNfc_MfUL_H_UpdateLen()
2390 NdefMap->TLVStruct.NdefTLVBlock = in phFriNfc_MfUL_H_UpdateLen()
2391 (uint8_t)(NdefMap->MifareULContainer.CurrentBlock in phFriNfc_MfUL_H_UpdateLen()
2395 static NFCSTATUS phFriNfc_MfUL_H_NxtOp(phFriNfc_NdefMap_t *NdefMap, in phFriNfc_MfUL_H_NxtOp() argument
2400 switch(NdefMap->PrevOperation) in phFriNfc_MfUL_H_NxtOp()
2405 if (NdefMap->TLVStruct.ActualSize > (NdefMap->CardMemSize - 2)) in phFriNfc_MfUL_H_NxtOp()
2413 if (NdefMap->TLVStruct.NdefTLVSector == 1) in phFriNfc_MfUL_H_NxtOp()
2416 NdefMap->MifareULContainer.CurrentSector = 1; in phFriNfc_MfUL_H_NxtOp()
2417 NdefMap->MifareULContainer.CurrentBlock = 0; in phFriNfc_MfUL_H_NxtOp()
2419 Result = phFriNfc_MfUL_H_SelectSector(NdefMap, in phFriNfc_MfUL_H_NxtOp()
2420 NdefMap->MifareULContainer.CurrentSector, 1, in phFriNfc_MfUL_H_NxtOp()
2425 NdefMap->MifareULContainer.CurrentBlock = (NdefMap->TLVStruct.NdefTLVBlock / 4) * 4; in phFriNfc_MfUL_H_NxtOp()
2427 Result = phFriNfc_MfUL_H_Rd16Bytes(NdefMap); in phFriNfc_MfUL_H_NxtOp()
2430 NdefMap->MifareULContainer.CurrentBlock = in phFriNfc_MfUL_H_NxtOp()
2433 Result = phFriNfc_MfUL_H_Rd16Bytes(NdefMap); in phFriNfc_MfUL_H_NxtOp()
2453 static NFCSTATUS phFriNfc_MfUL_H_CopyRdBytes(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MfUL_H_CopyRdBytes() argument
2461 if (NdefMap->MifareULContainer.CurrentBlock in phFriNfc_MfUL_H_CopyRdBytes()
2462 == NdefMap->TLVStruct.NdefTLVBlock) in phFriNfc_MfUL_H_CopyRdBytes()
2464 if (NdefMap->CardMemSize > (0x12 * PH_FRINFC_NDEFMAP_MFUL_MUL8)) in phFriNfc_MfUL_H_CopyRdBytes()
2466 v_field_byte = NdefMap->TLVStruct.NdefTLVByte; in phFriNfc_MfUL_H_CopyRdBytes()
2470 if (NdefMap->TLVStruct.ActualSize >= 0xFF) in phFriNfc_MfUL_H_CopyRdBytes()
2508 (void)memcpy(&(NdefMap->MifareULContainer.ReadBuf[ in phFriNfc_MfUL_H_CopyRdBytes()
2509 NdefMap->MifareULContainer.ReadBufIndex]), in phFriNfc_MfUL_H_CopyRdBytes()
2510 (void *)(NdefMap->SendRecvBuf + v_field_byte), in phFriNfc_MfUL_H_CopyRdBytes()
2511 (*NdefMap->SendRecvLength - v_field_byte)); in phFriNfc_MfUL_H_CopyRdBytes()
2513 NdefMap->MifareULContainer.ReadBufIndex = (uint16_t) in phFriNfc_MfUL_H_CopyRdBytes()
2514 (NdefMap->MifareULContainer.ReadBufIndex + in phFriNfc_MfUL_H_CopyRdBytes()
2515 (*NdefMap->SendRecvLength - v_field_byte)); in phFriNfc_MfUL_H_CopyRdBytes()
2518 (void)memcpy(&(NdefMap->MifareULContainer.ReadBuf[ in phFriNfc_MfUL_H_CopyRdBytes()
2519 NdefMap->MifareULContainer.ReadBufIndex]), in phFriNfc_MfUL_H_CopyRdBytes()
2520 NdefMap->SendRecvBuf, in phFriNfc_MfUL_H_CopyRdBytes()
2521 *NdefMap->SendRecvLength); in phFriNfc_MfUL_H_CopyRdBytes()
2523NdefMap->MifareULContainer.ReadBufIndex=NdefMap->MifareULContainer.ReadBufIndex +*NdefMap->SendRec… in phFriNfc_MfUL_H_CopyRdBytes()
2526 localCurrentBlock = NdefMap->MifareULContainer.CurrentBlock+ in phFriNfc_MfUL_H_CopyRdBytes()
2527 (uint8_t)((NdefMap->MifareULContainer.ReadBufIndex != in phFriNfc_MfUL_H_CopyRdBytes()
2528 NdefMap->CardMemSize)? in phFriNfc_MfUL_H_CopyRdBytes()
2533 NdefMap->MifareULContainer.CurrentBlock = NdefMap->MifareULContainer.CurrentBlock+ in phFriNfc_MfUL_H_CopyRdBytes()
2534 (uint8_t)((NdefMap->MifareULContainer.ReadBufIndex != in phFriNfc_MfUL_H_CopyRdBytes()
2535 NdefMap->CardMemSize)? in phFriNfc_MfUL_H_CopyRdBytes()
2542 if (NdefMap->MifareULContainer.CurrentSector == 0) in phFriNfc_MfUL_H_CopyRdBytes()
2544 NdefMap->MifareULContainer.CurrentSector++; in phFriNfc_MfUL_H_CopyRdBytes()
2545 NdefMap->MifareULContainer.CurrentBlock = 0xff; in phFriNfc_MfUL_H_CopyRdBytes()
2547 Result = phFriNfc_MfUL_H_SelectSector(NdefMap, in phFriNfc_MfUL_H_CopyRdBytes()
2548 NdefMap->MifareULContainer.CurrentSector, 1, in phFriNfc_MfUL_H_CopyRdBytes()
2556 static NFCSTATUS phFriNfc_MfUL_H_CpDataToUserBuf(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MfUL_H_CpDataToUserBuf() argument
2562 if(NdefMap->ApduBufferSize >= in phFriNfc_MfUL_H_CpDataToUserBuf()
2563 NdefMap->TLVStruct.BytesRemainLinTLV) in phFriNfc_MfUL_H_CpDataToUserBuf()
2565 (void)memcpy(NdefMap->ApduBuffer, in phFriNfc_MfUL_H_CpDataToUserBuf()
2566 &(NdefMap->MifareULContainer.ReadBuf[ in phFriNfc_MfUL_H_CpDataToUserBuf()
2567 NdefMap->MifareULContainer.ByteNumber]), in phFriNfc_MfUL_H_CpDataToUserBuf()
2568 NdefMap->TLVStruct.BytesRemainLinTLV); in phFriNfc_MfUL_H_CpDataToUserBuf()
2570 *(NdefMap->NumOfBytesRead) = in phFriNfc_MfUL_H_CpDataToUserBuf()
2571 NdefMap->TLVStruct.BytesRemainLinTLV; in phFriNfc_MfUL_H_CpDataToUserBuf()
2572 NdefMap->MifareULContainer.ByteNumber = in phFriNfc_MfUL_H_CpDataToUserBuf()
2574 NdefMap->MifareULContainer.ReadWriteCompleteFlag = in phFriNfc_MfUL_H_CpDataToUserBuf()
2576 NdefMap->MifareULContainer.RemainingSize = NdefMap->MifareULContainer.RemainingSize- in phFriNfc_MfUL_H_CpDataToUserBuf()
2577 NdefMap->TLVStruct.BytesRemainLinTLV; in phFriNfc_MfUL_H_CpDataToUserBuf()
2578 NdefMap->TLVStruct.BytesRemainLinTLV = in phFriNfc_MfUL_H_CpDataToUserBuf()
2583 (void)memcpy(NdefMap->ApduBuffer, in phFriNfc_MfUL_H_CpDataToUserBuf()
2584 &(NdefMap->MifareULContainer.ReadBuf[ in phFriNfc_MfUL_H_CpDataToUserBuf()
2585 NdefMap->MifareULContainer.ByteNumber]), in phFriNfc_MfUL_H_CpDataToUserBuf()
2586 NdefMap->ApduBufferSize); in phFriNfc_MfUL_H_CpDataToUserBuf()
2588 *(NdefMap->NumOfBytesRead) = in phFriNfc_MfUL_H_CpDataToUserBuf()
2589 NdefMap->ApduBufferSize; in phFriNfc_MfUL_H_CpDataToUserBuf()
2590 NdefMap->MifareULContainer.ByteNumber = NdefMap->MifareULContainer.ByteNumber+ in phFriNfc_MfUL_H_CpDataToUserBuf()
2591 (uint16_t)NdefMap->ApduBufferSize; in phFriNfc_MfUL_H_CpDataToUserBuf()
2592 NdefMap->MifareULContainer.RemainingSize=NdefMap->MifareULContainer.RemainingSize- in phFriNfc_MfUL_H_CpDataToUserBuf()
2593 (uint16_t)NdefMap->ApduBufferSize; in phFriNfc_MfUL_H_CpDataToUserBuf()
2594 NdefMap->TLVStruct.BytesRemainLinTLV = NdefMap->TLVStruct.BytesRemainLinTLV- in phFriNfc_MfUL_H_CpDataToUserBuf()
2595 (uint16_t)NdefMap->ApduBufferSize; in phFriNfc_MfUL_H_CpDataToUserBuf()
2600 static NFCSTATUS phFriNfc_MfUL_H_RdBeforeWrite(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MfUL_H_RdBeforeWrite() argument
2602 uint16_t localCurrentBlock = NdefMap->TLVStruct.NdefTLVBlock; in phFriNfc_MfUL_H_RdBeforeWrite()
2610 switch((NdefMap->TLVStruct.NdefTLVByte - PH_FRINFC_NDEFMAP_MFUL_VAL1)) in phFriNfc_MfUL_H_RdBeforeWrite()
2614 NdefMap->MifareULContainer.CurrentBlock = in phFriNfc_MfUL_H_RdBeforeWrite()
2615 NdefMap->TLVStruct.NdefTLVBlock; in phFriNfc_MfUL_H_RdBeforeWrite()
2617 NdefMap->SendRecvBuf[index] = in phFriNfc_MfUL_H_RdBeforeWrite()
2618 NdefMap->MifareULContainer.CurrentBlock; in phFriNfc_MfUL_H_RdBeforeWrite()
2620 NdefMap->SendRecvBuf[index] = in phFriNfc_MfUL_H_RdBeforeWrite()
2623 if (NdefMap->ApduBufferSize > 254) in phFriNfc_MfUL_H_RdBeforeWrite()
2625 NdefMap->SendRecvBuf[index] = 0xFF; in phFriNfc_MfUL_H_RdBeforeWrite()
2627 NdefMap->SendRecvBuf[index] = in phFriNfc_MfUL_H_RdBeforeWrite()
2630 NdefMap->SendRecvBuf[index] = in phFriNfc_MfUL_H_RdBeforeWrite()
2636 NdefMap->SendRecvBuf[index] = in phFriNfc_MfUL_H_RdBeforeWrite()
2647 Result = phFriNfc_MfUL_H_RdCardfindNdefTLV(NdefMap, in phFriNfc_MfUL_H_RdBeforeWrite()
2648 NdefMap->TLVStruct.NdefTLVBlock); in phFriNfc_MfUL_H_RdBeforeWrite()
2653 localCurrentBlock = (NdefMap->MifareULContainer.CurrentBlock + in phFriNfc_MfUL_H_RdBeforeWrite()
2659 NdefMap->MifareULContainer.CurrentBlock = in phFriNfc_MfUL_H_RdBeforeWrite()
2660 (NdefMap->MifareULContainer.CurrentBlock + in phFriNfc_MfUL_H_RdBeforeWrite()
2662 NdefMap->SendRecvBuf[index] = in phFriNfc_MfUL_H_RdBeforeWrite()
2663 NdefMap->MifareULContainer.CurrentBlock; in phFriNfc_MfUL_H_RdBeforeWrite()
2666 if (NdefMap->ApduBufferSize > 254) in phFriNfc_MfUL_H_RdBeforeWrite()
2668 NdefMap->SendRecvBuf[index] = 0xFF; in phFriNfc_MfUL_H_RdBeforeWrite()
2670 NdefMap->SendRecvBuf[index] = in phFriNfc_MfUL_H_RdBeforeWrite()
2673 NdefMap->SendRecvBuf[index] = in phFriNfc_MfUL_H_RdBeforeWrite()
2679 NdefMap->SendRecvBuf[index] = in phFriNfc_MfUL_H_RdBeforeWrite()
2687 NdefMap->MifareULContainer.CurrentSector++; in phFriNfc_MfUL_H_RdBeforeWrite()
2689 Result = phFriNfc_MfUL_H_SelectSector(NdefMap, in phFriNfc_MfUL_H_RdBeforeWrite()
2690 NdefMap->MifareULContainer.CurrentSector, 1, in phFriNfc_MfUL_H_RdBeforeWrite()
2701 if((((NdefMap->TLVStruct.NdefTLVByte - in phFriNfc_MfUL_H_RdBeforeWrite()
2703 ((NdefMap->TLVStruct.NdefTLVByte - PH_FRINFC_NDEFMAP_MFUL_VAL1) in phFriNfc_MfUL_H_RdBeforeWrite()
2707 TemLength = (((NdefMap->TLVStruct.NdefTLVByte - PH_FRINFC_NDEFMAP_MFUL_VAL1) == in phFriNfc_MfUL_H_RdBeforeWrite()
2712 if (NdefMap->ApduBufferSize > 254) in phFriNfc_MfUL_H_RdBeforeWrite()
2717 if(NdefMap->ApduBufferSize >= TemLength) in phFriNfc_MfUL_H_RdBeforeWrite()
2720 (void)memcpy(&(NdefMap->SendRecvBuf[ in phFriNfc_MfUL_H_RdBeforeWrite()
2722 &(NdefMap->ApduBuffer[ in phFriNfc_MfUL_H_RdBeforeWrite()
2723 NdefMap->ApduBuffIndex]), in phFriNfc_MfUL_H_RdBeforeWrite()
2727 NdefMap->NumOfBytesWritten = TemLength; in phFriNfc_MfUL_H_RdBeforeWrite()
2733 *NdefMap->DataCount = (index - PH_FRINFC_NDEFMAP_MFUL_VAL1); in phFriNfc_MfUL_H_RdBeforeWrite()
2744 (void)memcpy(&(NdefMap->SendRecvBuf[ in phFriNfc_MfUL_H_RdBeforeWrite()
2746 &(NdefMap->ApduBuffer[ in phFriNfc_MfUL_H_RdBeforeWrite()
2747 NdefMap->ApduBuffIndex]), in phFriNfc_MfUL_H_RdBeforeWrite()
2748 (uint16_t)NdefMap->ApduBufferSize); in phFriNfc_MfUL_H_RdBeforeWrite()
2751 NdefMap->NumOfBytesWritten = (uint16_t)NdefMap->ApduBufferSize; in phFriNfc_MfUL_H_RdBeforeWrite()
2753 index= index +(uint8_t)NdefMap->ApduBufferSize; in phFriNfc_MfUL_H_RdBeforeWrite()
2755 *NdefMap->DataCount = (index - PH_FRINFC_NDEFMAP_MFUL_VAL1); in phFriNfc_MfUL_H_RdBeforeWrite()
2759 NdefMap->SendRecvBuf[i] = (uint8_t)((i == index)? in phFriNfc_MfUL_H_RdBeforeWrite()
2762 NdefMap->TLVStruct.SetTermTLVFlag = PH_FRINFC_NDEFMAP_MFUL_FLAG1; in phFriNfc_MfUL_H_RdBeforeWrite()
2768 (void)memcpy(NdefMap->MifareULContainer.Buffer, in phFriNfc_MfUL_H_RdBeforeWrite()
2769 &(NdefMap->SendRecvBuf[ in phFriNfc_MfUL_H_RdBeforeWrite()
2774 (void)memcpy(NdefMap->TLVStruct.NdefTLVBuffer, in phFriNfc_MfUL_H_RdBeforeWrite()
2775 NdefMap->MifareULContainer.Buffer, in phFriNfc_MfUL_H_RdBeforeWrite()
2780 NdefMap->State = PH_FRINFC_NDEFMAP_MFUL_STATE_WRITE; in phFriNfc_MfUL_H_RdBeforeWrite()
2782 Result = phFriNfc_MfUL_H_Wr4bytes(NdefMap); in phFriNfc_MfUL_H_RdBeforeWrite()
2787 static NFCSTATUS phFriNfc_MfUL_H_CallWrOp(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MfUL_H_CallWrOp() argument
2793 NdefMap->MifareULContainer.CurrentBlock = in phFriNfc_MfUL_H_CallWrOp()
2794 NdefMap->TLVStruct.NdefTLVBlock; in phFriNfc_MfUL_H_CallWrOp()
2796 (void)memcpy(&(NdefMap->SendRecvBuf[ in phFriNfc_MfUL_H_CallWrOp()
2798 NdefMap->SendRecvBuf, in phFriNfc_MfUL_H_CallWrOp()
2801 NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_VAL0] = in phFriNfc_MfUL_H_CallWrOp()
2802 NdefMap->MifareULContainer.CurrentBlock; in phFriNfc_MfUL_H_CallWrOp()
2804 if (NdefMap->ApduBufferSize > 254) in phFriNfc_MfUL_H_CallWrOp()
2806 NdefMap->SendRecvBuf[(NdefMap->TLVStruct.NdefTLVByte + in phFriNfc_MfUL_H_CallWrOp()
2810 if((NdefMap->TLVStruct.NdefTLVByte + PH_FRINFC_NDEFMAP_MFUL_VAL1) < in phFriNfc_MfUL_H_CallWrOp()
2813 NdefMap->SendRecvBuf[(NdefMap->TLVStruct.NdefTLVByte + in phFriNfc_MfUL_H_CallWrOp()
2816 NdefMap->NumOfLReminWrite = 1; in phFriNfc_MfUL_H_CallWrOp()
2821 NdefMap->NumOfLReminWrite = 2; in phFriNfc_MfUL_H_CallWrOp()
2823 NdefMap->NumOfBytesWritten = 0; in phFriNfc_MfUL_H_CallWrOp()
2828 NdefMap->SendRecvBuf[(NdefMap->TLVStruct.NdefTLVByte + in phFriNfc_MfUL_H_CallWrOp()
2832 if((NdefMap->TLVStruct.NdefTLVByte + PH_FRINFC_NDEFMAP_MFUL_VAL1) < in phFriNfc_MfUL_H_CallWrOp()
2836 (void)memcpy(&(NdefMap->SendRecvBuf[ in phFriNfc_MfUL_H_CallWrOp()
2838 &(NdefMap->ApduBuffer[ in phFriNfc_MfUL_H_CallWrOp()
2839 NdefMap->ApduBuffIndex]), in phFriNfc_MfUL_H_CallWrOp()
2842 NdefMap->NumOfBytesWritten = PH_FRINFC_NDEFMAP_MFUL_VAL1; in phFriNfc_MfUL_H_CallWrOp()
2846 (void)memcpy(NdefMap->MifareULContainer.Buffer, in phFriNfc_MfUL_H_CallWrOp()
2847 &(NdefMap->SendRecvBuf[ in phFriNfc_MfUL_H_CallWrOp()
2852 (void)memcpy(NdefMap->TLVStruct.NdefTLVBuffer, in phFriNfc_MfUL_H_CallWrOp()
2853 NdefMap->MifareULContainer.Buffer, in phFriNfc_MfUL_H_CallWrOp()
2857 *NdefMap->DataCount = PH_FRINFC_NDEFMAP_MFUL_VAL4; in phFriNfc_MfUL_H_CallWrOp()
2860 NdefMap->State = PH_FRINFC_NDEFMAP_MFUL_STATE_WRITE; in phFriNfc_MfUL_H_CallWrOp()
2862 Result = phFriNfc_MfUL_H_Wr4bytes(NdefMap); in phFriNfc_MfUL_H_CallWrOp()
2867 static NFCSTATUS phFriNfc_MfUL_H_ProWrittenBytes(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MfUL_H_ProWrittenBytes() argument
2873 if(NdefMap->ApduBuffIndex < NdefMap->ApduBufferSize) in phFriNfc_MfUL_H_ProWrittenBytes()
2875 NdefMap->ApduBuffIndex = NdefMap->ApduBuffIndex+NdefMap->NumOfBytesWritten; in phFriNfc_MfUL_H_ProWrittenBytes()
2876 if(*NdefMap->DataCount < in phFriNfc_MfUL_H_ProWrittenBytes()
2879 (void)memcpy(NdefMap->MifareULContainer.InternalBuf, in phFriNfc_MfUL_H_ProWrittenBytes()
2880 NdefMap->MifareULContainer.Buffer, in phFriNfc_MfUL_H_ProWrittenBytes()
2881 *NdefMap->DataCount); in phFriNfc_MfUL_H_ProWrittenBytes()
2883 NdefMap->MifareULContainer.InternalLength = *NdefMap->DataCount; in phFriNfc_MfUL_H_ProWrittenBytes()
2887 NdefMap->MifareULContainer.InternalLength = in phFriNfc_MfUL_H_ProWrittenBytes()
2891 NdefMap->MifareULContainer.RemainingSize= NdefMap->MifareULContainer.RemainingSize- in phFriNfc_MfUL_H_ProWrittenBytes()
2892 NdefMap->NumOfBytesWritten; in phFriNfc_MfUL_H_ProWrittenBytes()
2893 if((NdefMap->ApduBuffIndex == NdefMap->ApduBufferSize) || in phFriNfc_MfUL_H_ProWrittenBytes()
2894 (NdefMap->MifareULContainer.RemainingSize == in phFriNfc_MfUL_H_ProWrittenBytes()
2898 NdefMap->MifareULContainer.ReadWriteCompleteFlag = in phFriNfc_MfUL_H_ProWrittenBytes()
2899 (uint8_t)((NdefMap->MifareULContainer.RemainingSize == in phFriNfc_MfUL_H_ProWrittenBytes()
2904 NdefMap->TLVStruct.SetTermTLVFlag = in phFriNfc_MfUL_H_ProWrittenBytes()
2905 (uint8_t)(((NdefMap->MifareULContainer.RemainingSize == in phFriNfc_MfUL_H_ProWrittenBytes()
2907 (NdefMap->TLVStruct.SetTermTLVFlag == in phFriNfc_MfUL_H_ProWrittenBytes()
2912 NdefMap->MifareULContainer.CurrentBlock = NdefMap->MifareULContainer.CurrentBlock+ in phFriNfc_MfUL_H_ProWrittenBytes()
2913 (uint8_t)((NdefMap->MifareULContainer.InternalLength != in phFriNfc_MfUL_H_ProWrittenBytes()
2918 *NdefMap->WrNdefPacketLength = NdefMap->ApduBuffIndex; in phFriNfc_MfUL_H_ProWrittenBytes()
2922 localCurrentBlock = NdefMap->MifareULContainer.CurrentBlock + 1; in phFriNfc_MfUL_H_ProWrittenBytes()
2925 NdefMap->MifareULContainer.CurrentBlock++; in phFriNfc_MfUL_H_ProWrittenBytes()
2926 Result = phFriNfc_MfUL_H_fillSendBufToWr(NdefMap); in phFriNfc_MfUL_H_ProWrittenBytes()
2931 NdefMap->MifareULContainer.CurrentSector++; in phFriNfc_MfUL_H_ProWrittenBytes()
2933 Result = phFriNfc_MfUL_H_SelectSector(NdefMap, in phFriNfc_MfUL_H_ProWrittenBytes()
2934 NdefMap->MifareULContainer.CurrentSector, 1, in phFriNfc_MfUL_H_ProWrittenBytes()
2941 (NdefMap->TLVStruct.SetTermTLVFlag != in phFriNfc_MfUL_H_ProWrittenBytes()
2943 (NdefMap->MifareULContainer.RemainingSize > in phFriNfc_MfUL_H_ProWrittenBytes()
2946 Result = phFriNfc_MfUL_H_WrTermTLV(NdefMap); in phFriNfc_MfUL_H_ProWrittenBytes()
2951 (NdefMap->TLVStruct.SetTermTLVFlag == in phFriNfc_MfUL_H_ProWrittenBytes()
2954 Result = phFriNfc_MfUL_H_UpdateWrLen(NdefMap); in phFriNfc_MfUL_H_ProWrittenBytes()
2959 static NFCSTATUS phFriNfc_MfUL_H_fillSendBufToWr(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MfUL_H_fillSendBufToWr() argument
2966 RemainingBytes = (uint16_t)(( (NdefMap->ApduBufferSize - NdefMap->ApduBuffIndex) <= in phFriNfc_MfUL_H_fillSendBufToWr()
2967 NdefMap->MifareULContainer.RemainingSize)? in phFriNfc_MfUL_H_fillSendBufToWr()
2968 (uint16_t)(NdefMap->ApduBufferSize - in phFriNfc_MfUL_H_fillSendBufToWr()
2969 NdefMap->ApduBuffIndex): in phFriNfc_MfUL_H_fillSendBufToWr()
2970 NdefMap->MifareULContainer.RemainingSize); in phFriNfc_MfUL_H_fillSendBufToWr()
2972 NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_VAL0] = in phFriNfc_MfUL_H_fillSendBufToWr()
2973 NdefMap->MifareULContainer.CurrentBlock; in phFriNfc_MfUL_H_fillSendBufToWr()
2979 NdefMap->MifareULContainer.InternalLength))? in phFriNfc_MfUL_H_fillSendBufToWr()
2982 NdefMap->MifareULContainer.InternalLength)); in phFriNfc_MfUL_H_fillSendBufToWr()
2984 if (NdefMap->NumOfBytesWritten == 0 && NdefMap->NumOfLReminWrite > 0) in phFriNfc_MfUL_H_fillSendBufToWr()
2986 BytesToWrite = BytesToWrite - NdefMap->NumOfLReminWrite; in phFriNfc_MfUL_H_fillSendBufToWr()
2988 if (NdefMap->NumOfLReminWrite == 1) in phFriNfc_MfUL_H_fillSendBufToWr()
2990 NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_VAL1] = 0x00; in phFriNfc_MfUL_H_fillSendBufToWr()
2994 NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_VAL1] = 0x00; in phFriNfc_MfUL_H_fillSendBufToWr()
2995 NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_VAL2] = 0x00; in phFriNfc_MfUL_H_fillSendBufToWr()
2999 if(NdefMap->MifareULContainer.InternalLength > in phFriNfc_MfUL_H_fillSendBufToWr()
3003 (void)memcpy(&(NdefMap->SendRecvBuf[ in phFriNfc_MfUL_H_fillSendBufToWr()
3005 NdefMap->MifareULContainer.InternalBuf, in phFriNfc_MfUL_H_fillSendBufToWr()
3006 NdefMap->MifareULContainer.InternalLength); in phFriNfc_MfUL_H_fillSendBufToWr()
3011 (void)memcpy(&(NdefMap->SendRecvBuf[ in phFriNfc_MfUL_H_fillSendBufToWr()
3013 NdefMap->MifareULContainer.InternalLength) + in phFriNfc_MfUL_H_fillSendBufToWr()
3014 NdefMap->NumOfLReminWrite]), in phFriNfc_MfUL_H_fillSendBufToWr()
3015 &(NdefMap->ApduBuffer[NdefMap->ApduBuffIndex]), in phFriNfc_MfUL_H_fillSendBufToWr()
3019 NdefMap->NumOfBytesWritten = BytesToWrite; in phFriNfc_MfUL_H_fillSendBufToWr()
3023 *NdefMap->DataCount = in phFriNfc_MfUL_H_fillSendBufToWr()
3024 (BytesToWrite + NdefMap->MifareULContainer.InternalLength + in phFriNfc_MfUL_H_fillSendBufToWr()
3025 NdefMap->NumOfLReminWrite); in phFriNfc_MfUL_H_fillSendBufToWr()
3030 if((BytesToWrite + NdefMap->MifareULContainer.InternalLength + in phFriNfc_MfUL_H_fillSendBufToWr()
3031 NdefMap->NumOfLReminWrite) in phFriNfc_MfUL_H_fillSendBufToWr()
3034 …for(index = (uint8_t)((BytesToWrite + NdefMap->MifareULContainer.InternalLength + NdefMap->NumOfLR… in phFriNfc_MfUL_H_fillSendBufToWr()
3039 NdefMap->SendRecvBuf[index] = (uint8_t)((index == in phFriNfc_MfUL_H_fillSendBufToWr()
3041NdefMap->MifareULContainer.InternalLength + NdefMap->NumOfLReminWrite) + in phFriNfc_MfUL_H_fillSendBufToWr()
3046 NdefMap->TLVStruct.SetTermTLVFlag = PH_FRINFC_NDEFMAP_MFUL_FLAG1; in phFriNfc_MfUL_H_fillSendBufToWr()
3052 (void)memcpy(NdefMap->MifareULContainer.Buffer, in phFriNfc_MfUL_H_fillSendBufToWr()
3053 &(NdefMap->SendRecvBuf[ in phFriNfc_MfUL_H_fillSendBufToWr()
3059 if((NdefMap->TLVStruct.NdefTLVByte - PH_FRINFC_NDEFMAP_MFUL_VAL1) < in phFriNfc_MfUL_H_fillSendBufToWr()
3062 if ((NdefMap->TLVStruct.NdefTLVSector == in phFriNfc_MfUL_H_fillSendBufToWr()
3063 NdefMap->MifareULContainer.CurrentSector)) in phFriNfc_MfUL_H_fillSendBufToWr()
3065 if(NdefMap->MifareULContainer.CurrentBlock == in phFriNfc_MfUL_H_fillSendBufToWr()
3066 NdefMap->TLVStruct.NdefTLVBlock) in phFriNfc_MfUL_H_fillSendBufToWr()
3068 (void)memcpy(NdefMap->TLVStruct.NdefTLVBuffer, in phFriNfc_MfUL_H_fillSendBufToWr()
3069 NdefMap->MifareULContainer.Buffer, in phFriNfc_MfUL_H_fillSendBufToWr()
3074 if ((NdefMap->TLVStruct.NdefTLVSector == in phFriNfc_MfUL_H_fillSendBufToWr()
3075 NdefMap->MifareULContainer.CurrentSector) || in phFriNfc_MfUL_H_fillSendBufToWr()
3076 (NdefMap->TLVStruct.NdefTLVBlock == 0xFF)) in phFriNfc_MfUL_H_fillSendBufToWr()
3078 if(NdefMap->MifareULContainer.CurrentBlock == in phFriNfc_MfUL_H_fillSendBufToWr()
3079 (NdefMap->TLVStruct.NdefTLVBlock + PH_FRINFC_NDEFMAP_MFUL_VAL1)) in phFriNfc_MfUL_H_fillSendBufToWr()
3081 (void)memcpy(NdefMap->TLVStruct.NdefTLVBuffer1, in phFriNfc_MfUL_H_fillSendBufToWr()
3082 NdefMap->MifareULContainer.Buffer, in phFriNfc_MfUL_H_fillSendBufToWr()
3089 if ((NdefMap->TLVStruct.NdefTLVSector == in phFriNfc_MfUL_H_fillSendBufToWr()
3090 NdefMap->MifareULContainer.CurrentSector)) in phFriNfc_MfUL_H_fillSendBufToWr()
3092 if(NdefMap->MifareULContainer.CurrentBlock == in phFriNfc_MfUL_H_fillSendBufToWr()
3093 (NdefMap->TLVStruct.NdefTLVBlock + in phFriNfc_MfUL_H_fillSendBufToWr()
3096 (void)memcpy(NdefMap->TLVStruct.NdefTLVBuffer, in phFriNfc_MfUL_H_fillSendBufToWr()
3097 NdefMap->MifareULContainer.Buffer, in phFriNfc_MfUL_H_fillSendBufToWr()
3102 if ((NdefMap->TLVStruct.NdefTLVSector == in phFriNfc_MfUL_H_fillSendBufToWr()
3103 NdefMap->MifareULContainer.CurrentSector)|| in phFriNfc_MfUL_H_fillSendBufToWr()
3104 (NdefMap->TLVStruct.NdefTLVBlock == 0xFF)) in phFriNfc_MfUL_H_fillSendBufToWr()
3106 if(NdefMap->MifareULContainer.CurrentBlock == in phFriNfc_MfUL_H_fillSendBufToWr()
3107 (NdefMap->TLVStruct.NdefTLVBlock + PH_FRINFC_NDEFMAP_MFUL_VAL2)) in phFriNfc_MfUL_H_fillSendBufToWr()
3109 (void)memcpy(NdefMap->TLVStruct.NdefTLVBuffer1, in phFriNfc_MfUL_H_fillSendBufToWr()
3110 NdefMap->MifareULContainer.Buffer, in phFriNfc_MfUL_H_fillSendBufToWr()
3118 NdefMap->State = PH_FRINFC_NDEFMAP_MFUL_STATE_WRITE; in phFriNfc_MfUL_H_fillSendBufToWr()
3120 NdefMap->NumOfLReminWrite = 0; in phFriNfc_MfUL_H_fillSendBufToWr()
3123 Result = phFriNfc_MfUL_H_Wr4bytes(NdefMap); in phFriNfc_MfUL_H_fillSendBufToWr()
3127 static NFCSTATUS phFriNfc_MfUL_H_WrTermTLV(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MfUL_H_WrTermTLV() argument
3134 NdefMap->State = PH_FRINFC_NDEFMAP_MFUL_STATE_TERM_TLV; in phFriNfc_MfUL_H_WrTermTLV()
3136 NdefMap->SendRecvBuf[index] = in phFriNfc_MfUL_H_WrTermTLV()
3137 (NdefMap->MifareULContainer.CurrentBlock + in phFriNfc_MfUL_H_WrTermTLV()
3140 NdefMap->SendRecvBuf[index] = PH_FRINFC_NDEFMAP_MFUL_TERMTLV; in phFriNfc_MfUL_H_WrTermTLV()
3145 NdefMap->SendRecvBuf[i] = PH_FRINFC_NDEFMAP_MFUL_NULLTLV; in phFriNfc_MfUL_H_WrTermTLV()
3148 Result = phFriNfc_MfUL_H_Wr4bytes(NdefMap); in phFriNfc_MfUL_H_WrTermTLV()
3152 static NFCSTATUS phFriNfc_MfUL_H_UpdateWrLen(phFriNfc_NdefMap_t *NdefMap) in phFriNfc_MfUL_H_UpdateWrLen() argument
3158 if ((NdefMap->TLVStruct.NdefTLVSector == in phFriNfc_MfUL_H_UpdateWrLen()
3159 NdefMap->MifareULContainer.CurrentSector) || in phFriNfc_MfUL_H_UpdateWrLen()
3160 ((NdefMap->TLVStruct.NdefTLVBlock == 0xFF) && in phFriNfc_MfUL_H_UpdateWrLen()
3161 (NdefMap->TLVStruct.NdefTLVByte == 4) && in phFriNfc_MfUL_H_UpdateWrLen()
3162 (NdefMap->TLVStruct.NdefTLVSector == 0))) in phFriNfc_MfUL_H_UpdateWrLen()
3164 BlockNo = (((NdefMap->TLVStruct.NdefTLVByte - in phFriNfc_MfUL_H_UpdateWrLen()
3167 NdefMap->TLVStruct.NdefTLVBlock: in phFriNfc_MfUL_H_UpdateWrLen()
3168 (NdefMap->TLVStruct.NdefTLVBlock + in phFriNfc_MfUL_H_UpdateWrLen()
3171 ByteNo = (((NdefMap->TLVStruct.NdefTLVByte - in phFriNfc_MfUL_H_UpdateWrLen()
3175 (NdefMap->TLVStruct.NdefTLVByte + in phFriNfc_MfUL_H_UpdateWrLen()
3178 if (NdefMap->NumOfLReminWrite > 0) in phFriNfc_MfUL_H_UpdateWrLen()
3183 (void)memcpy(&(NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_VAL1]), in phFriNfc_MfUL_H_UpdateWrLen()
3184 NdefMap->TLVStruct.NdefTLVBuffer1, in phFriNfc_MfUL_H_UpdateWrLen()
3187 if (NdefMap->NumOfLReminWrite == 1) in phFriNfc_MfUL_H_UpdateWrLen()
3190 NdefMap->SendRecvBuf[1] = (uint8_t) NdefMap->ApduBuffIndex; in phFriNfc_MfUL_H_UpdateWrLen()
3193 else if (NdefMap->NumOfLReminWrite == 2) in phFriNfc_MfUL_H_UpdateWrLen()
3195 NdefMap->SendRecvBuf[1] = (uint8_t) ((NdefMap->ApduBuffIndex & 0xFF00) >> 8); in phFriNfc_MfUL_H_UpdateWrLen()
3196 NdefMap->SendRecvBuf[2]= (uint8_t) (NdefMap->ApduBuffIndex); in phFriNfc_MfUL_H_UpdateWrLen()
3203 NdefMap->NumOfLReminWrite = 0; in phFriNfc_MfUL_H_UpdateWrLen()
3208 (void)memcpy(&(NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_VAL1]), in phFriNfc_MfUL_H_UpdateWrLen()
3209 NdefMap->TLVStruct.NdefTLVBuffer, in phFriNfc_MfUL_H_UpdateWrLen()
3213 if (NdefMap->ApduBuffIndex > 254) in phFriNfc_MfUL_H_UpdateWrLen()
3218NdefMap->SendRecvBuf[ByteNo]= (uint8_t) ((NdefMap->ApduBuffIndex & 0xFF00) >> 8); in phFriNfc_MfUL_H_UpdateWrLen()
3220 NdefMap->SendRecvBuf[ByteNo] = (uint8_t) (NdefMap->ApduBuffIndex); in phFriNfc_MfUL_H_UpdateWrLen()
3222 NdefMap->NumOfLReminWrite = 0; in phFriNfc_MfUL_H_UpdateWrLen()
3227 NdefMap->SendRecvBuf[ByteNo]= (uint8_t) ((NdefMap->ApduBuffIndex & 0xFF00) >> 8); in phFriNfc_MfUL_H_UpdateWrLen()
3229 NdefMap->NumOfLReminWrite = 1; in phFriNfc_MfUL_H_UpdateWrLen()
3233 NdefMap->NumOfLReminWrite = 2; in phFriNfc_MfUL_H_UpdateWrLen()
3238 NdefMap->SendRecvBuf[ByteNo]= in phFriNfc_MfUL_H_UpdateWrLen()
3239 (uint8_t)((NdefMap->Offset == in phFriNfc_MfUL_H_UpdateWrLen()
3241 (uint8_t)NdefMap->ApduBuffIndex: in phFriNfc_MfUL_H_UpdateWrLen()
3242 (NdefMap->ApduBuffIndex + in phFriNfc_MfUL_H_UpdateWrLen()
3243 NdefMap->SendRecvBuf[ByteNo])); in phFriNfc_MfUL_H_UpdateWrLen()
3247 (void)memcpy(NdefMap->MifareULContainer.Buffer, in phFriNfc_MfUL_H_UpdateWrLen()
3248 &(NdefMap->SendRecvBuf[ in phFriNfc_MfUL_H_UpdateWrLen()
3252 NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_MFUL_VAL0] = (uint8_t)BlockNo; in phFriNfc_MfUL_H_UpdateWrLen()
3253 Result = phFriNfc_MfUL_H_Wr4bytes(NdefMap); in phFriNfc_MfUL_H_UpdateWrLen()
3255 if (NdefMap->NumOfLReminWrite == 0) in phFriNfc_MfUL_H_UpdateWrLen()
3257 NdefMap->State = PH_FRINFC_NDEFMAP_MFUL_STATE_WR_LEN_TLV; in phFriNfc_MfUL_H_UpdateWrLen()
3261 NdefMap->State = PH_FRINFC_NDEFMAP_MFUL_STATE_TERM_TLV; in phFriNfc_MfUL_H_UpdateWrLen()
3264 else if (NdefMap->TLVStruct.NdefTLVSector == 0) in phFriNfc_MfUL_H_UpdateWrLen()
3267 NdefMap->MifareULContainer.CurrentSector = 0; in phFriNfc_MfUL_H_UpdateWrLen()
3268 NdefMap->PrevState = PH_FRINFC_NDEFMAP_MFUL_STATE_WRITE; in phFriNfc_MfUL_H_UpdateWrLen()
3270 Result = phFriNfc_MfUL_H_SelectSector(NdefMap, in phFriNfc_MfUL_H_UpdateWrLen()
3271 NdefMap->MifareULContainer.CurrentSector, 1, in phFriNfc_MfUL_H_UpdateWrLen()