• Home
  • Raw
  • Download

Lines Matching refs:NdefSmtCrdFmt

48 static void phFriNfc_MfStd_H_FillSendBuf(phFriNfc_sNdefSmtCrdFmt_t      *NdefSmtCrdFmt,
55 static NFCSTATUS phFriNfc_MfStd_H_Transceive(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
61 static NFCSTATUS phFriNfc_MfStd_H_CallDisCon(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt,
68 static NFCSTATUS phFriNfc_MfStd_H_CallCon(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
75 static NFCSTATUS phFriNfc_MfStd_H_CallPoll(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
82 static NFCSTATUS phFriNfc_MfStd_H_ProCon(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
88 static NFCSTATUS phFriNfc_MfStd_H_ProAuth(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
94 static NFCSTATUS phFriNfc_MfStd_H_ProRdSectTr(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
100 static NFCSTATUS phFriNfc_MfStd_H_ProWrSectTr(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
106 static NFCSTATUS phFriNfc_MfStd_H_WrRdAuth(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
121 static void phFriNfc_MfStd_H_ChangeAuthSt(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
134 static NFCSTATUS phFriNfc_MfStd_H_ProWrMADBlk(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
140 static NFCSTATUS phFriNfc_MfStd_H_ProErrAuth(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
146 static NFCSTATUS phFriNfc_MfStd_H_ErrWrSectTr(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
152 static NFCSTATUS phFriNfc_MfStd_H_ErrRdSectTr(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
158 static NFCSTATUS phFriNfc_MfStd_H_ProUpdMADBlk(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
164 static void phFriNfc_MfStd_H_StrNdefData(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
170 static void phFriNfc_MfStd_H_BlkNoToWrTLV(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
175 void phFriNfc_MfStd_Reset(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt) in phFriNfc_MfStd_Reset() argument
181 NdefSmtCrdFmt->AddInfo.MfStdInfo.AuthState = PH_FRINFC_MFSTD_FMT_VAL_1; in phFriNfc_MfStd_Reset()
184 (void)memset(NdefSmtCrdFmt->AddInfo.MfStdInfo.Default_KeyA_OR_B, in phFriNfc_MfStd_Reset()
189 (void)memcpy(NdefSmtCrdFmt->AddInfo.MfStdInfo.MADSect_KeyA, in phFriNfc_MfStd_Reset()
194 (void)memcpy(NdefSmtCrdFmt->AddInfo.MfStdInfo.MADSect_AccessBits, in phFriNfc_MfStd_Reset()
199 (void)memcpy(NdefSmtCrdFmt->AddInfo.MfStdInfo.NFCForumSect_KeyA, in phFriNfc_MfStd_Reset()
204 (void)memcpy(NdefSmtCrdFmt->AddInfo.MfStdInfo.NFCForumSect_AccessBits, in phFriNfc_MfStd_Reset()
209 (void)memset(NdefSmtCrdFmt->AddInfo.MfStdInfo.SectCompl, in phFriNfc_MfStd_Reset()
213 NdefSmtCrdFmt->AddInfo.MfStdInfo.WrMADBlkFlag = (uint8_t)PH_FRINFC_MFSTD_FMT_VAL_0; in phFriNfc_MfStd_Reset()
214 NdefSmtCrdFmt->AddInfo.MfStdInfo.UpdMADBlk = (uint8_t)PH_FRINFC_MFSTD_FMT_NOT_A_MAD_BLK; in phFriNfc_MfStd_Reset()
218 NFCSTATUS phFriNfc_MfStd_Format( phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt, const uint8_t *ScrtKeyB ) in phFriNfc_MfStd_Format() argument
226 NdefSmtCrdFmt->AddInfo.MfStdInfo.UpdMADBlk = in phFriNfc_MfStd_Format()
231 NdefSmtCrdFmt->AddInfo.MfStdInfo.ScrtKeyB[index] = ScrtKeyB[index]; in phFriNfc_MfStd_Format()
235 NdefSmtCrdFmt->State = PH_FRINFC_MFSTD_FMT_AUTH_SECT; in phFriNfc_MfStd_Format()
237 NdefSmtCrdFmt->AddInfo.MfStdInfo.CurrentBlock = PH_FRINFC_MFSTD_FMT_VAL_3; in phFriNfc_MfStd_Format()
239 NdefSmtCrdFmt->AddInfo.MfStdInfo.AuthState = PH_FRINFC_MFSTD_FMT_AUTH_DEF_KEY; in phFriNfc_MfStd_Format()
241 Result = phFriNfc_MfStd_H_WrRdAuth(NdefSmtCrdFmt); in phFriNfc_MfStd_Format()
249 phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt = (phFriNfc_sNdefSmtCrdFmt_t *)Context; in phFriNfc_MfStd_Process() local
251 NdefSmtCrdFmt->FmtProcStatus = Status; in phFriNfc_MfStd_Process()
254 switch(NdefSmtCrdFmt->State) in phFriNfc_MfStd_Process()
257 Status = phFriNfc_MfStd_H_ProAuth(NdefSmtCrdFmt); in phFriNfc_MfStd_Process()
262 Status = phFriNfc_MfStd_H_CallPoll(NdefSmtCrdFmt); in phFriNfc_MfStd_Process()
267 Status = phFriNfc_MfStd_H_CallCon(NdefSmtCrdFmt); in phFriNfc_MfStd_Process()
271 Status = phFriNfc_MfStd_H_ProCon(NdefSmtCrdFmt); in phFriNfc_MfStd_Process()
275 Status = phFriNfc_MfStd_H_ProRdSectTr(NdefSmtCrdFmt); in phFriNfc_MfStd_Process()
279 Status = phFriNfc_MfStd_H_ProWrSectTr(NdefSmtCrdFmt); in phFriNfc_MfStd_Process()
283 Status = phFriNfc_MfStd_H_ProWrMADBlk(NdefSmtCrdFmt); in phFriNfc_MfStd_Process()
290 Status = phFriNfc_MfStd_H_ProUpdMADBlk(NdefSmtCrdFmt); in phFriNfc_MfStd_Process()
301 switch(NdefSmtCrdFmt->State) in phFriNfc_MfStd_Process()
304 Status = phFriNfc_MfStd_H_ProErrAuth(NdefSmtCrdFmt); in phFriNfc_MfStd_Process()
308 Status = phFriNfc_MfStd_H_ErrWrSectTr(NdefSmtCrdFmt); in phFriNfc_MfStd_Process()
312 Status = phFriNfc_MfStd_H_ErrRdSectTr(NdefSmtCrdFmt); in phFriNfc_MfStd_Process()
316 Status = NdefSmtCrdFmt->FmtProcStatus; in phFriNfc_MfStd_Process()
324 phFriNfc_SmtCrdFmt_HCrHandler(NdefSmtCrdFmt, Status); in phFriNfc_MfStd_Process()
328 static void phFriNfc_MfStd_H_FillSendBuf(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt, in phFriNfc_MfStd_H_FillSendBuf() argument
345 NdefSmtCrdFmt->SendRecvBuf[PH_FRINFC_MFSTD_FMT_VAL_0] = (uint8_t)BlockNo; in phFriNfc_MfStd_H_FillSendBuf()
347 *NdefSmtCrdFmt->SendRecvLength = PH_FRINFC_MFSTD_FMT_MAX_RECV_LENGTH; in phFriNfc_MfStd_H_FillSendBuf()
350 switch(NdefSmtCrdFmt->State) in phFriNfc_MfStd_H_FillSendBuf()
354 switch(NdefSmtCrdFmt->AddInfo.MfStdInfo.AuthState) in phFriNfc_MfStd_H_FillSendBuf()
382 NdefSmtCrdFmt->Cmd.MfCmd = phHal_eMifareRead; in phFriNfc_MfStd_H_FillSendBuf()
384 NdefSmtCrdFmt->Cmd.MfCmd = phHal_eMifareCmdListMifareRead; in phFriNfc_MfStd_H_FillSendBuf()
388 NdefSmtCrdFmt->SendLength = PH_FRINFC_MFSTD_FMT_VAL_1; in phFriNfc_MfStd_H_FillSendBuf()
394 NdefSmtCrdFmt->Cmd.MfCmd = phHal_eMifareWrite16; in phFriNfc_MfStd_H_FillSendBuf()
396 NdefSmtCrdFmt->Cmd.MfCmd = phHal_eMifareCmdListMifareWrite16; in phFriNfc_MfStd_H_FillSendBuf()
399 switch(NdefSmtCrdFmt->AddInfo.MfStdInfo.CurrentBlock) in phFriNfc_MfStd_H_FillSendBuf()
402 if (NdefSmtCrdFmt->CardType == PH_FRINFC_SMTCRDFMT_MFSTD_1K_CRD) in phFriNfc_MfStd_H_FillSendBuf()
404 (void)memcpy(&NdefSmtCrdFmt->SendRecvBuf[PH_FRINFC_MFSTD_FMT_VAL_1], in phFriNfc_MfStd_H_FillSendBuf()
410 (void)memcpy(&NdefSmtCrdFmt->SendRecvBuf[PH_FRINFC_MFSTD_FMT_VAL_1], in phFriNfc_MfStd_H_FillSendBuf()
416 (void)memcpy(&NdefSmtCrdFmt->SendRecvBuf[PH_FRINFC_MFSTD_FMT_VAL_1], in phFriNfc_MfStd_H_FillSendBuf()
421 (void)memcpy(&NdefSmtCrdFmt->SendRecvBuf[PH_FRINFC_MFSTD_FMT_VAL_1], in phFriNfc_MfStd_H_FillSendBuf()
426 (void)memcpy(&NdefSmtCrdFmt->SendRecvBuf[PH_FRINFC_MFSTD_FMT_VAL_11], in phFriNfc_MfStd_H_FillSendBuf()
427 NdefSmtCrdFmt->AddInfo.MfStdInfo.ScrtKeyB, in phFriNfc_MfStd_H_FillSendBuf()
428 sizeof(NdefSmtCrdFmt->AddInfo.MfStdInfo.ScrtKeyB)); in phFriNfc_MfStd_H_FillSendBuf()
431 NdefSmtCrdFmt->SendLength = PH_FRINFC_MFSTD_FMT_WR_SEND_LENGTH; in phFriNfc_MfStd_H_FillSendBuf()
437 NdefSmtCrdFmt->Cmd.MfCmd = phHal_eMifareWrite16; in phFriNfc_MfStd_H_FillSendBuf()
439 NdefSmtCrdFmt->Cmd.MfCmd = phHal_eMifareCmdListMifareWrite16; in phFriNfc_MfStd_H_FillSendBuf()
442 (void)memcpy(&NdefSmtCrdFmt->SendRecvBuf[PH_FRINFC_MFSTD_FMT_VAL_1], in phFriNfc_MfStd_H_FillSendBuf()
445 NdefSmtCrdFmt->SendLength = PH_FRINFC_MFSTD_FMT_WR_SEND_LENGTH; in phFriNfc_MfStd_H_FillSendBuf()
451 NdefSmtCrdFmt->Cmd.MfCmd = phHal_eMifareWrite16; in phFriNfc_MfStd_H_FillSendBuf()
453 NdefSmtCrdFmt->Cmd.MfCmd = phHal_eMifareCmdListMifareWrite16; in phFriNfc_MfStd_H_FillSendBuf()
465 (void)memcpy(&NdefSmtCrdFmt->SendRecvBuf[PH_FRINFC_MFSTD_FMT_VAL_1], in phFriNfc_MfStd_H_FillSendBuf()
468 NdefSmtCrdFmt->SendLength = PH_FRINFC_MFSTD_FMT_WR_SEND_LENGTH; in phFriNfc_MfStd_H_FillSendBuf()
475 NdefSmtCrdFmt->Cmd.MfCmd = phHal_eMifareWrite16; in phFriNfc_MfStd_H_FillSendBuf()
477 NdefSmtCrdFmt->Cmd.MfCmd = phHal_eMifareCmdListMifareWrite16; in phFriNfc_MfStd_H_FillSendBuf()
479 NdefSmtCrdFmt->SendLength = PH_FRINFC_MFSTD_FMT_WR_SEND_LENGTH; in phFriNfc_MfStd_H_FillSendBuf()
480 switch(NdefSmtCrdFmt->AddInfo.MfStdInfo.UpdMADBlk) in phFriNfc_MfStd_H_FillSendBuf()
483 (void)memcpy(&NdefSmtCrdFmt->SendRecvBuf[PH_FRINFC_MFSTD_FMT_VAL_1], in phFriNfc_MfStd_H_FillSendBuf()
484 NdefSmtCrdFmt->AddInfo.MfStdInfo.MADSectBlk, in phFriNfc_MfStd_H_FillSendBuf()
489 (void)memcpy(&NdefSmtCrdFmt->SendRecvBuf[PH_FRINFC_MFSTD_FMT_VAL_1], in phFriNfc_MfStd_H_FillSendBuf()
490 &NdefSmtCrdFmt->AddInfo.MfStdInfo.MADSectBlk[16], in phFriNfc_MfStd_H_FillSendBuf()
495 (void)memcpy(&NdefSmtCrdFmt->SendRecvBuf[PH_FRINFC_MFSTD_FMT_VAL_1], in phFriNfc_MfStd_H_FillSendBuf()
496 &NdefSmtCrdFmt->AddInfo.MfStdInfo.MADSectBlk[32], in phFriNfc_MfStd_H_FillSendBuf()
501 (void)memcpy(&NdefSmtCrdFmt->SendRecvBuf[PH_FRINFC_MFSTD_FMT_VAL_1], in phFriNfc_MfStd_H_FillSendBuf()
502 &NdefSmtCrdFmt->AddInfo.MfStdInfo.MADSectBlk[48], in phFriNfc_MfStd_H_FillSendBuf()
508 (void)memcpy(&NdefSmtCrdFmt->SendRecvBuf[PH_FRINFC_MFSTD_FMT_VAL_1], in phFriNfc_MfStd_H_FillSendBuf()
509 &NdefSmtCrdFmt->AddInfo.MfStdInfo.MADSectBlk[64], in phFriNfc_MfStd_H_FillSendBuf()
518 static NFCSTATUS phFriNfc_MfStd_H_Transceive(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt) in phFriNfc_MfStd_H_Transceive() argument
523 NdefSmtCrdFmt->psDepAdditionalInfo.DepFlags.MetaChaining = 0; in phFriNfc_MfStd_H_Transceive()
524 NdefSmtCrdFmt->psDepAdditionalInfo.DepFlags.NADPresent = 0; in phFriNfc_MfStd_H_Transceive()
525 NdefSmtCrdFmt->psDepAdditionalInfo.NAD = 0; in phFriNfc_MfStd_H_Transceive()
528 NdefSmtCrdFmt->SmtCrdFmtCompletionInfo.CompletionRoutine = phFriNfc_NdefSmtCrd_Process; in phFriNfc_MfStd_H_Transceive()
529 NdefSmtCrdFmt->SmtCrdFmtCompletionInfo.Context = NdefSmtCrdFmt; in phFriNfc_MfStd_H_Transceive()
531 *NdefSmtCrdFmt->SendRecvLength = PH_FRINFC_SMTCRDFMT_MAX_SEND_RECV_BUF_SIZE; in phFriNfc_MfStd_H_Transceive()
534 Result = phFriNfc_OvrHal_Transceive( NdefSmtCrdFmt->LowerDevice, in phFriNfc_MfStd_H_Transceive()
535 &NdefSmtCrdFmt->SmtCrdFmtCompletionInfo, in phFriNfc_MfStd_H_Transceive()
536 NdefSmtCrdFmt->psRemoteDevInfo, in phFriNfc_MfStd_H_Transceive()
537 NdefSmtCrdFmt->Cmd, in phFriNfc_MfStd_H_Transceive()
538 &NdefSmtCrdFmt->psDepAdditionalInfo, in phFriNfc_MfStd_H_Transceive()
539 NdefSmtCrdFmt->SendRecvBuf, in phFriNfc_MfStd_H_Transceive()
540 NdefSmtCrdFmt->SendLength, in phFriNfc_MfStd_H_Transceive()
541 NdefSmtCrdFmt->SendRecvBuf, in phFriNfc_MfStd_H_Transceive()
542 NdefSmtCrdFmt->SendRecvLength); in phFriNfc_MfStd_H_Transceive()
546 static NFCSTATUS phFriNfc_MfStd_H_CallDisCon(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt, in phFriNfc_MfStd_H_CallDisCon() argument
552 NdefSmtCrdFmt->State = PH_FRINFC_MFSTD_FMT_DIS_CON; in phFriNfc_MfStd_H_CallDisCon()
557 Result = phFriNfc_OvrHal_Reconnect( NdefSmtCrdFmt->LowerDevice, in phFriNfc_MfStd_H_CallDisCon()
558 &NdefSmtCrdFmt->SmtCrdFmtCompletionInfo, in phFriNfc_MfStd_H_CallDisCon()
559 NdefSmtCrdFmt->psRemoteDevInfo); in phFriNfc_MfStd_H_CallDisCon()
562 Result = phFriNfc_OvrHal_Disconnect( NdefSmtCrdFmt->LowerDevice, in phFriNfc_MfStd_H_CallDisCon()
563 &NdefSmtCrdFmt->SmtCrdFmtCompletionInfo, in phFriNfc_MfStd_H_CallDisCon()
564 NdefSmtCrdFmt->psRemoteDevInfo); in phFriNfc_MfStd_H_CallDisCon()
570 static NFCSTATUS phFriNfc_MfStd_H_CallCon(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt) in phFriNfc_MfStd_H_CallCon() argument
574 NdefSmtCrdFmt->State = PH_FRINFC_MFSTD_FMT_CON; in phFriNfc_MfStd_H_CallCon()
578 Result = phFriNfc_OvrHal_Connect( NdefSmtCrdFmt->LowerDevice, in phFriNfc_MfStd_H_CallCon()
579 &NdefSmtCrdFmt->SmtCrdFmtCompletionInfo, in phFriNfc_MfStd_H_CallCon()
580 NdefSmtCrdFmt->psRemoteDevInfo, in phFriNfc_MfStd_H_CallCon()
581 NdefSmtCrdFmt->AddInfo.MfStdInfo.DevInputParam); in phFriNfc_MfStd_H_CallCon()
583 Result = phFriNfc_OvrHal_Connect( NdefSmtCrdFmt->LowerDevice, in phFriNfc_MfStd_H_CallCon()
584 &NdefSmtCrdFmt->SmtCrdFmtCompletionInfo, in phFriNfc_MfStd_H_CallCon()
586 NdefSmtCrdFmt->psRemoteDevInfo, in phFriNfc_MfStd_H_CallCon()
587 NdefSmtCrdFmt->AddInfo.MfStdInfo.DevInputParam); in phFriNfc_MfStd_H_CallCon()
595 static NFCSTATUS phFriNfc_MfStd_H_CallPoll(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt) in phFriNfc_MfStd_H_CallPoll() argument
599 NdefSmtCrdFmt->State = PH_FRINFC_MFSTD_FMT_POLL; in phFriNfc_MfStd_H_CallPoll()
601 NdefSmtCrdFmt->OpModeType[PH_FRINFC_MFSTD_FMT_VAL_0] = phHal_eOpModesMifare; in phFriNfc_MfStd_H_CallPoll()
602 NdefSmtCrdFmt->OpModeType[PH_FRINFC_MFSTD_FMT_VAL_1] = phHal_eOpModesArrayTerminator; in phFriNfc_MfStd_H_CallPoll()
605 NdefSmtCrdFmt->AddInfo.MfStdInfo.NoOfDevices = PH_FRINFC_MFSTD_FMT_VAL_1; in phFriNfc_MfStd_H_CallPoll()
608 Result = phFriNfc_OvrHal_Poll( NdefSmtCrdFmt->LowerDevice, in phFriNfc_MfStd_H_CallPoll()
609 &NdefSmtCrdFmt->SmtCrdFmtCompletionInfo, in phFriNfc_MfStd_H_CallPoll()
610 NdefSmtCrdFmt->OpModeType, in phFriNfc_MfStd_H_CallPoll()
611 NdefSmtCrdFmt->psRemoteDevInfo, in phFriNfc_MfStd_H_CallPoll()
612 &NdefSmtCrdFmt->AddInfo.MfStdInfo.NoOfDevices, in phFriNfc_MfStd_H_CallPoll()
613 NdefSmtCrdFmt->AddInfo.MfStdInfo.DevInputParam); in phFriNfc_MfStd_H_CallPoll()
619 static NFCSTATUS phFriNfc_MfStd_H_ProCon(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt) in phFriNfc_MfStd_H_ProCon() argument
626 phFriNfc_MfStd_H_ChangeAuthSt(NdefSmtCrdFmt); in phFriNfc_MfStd_H_ProCon()
634 NdefSmtCrdFmt->State = PH_FRINFC_MFSTD_FMT_AUTH_SECT; in phFriNfc_MfStd_H_ProCon()
636 Result = phFriNfc_MfStd_H_WrRdAuth(NdefSmtCrdFmt); in phFriNfc_MfStd_H_ProCon()
641 static NFCSTATUS phFriNfc_MfStd_H_ProAuth(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt) in phFriNfc_MfStd_H_ProAuth() argument
646 switch(NdefSmtCrdFmt->AddInfo.MfStdInfo.AuthState) in phFriNfc_MfStd_H_ProAuth()
649 if((NdefSmtCrdFmt->AddInfo.MfStdInfo.CurrentBlock == in phFriNfc_MfStd_H_ProAuth()
651 (NdefSmtCrdFmt->AddInfo.MfStdInfo.WrMADBlkFlag == in phFriNfc_MfStd_H_ProAuth()
656 NdefSmtCrdFmt->AddInfo.MfStdInfo.CurrentBlock = in phFriNfc_MfStd_H_ProAuth()
659 NdefSmtCrdFmt->State = PH_FRINFC_MFSTD_FMT_WR_MAD_BLK; in phFriNfc_MfStd_H_ProAuth()
661 else if((NdefSmtCrdFmt->AddInfo.MfStdInfo.CurrentBlock == 67) in phFriNfc_MfStd_H_ProAuth()
662 && (NdefSmtCrdFmt->AddInfo.MfStdInfo.WrMADBlkFlag == in phFriNfc_MfStd_H_ProAuth()
667 NdefSmtCrdFmt->AddInfo.MfStdInfo.CurrentBlock = 64; in phFriNfc_MfStd_H_ProAuth()
669 NdefSmtCrdFmt->State = PH_FRINFC_MFSTD_FMT_WR_MAD_BLK; in phFriNfc_MfStd_H_ProAuth()
674 NdefSmtCrdFmt->AddInfo.MfStdInfo.WrMADBlkFlag = in phFriNfc_MfStd_H_ProAuth()
677 NdefSmtCrdFmt->State = PH_FRINFC_MFSTD_FMT_WR_SECT_TR; in phFriNfc_MfStd_H_ProAuth()
682 if((NdefSmtCrdFmt->AddInfo.MfStdInfo.UpdMADBlk == in phFriNfc_MfStd_H_ProAuth()
684 (NdefSmtCrdFmt->AddInfo.MfStdInfo.UpdMADBlk == in phFriNfc_MfStd_H_ProAuth()
686 (NdefSmtCrdFmt->AddInfo.MfStdInfo.UpdMADBlk == in phFriNfc_MfStd_H_ProAuth()
688 (NdefSmtCrdFmt->AddInfo.MfStdInfo.UpdMADBlk == in phFriNfc_MfStd_H_ProAuth()
690 (NdefSmtCrdFmt->AddInfo.MfStdInfo.UpdMADBlk == in phFriNfc_MfStd_H_ProAuth()
693 NdefSmtCrdFmt->AddInfo.MfStdInfo.CurrentBlock = in phFriNfc_MfStd_H_ProAuth()
694 NdefSmtCrdFmt->AddInfo.MfStdInfo.UpdMADBlk; in phFriNfc_MfStd_H_ProAuth()
695 NdefSmtCrdFmt->State = PH_FRINFC_MFSTD_FMT_UPD_MAD_BLK; in phFriNfc_MfStd_H_ProAuth()
699 NdefSmtCrdFmt->AddInfo.MfStdInfo.UpdMADBlk = in phFriNfc_MfStd_H_ProAuth()
701 NdefSmtCrdFmt->State = PH_FRINFC_MFSTD_FMT_WR_SECT_TR; in phFriNfc_MfStd_H_ProAuth()
707 if((NdefSmtCrdFmt->AddInfo.MfStdInfo.UpdMADBlk == in phFriNfc_MfStd_H_ProAuth()
709 (NdefSmtCrdFmt->AddInfo.MfStdInfo.UpdMADBlk == in phFriNfc_MfStd_H_ProAuth()
711 (NdefSmtCrdFmt->AddInfo.MfStdInfo.UpdMADBlk == in phFriNfc_MfStd_H_ProAuth()
713 (NdefSmtCrdFmt->AddInfo.MfStdInfo.UpdMADBlk == in phFriNfc_MfStd_H_ProAuth()
715 (NdefSmtCrdFmt->AddInfo.MfStdInfo.UpdMADBlk == in phFriNfc_MfStd_H_ProAuth()
718 NdefSmtCrdFmt->AddInfo.MfStdInfo.CurrentBlock = in phFriNfc_MfStd_H_ProAuth()
719 NdefSmtCrdFmt->AddInfo.MfStdInfo.UpdMADBlk; in phFriNfc_MfStd_H_ProAuth()
720 NdefSmtCrdFmt->State = PH_FRINFC_MFSTD_FMT_UPD_MAD_BLK; in phFriNfc_MfStd_H_ProAuth()
724 NdefSmtCrdFmt->AddInfo.MfStdInfo.UpdMADBlk = in phFriNfc_MfStd_H_ProAuth()
726 NdefSmtCrdFmt->State = PH_FRINFC_MFSTD_FMT_WR_SECT_TR; in phFriNfc_MfStd_H_ProAuth()
733 if((NdefSmtCrdFmt->AddInfo.MfStdInfo.UpdMADBlk == in phFriNfc_MfStd_H_ProAuth()
735 (NdefSmtCrdFmt->AddInfo.MfStdInfo.UpdMADBlk == in phFriNfc_MfStd_H_ProAuth()
739 NdefSmtCrdFmt->AddInfo.MfStdInfo.UpdMADBlk = in phFriNfc_MfStd_H_ProAuth()
742 NdefSmtCrdFmt->State = PH_FRINFC_MFSTD_FMT_WR_TLV; in phFriNfc_MfStd_H_ProAuth()
747 NdefSmtCrdFmt->State = PH_FRINFC_MFSTD_FMT_RD_SECT_TR; in phFriNfc_MfStd_H_ProAuth()
752 Result = phFriNfc_MfStd_H_WrRdAuth(NdefSmtCrdFmt); in phFriNfc_MfStd_H_ProAuth()
756 static NFCSTATUS phFriNfc_MfStd_H_ErrWrSectTr( phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt ) in phFriNfc_MfStd_H_ErrWrSectTr() argument
758 NFCSTATUS Result = NdefSmtCrdFmt->FmtProcStatus; in phFriNfc_MfStd_H_ErrWrSectTr()
761 if(NdefSmtCrdFmt->AddInfo.MfStdInfo.AuthState == in phFriNfc_MfStd_H_ErrWrSectTr()
765 NdefSmtCrdFmt->State = PH_FRINFC_MFSTD_FMT_AUTH_SECT; in phFriNfc_MfStd_H_ErrWrSectTr()
767 NdefSmtCrdFmt->AddInfo.MfStdInfo.AuthState = PH_FRINFC_MFSTD_FMT_AUTH_KEYB; in phFriNfc_MfStd_H_ErrWrSectTr()
769 Result = phFriNfc_MfStd_H_WrRdAuth(NdefSmtCrdFmt); in phFriNfc_MfStd_H_ErrWrSectTr()
773 Result = phFriNfc_MfStd_H_ProWrSectTr(NdefSmtCrdFmt); in phFriNfc_MfStd_H_ErrWrSectTr()
777 static NFCSTATUS phFriNfc_MfStd_H_ProRdSectTr(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt) in phFriNfc_MfStd_H_ProRdSectTr() argument
789 memcompare = phFriNfc_MfStd_H_ChkAcsBit(NdefSmtCrdFmt->AddInfo.MfStdInfo.CurrentBlock, in phFriNfc_MfStd_H_ProRdSectTr()
790 NdefSmtCrdFmt->SendRecvBuf, in phFriNfc_MfStd_H_ProRdSectTr()
791 NdefSmtCrdFmt->AddInfo.MfStdInfo.MADSect_AccessBits, in phFriNfc_MfStd_H_ProRdSectTr()
792NdefSmtCrdFmt->AddInfo.MfStdInfo.NFCForumSect_AccessBits); in phFriNfc_MfStd_H_ProRdSectTr()
795 NdefSmtCrdFmt->AddInfo.MfStdInfo.SectCompl[SectIndex] = (uint8_t) in phFriNfc_MfStd_H_ProRdSectTr()
810 NdefSmtCrdFmt->State = PH_FRINFC_MFSTD_FMT_AUTH_SECT; in phFriNfc_MfStd_H_ProRdSectTr()
812 NdefSmtCrdFmt->AddInfo.MfStdInfo.AuthState = in phFriNfc_MfStd_H_ProRdSectTr()
815 Result = phFriNfc_MfStd_H_WrRdAuth(NdefSmtCrdFmt); in phFriNfc_MfStd_H_ProRdSectTr()
820 static NFCSTATUS phFriNfc_MfStd_H_ProWrSectTr(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt) in phFriNfc_MfStd_H_ProWrSectTr() argument
832 NdefSmtCrdFmt->AddInfo.MfStdInfo.SectCompl[SectIndex] = (uint8_t) in phFriNfc_MfStd_H_ProWrSectTr()
833 ((NdefSmtCrdFmt->FmtProcStatus != NFCSTATUS_SUCCESS)? in phFriNfc_MfStd_H_ProWrSectTr()
847 NdefSmtCrdFmt->State = PH_FRINFC_MFSTD_FMT_AUTH_SECT; in phFriNfc_MfStd_H_ProWrSectTr()
849 NdefSmtCrdFmt->AddInfo.MfStdInfo.AuthState = in phFriNfc_MfStd_H_ProWrSectTr()
852 Result = phFriNfc_MfStd_H_WrRdAuth(NdefSmtCrdFmt); in phFriNfc_MfStd_H_ProWrSectTr()
877 static NFCSTATUS phFriNfc_MfStd_H_WrRdAuth(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt) in phFriNfc_MfStd_H_WrRdAuth() argument
881 phFriNfc_MfStd_H_FillSendBuf(NdefSmtCrdFmt, in phFriNfc_MfStd_H_WrRdAuth()
882 NdefSmtCrdFmt->AddInfo.MfStdInfo.CurrentBlock); in phFriNfc_MfStd_H_WrRdAuth()
884 Result = phFriNfc_MfStd_H_Transceive(NdefSmtCrdFmt); in phFriNfc_MfStd_H_WrRdAuth()
889 static void phFriNfc_MfStd_H_ChangeAuthSt(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt) in phFriNfc_MfStd_H_ChangeAuthSt() argument
893 if( NdefSmtCrdFmt->AddInfo.MfStdInfo.AuthState == in phFriNfc_MfStd_H_ChangeAuthSt()
900 NdefSmtCrdFmt->AddInfo.MfStdInfo.SectCompl[SectIndex] = in phFriNfc_MfStd_H_ChangeAuthSt()
979 static NFCSTATUS phFriNfc_MfStd_H_ProWrMADBlk(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt) in phFriNfc_MfStd_H_ProWrMADBlk() argument
983 switch(NdefSmtCrdFmt->AddInfo.MfStdInfo.CurrentBlock) in phFriNfc_MfStd_H_ProWrMADBlk()
987 NdefSmtCrdFmt->State = PH_FRINFC_MFSTD_FMT_WR_MAD_BLK; in phFriNfc_MfStd_H_ProWrMADBlk()
989 NdefSmtCrdFmt->AddInfo.MfStdInfo.CurrentBlock = in phFriNfc_MfStd_H_ProWrMADBlk()
995 NdefSmtCrdFmt->AddInfo.MfStdInfo.WrMADBlkFlag = in phFriNfc_MfStd_H_ProWrMADBlk()
998 NdefSmtCrdFmt->State = PH_FRINFC_MFSTD_FMT_WR_SECT_TR; in phFriNfc_MfStd_H_ProWrMADBlk()
1000 NdefSmtCrdFmt->AddInfo.MfStdInfo.CurrentBlock = in phFriNfc_MfStd_H_ProWrMADBlk()
1006 NdefSmtCrdFmt->State = PH_FRINFC_MFSTD_FMT_WR_MAD_BLK; in phFriNfc_MfStd_H_ProWrMADBlk()
1007 NdefSmtCrdFmt->AddInfo.MfStdInfo.CurrentBlock = 65; in phFriNfc_MfStd_H_ProWrMADBlk()
1012 NdefSmtCrdFmt->State = PH_FRINFC_MFSTD_FMT_WR_MAD_BLK; in phFriNfc_MfStd_H_ProWrMADBlk()
1013 NdefSmtCrdFmt->AddInfo.MfStdInfo.CurrentBlock = 66; in phFriNfc_MfStd_H_ProWrMADBlk()
1019 NdefSmtCrdFmt->AddInfo.MfStdInfo.WrMADBlkFlag = in phFriNfc_MfStd_H_ProWrMADBlk()
1022 NdefSmtCrdFmt->State = PH_FRINFC_MFSTD_FMT_WR_SECT_TR; in phFriNfc_MfStd_H_ProWrMADBlk()
1023 NdefSmtCrdFmt->AddInfo.MfStdInfo.CurrentBlock = 67; in phFriNfc_MfStd_H_ProWrMADBlk()
1028 Result = phFriNfc_MfStd_H_WrRdAuth(NdefSmtCrdFmt); in phFriNfc_MfStd_H_ProWrMADBlk()
1033 static NFCSTATUS phFriNfc_MfStd_H_ProErrAuth( phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt ) in phFriNfc_MfStd_H_ProErrAuth() argument
1035 NFCSTATUS Result = NdefSmtCrdFmt->FmtProcStatus; in phFriNfc_MfStd_H_ProErrAuth()
1040 if ((NdefSmtCrdFmt->AddInfo.MfStdInfo.CurrentBlock == 67) && in phFriNfc_MfStd_H_ProErrAuth()
1041 (NdefSmtCrdFmt->AddInfo.MfStdInfo.AuthState == in phFriNfc_MfStd_H_ProErrAuth()
1046 (void)memset(&NdefSmtCrdFmt->AddInfo.MfStdInfo.SectCompl[16], in phFriNfc_MfStd_H_ProErrAuth()
1051 else if(((NdefSmtCrdFmt->AddInfo.MfStdInfo.CurrentBlock > in phFriNfc_MfStd_H_ProErrAuth()
1053 (NdefSmtCrdFmt->AddInfo.MfStdInfo.AuthState != in phFriNfc_MfStd_H_ProErrAuth()
1055 ((NdefSmtCrdFmt->AddInfo.MfStdInfo.CurrentBlock == in phFriNfc_MfStd_H_ProErrAuth()
1057 (NdefSmtCrdFmt->AddInfo.MfStdInfo.AuthState < in phFriNfc_MfStd_H_ProErrAuth()
1061 Result = phFriNfc_MfStd_H_CallDisCon(NdefSmtCrdFmt, in phFriNfc_MfStd_H_ProErrAuth()
1066 if (NdefSmtCrdFmt->AddInfo.MfStdInfo.CurrentBlock == in phFriNfc_MfStd_H_ProErrAuth()
1069 (void)memset(NdefSmtCrdFmt->AddInfo.MfStdInfo.SectCompl, in phFriNfc_MfStd_H_ProErrAuth()
1078 static NFCSTATUS phFriNfc_MfStd_H_ProUpdMADBlk(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt) in phFriNfc_MfStd_H_ProUpdMADBlk() argument
1081 switch(NdefSmtCrdFmt->AddInfo.MfStdInfo.UpdMADBlk) in phFriNfc_MfStd_H_ProUpdMADBlk()
1085 NdefSmtCrdFmt->AddInfo.MfStdInfo.UpdMADBlk = (uint8_t) in phFriNfc_MfStd_H_ProUpdMADBlk()
1087 NdefSmtCrdFmt->AddInfo.MfStdInfo.CurrentBlock = in phFriNfc_MfStd_H_ProUpdMADBlk()
1093 if((NdefSmtCrdFmt->CardType == PH_FRINFC_SMTCRDFMT_MFSTD_1K_CRD) || in phFriNfc_MfStd_H_ProUpdMADBlk()
1094 (NdefSmtCrdFmt->AddInfo.MfStdInfo.CurrentBlock == in phFriNfc_MfStd_H_ProUpdMADBlk()
1098 phFriNfc_MfStd_H_BlkNoToWrTLV(NdefSmtCrdFmt); in phFriNfc_MfStd_H_ProUpdMADBlk()
1100 NdefSmtCrdFmt->State = PH_FRINFC_MFSTD_FMT_AUTH_SECT; in phFriNfc_MfStd_H_ProUpdMADBlk()
1101 NdefSmtCrdFmt->AddInfo.MfStdInfo.AuthState = in phFriNfc_MfStd_H_ProUpdMADBlk()
1107 NdefSmtCrdFmt->AddInfo.MfStdInfo.UpdMADBlk = (uint8_t) in phFriNfc_MfStd_H_ProUpdMADBlk()
1109 NdefSmtCrdFmt->AddInfo.MfStdInfo.CurrentBlock = in phFriNfc_MfStd_H_ProUpdMADBlk()
1111 NdefSmtCrdFmt->State = PH_FRINFC_MFSTD_FMT_AUTH_SECT; in phFriNfc_MfStd_H_ProUpdMADBlk()
1112 NdefSmtCrdFmt->AddInfo.MfStdInfo.AuthState = in phFriNfc_MfStd_H_ProUpdMADBlk()
1119 NdefSmtCrdFmt->AddInfo.MfStdInfo.UpdMADBlk = (uint8_t) in phFriNfc_MfStd_H_ProUpdMADBlk()
1121 NdefSmtCrdFmt->AddInfo.MfStdInfo.CurrentBlock = in phFriNfc_MfStd_H_ProUpdMADBlk()
1128 NdefSmtCrdFmt->AddInfo.MfStdInfo.UpdMADBlk = (uint8_t) in phFriNfc_MfStd_H_ProUpdMADBlk()
1130 NdefSmtCrdFmt->AddInfo.MfStdInfo.CurrentBlock = in phFriNfc_MfStd_H_ProUpdMADBlk()
1134 Result = phFriNfc_MfStd_H_WrRdAuth(NdefSmtCrdFmt); in phFriNfc_MfStd_H_ProUpdMADBlk()
1138 static void phFriNfc_MfStd_H_StrNdefData( phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt ) in phFriNfc_MfStd_H_StrNdefData() argument
1143 (void)memset(NdefSmtCrdFmt->AddInfo.MfStdInfo.MADSectBlk, in phFriNfc_MfStd_H_StrNdefData()
1148 NdefSmtCrdFmt->AddInfo.MfStdInfo.MADSectBlk[PH_FRINFC_MFSTD_FMT_VAL_0] = 0x14; in phFriNfc_MfStd_H_StrNdefData()
1151 NdefSmtCrdFmt->AddInfo.MfStdInfo.MADSectBlk[PH_FRINFC_MFSTD_FMT_VAL_1] = 0x01; in phFriNfc_MfStd_H_StrNdefData()
1153 if(NdefSmtCrdFmt->CardType == PH_FRINFC_SMTCRDFMT_MFSTD_4K_CRD) in phFriNfc_MfStd_H_StrNdefData()
1156 NdefSmtCrdFmt->AddInfo.MfStdInfo.MADSectBlk[32] = 0xE8; in phFriNfc_MfStd_H_StrNdefData()
1160 NdefSmtCrdFmt->AddInfo.MfStdInfo.MADSectBlk[33] = 0x01; in phFriNfc_MfStd_H_StrNdefData()
1166 (NdefSmtCrdFmt->CardType == PH_FRINFC_SMTCRDFMT_MFSTD_4K_CRD)) || in phFriNfc_MfStd_H_StrNdefData()
1168 (NdefSmtCrdFmt->CardType == PH_FRINFC_SMTCRDFMT_MFSTD_1K_CRD))) in phFriNfc_MfStd_H_StrNdefData()
1171 if(NdefSmtCrdFmt->AddInfo.MfStdInfo.SectCompl[SectIndex] == in phFriNfc_MfStd_H_StrNdefData()
1177 NdefSmtCrdFmt->AddInfo.MfStdInfo.MADSectBlk[index] = in phFriNfc_MfStd_H_StrNdefData()
1180 NdefSmtCrdFmt->AddInfo.MfStdInfo.MADSectBlk[index] = in phFriNfc_MfStd_H_StrNdefData()
1189 NdefSmtCrdFmt->AddInfo.MfStdInfo.MADSectBlk[index] = 0x00; in phFriNfc_MfStd_H_StrNdefData()
1191 NdefSmtCrdFmt->AddInfo.MfStdInfo.MADSectBlk[index] = 0x00; in phFriNfc_MfStd_H_StrNdefData()
1206 static void phFriNfc_MfStd_H_BlkNoToWrTLV( phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt ) in phFriNfc_MfStd_H_BlkNoToWrTLV() argument
1210 (NdefSmtCrdFmt->CardType == (uint8_t)PH_FRINFC_SMTCRDFMT_MFSTD_4K_CRD)) || in phFriNfc_MfStd_H_BlkNoToWrTLV()
1212 (NdefSmtCrdFmt->CardType == (uint8_t)PH_FRINFC_SMTCRDFMT_MFSTD_1K_CRD))) in phFriNfc_MfStd_H_BlkNoToWrTLV()
1214 if (NdefSmtCrdFmt->AddInfo.MfStdInfo.SectCompl[SectIndex] == in phFriNfc_MfStd_H_BlkNoToWrTLV()
1218 NdefSmtCrdFmt->AddInfo.MfStdInfo.CurrentBlock = (uint16_t) in phFriNfc_MfStd_H_BlkNoToWrTLV()
1229 static NFCSTATUS phFriNfc_MfStd_H_ErrRdSectTr( phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt ) in phFriNfc_MfStd_H_ErrRdSectTr() argument
1231 NFCSTATUS Result = NdefSmtCrdFmt->FmtProcStatus; in phFriNfc_MfStd_H_ErrRdSectTr()
1238 if(NdefSmtCrdFmt->AddInfo.MfStdInfo.AuthState == in phFriNfc_MfStd_H_ErrRdSectTr()
1242 NdefSmtCrdFmt->State = PH_FRINFC_MFSTD_FMT_AUTH_SECT; in phFriNfc_MfStd_H_ErrRdSectTr()
1244 NdefSmtCrdFmt->AddInfo.MfStdInfo.AuthState = PH_FRINFC_MFSTD_FMT_AUTH_KEYB; in phFriNfc_MfStd_H_ErrRdSectTr()
1246 Result = phFriNfc_MfStd_H_WrRdAuth(NdefSmtCrdFmt); in phFriNfc_MfStd_H_ErrRdSectTr()
1254 NdefSmtCrdFmt->AddInfo.MfStdInfo.SectCompl[SectIndex] = (uint8_t) in phFriNfc_MfStd_H_ErrRdSectTr()
1255 ((NdefSmtCrdFmt->FmtProcStatus != NFCSTATUS_SUCCESS)? in phFriNfc_MfStd_H_ErrRdSectTr()
1269 NdefSmtCrdFmt->State = PH_FRINFC_MFSTD_FMT_AUTH_SECT; in phFriNfc_MfStd_H_ErrRdSectTr()
1271 NdefSmtCrdFmt->AddInfo.MfStdInfo.AuthState = in phFriNfc_MfStd_H_ErrRdSectTr()
1274 Result = phFriNfc_MfStd_H_WrRdAuth(NdefSmtCrdFmt); in phFriNfc_MfStd_H_ErrRdSectTr()