Home | History | Annotate | Download | only in src

Lines Matching refs:NdefSmtCrdFmt

110 static void phFriNfc_Desf_HWrapISONativeCmds(phFriNfc_sNdefSmtCrdFmt_t    *NdefSmtCrdFmt,uint8_t CmdType);
113 static NFCSTATUS phFriNfc_Desf_HGetHWVersion(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
116 static NFCSTATUS phFriNfc_Desf_HGetSWVersion(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
119 static NFCSTATUS phFriNfc_Desf_HUpdateVersionDetails(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
122 static NFCSTATUS phFriNfc_Desf_HGetUIDDetails(phFriNfc_sNdefSmtCrdFmt_t * NdefSmtCrdFmt);
125 static NFCSTATUS phFriNfc_Desf_HCreateApp(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
128 static NFCSTATUS phFriNfc_Desf_HSelectApp(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
131 static NFCSTATUS phFriNfc_Desf_HCreatCCFile(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
134 static NFCSTATUS phFriNfc_Desf_HCreatNDEFFile(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
137 static NFCSTATUS phFriNfc_Desf_HWrCCBytes(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
140 static NFCSTATUS phFriNfc_Desf_HWrNDEFData(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
143 static NFCSTATUS phFriNfc_Desf_HSendTransCmd(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
151 phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
157 phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
162 phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
167 phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
174 phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt);
180 void phFriNfc_Desfire_Reset( phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt)
186 /*NdefSmtCrdFmt->AddInfo.Type4Info.PICCMasterKey[] = PH_FRINFC_SMTCRDFMT_DESF_PICC_MASTER_KEY;
187 NdefSmtCrdFmt->AddInfo.Type4Info.NFCForumMasterkey[] = PH_FRINFC_SMTCRDFMT_DESF_NFCFORUM_APP_KEY;*/
190 (void)memset((void *)NdefSmtCrdFmt->AddInfo.Type4Info.PICCMasterKey,
194 (void)memset((void *)NdefSmtCrdFmt->AddInfo.Type4Info.NFCForumMasterkey,
197 NdefSmtCrdFmt->AddInfo.Type4Info.PrevState = 0;
202 static void phFriNfc_Desf_HWrapISONativeCmds(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt,uint8_t CmdType)
213 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_NATIVE_CLASS_BYTE;
220 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_NATIVE_OFFSET_P1;
222 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_NATIVE_OFFSET_P2;
234 NdefSmtCrdFmt->SendRecvBuf[CmdByte] = PH_FRINFC_DESF_GET_VER_CMD;
239 NdefSmtCrdFmt->SendRecvBuf[CmdByte] = PH_FRINFC_DESF_PICC_ADDI_FRAME_RESP;
243 NdefSmtCrdFmt->SendRecvBuf[i] = 0x00;
249 NdefSmtCrdFmt->SendLength = i;
261 NdefSmtCrdFmt->SendRecvBuf[CmdByte] = PH_FRINFC_DESF_CREATE_AID_CMD;
264 if (DESFIRE_CARD_TYPE_EV1 == NdefSmtCrdFmt->CardType)
268 NdefSmtCrdFmt->SendRecvBuf[i] = (uint8_t)(PH_FRINFC_DESF_NATIVE_CRAPP_WRDT_LEN +
272 NdefSmtCrdFmt->SendRecvBuf[i] = DESFIRE_EV1_FIRST_AID_BYTE;
274 NdefSmtCrdFmt->SendRecvBuf[i] = DESFIRE_EV1_SECOND_AID_BYTE;
276 NdefSmtCrdFmt->SendRecvBuf[i] = DESFIRE_EV1_THIRD_AID_BYTE;
283 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_NATIVE_CRAPP_WRDT_LEN;
286 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_FIRST_AID_BYTE;
288 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_SEC_AID_BYTE;
290 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_THIRD_AID_BYTE;
294 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_PICC_NFC_KEY_SETTING;
297 if (DESFIRE_CARD_TYPE_EV1 == NdefSmtCrdFmt->CardType)
300 NdefSmtCrdFmt->SendRecvBuf[i] = DESFIRE_EV1_KEY_SETTINGS_2;
306 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_NFCFORUM_APP_NO_OF_KEYS;
311 if (DESFIRE_CARD_TYPE_EV1 == NdefSmtCrdFmt->CardType)
314 NdefSmtCrdFmt->SendRecvBuf[i] = DESFIRE_EV1_FIRST_ISO_FILE_ID;
316 NdefSmtCrdFmt->SendRecvBuf[i] = DESFIRE_EV1_SECOND_ISO_FILE_ID;
319 (void)memcpy ((void *)&NdefSmtCrdFmt->SendRecvBuf[i],
326 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_NATIVE_LE_BYTE;
330 if (DESFIRE_CARD_TYPE_EV1 == NdefSmtCrdFmt->CardType)
333 NdefSmtCrdFmt->SendLength = i;
338 NdefSmtCrdFmt->SendLength = PH_FRINFC_DESF_CREATEAPP_CMD_SNLEN;
346 NdefSmtCrdFmt->SendRecvBuf[CmdByte] = PH_FRINFC_DESF_SLECT_APP_CMD;
349 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_NATIVE_SLAPP_WRDT_LEN;
353 if (DESFIRE_CARD_TYPE_EV1 == NdefSmtCrdFmt->CardType)
357 NdefSmtCrdFmt->SendRecvBuf[i] = DESFIRE_EV1_FIRST_AID_BYTE;
360 NdefSmtCrdFmt->SendRecvBuf[i] = DESFIRE_EV1_SECOND_AID_BYTE;
363 NdefSmtCrdFmt->SendRecvBuf[i] = DESFIRE_EV1_THIRD_AID_BYTE;
371 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_FIRST_AID_BYTE;
374 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_SEC_AID_BYTE;
377 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_THIRD_AID_BYTE;
382 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_NATIVE_LE_BYTE;
386 NdefSmtCrdFmt->SendLength = PH_FRINFC_DESF_SELECTAPP_CMD_SNLEN;
393 NdefSmtCrdFmt->SendRecvBuf[CmdByte] = PH_FRINFC_DESF_CREATE_DATA_FILE_CMD;
396 if (DESFIRE_CARD_TYPE_EV1 == NdefSmtCrdFmt->CardType)
400 NdefSmtCrdFmt->SendRecvBuf[i] = (uint8_t)
404 NdefSmtCrdFmt->SendRecvBuf[i] = DESFIRE_EV1_CC_FILE_ID;
407 NdefSmtCrdFmt->SendRecvBuf[i] = DESFIRE_EV1_FIRST_CC_FILE_ID_BYTE;
409 NdefSmtCrdFmt->SendRecvBuf[i] = DESFIRE_EV1_SECOND_CC_FILE_ID_BYTE;
416 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_NATIVE_CRCCNDEF_WRDT_LEN;
419 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_CC_FILE_ID;
423 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_COMM_SETTINGS;
427 NdefSmtCrdFmt->SendRecvBuf[i] = 0xEE;
429 NdefSmtCrdFmt->SendRecvBuf[i] = 0xEE;
433 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_CC_FILE_SIZE;
435 NdefSmtCrdFmt->SendRecvBuf[i] = 0x00;
437 NdefSmtCrdFmt->SendRecvBuf[i] = 0x00;
441 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_NATIVE_LE_BYTE;
444 if (DESFIRE_CARD_TYPE_EV1 == NdefSmtCrdFmt->CardType)
447 NdefSmtCrdFmt->SendLength = i;
453 NdefSmtCrdFmt
461 NdefSmtCrdFmt->SendRecvBuf[CmdByte] = PH_FRINFC_DESF_CREATE_DATA_FILE_CMD;
464 if (DESFIRE_CARD_TYPE_EV1 == NdefSmtCrdFmt->CardType)
468 NdefSmtCrdFmt->SendRecvBuf[i] = (uint8_t)
472 NdefSmtCrdFmt->SendRecvBuf[i] = DESFIRE_EV1_NDEF_FILE_ID;
475 NdefSmtCrdFmt->SendRecvBuf[i] = DESFIRE_EV1_FIRST_NDEF_FILE_ID_BYTE;
477 NdefSmtCrdFmt->SendRecvBuf[i] = DESFIRE_EV1_SECOND_NDEF_FILE_ID_BYTE;
484 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_NATIVE_CRCCNDEF_WRDT_LEN;
488 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_NDEF_FILE_ID;
491 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_COMM_SETTINGS;
496 NdefSmtCrdFmt->SendRecvBuf[i] = 0xEE;
498 NdefSmtCrdFmt->SendRecvBuf[i] = 0xEE;
501 NdefSmtCrdFmt->SendRecvBuf[i]= (uint8_t)NdefSmtCrdFmt->AddInfo.Type4Info.CardSize;
503 NdefSmtCrdFmt->SendRecvBuf[i]= (uint8_t)
504 (NdefSmtCrdFmt->AddInfo.Type4Info.CardSize >> 8);
506 NdefSmtCrdFmt->SendRecvBuf[i]= (uint8_t)
507 (NdefSmtCrdFmt->AddInfo.Type4Info.CardSize >> 16);
511 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_NATIVE_LE_BYTE;
515 if (DESFIRE_CARD_TYPE_EV1 == NdefSmtCrdFmt->CardType)
518 NdefSmtCrdFmt->SendLength = i;
524 NdefSmtCrdFmt->SendLength = PH_FRINFC_DESF_CREATECCNDEF_CMD_SNLEN;
532 NdefSmtCrdFmt->SendRecvBuf[CmdByte] = PH_FRINFC_DESF_WRITE_CMD;
535 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_NATIVE_WRCC_WRDT_LEN;
539 if (DESFIRE_CARD_TYPE_EV1 == NdefSmtCrdFmt->CardType)
542 NdefSmtCrdFmt->SendRecvBuf[i] = DESFIRE_EV1_CC_FILE_ID;
549 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_CC_FILE_ID;
554 NdefSmtCrdFmt->SendRecvBuf[i] = 0x00;
556 NdefSmtCrdFmt->SendRecvBuf[i] = 0x00;
558 NdefSmtCrdFmt->SendRecvBuf[i] = 0x00;
562 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_CC_FILE_SIZE;
564 NdefSmtCrdFmt->SendRecvBuf[i] = 0x00;
566 NdefSmtCrdFmt->SendRecvBuf[i] = 0x00;
569 if (DESFIRE_CARD_TYPE_EV1 == NdefSmtCrdFmt->CardType)
576 (NdefSmtCrdFmt->AddInfo.Type4Info.CardSize >> 8);
578 (NdefSmtCrdFmt->AddInfo.Type4Info.CardSize);
582 (void)memcpy ((void *)&NdefSmtCrdFmt->SendRecvBuf[i],
592 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_NATIVE_LE_BYTE;
595 if (DESFIRE_CARD_TYPE_EV1 == NdefSmtCrdFmt->CardType)
597 NdefSmtCrdFmt->SendLength = i;
602 NdefSmtCrdFmt->SendLength = PH_FRINFC_DESF_WRITECC_CMD_SNLEN;
610 NdefSmtCrdFmt->SendRecvBuf[CmdByte] = PH_FRINFC_DESF_WRITE_CMD;
613 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_NATIVE_WRNDEF_WRDT_LEN;
617 if (DESFIRE_CARD_TYPE_EV1 == NdefSmtCrdFmt->CardType)
620 NdefSmtCrdFmt->SendRecvBuf[i] = DESFIRE_EV1_NDEF_FILE_ID;
627 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_NDEF_FILE_ID;
632 NdefSmtCrdFmt->SendRecvBuf[i] = 0x00;
634 NdefSmtCrdFmt->SendRecvBuf[i] = 0x00;
636 NdefSmtCrdFmt->SendRecvBuf[i] = 0x00;
640 NdefSmtCrdFmt->SendRecvBuf[i] = 0x02;
642 NdefSmtCrdFmt->SendRecvBuf[i] = 0x00;
644 NdefSmtCrdFmt->SendRecvBuf[i] = 0x00;
649 (void)memcpy(&NdefSmtCrdFmt->SendRecvBuf[i],
654 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_NATIVE_LE_BYTE;
657 NdefSmtCrdFmt->SendLength = PH_FRINFC_DESF_WRITENDEF_CMD_SNLEN;
668 static NFCSTATUS phFriNfc_Desf_HGetHWVersion(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt)
678 NdefSmtCrdFmt->State = PH_FRINFC_DESF_STATE_GET_HW_VERSION;
681 phFriNfc_Desf_HWrapISONativeCmds(NdefSmtCrdFmt,PH_FRINFC_DESF_GET_HW_VERSION_CMD);
683 status = phFriNfc_Desf_HSendTransCmd(NdefSmtCrdFmt);
688 static NFCSTATUS phFriNfc_Desf_HGetSWVersion(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt)
694 if( ( NdefSmtCrdFmt->SendRecvBuf[*(NdefSmtCrdFmt->SendRecvLength)- 1] ==
698 NdefSmtCrdFmt->State = PH_FRINFC_DESF_STATE_GET_SW_VERSION;
701 phFriNfc_Desf_HWrapISONativeCmds(NdefSmtCrdFmt,PH_FRINFC_DESF_GET_SW_VERSION_CMD);
703 status = phFriNfc_Desf_HSendTransCmd(NdefSmtCrdFmt);
708 static NFCSTATUS phFriNfc_Desf_HUpdateVersionDetails(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt)
713 if( ( NdefSmtCrdFmt->SendRecvBuf[*(NdefSmtCrdFmt->SendRecvLength)-
716 NdefSmtCrdFmt->AddInfo.Type4Info.MajorVersion = NdefSmtCrdFmt->SendRecvBuf[PH_SMTCRDFMT_DESF_VAL3];
717 NdefSmtCrdFmt->AddInfo.Type4Info.MinorVersion = NdefSmtCrdFmt->SendRecvBuf[PH_SMTCRDFMT_DESF_VAL4];
719 if ((PH_FRINFC_DESF4_MAJOR_VERSION == NdefSmtCrdFmt->AddInfo.Type4Info.MajorVersion) &&
720 (PH_FRINFC_DESF4_MINOR_VERSION == NdefSmtCrdFmt->AddInfo.Type4Info.MinorVersion))
723 NdefSmtCrdFmt->AddInfo.Type4Info.CardSize = PH_FRINFC_DESF4_MEMORY_SIZE;
727 else if ((DESFIRE_EV1_SW_MAJOR_VERSION == NdefSmtCrdFmt->AddInfo.Type4Info.MajorVersion) &&
728 (DESFIRE_EV1_SW_MINOR_VERSION == NdefSmtCrdFmt->AddInfo.Type4Info.MinorVersion))
730 NdefSmtCrdFmt->CardType = DESFIRE_CARD_TYPE_EV1;
742 if (DESFIRE_CARD_TYPE_EV1 == NdefSmtCrdFmt->CardType)
744 switch (NdefSmtCrdFmt->SendRecvBuf[5])
748 NdefSmtCrdFmt->AddInfo.Type4Info.CardSize = DESFIRE_2K_CARD;
754 NdefSmtCrdFmt->AddInfo.Type4Info.CardSize = DESFIRE_4K_CARD;
760 NdefSmtCrdFmt->AddInfo.Type4Info.CardSize = DESFIRE_8K_CARD;
778 static NFCSTATUS phFriNfc_Desf_HGetUIDDetails(phFriNfc_sNdefSmtCrdFmt_t * NdefSmtCrdFmt)
782 if( ( NdefSmtCrdFmt->SendRecvBuf[*(NdefSmtCrdFmt->SendRecvLength)-
786 NdefSmtCrdFmt->State = PH_FRINFC_DESF_STATE_GET_UID;
789 phFriNfc_Desf_HWrapISONativeCmds(NdefSmtCrdFmt,PH_FRINFC_DESF_GET_UID_CMD);
791 status = phFriNfc_Desf_HSendTransCmd(NdefSmtCrdFmt);
799 static NFCSTATUS phFriNfc_Desf_HCreateApp(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt)
804 if ( (NdefSmtCrdFmt->SendRecvBuf[PH_SMTCRDFMT_DESF_VAL14] == PH_FRINFC_DESF_NAT_WRAP_FIRST_RESP_BYTE)
805 && (NdefSmtCrdFmt->SendRecvBuf[PH_SMTCRDFMT_DESF_VAL15] == PH_FRINFC_DESF_NAT_WRAP_SEC_RESP_BYTE ))
808 NdefSmtCrdFmt->State = PH_FRINFC_DESF_STATE_CREATE_AID;
811 phFriNfc_Desf_HWrapISONativeCmds(NdefSmtCrdFmt,PH_FRINFC_DESF_CREATEAPP_CMD);
813 status = phFriNfc_Desf_HSendTransCmd(NdefSmtCrdFmt);
819 static NFCSTATUS phFriNfc_Desf_HSelectApp(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt)
828 if ( (NdefSmtCrdFmt->SendRecvBuf[PH_SMTCRDFMT_DESF_VAL0] == PH_FRINFC_DESF_NAT_WRAP_FIRST_RESP_BYTE) &&
829 (NdefSmtCrdFmt->SendRecvBuf[PH_SMTCRDFMT_DESF_VAL1] == PH_FRINFC_DESF_NAT_WRAP_SEC_RESP_BYTE ))
832 NdefSmtCrdFmt->State = PH_FRINFC_DESF_STATE_SELECT_APP;
835 phFriNfc_Desf_HWrapISONativeCmds(NdefSmtCrdFmt,PH_FRINFC_DESF_SELECTAPP_CMD);
837 status = phFriNfc_Desf_HSendTransCmd(NdefSmtCrdFmt);
843 static NFCSTATUS phFriNfc_Desf_HCreatCCFile(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt)
848 if ( (NdefSmtCrdFmt->SendRecvBuf[PH_SMTCRDFMT_DESF_VAL0] == PH_FRINFC_DESF_NATIVE_RESP_BYTE1) &&
849 (NdefSmtCrdFmt->SendRecvBuf[PH_SMTCRDFMT_DESF_VAL1] == PH_FRINFC_DESF_NATIVE_RESP_BYTE2 ))
852 NdefSmtCrdFmt->State = PH_FRINFC_DESF_STATE_CREATE_CCFILE;
855 phFriNfc_Desf_HWrapISONativeCmds(NdefSmtCrdFmt,PH_FRINFC_DESF_CREATECC_CMD);
857 status = phFriNfc_Desf_HSendTransCmd(NdefSmtCrdFmt);
862 static NFCSTATUS phFriNfc_Desf_HCreatNDEFFile(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt)
868 if ( (NdefSmtCrdFmt->SendRecvBuf[PH_SMTCRDFMT_DESF_VAL0] == PH_FRINFC_DESF_NATIVE_RESP_BYTE1) &&
869 (NdefSmtCrdFmt->SendRecvBuf[PH_SMTCRDFMT_DESF_VAL1] == PH_FRINFC_DESF_NATIVE_RESP_BYTE2 ))
872 NdefSmtCrdFmt->State = PH_FRINFC_DESF_STATE_CREATE_NDEFFILE;
875 phFriNfc_Desf_HWrapISONativeCmds(NdefSmtCrdFmt,PH_FRINFC_DESF_CREATENDEF_CMD);
877 status = phFriNfc_Desf_HSendTransCmd(NdefSmtCrdFmt);
885 static NFCSTATUS phFriNfc_Desf_HWrCCBytes(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt)
890 if ( (NdefSmtCrdFmt->SendRecvBuf[PH_SMTCRDFMT_DESF_VAL0] == PH_FRINFC_DESF_NATIVE_RESP_BYTE1) &&
891 (NdefSmtCrdFmt->SendRecvBuf[PH_SMTCRDFMT_DESF_VAL1] == PH_FRINFC_DESF_NATIVE_RESP_BYTE2 ))
895 NdefSmtCrdFmt->State = PH_FRINFC_DESF_STATE_WRITE_CC_FILE;
898 phFriNfc_Desf_HWrapISONativeCmds(NdefSmtCrdFmt,PH_FRINFC_DESF_WRITECC_CMD);
900 result = phFriNfc_Desf_HSendTransCmd(NdefSmtCrdFmt);
905 static NFCSTATUS phFriNfc_Desf_HWrNDEFData(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt)
912 if ( (NdefSmtCrdFmt->SendRecvBuf[PH_SMTCRDFMT_DESF_VAL0] == PH_FRINFC_DESF_NATIVE_RESP_BYTE1) &&
913 (NdefSmtCrdFmt->SendRecvBuf[PH_SMTCRDFMT_DESF_VAL1] == PH_FRINFC_DESF_NATIVE_RESP_BYTE2 ))
916 NdefSmtCrdFmt->State = PH_FRINFC_DESF_STATE_WRITE_NDEF_FILE;
919 phFriNfc_Desf_HWrapISONativeCmds(NdefSmtCrdFmt,PH_FRINFC_DESF_WRITENDEF_CMD);
921 Result = phFriNfc_Desf_HSendTransCmd(NdefSmtCrdFmt);
926 static NFCSTATUS phFriNfc_Desf_HSendTransCmd(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt)
933 NdefSmtCrdFmt->Cmd.Iso144434Cmd = phHal_eIso14443_4_Raw;
935 NdefSmtCrdFmt->Cmd.Iso144434Cmd = phHal_eIso14443_4_CmdListTClCmd;
939 NdefSmtCrdFmt->psDepAdditionalInfo.DepFlags.MetaChaining = 0;
940 NdefSmtCrdFmt->psDepAdditionalInfo.DepFlags.NADPresent = 0;
943 NdefSmtCrdFmt->SmtCrdFmtCompletionInfo.CompletionRoutine = phFriNfc_NdefSmtCrd_Process;
944 NdefSmtCrdFmt->SmtCrdFmtCompletionInfo.Context = NdefSmtCrdFmt;
947 *NdefSmtCrdFmt->SendRecvLength = PH_FRINFC_SMTCRDFMT_MAX_SEND_RECV_BUF_SIZE;
951 status = phFriNfc_OvrHal_Transceive(NdefSmtCrdFmt->LowerDevice,
952 &NdefSmtCrdFmt->SmtCrdFmtCompletionInfo,
953 NdefSmtCrdFmt->psRemoteDevInfo,
954 NdefSmtCrdFmt->Cmd,
955 &NdefSmtCrdFmt->psDepAdditionalInfo,
956 NdefSmtCrdFmt->SendRecvBuf,
957 NdefSmtCrdFmt->SendLength,
958 NdefSmtCrdFmt->SendRecvBuf,
959 NdefSmtCrdFmt->SendRecvLength);
966 NFCSTATUS phFriNfc_Desfire_Format(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt)
971 NdefSmtCrdFmt->CardType = 0;
973 status = phFriNfc_Desf_HGetHWVersion(NdefSmtCrdFmt);
983 phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt)
993 phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt)
999 NdefSmtCrdFmt->SendRecvBuf[(*NdefSmtCrdFmt->SendRecvLength - 2)])
1001 NdefSmtCrdFmt->SendRecvBuf[(*NdefSmtCrdFmt->SendRecvLength - 1)]))
1003 NdefSmtCrdFmt->State = PH_FRINFC_DESF_STATE_RO_READ_CC_FILE;
1006 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_NATIVE_CLASS_BYTE;
1011 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_READ_DATA_CMD;
1016 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_NATIVE_OFFSET_P1;
1018 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_NATIVE_OFFSET_P2;
1022 NdefSmtCrdFmt->SendRecvBuf[i] = NATIVE_WRAPPER_READ_DATA_LC_VALUE;
1026 if (DESFIRE_CARD_TYPE_EV1 == NdefSmtCrdFmt->CardType)
1029 NdefSmtCrdFmt->SendRecvBuf[i] = DESFIRE_EV1_CC_FILE_ID;
1036 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_CC_FILE_ID;
1041 NdefSmtCrdFmt->SendRecvBuf[i] = 0x00;
1043 NdefSmtCrdFmt->SendRecvBuf[i] = 0x00;
1045 NdefSmtCrdFmt->SendRecvBuf[i] = 0x00;
1049 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_CC_FILE_SIZE;
1051 NdefSmtCrdFmt->SendRecvBuf[i] = 0x00;
1053 NdefSmtCrdFmt->SendRecvBuf[i] = 0x00;
1057 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_NATIVE_LE_BYTE;
1060 NdefSmtCrdFmt->SendLength = i;
1062 result = phFriNfc_Desf_HSendTransCmd (NdefSmtCrdFmt);
1076 phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt)
1083 NdefSmtCrdFmt->SendRecvBuf[(*NdefSmtCrdFmt->SendRecvLength - 2)])
1085 NdefSmtCrdFmt->SendRecvBuf[(*NdefSmtCrdFmt->SendRecvLength - 1)]))
1087 NdefSmtCrdFmt->State = PH_FRINFC_DESF_STATE_RO_UPDATE_CC_FILE;
1089 memcpy ((void *)read_cc_btyes, (void *)NdefSmtCrdFmt->SendRecvBuf,
1094 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_NATIVE_CLASS_BYTE;
1099 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_WRITE_CMD;
1104 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_NATIVE_OFFSET_P1;
1106 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_NATIVE_OFFSET_P2;
1110 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_NATIVE_WRCC_WRDT_LEN;
1114 if (DESFIRE_CARD_TYPE_EV1 == NdefSmtCrdFmt->CardType)
1117 NdefSmtCrdFmt->SendRecvBuf[i] = DESFIRE_EV1_CC_FILE_ID;
1124 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_CC_FILE_ID;
1129 NdefSmtCrdFmt->SendRecvBuf[i] = 0x00;
1131 NdefSmtCrdFmt->SendRecvBuf[i] = 0x00;
1133 NdefSmtCrdFmt->SendRecvBuf[i] = 0x00;
1137 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_CC_FILE_SIZE;
1139 NdefSmtCrdFmt->SendRecvBuf[i] = 0x00;
1141 NdefSmtCrdFmt->SendRecvBuf[i] = 0x00;
1145 (void)memcpy ((void *)&NdefSmtCrdFmt->SendRecvBuf[i],
1155 NdefSmtCrdFmt->SendRecvBuf[i] = PH_FRINFC_DESF_NATIVE_LE_BYTE;
1158 if (DESFIRE_CARD_TYPE_EV1 == NdefSmtCrdFmt->CardType)
1160 NdefSmtCrdFmt->SendLength = i;
1165 NdefSmtCrdFmt->SendLength = PH_FRINFC_DESF_WRITECC_CMD_SNLEN;
1168 result = phFriNfc_Desf_HSendTransCmd (NdefSmtCrdFmt);
1182 phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt)
1186 NdefSmtCrdFmt->CardType = 0;
1188 NdefSmtCrdFmt->State = PH_FRINFC_DESF_STATE_RO_SELECT_APP;
1191 phFriNfc_Desf_HWrapISONativeCmds (NdefSmtCrdFmt, PH_FRINFC_DESF_SELECTAPP_CMD);
1193 result = phFriNfc_Desf_HSendTransCmd (NdefSmtCrdFmt);
1202 phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt)
1206 NdefSmtCrdFmt->CardType = DESFIRE_CARD_TYPE_EV1;
1208 NdefSmtCrdFmt->State = PH_FRINFC_DESF_STATE_RO_SELECT_APP_EV1;
1211 phFriNfc_Desf_HWrapISONativeCmds (NdefSmtCrdFmt, PH_FRINFC_DESF_SELECTAPP_CMD);
1213 result = phFriNfc_Desf_HSendTransCmd (NdefSmtCrdFmt);
1221 phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt)
1226 result = phFriNfc_Desf_HReadOnlySelectAppEV1 (NdefSmtCrdFmt);
1228 result = phFriNfc_Desf_HReadOnlySelectApp (NdefSmtCrdFmt);
1240 phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt;
1242 NdefSmtCrdFmt = (phFriNfc_sNdefSmtCrdFmt_t *)Context;
1246 switch(NdefSmtCrdFmt->State)
1253 NdefSmtCrdFmt->SendRecvBuf[(*NdefSmtCrdFmt->SendRecvLength - 2)])
1255 NdefSmtCrdFmt->SendRecvBuf[(*NdefSmtCrdFmt->SendRecvLength - 1)]))
1257 Status = phFriNfc_Desf_HReadOnlyReadCCFile (NdefSmtCrdFmt);
1261 Status = phFriNfc_Desf_HReadOnlySelectApp (NdefSmtCrdFmt);
1269 Status = phFriNfc_Desf_HReadOnlyReadCCFile (NdefSmtCrdFmt);
1275 Status = phFriNfc_Desf_HReadOnlyWriteCCFile (NdefSmtCrdFmt);
1282 NdefSmtCrdFmt->SendRecvBuf[(*NdefSmtCrdFmt->SendRecvLength - 2)])
1284 NdefSmtCrdFmt->SendRecvBuf[(*NdefSmtCrdFmt->SendRecvLength - 1)]))
1288 if (DESFIRE_CARD_TYPE_EV1 == NdefSmtCrdFmt->CardType)
1291 NdefSmtCrdFmt->LowerDevice,
1292 &NdefSmtCrdFmt->SmtCrdFmtCompletionInfo,
1293 NdefSmtCrdFmt->psRemoteDevInfo);
1297 NdefSmtCrdFmt->State = PH_FRINFC_DESF_STATE_REACTIVATE;
1316 Status = phFriNfc_Desf_HGetSWVersion (NdefSmtCrdFmt);
1326 Status = phFriNfc_Desf_HUpdateVersionDetails (NdefSmtCrdFmt);
1329 Status = phFriNfc_Desf_HGetUIDDetails (NdefSmtCrdFmt);
1336 Status = phFriNfc_Desf_HCreateApp (NdefSmtCrdFmt);
1342 Status = phFriNfc_Desf_HSelectApp (NdefSmtCrdFmt);
1348 Status = phFriNfc_Desf_HCreatCCFile (NdefSmtCrdFmt);
1354 Status = phFriNfc_Desf_HCreatNDEFFile (NdefSmtCrdFmt);
1360 Status = phFriNfc_Desf_HWrCCBytes (NdefSmtCrdFmt);
1366 Status = phFriNfc_Desf_HWrNDEFData (NdefSmtCrdFmt);
1373 NdefSmtCrdFmt->SendRecvBuf[PH_SMTCRDFMT_DESF_VAL0]) &&
1375 NdefSmtCrdFmt->SendRecvBuf[PH_SMTCRDFMT_DESF_VAL1]))
1377 NdefSmtCrdFmt->CardState = 0;
1379 if (DESFIRE_CARD_TYPE_EV1 == NdefSmtCrdFmt->CardType)
1382 NdefSmtCrdFmt->LowerDevice,
1383 &NdefSmtCrdFmt->SmtCrdFmtCompletionInfo,
1384 NdefSmtCrdFmt->psRemoteDevInfo);
1388 NdefSmtCrdFmt->State = PH_FRINFC_DESF_STATE_REACTIVATE;
1421 phFriNfc_SmtCrdFmt_HCrHandler(NdefSmtCrdFmt,Status);