summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Brands <jan.r.brands@nxp.com>2010-11-30 23:23:23 +0100
committerNick Pelly <npelly@google.com>2010-12-05 13:14:46 -0800
commit794aa72f7bd1e5b1fb51efb957cb925c7cfed746 (patch)
tree07b8cad50382ddc53715d84bea5f65b8f364c80c
parent3043b52934292173592f27dcbb054321001a3017 (diff)
downloadlibnfc-nxp-794aa72f7bd1e5b1fb51efb957cb925c7cfed746.tar.gz
This patch allows type 4 tag v2 ndef to be detected properly.
Same as Change-Id: I414e7864bdc654c3b9e1b459832bb8e95ea9c51a Change-Id: I0a0119349419bb4f1031ab683e40dd3be7b26f5f
-rw-r--r--src/phFriNfc_DesfireMap.c417
-rw-r--r--src/phFriNfc_DesfireMap.h66
-rw-r--r--src/phFriNfc_MapTools.c141
-rw-r--r--src/phFriNfc_MapTools.h27
-rw-r--r--src/phFriNfc_NdefMap.c272
-rw-r--r--src/phFriNfc_NdefMap.h219
6 files changed, 688 insertions, 454 deletions
diff --git a/src/phFriNfc_DesfireMap.c b/src/phFriNfc_DesfireMap.c
index 6667bb0..0c303a2 100644
--- a/src/phFriNfc_DesfireMap.c
+++ b/src/phFriNfc_DesfireMap.c
@@ -17,14 +17,14 @@
/*!
* \file phFriNfc_Desfire.c
* \brief This component encapsulates read/write/check ndef/process functionalities,
-* for the Desfire Card.
+* for the Desfire Card.
*
* Project: NFC-FRI
*
-* $Date: Thu Jul 23 13:45:00 2009 $
-* $Author: ing07336 $
-* $Revision: 1.10 $
-* $Aliases: NFC_FRI1.1_WK930_R30_1,NFC_FRI1.1_WK934_PREP_1,NFC_FRI1.1_WK934_R31_1,NFC_FRI1.1_WK941_PREP1,NFC_FRI1.1_WK941_PREP2,NFC_FRI1.1_WK941_1,NFC_FRI1.1_WK943_R32_1,NFC_FRI1.1_WK949_PREP1,NFC_FRI1.1_WK943_R32_10,NFC_FRI1.1_WK943_R32_13,NFC_FRI1.1_WK943_R32_14,NFC_FRI1.1_WK1007_R33_1,NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $
+* $Date: Tue Jul 27 08:58:22 2010 $
+* $Author: ing02260 $
+* $Revision: 1.11 $
+* $Aliases: $
*
*/
@@ -42,11 +42,18 @@
*
*/
/*@{*/
-#define PHFRINFCNDEFMAP_FILEREVISION "$Revision: 1.10 $"
-#define PHFRINFCNDEFMAP_FILEALIASES "$Aliases: NFC_FRI1.1_WK930_R30_1,NFC_FRI1.1_WK934_PREP_1,NFC_FRI1.1_WK934_R31_1,NFC_FRI1.1_WK941_PREP1,NFC_FRI1.1_WK941_PREP2,NFC_FRI1.1_WK941_1,NFC_FRI1.1_WK943_R32_1,NFC_FRI1.1_WK949_PREP1,NFC_FRI1.1_WK943_R32_10,NFC_FRI1.1_WK943_R32_13,NFC_FRI1.1_WK943_R32_14,NFC_FRI1.1_WK1007_R33_1,NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $"
+#define PHFRINFCNDEFMAP_FILEREVISION "$Revision: 1.11 $"
+#define PHFRINFCNDEFMAP_FILEALIASES "$Aliases: $"
/*@}*/
+/***************** Start of MACROS ********************/
+#ifdef DESFIRE_EV1
+ #define DESFIRE_EV1_P2_OFFSET_VALUE (0x0CU)
+#endif /* #ifdef DESFIRE_EV1 */
+
+/***************** End of MACROS ********************/
+
/*@}*/
/*!
@@ -56,34 +63,34 @@
/*@{*/
/*!
- * \brief \copydoc page_ovr Helper function for Desfire. This function specifies
+ * \brief \copydoc page_ovr Helper function for Desfire. This function specifies
* the card is a Desfire card or not.
*/
static NFCSTATUS phFriNfc_Desfire_SelectSmartTag( phFriNfc_NdefMap_t *NdefMap);
/*!
- * \brief \copydoc page_ovr Helper function for Desfire. This function is used
+ * \brief \copydoc page_ovr Helper function for Desfire. This function is used
* to selct a file in the card.
*/
static NFCSTATUS phFriNfc_Desfire_SelectFile ( phFriNfc_NdefMap_t *NdefMap);
/*!
- * \brief \copydoc page_ovr Helper function for Desfire. This function is to
+ * \brief \copydoc page_ovr Helper function for Desfire. This function is to
* read the card.
*/
static NFCSTATUS phFriNfc_Desfire_ReadBinary( phFriNfc_NdefMap_t *NdefMap);
/*!
- * \brief \copydoc page_ovr Helper function for Desfire. This function is to
+ * \brief \copydoc page_ovr Helper function for Desfire. This function is to
* write to the card.
*/
static NFCSTATUS phFriNfc_Desfire_UpdateBinary( phFriNfc_NdefMap_t *NdefMap);
/*!
- * \brief \copydoc page_ovr Helper function for Desfire. This function is to
+ * \brief \copydoc page_ovr Helper function for Desfire. This function is to
* update the capability container of the card.
*/
-static NFCSTATUS phFriNfc_Desfire_Update_SmartTagCapContainer( phFriNfc_NdefMap_t *NdefMap);
+static NFCSTATUS phFriNfc_Desfire_Update_SmartTagCapContainer( phFriNfc_NdefMap_t *NdefMap);
/* Completion Helper*/
@@ -93,7 +100,7 @@ static void phFriNfc_Desfire_HCrHandler( phFriNfc_NdefMap_t *NdefMap,
/* Calculates the Le Bytes for Read Operation*/
static uint32_t phFriNfc_Desfire_HGetLeBytes( phFriNfc_NdefMap_t *NdefMap);
-static NFCSTATUS phFriNfc_Desf_HChkAndParseTLV( phFriNfc_NdefMap_t *NdefMap,
+static NFCSTATUS phFriNfc_Desf_HChkAndParseTLV( phFriNfc_NdefMap_t *NdefMap,
uint8_t BuffIndex);
static NFCSTATUS phFriNfc_Desfire_HSetGet_NLEN( phFriNfc_NdefMap_t *NdefMap);
@@ -150,7 +157,7 @@ static NFCSTATUS phFriNfc_Desfire_HGetSWVersion(phFriNfc_NdefMap_t *NdefMap)
#ifdef PH_HAL4_ENABLE
else
{
- status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
+ status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
NFCSTATUS_INVALID_PARAMETER);
}
#endif /* #ifdef PH_HAL4_ENABLE */
@@ -175,7 +182,7 @@ static NFCSTATUS phFriNfc_Desfire_HGetUIDDetails(phFriNfc_NdefMap_t *NdefMap)
#ifdef PH_HAL4_ENABLE
else
{
- status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
+ status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
NFCSTATUS_INVALID_PARAMETER);
}
#endif /* #ifdef PH_HAL4_ENABLE */
@@ -185,7 +192,7 @@ static NFCSTATUS phFriNfc_Desfire_HGetUIDDetails(phFriNfc_NdefMap_t *NdefMap)
static NFCSTATUS phFriNfc_Desfire_HUpdateVersionDetails(const phFriNfc_NdefMap_t *NdefMap)
{
- NFCSTATUS status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
+ NFCSTATUS status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
NFCSTATUS_INVALID_PARAMETER);
if( ( NdefMap->SendRecvBuf[*(NdefMap->SendRecvLength)- 1] == 0xAF) )
@@ -222,7 +229,7 @@ static NFCSTATUS phFriNfc_Desfire_HUpdateVersionDetails(const phFriNfc_NdefMap_t
*
* The function initiates the reading of NDEF information from a Remote Device.
* It performs a reset of the state and starts the action (state machine).
-* A periodic call of the \ref phFriNfcNdefMap_Process has to be
+* A periodic call of the \ref phFriNfcNdefMap_Process has to be
* done once the action has been triggered.
*/
@@ -246,7 +253,7 @@ NFCSTATUS phFriNfc_Desfire_RdNdef( phFriNfc_NdefMap_t *NdefMap,
{
/* No space on card for Reading : we have already
reached the end of file !
- Offset is set to Continue Operation */
+ Offset is set to Continue Operation */
status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
NFCSTATUS_EOF_NDEF_CONTAINER_REACHED);
}
@@ -265,8 +272,17 @@ NFCSTATUS phFriNfc_Desfire_RdNdef( phFriNfc_NdefMap_t *NdefMap,
NdefMap->PrevOperation = PH_FRINFC_NDEFMAP_READ_OPE;
+#ifdef DESFIRE_EV1
/* Select smart tag operation. First step for the read operation. */
- status = phFriNfc_Desfire_SelectSmartTag(NdefMap);
+ if (PH_FRINFC_NDEFMAP_ISO14443_4A_CARD_EV1 == NdefMap->CardType)
+ {
+ status = phFriNfc_Desfire_SelectFile(NdefMap);
+ }
+ else
+#endif /* #ifdef DESFIRE_EV1 */
+ {
+ status = phFriNfc_Desfire_SelectSmartTag(NdefMap);
+ }
}
return status;
@@ -302,7 +318,7 @@ NFCSTATUS phFriNfc_Desfire_WrNdef( phFriNfc_NdefMap_t *NdefMap,
{
/* No space on card for writing : we have already
reached the end of file !
- Offset is set to Continue Operation */
+ Offset is set to Continue Operation */
status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
NFCSTATUS_EOF_NDEF_CONTAINER_REACHED);
}
@@ -318,8 +334,17 @@ NFCSTATUS phFriNfc_Desfire_WrNdef( phFriNfc_NdefMap_t *NdefMap,
/*Store the packet data buffer*/
NdefMap->ApduBuffer = PacketData;
- /* Select smart tag operation. First step for the write operation. */
- status = phFriNfc_Desfire_SelectSmartTag (NdefMap);
+#ifdef DESFIRE_EV1
+ if (PH_FRINFC_NDEFMAP_ISO14443_4A_CARD_EV1 == NdefMap->CardType)
+ {
+ status = phFriNfc_Desfire_SelectFile(NdefMap);
+ }
+ else
+#endif /* #ifdef DESFIRE_EV1 */
+ {
+ /* Select smart tag operation. First step for the write operation. */
+ status = phFriNfc_Desfire_SelectSmartTag (NdefMap);
+ }
}
return status;
}
@@ -337,6 +362,10 @@ NFCSTATUS phFriNfc_Desfire_ChkNdef( phFriNfc_NdefMap_t *NdefMap)
#ifdef PH_HAL4_ENABLE
+#ifdef DESFIRE_EV1
+ /* Reset card type */
+ NdefMap->CardType = 0;
+#endif /* #ifdef DESFIRE_EV1 */
/*Set the desfire operation flag*/
NdefMap->DespOpFlag = PH_FRINFC_NDEFMAP_DESF_NDEF_CHK_OP;
@@ -355,7 +384,7 @@ static NFCSTATUS phFriNfc_Desf_HChkAndParseTLV(phFriNfc_NdefMap_t *NdefMap,
{
NFCSTATUS status = NFCSTATUS_SUCCESS;
- if((NdefMap->SendRecvBuf[BuffIndex] <= 0x03) ||
+ if((NdefMap->SendRecvBuf[BuffIndex] <= 0x03) ||
(NdefMap->SendRecvBuf[BuffIndex] >= 0x06) )
{
status = PHNFCSTVAL( CID_FRI_NFC_NDEF_MAP,
@@ -364,9 +393,9 @@ static NFCSTATUS phFriNfc_Desf_HChkAndParseTLV(phFriNfc_NdefMap_t *NdefMap,
else
{
/* check for the type of TLV*/
- NdefMap->TLVFoundFlag =
+ NdefMap->TLVFoundFlag =
((NdefMap->SendRecvBuf[BuffIndex] == 0x04)?
- PH_FRINFC_NDEFMAP_DESF_NDEF_CNTRL_TLV:
+ PH_FRINFC_NDEFMAP_DESF_NDEF_CNTRL_TLV:
PH_FRINFC_NDEFMAP_DESF_PROP_CNTRL_TLV);
status = PHNFCSTVAL( CID_FRI_NFC_NDEF_MAP,
@@ -388,13 +417,13 @@ static NFCSTATUS phFriNfc_Desfire_HSetGet_NLEN(phFriNfc_NdefMap_t *NdefMap)
}
else
{
-
+
/* Get the Data Count and set it to NoOfBytesWritten
Update the NLEN using Transceive cmd*/
- /*Form the packet for the update binary command*/
- NdefMap->SendRecvBuf[0] = 0x00;
- NdefMap->SendRecvBuf[1] = 0xD6;
+ /*Form the packet for the update binary command*/
+ NdefMap->SendRecvBuf[0] = 0x00;
+ NdefMap->SendRecvBuf[1] = 0xD6;
/* As we need to set the NLEN @ first 2 bytes of NDEF File*/
/* set the p1/p2 offsets */
@@ -424,7 +453,7 @@ static void phFriNfc_Desfire_HProcReadData(phFriNfc_NdefMap_t *NdefMap)
uint32_t BufferSize = 0;
uint8_t BufIndex=0;
uint16_t SizeToCpy=0;
-
+
/* Need to check the Actual Ndef Length before copying the data to buffer*/
/* Only NDEF data should be copied , rest all the data should be ignored*/
/* Ex : Ndef File Size 50 bytes , but only 5 bytes(NLEN) are relavent to NDEF data*/
@@ -449,7 +478,7 @@ static void phFriNfc_Desfire_HProcReadData(phFriNfc_NdefMap_t *NdefMap)
NdefMap->DesfireCapContainer.NdefDataLen);
/* Decide how many byes to be copied into user buffer: depending upon the actual NDEF
- size need to copy the content*/
+ size need to copy the content*/
if ( (NdefMap->DesfireCapContainer.NdefDataLen) <= (*NdefMap->SendRecvLength - \
(PH_FRINFC_NDEFMAP_DESF_RESP_OFFSET + BufIndex)))
{
@@ -460,39 +489,39 @@ static void phFriNfc_Desfire_HProcReadData(phFriNfc_NdefMap_t *NdefMap)
{
SizeToCpy = ((*NdefMap->SendRecvLength)-(PH_FRINFC_NDEFMAP_DESF_RESP_OFFSET+BufIndex));
}
-
+
/* Check do we have Ndef Data len > 0 present in the card.If No Ndef Data
present in the card , set the card state to Initalised and set an Error*/
if ( NdefMap->DesfireCapContainer.NdefDataLen == 0x00 )
{
NdefMap->CardState = PH_NDEFMAP_CARD_STATE_INITIALIZED;
- Result = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP, NFCSTATUS_EOF_NDEF_CONTAINER_REACHED);
+ Result = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP, NFCSTATUS_EOF_NDEF_CONTAINER_REACHED);
#ifdef PH_HAL4_ENABLE
#else
NdefMap->PrevOperation = 0;
#endif /* #ifdef PH_HAL4_ENABLE */
- phFriNfc_Desfire_HCrHandler(NdefMap,Result);
+ phFriNfc_Desfire_HCrHandler(NdefMap,Result);
}
else
{
- (void)memcpy( (&(NdefMap->ApduBuffer[
+ (void)memcpy( (&(NdefMap->ApduBuffer[
NdefMap->ApduBuffIndex])),
(&(NdefMap->SendRecvBuf[BufIndex])),
(SizeToCpy));
/* Increment the Number of Bytes Read, which will be returned to the caller. */
- *NdefMap->NumOfBytesRead +=SizeToCpy;
+ *NdefMap->NumOfBytesRead = (uint32_t)(*NdefMap->NumOfBytesRead + SizeToCpy);
/*update the data count*/
- *NdefMap->DataCount += SizeToCpy;
+ *NdefMap->DataCount = (uint16_t)(*NdefMap->DataCount + SizeToCpy);
/*update the buffer index of the apdu buffer*/
- NdefMap->ApduBuffIndex += SizeToCpy;
+ NdefMap->ApduBuffIndex = (uint16_t)(NdefMap->ApduBuffIndex + SizeToCpy);
}
}
else
{
- (void)memcpy( (&(NdefMap->ApduBuffer[
+ (void)memcpy( (&(NdefMap->ApduBuffer[
NdefMap->ApduBuffIndex])),
(NdefMap->SendRecvBuf),/* to avoid the length of the NDEF File*/
(*(NdefMap->SendRecvLength)-(PH_FRINFC_NDEFMAP_DESF_RESP_OFFSET)));
@@ -512,15 +541,15 @@ static void phFriNfc_Desfire_HProcReadData(phFriNfc_NdefMap_t *NdefMap)
/* check whether we still have to read some more data. */
if (*NdefMap->DataCount < NdefMap->DesfireCapContainer.NdefDataLen )
- {
+ {
/* we have some bytes to read. */
/* Now check, we still have bytes left in the user buffer. */
- BufferSize = NdefMap->ApduBufferSize - NdefMap->ApduBuffIndex;
+ BufferSize = NdefMap->ApduBufferSize - NdefMap->ApduBuffIndex;
if(BufferSize != 0)
{
/* Before read need to set the flag to intimate the module to
- dont skip the first 2 bytes as we are in mode reading next
+ dont skip the first 2 bytes as we are in mode reading next
continues available bytes, which will not contain the NLEN
information in the begining part that is 2 bytes*/
NdefMap->DesfireCapContainer.IsNlenPresentFlag = 1;
@@ -535,12 +564,12 @@ static void phFriNfc_Desfire_HProcReadData(phFriNfc_NdefMap_t *NdefMap)
}
else
{
- /* There are some more bytes to read, but
+ /* There are some more bytes to read, but
no space in the user buffer */
Result = PHNFCSTVAL(CID_NFC_NONE,NFCSTATUS_SUCCESS);
NdefMap->ApduBuffIndex =0;
/* call respective CR */
- phFriNfc_Desfire_HCrHandler(NdefMap,Result);
+ phFriNfc_Desfire_HCrHandler(NdefMap,Result);
}
}
else
@@ -571,9 +600,9 @@ static void phFriNfc_Desfire_HProcReadData(phFriNfc_NdefMap_t *NdefMap)
NdefMap->ApduBuffIndex = 0;
-
+
/* call respective CR */
- phFriNfc_Desfire_HCrHandler(NdefMap,Result);
+ phFriNfc_Desfire_HCrHandler(NdefMap,Result);
}
}
@@ -596,13 +625,16 @@ void phFriNfc_Desfire_Process(void *Context,
uint16_t NLength = 0,
SendRecLen=0;
uint32_t BytesRead = 0;
-
+#ifdef DESFIRE_EV1
+ static uint8_t card_type = PH_FRINFC_NDEFMAP_ISO14443_4A_CARD;
+#endif /* #ifdef DESFIRE_EV1 */
+
/* Sujatha P: Fix for 0000255/0000257:[gk] MAP:Handling HAL Errors */
if ( Status == NFCSTATUS_SUCCESS )
{
switch (NdefMap->State)
- {
+ {
#ifdef PH_HAL4_ENABLE
#else
@@ -638,7 +670,7 @@ void phFriNfc_Desfire_Process(void *Context,
phFriNfc_Desfire_HCrHandler(NdefMap,Status);
}
}
-
+
break;
case PH_FRINFC_DESF_STATE_GET_UID :
@@ -652,10 +684,51 @@ void phFriNfc_Desfire_Process(void *Context,
break;
#endif /* #ifdef PH_HAL4_ENABLE */
- case PH_FRINFC_NDEFMAP_DESF_STATE_SELECT_SMART_TAG:
+#ifdef DESFIRE_EV1
+ case PH_FRINFC_NDEFMAP_DESF_STATE_SELECT_SMART_TAG_EV1:
+ {
+ if(( NdefMap->SendRecvBuf[(*(NdefMap->SendRecvLength) - 2)] ==
+ PH_FRINFC_NDEFMAP_DESF_RAPDU_SW1_BYTE) &&
+ (NdefMap->SendRecvBuf[(*(NdefMap->SendRecvLength) - 1)] ==
+ PH_FRINFC_NDEFMAP_DESF_RAPDU_SW2_BYTE))
+ {
+ card_type = PH_FRINFC_NDEFMAP_ISO14443_4A_CARD_EV1;
+ NdefMap->CardType = card_type;
+
+ Status = phFriNfc_Desfire_SelectFile(NdefMap);
- if(( NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_DESF_SW1_INDEX] == PH_FRINFC_NDEFMAP_DESF_RAPDU_SW1_BYTE) &&
- (NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_DESF_SW2_INDEX] == PH_FRINFC_NDEFMAP_DESF_RAPDU_SW2_BYTE))
+ /* handle the error in Transc function*/
+ if ((Status & PHNFCSTBLOWER) != (NFCSTATUS_PENDING & PHNFCSTBLOWER))
+ {
+ /* call respective CR */
+ phFriNfc_Desfire_HCrHandler(NdefMap,Status);
+ }
+ }
+ else
+ {
+ NdefMap->CardType = PH_FRINFC_NDEFMAP_ISO14443_4A_CARD;
+ /* The card is not the new desfire, so send select smart tag command
+ of the old desfire */
+ Status = phFriNfc_Desfire_SelectSmartTag(NdefMap);
+
+
+ }
+ break;
+ }
+#endif /* #ifdef DESFIRE_EV1 */
+
+ case PH_FRINFC_NDEFMAP_DESF_STATE_SELECT_SMART_TAG:
+#ifdef DESFIRE_EV1
+ if(( NdefMap->SendRecvBuf[(*(NdefMap->SendRecvLength) - 2)] ==
+ PH_FRINFC_NDEFMAP_DESF_RAPDU_SW1_BYTE) &&
+ (NdefMap->SendRecvBuf[(*(NdefMap->SendRecvLength) - 1)] ==
+ PH_FRINFC_NDEFMAP_DESF_RAPDU_SW2_BYTE))
+#else
+ if(( NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_DESF_SW1_INDEX] ==
+ PH_FRINFC_NDEFMAP_DESF_RAPDU_SW1_BYTE) &&
+ (NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_DESF_SW2_INDEX] ==
+ PH_FRINFC_NDEFMAP_DESF_RAPDU_SW2_BYTE))
+#endif /* #ifdef DESFIRE_EV1 */
{
Status = phFriNfc_Desfire_SelectFile(NdefMap);
@@ -671,6 +744,9 @@ void phFriNfc_Desfire_Process(void *Context,
/*Error " Smart Tag Functionality Not Supported"*/
Status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,\
NFCSTATUS_SMART_TAG_FUNC_NOT_SUPPORTED);
+#ifdef DESFIRE_EV1
+ NdefMap->CardType = 0;
+#endif /* #ifdef DESFIRE_EV1 */
/* call respective CR */
phFriNfc_Desfire_HCrHandler(NdefMap,Status);
@@ -685,7 +761,7 @@ void phFriNfc_Desfire_Process(void *Context,
(NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_DESF_SW2_INDEX] == PH_FRINFC_NDEFMAP_DESF_RAPDU_SW2_BYTE))
{
/*check for the which operation */
- if( (NdefMap->DespOpFlag == PH_FRINFC_NDEFMAP_DESF_READ_OP) ||
+ if( (NdefMap->DespOpFlag == PH_FRINFC_NDEFMAP_DESF_READ_OP) ||
(NdefMap->DespOpFlag == PH_FRINFC_NDEFMAP_DESF_NDEF_CHK_OP) ||
(NdefMap->DespOpFlag == PH_FRINFC_NDEFMAP_DESF_GET_LEN_OP ))
{
@@ -742,7 +818,16 @@ void phFriNfc_Desfire_Process(void *Context,
if ( Status == NFCSTATUS_SUCCESS)
{
NdefMap->DespOpFlag = PH_FRINFC_NDEFMAP_DESF_GET_LEN_OP;
- Status = phFriNfc_Desfire_HSetGet_NLEN(NdefMap);
+#ifdef DESFIRE_EV1
+ if (PH_FRINFC_NDEFMAP_ISO14443_4A_CARD_EV1 == card_type)
+ {
+ Status = phFriNfc_Desfire_SelectFile(NdefMap);
+ }
+ else
+#endif /* #ifdef DESFIRE_EV1 */
+ {
+ Status = phFriNfc_Desfire_HSetGet_NLEN(NdefMap);
+ }
/* handle the error in Transc function*/
if ( (Status & PHNFCSTBLOWER) != (NFCSTATUS_PENDING & PHNFCSTBLOWER))
{
@@ -787,7 +872,7 @@ void phFriNfc_Desfire_Process(void *Context,
}
/* Read More Number Of Bytes than Expected*/
if ( ( BytesRead == SendRecLen ) &&
- ((NdefMap->SendRecvBuf[(*NdefMap->SendRecvLength-2)] == PH_FRINFC_NDEFMAP_DESF_RAPDU_SW1_BYTE) &&
+ ((NdefMap->SendRecvBuf[(*NdefMap->SendRecvLength-2)] == PH_FRINFC_NDEFMAP_DESF_RAPDU_SW1_BYTE) &&
(NdefMap->SendRecvBuf[(*NdefMap->SendRecvLength-1)] == PH_FRINFC_NDEFMAP_DESF_RAPDU_SW2_BYTE)))
{
@@ -814,9 +899,14 @@ void phFriNfc_Desfire_Process(void *Context,
if ( Status == NFCSTATUS_SUCCESS )
{
/*Set the card type to Desfire*/
+#ifdef DESFIRE_EV1
+ NdefMap->CardType = card_type;
+#else
NdefMap->CardType = PH_FRINFC_NDEFMAP_ISO14443_4A_CARD;
+#endif /* #ifdef DESFIRE_EV1 */
/*Set the state to specify True for Ndef Compliant*/
- NdefMap->State = PH_FRINFC_NDEFMAP_DESF_STATE_CHK_NDEF;
+ NdefMap->State = PH_FRINFC_NDEFMAP_DESF_STATE_CHK_NDEF;
+
/*set the data count back to zero*/;
*NdefMap->DataCount = 0;
/*set the apdu buffer index to zero*/
@@ -857,7 +947,7 @@ void phFriNfc_Desfire_Process(void *Context,
NdefMap->ApduBuffIndex = 0;
/* call respective CR */
- phFriNfc_Desfire_HCrHandler(NdefMap,Status);
+ phFriNfc_Desfire_HCrHandler(NdefMap,Status);
}
break;
@@ -869,8 +959,10 @@ void phFriNfc_Desfire_Process(void *Context,
/* Write operation was successful. */
/* NdefMap->NumOfBytesWritten have been written on to the card.
Update the DataCount and the ApduBufferIndex */
- *NdefMap->DataCount += NdefMap->NumOfBytesWritten;
- NdefMap->ApduBuffIndex += NdefMap->NumOfBytesWritten;
+ *NdefMap->DataCount = (uint16_t)(*NdefMap->DataCount +
+ NdefMap->NumOfBytesWritten);
+ NdefMap->ApduBuffIndex = (uint16_t)(NdefMap->ApduBuffIndex +
+ NdefMap->NumOfBytesWritten);
/* Update the user-provided buffer size to write */
*NdefMap->WrNdefPacketLength += NdefMap->NumOfBytesWritten;
@@ -888,7 +980,7 @@ void phFriNfc_Desfire_Process(void *Context,
NdefMap->ApduBuffIndex = 0;
/* call respective CR */
- phFriNfc_Desfire_HCrHandler(NdefMap,Status);
+ phFriNfc_Desfire_HCrHandler(NdefMap,Status);
}
break;
case PH_FRINFC_NDEFMAP_DESF_STATE_UPDATE_BIN_END :
@@ -902,10 +994,10 @@ void phFriNfc_Desfire_Process(void *Context,
NFCSTATUS_SUCCESS);
/* set the state & Data len into context*/
- NdefMap->CardState = ((NdefMap->CardState ==
- PH_NDEFMAP_CARD_STATE_INITIALIZED)?
- PH_NDEFMAP_CARD_STATE_READ_WRITE:
- NdefMap->CardState);
+ NdefMap->CardState = (uint8_t)((NdefMap->CardState ==
+ PH_NDEFMAP_CARD_STATE_INITIALIZED)?
+ PH_NDEFMAP_CARD_STATE_READ_WRITE :
+ NdefMap->CardState);
NdefMap->DesfireCapContainer.NdefDataLen = (uint16_t)(*NdefMap->WrNdefPacketLength);
#ifdef PH_HAL4_ENABLE
@@ -913,7 +1005,7 @@ void phFriNfc_Desfire_Process(void *Context,
#else
NdefMap->PrevOperation = 0;
#endif /* #ifndef PH_HAL4_ENABLE */
-
+
}
else
{
@@ -925,23 +1017,23 @@ void phFriNfc_Desfire_Process(void *Context,
/*set the buffer index back to zero*/
NdefMap->ApduBuffIndex = 0;
-
+
/* call respective CR */
phFriNfc_Desfire_HCrHandler(NdefMap,Status);
break;
- default:
+ default:
/*define the invalid state*/
Status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,\
NFCSTATUS_INVALID_DEVICE_REQUEST);
- phFriNfc_Desfire_HCrHandler(NdefMap,Status);
+ phFriNfc_Desfire_HCrHandler(NdefMap,Status);
break;
}
}
else
{
/* call respective CR */
- phFriNfc_Desfire_HCrHandler(NdefMap,Status);
+ phFriNfc_Desfire_HCrHandler(NdefMap,Status);
}
}
@@ -959,6 +1051,9 @@ NFCSTATUS phFriNfc_Desfire_SelectSmartTag(phFriNfc_NdefMap_t *NdefMap)
{
NFCSTATUS status = NFCSTATUS_PENDING;
+#ifdef DESFIRE_EV1
+ uint8_t card_type = PH_FRINFC_NDEFMAP_ISO14443_4A_CARD_EV1;
+#endif /* #ifdef DESFIRE_EV1 */
/*form the packet for Select smart tag command*/
NdefMap->SendRecvBuf[0] = 0x00; /* cls */
@@ -974,16 +1069,79 @@ NFCSTATUS phFriNfc_Desfire_SelectSmartTag(phFriNfc_NdefMap_t *NdefMap)
NdefMap->SendRecvBuf[8] = 0x00;
NdefMap->SendRecvBuf[9] = 0x85;
NdefMap->SendRecvBuf[10] = 0x01;
+
+#ifdef DESFIRE_EV1
+
+ switch (NdefMap->DespOpFlag)
+ {
+ case PH_FRINFC_NDEFMAP_DESF_NDEF_CHK_OP:
+ {
+ /* First select the smart tag using the new desfire EV1 and increment the
+ "sel_index" and if it fails then try the old desfire select smart tag
+ command */
+ if (0 == NdefMap->CardType)
+ {
+ /* p2
+ NdefMap->SendRecvBuf[3] = DESFIRE_EV1_P2_OFFSET_VALUE; */
+ NdefMap->SendRecvBuf[11] = 0x01;
+ /* Le */
+ NdefMap->SendRecvBuf[12] = 0x00;
+ NdefMap->State = PH_FRINFC_NDEFMAP_DESF_STATE_SELECT_SMART_TAG_EV1;
+ card_type = PH_FRINFC_NDEFMAP_ISO14443_4A_CARD_EV1;
+ }
+ else
+ {
+ NdefMap->SendRecvBuf[3] = 0x00; /* p2 */
+ NdefMap->SendRecvBuf[11] = 0x00;
+ NdefMap->State = PH_FRINFC_NDEFMAP_DESF_STATE_SELECT_SMART_TAG;
+ card_type = PH_FRINFC_NDEFMAP_ISO14443_4A_CARD;
+ }
+ break;
+ }
+
+ case PH_FRINFC_NDEFMAP_DESF_READ_OP:
+ default :
+ {
+ if (PH_FRINFC_NDEFMAP_ISO14443_4A_CARD_EV1 == NdefMap->CardType)
+ {
+ NdefMap->SendRecvBuf[11] = 0x01;
+ NdefMap->SendRecvBuf[12] = 0x00;
+ NdefMap->State = (uint8_t)PH_FRINFC_NDEFMAP_DESF_STATE_SELECT_SMART_TAG_EV1;
+ card_type = PH_FRINFC_NDEFMAP_ISO14443_4A_CARD_EV1;
+ }
+ else
+ {
+ NdefMap->SendRecvBuf[11] = 0x00;
+ NdefMap->State = (uint8_t)PH_FRINFC_NDEFMAP_DESF_STATE_SELECT_SMART_TAG;
+ card_type = PH_FRINFC_NDEFMAP_ISO14443_4A_CARD;
+ }
+ break;
+ }
+ }
+
+#else /* #ifdef DESFIRE_EV1 */
+
NdefMap->SendRecvBuf[11] = 0x00;
+#endif /* #ifdef DESFIRE_EV1 */
+
/*Set the Send length*/
NdefMap->SendLength = PH_FRINFC_NDEFMAP_DESF_CAPDU_SMARTTAG_PKT_SIZE;
+#ifdef DESFIRE_EV1
+
+ if (PH_FRINFC_NDEFMAP_ISO14443_4A_CARD_EV1 == card_type)
+ {
+ /* Send length is updated for the NEW DESFIRE EV1 */
+ NdefMap->SendLength = (uint16_t)(NdefMap->SendLength + 1);
+ }
+#else
/* Change the state to Select Smart Tag */
NdefMap->State = PH_FRINFC_NDEFMAP_DESF_STATE_SELECT_SMART_TAG;
+#endif /* #ifdef DESFIRE_EV1 */
status = phFriNfc_Desfire_HSendTransCmd(NdefMap,PH_FRINFC_NDEFMAP_DESF_RESP_OFFSET);
-
+
return status;
}
@@ -991,8 +1149,8 @@ NFCSTATUS phFriNfc_Desfire_SelectSmartTag(phFriNfc_NdefMap_t *NdefMap)
* \brief this shall select/access the capability container of the Desfire
* card.
*
-* This shall be used to identify, if NDEF data structure do exist on
-* the smart tag, we receive command completed status.
+* This shall be used to identify, if NDEF data structure do exist on
+* the smart tag, we receive command completed status.
*
*/
static
@@ -1005,7 +1163,7 @@ NFCSTATUS phFriNfc_Desfire_SelectFile (phFriNfc_NdefMap_t *NdefMap)
if ((NdefMap->DespOpFlag != PH_FRINFC_NDEFMAP_DESF_NDEF_CHK_OP)&& \
(NdefMap->DespOpFlag != PH_FRINFC_NDEFMAP_DESF_READ_OP)&&\
( NdefMap->DespOpFlag != PH_FRINFC_NDEFMAP_DESF_WRITE_OP) &&
- ( NdefMap->DespOpFlag != PH_FRINFC_NDEFMAP_DESF_GET_LEN_OP))
+ ( NdefMap->DespOpFlag != PH_FRINFC_NDEFMAP_DESF_GET_LEN_OP))
{
status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP, NFCSTATUS_INVALID_REMOTE_DEVICE);
}
@@ -1023,15 +1181,22 @@ NFCSTATUS phFriNfc_Desfire_SelectFile (phFriNfc_NdefMap_t *NdefMap)
NdefMap->SendRecvBuf[3] = 0x00; /* p2 */
NdefMap->SendRecvBuf[4] = 0x02; /* lc */
+#ifdef DESFIRE_EV1
+ if (PH_FRINFC_NDEFMAP_ISO14443_4A_CARD_EV1 == NdefMap->CardType)
+ {
+ NdefMap->SendRecvBuf[3] = DESFIRE_EV1_P2_OFFSET_VALUE; /* p2 */
+ }
+#endif /* #ifdef DESFIRE_EV1 */
+
if ( (NdefMap->DespOpFlag == PH_FRINFC_NDEFMAP_DESF_NDEF_CHK_OP))
{
/* cap container file identifier*/
- NdefMap->SendRecvBuf[5] = 0xe1;
+ NdefMap->SendRecvBuf[5] = 0xe1;
NdefMap->SendRecvBuf[6] = 0x03;
}
/* Mantis entry 0394 fixed */
- else
+ else
{
NdefMap->SendRecvBuf[5] = (uint8_t)((NdefMap->DesfireCapContainer.NdefMsgFid) >> PH_FRINFC_NDEFMAP_DESF_SHL8);
NdefMap->SendRecvBuf[6] = (uint8_t)((NdefMap->DesfireCapContainer.NdefMsgFid) & (0x00ff));
@@ -1052,9 +1217,9 @@ NFCSTATUS phFriNfc_Desfire_SelectFile (phFriNfc_NdefMap_t *NdefMap)
/*!
* \brief this shall read the data from Desfire card.
-*
+*
* This is used in two cases namely Reading the Capability container
-* data( le == 0 ) and reading the file data.Maximum bytes to be read during
+* data( le == 0 ) and reading the file data.Maximum bytes to be read during
* a single read binary is known after the reading the data from the capability
* conatainer.
*
@@ -1073,7 +1238,7 @@ NFCSTATUS phFriNfc_Desfire_ReadBinary(phFriNfc_NdefMap_t *NdefMap)
/*specifies capability container shall be read*/
NdefMap->SendRecvBuf[0] = 0x00;
NdefMap->SendRecvBuf[1] = 0xb0;
- NdefMap->SendRecvBuf[2] = 0x00; /* p1 */
+ NdefMap->SendRecvBuf[2] = 0x00; /* p1 */
NdefMap->SendRecvBuf[3] = 0x00; /* p2 */
NdefMap->SendRecvBuf[4] = 0x0F; /* le */
@@ -1088,11 +1253,11 @@ NFCSTATUS phFriNfc_Desfire_ReadBinary(phFriNfc_NdefMap_t *NdefMap)
/*desfire file read operation*/
else
{
- NdefMap->SendRecvBuf[0] = 0x00;
+ NdefMap->SendRecvBuf[0] = 0x00;
NdefMap->SendRecvBuf[1] = 0xb0;
/*TBD the NLEN bytes*/
- if( *NdefMap->DataCount == 0 )
+ if( *NdefMap->DataCount == 0 )
{
/* first read */
/* set the offset p1 and p2*/
@@ -1103,7 +1268,7 @@ NFCSTATUS phFriNfc_Desfire_ReadBinary(phFriNfc_NdefMap_t *NdefMap)
{
/* as the p1 of the 8bit is 0, p1 and p2 are used to store the
ofset value*/
- DataCnt = *NdefMap->DataCount;
+ DataCnt = *NdefMap->DataCount;
DataCnt += PH_FRINFC_NDEFMAP_DESF_NLEN_SIZE_IN_BYTES;
NdefMap->SendRecvBuf[2] = (uint8_t)((DataCnt)>> PH_FRINFC_NDEFMAP_DESF_SHL8);
NdefMap->SendRecvBuf[3] = (uint8_t)((DataCnt)& (0x00ff));
@@ -1139,30 +1304,30 @@ NFCSTATUS phFriNfc_Desfire_ReadBinary(phFriNfc_NdefMap_t *NdefMap)
if (OperFlag == 1 )
{
- status = phFriNfc_Desfire_HSendTransCmd(NdefMap,PH_FRINFC_NDEFMAP_MAX_SEND_RECV_BUF_SIZE);
+ status = phFriNfc_Desfire_HSendTransCmd(NdefMap,PH_FRINFC_NDEFMAP_MAX_SEND_RECV_BUF_SIZE);
}
else
{
- status = phFriNfc_Desfire_HSendTransCmd(NdefMap,(uint8_t)(BytesToRead +PH_FRINFC_NDEFMAP_DESF_RESP_OFFSET));
+ status = phFriNfc_Desfire_HSendTransCmd(NdefMap,(uint8_t)(BytesToRead +PH_FRINFC_NDEFMAP_DESF_RESP_OFFSET));
}
return (status);
}
/*!
* \brief this shall write the data to Desfire card.
-* Maximum bytes to be written during a single update binary
+* Maximum bytes to be written during a single update binary
* is known after the reading the data from the capability
* conatainer.
-*
+*
* le filed specifes , how many bytes of data to be written to the
* Card.
*
*/
static
-NFCSTATUS phFriNfc_Desfire_UpdateBinary(phFriNfc_NdefMap_t *NdefMap)
+NFCSTATUS phFriNfc_Desfire_UpdateBinary(phFriNfc_NdefMap_t *NdefMap)
{
- NFCSTATUS status = NFCSTATUS_PENDING;
+ NFCSTATUS status = NFCSTATUS_PENDING;
uint16_t noOfBytesToWrite = 0, DataCnt=0,
index=0;
@@ -1171,7 +1336,7 @@ NFCSTATUS phFriNfc_Desfire_UpdateBinary(phFriNfc_NdefMap_t *NdefMap)
(NdefMap->ApduBuffIndex < NdefMap->ApduBufferSize))
{
/* Yes, we have some bytes to write */
- /* Check and set the card memory size , if user sent bytes are more than the
+ /* Check and set the card memory size , if user sent bytes are more than the
card memory size*/
if( (uint16_t)(NdefMap->ApduBufferSize - NdefMap->ApduBuffIndex) >\
(uint16_t)(PH_NFCFRI_NDEFMAP_DESF_NDEF_FILE_SIZE - *NdefMap->DataCount))
@@ -1180,11 +1345,11 @@ NFCSTATUS phFriNfc_Desfire_UpdateBinary(phFriNfc_NdefMap_t *NdefMap)
}
/* Now, we have space in the card to write the data, */
- /*Form the packet for the update binary command*/
- NdefMap->SendRecvBuf[0] = 0x00;
- NdefMap->SendRecvBuf[1] = 0xD6;
+ /*Form the packet for the update binary command*/
+ NdefMap->SendRecvBuf[0] = 0x00;
+ NdefMap->SendRecvBuf[1] = 0xD6;
- if( *NdefMap->DataCount == 0)
+ if( *NdefMap->DataCount == 0)
{
/* set the p1/p2 offsets */
NdefMap->SendRecvBuf[2] = 0x00; /* p1 */
@@ -1195,11 +1360,11 @@ NFCSTATUS phFriNfc_Desfire_UpdateBinary(phFriNfc_NdefMap_t *NdefMap)
{
/* as the p1 of the 8bit is 0, p1 and p2 are used to store the
ofset value*/
- /* This sets card offset in a card for a write operation. + 2 is
+ /* This sets card offset in a card for a write operation. + 2 is
added as first 2 offsets represents the size of the NDEF Len present
in the file*/
- DataCnt = *NdefMap->DataCount;
+ DataCnt = *NdefMap->DataCount;
DataCnt += PH_FRINFC_NDEFMAP_DESF_NLEN_SIZE_IN_BYTES;
NdefMap->SendRecvBuf[2] = (uint8_t)((DataCnt)>> PH_FRINFC_NDEFMAP_DESF_SHL8);
NdefMap->SendRecvBuf[3] = (uint8_t)((DataCnt)& (0x00ff));
@@ -1265,7 +1430,7 @@ NFCSTATUS phFriNfc_Desfire_UpdateBinary(phFriNfc_NdefMap_t *NdefMap)
/* Change the state to Write */
NdefMap->State = PH_FRINFC_NDEFMAP_DESF_STATE_UPDATE_BIN_BEGIN;
- status = phFriNfc_Desfire_HSendTransCmd(NdefMap,PH_FRINFC_NDEFMAP_DESF_RESP_OFFSET);
+ status = phFriNfc_Desfire_HSendTransCmd(NdefMap,PH_FRINFC_NDEFMAP_DESF_RESP_OFFSET);
} /* if(NdefMap->ApduBuffIndex < NdefMap->ApduBufferSize) */
else
@@ -1273,7 +1438,7 @@ NFCSTATUS phFriNfc_Desfire_UpdateBinary(phFriNfc_NdefMap_t *NdefMap)
if ( (*NdefMap->DataCount == PH_NFCFRI_NDEFMAP_DESF_NDEF_FILE_SIZE) ||
(NdefMap->ApduBuffIndex == NdefMap->ApduBufferSize))
{
- /* The NdefMap->DespOpFlag = PH_FRINFC_NDEFMAP_DESF_SET_LEN_OP is not
+ /* The NdefMap->DespOpFlag = PH_FRINFC_NDEFMAP_DESF_SET_LEN_OP is not
required, because the DespOpFlag shall be WRITE_OP
*/
/* Update the NLEN Bytes*/
@@ -1302,7 +1467,7 @@ NFCSTATUS phFriNfc_Desfire_UpdateBinary(phFriNfc_NdefMap_t *NdefMap)
NdefMap->PrevOperation = 0;
/* call respective CR */
- phFriNfc_Desfire_HCrHandler(NdefMap,status);
+ phFriNfc_Desfire_HCrHandler(NdefMap,status);
}
}
@@ -1318,12 +1483,12 @@ static void phFriNfc_Desfire_HChkNDEFFileAccessRights(phFriNfc_NdefMap_t *NdefMa
(NdefMap->DesfireCapContainer.WriteAccess == 0x00 ))
{
/* Set the card state to Read/write State*/
- /* This state can be either INITIALISED or READWRITE. but default
+ /* This state can be either INITIALISED or READWRITE. but default
is INITIALISED */
NdefMap->CardState = PH_NDEFMAP_CARD_STATE_READ_WRITE;
}
- else if((NdefMap->DesfireCapContainer.ReadAccess == 0x00) &&
+ else if((NdefMap->DesfireCapContainer.ReadAccess == 0x00) &&
(NdefMap->DesfireCapContainer.WriteAccess == 0xFF ))
{
/* Set the card state to Read Only State*/
@@ -1338,17 +1503,17 @@ static void phFriNfc_Desfire_HChkNDEFFileAccessRights(phFriNfc_NdefMap_t *NdefMa
/*!
* \brief this shall update the Desfire capability container structure.
-*
+*
* This function shall store version,maximum Ndef data structure size,
-* Read Access permissions, Write Access permissions , Maximum data size
-* that can be sent using a single Update Binary, maximum data size that
+* Read Access permissions, Write Access permissions , Maximum data size
+* that can be sent using a single Update Binary, maximum data size that
* can be read from the Desfire using a singlr read binary.
-* These vaues shall be stored and used during the read/update binary
+* These vaues shall be stored and used during the read/update binary
* operations.
*
*/
static
-NFCSTATUS phFriNfc_Desfire_Update_SmartTagCapContainer(phFriNfc_NdefMap_t *NdefMap)
+NFCSTATUS phFriNfc_Desfire_Update_SmartTagCapContainer(phFriNfc_NdefMap_t *NdefMap)
{
uint16_t CapContSize = 0,
/* this is initalised 2 because CCLEN includes the field size bytes i.e 2bytes*/
@@ -1381,15 +1546,15 @@ NFCSTATUS phFriNfc_Desfire_Update_SmartTagCapContainer(phFriNfc_NdefMap_t *N
{
CCLen += 1;
- /*Get Response APDU data size
- to check the integration s/w response size*/
+ /*Get Response APDU data size
+ to check the integration s/w response size*/
#ifdef PH_HAL4_ENABLE
{
- uint16_t max_rsp_size =
+ uint16_t max_rsp_size =
((((uint16_t)NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_DESF_MLE_BYTE_FIRST_INDEX]) << 8)\
+ NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_DESF_MLE_BYTE_SECOND_INDEX]);
NdefMap->DesfireCapContainer.MaxRespSize =
- ((max_rsp_size > PHHAL_MAX_DATASIZE)?
+ ((max_rsp_size > PHHAL_MAX_DATASIZE)?
(PHHAL_MAX_DATASIZE) : max_rsp_size);
}
#else
@@ -1398,26 +1563,26 @@ NFCSTATUS phFriNfc_Desfire_Update_SmartTagCapContainer(phFriNfc_NdefMap_t *N
+NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_DESF_MLE_BYTE_SECOND_INDEX]);
#endif /* #ifdef PH_HAL4_ENABLE */
- /*Get Command APDU data size*/
+ /*Get Command APDU data size*/
#ifdef PH_HAL4_ENABLE
{
- uint16_t max_cmd_size =
+ uint16_t max_cmd_size =
((((uint16_t)NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_DESF_MLC_BYTE_FIRST_INDEX])<<8)\
+ NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_DESF_MLC_BYTE_SECOND_INDEX]);
- NdefMap->DesfireCapContainer.MaxCmdSize =
- ((max_cmd_size > PHHAL_MAX_DATASIZE)?
+ NdefMap->DesfireCapContainer.MaxCmdSize =
+ ((max_cmd_size > PHHAL_MAX_DATASIZE)?
(PHHAL_MAX_DATASIZE): max_cmd_size);
}
#else
- NdefMap->DesfireCapContainer.MaxCmdSize =
+ NdefMap->DesfireCapContainer.MaxCmdSize =
((((uint16_t)NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_DESF_MLC_BYTE_FIRST_INDEX])<<8)\
+NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_DESF_MLC_BYTE_SECOND_INDEX]);
#endif /* #ifdef PH_HAL4_ENABLE */
/* Check for the Validity of Cmd & Resp Size*/
/* check the Validity of the Cmd Size*/
if( (NdefMap->DesfireCapContainer.MaxRespSize < 0x0f) ||
- ( NdefMap->DesfireCapContainer.MaxCmdSize == 0x00))
+ ( NdefMap->DesfireCapContainer.MaxCmdSize == 0x00))
{
ErrFlag=1;
@@ -1457,9 +1622,9 @@ NFCSTATUS phFriNfc_Desfire_Update_SmartTagCapContainer(phFriNfc_NdefMap_t *N
ErrFlag=1;
}
else
- {
+ {
/*Get Ndef Size*/
- NdefMap->DesfireCapContainer.NdefFileSize =
+ NdefMap->DesfireCapContainer.NdefFileSize =
((((uint16_t)NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_DESF_NDEF_FILESZ_BYTE_FIRST_INDEX])<<8)
| (NdefMap->SendRecvBuf[PH_FRINFC_NDEFMAP_DESF_NDEF_FILESZ_BYTE_SECOND_INDEX] & 0x00ff));
@@ -1467,7 +1632,7 @@ NFCSTATUS phFriNfc_Desfire_Update_SmartTagCapContainer(phFriNfc_NdefMap_t *N
/*Check Ndef Size*/
/* TBD : Do we need to minus 2 bytes of size it self?*/
if ( ((NdefMap->DesfireCapContainer.NdefFileSize -2) <= 0x0004 ) ||
- ((NdefMap->DesfireCapContainer.NdefFileSize -2) == 0xFFFD ) )
+ ((NdefMap->DesfireCapContainer.NdefFileSize -2) == 0xFFFD ) )
{
ErrFlag=1;
}
@@ -1549,10 +1714,10 @@ static uint32_t phFriNfc_Desfire_HGetLeBytes(phFriNfc_NdefMap_t *NdefMap)
size bytes
Now, check do we have NdefMap->DesfireCapContainer.MaxRespSize to read ? */
- BytesToRead = (((NdefMap->DesfireCapContainer.NdefDataLen - *NdefMap->DataCount) >=
+ BytesToRead = (((NdefMap->DesfireCapContainer.NdefDataLen - *NdefMap->DataCount) >=
NdefMap->DesfireCapContainer.MaxRespSize) ?
NdefMap->DesfireCapContainer.MaxRespSize :
- (NdefMap->DesfireCapContainer.NdefDataLen -
+ (NdefMap->DesfireCapContainer.NdefDataLen -
*NdefMap->DataCount));
}
else
@@ -1565,7 +1730,7 @@ static uint32_t phFriNfc_Desfire_HGetLeBytes(phFriNfc_NdefMap_t *NdefMap)
}
}
- NdefMap->DesfireCapContainer.SkipNlenBytesFlag =
+ NdefMap->DesfireCapContainer.SkipNlenBytesFlag =
(uint8_t)(((NdefMap->Offset == PH_FRINFC_NDEFMAP_SEEK_BEGIN )&&( *NdefMap->DataCount == 0 )) ?
1 : 0);
@@ -1591,7 +1756,7 @@ static void phFriNfc_Desfire_HCrHandler( phFriNfc_NdefMap_t *NdefMap,
switch(NdefMap->DespOpFlag)
{
- /* check which routine has the problem and set the CR*/
+ /* check which routine has the problem and set the CR*/
case PH_FRINFC_NDEFMAP_DESF_NDEF_CHK_OP :
/* set the completion routine*/
NdefMap->CompletionRoutine[PH_FRINFC_NDEFMAP_CR_CHK_NDEF].\
@@ -1613,7 +1778,7 @@ static void phFriNfc_Desfire_HCrHandler( phFriNfc_NdefMap_t *NdefMap,
Status);
break;
- default :
+ default :
/* set the completion routine*/
NdefMap->CompletionRoutine[PH_FRINFC_NDEFMAP_CR_INVALID_OPE].\
CompletionRoutine(NdefMap->CompletionRoutine->Context,\
@@ -1629,12 +1794,12 @@ static NFCSTATUS phFriNfc_Desfire_HSendTransCmd(phFriNfc_NdefMap_t *NdefMap,uint
NFCSTATUS status = NFCSTATUS_SUCCESS;
/* set the command type*/
-#ifndef PH_HAL4_ENABLE
+#ifndef PH_HAL4_ENABLE
NdefMap->Cmd.Iso144434Cmd = phHal_eIso14443_4_CmdListTClCmd;
#else
NdefMap->Cmd.Iso144434Cmd = phHal_eIso14443_4_Raw;
#endif
-
+
/* set the Additional Info*/
NdefMap->psDepAdditionalInfo.DepFlags.MetaChaining = 0;
NdefMap->psDepAdditionalInfo.DepFlags.NADPresent = 0;
@@ -1647,7 +1812,7 @@ static NFCSTATUS phFriNfc_Desfire_HSendTransCmd(phFriNfc_NdefMap_t *NdefMap,uint
*NdefMap->SendRecvLength = ((uint16_t)(SendRecvLen));
- /*Call the Overlapped HAL Transceive function */
+ /*Call the Overlapped HAL Transceive function */
status = phFriNfc_OvrHal_Transceive(NdefMap->LowerDevice,
&NdefMap->MapCompletionInfo,
NdefMap->psRemoteDevInfo,
diff --git a/src/phFriNfc_DesfireMap.h b/src/phFriNfc_DesfireMap.h
index 6731b86..0432ab5 100644
--- a/src/phFriNfc_DesfireMap.h
+++ b/src/phFriNfc_DesfireMap.h
@@ -20,10 +20,10 @@
*
* Project: NFC-FRI
*
- * $Date: Thu Jul 23 13:45:06 2009 $
- * $Author: ing07336 $
- * $Revision: 1.4 $
- * $Aliases: NFC_FRI1.1_WK930_R30_1,NFC_FRI1.1_WK934_PREP_1,NFC_FRI1.1_WK934_R31_1,NFC_FRI1.1_WK941_PREP1,NFC_FRI1.1_WK941_PREP2,NFC_FRI1.1_WK941_1,NFC_FRI1.1_WK943_R32_1,NFC_FRI1.1_WK949_PREP1,NFC_FRI1.1_WK943_R32_10,NFC_FRI1.1_WK943_R32_13,NFC_FRI1.1_WK943_R32_14,NFC_FRI1.1_WK1007_R33_1,NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $
+ * $Date: Tue Jul 27 08:58:21 2010 $
+ * $Author: ing02260 $
+ * $Revision: 1.5 $
+ * $Aliases: $
*
*/
@@ -31,8 +31,10 @@
#define PHFRINFC_DESFIREMAP_H
#include <phFriNfc.h>
-#if !defined PH_HAL4_ENABLE
+#ifdef PH_HAL4_ENABLE
#include <phHal4Nfc.h>
+#else
+#include <phHalNfc.h>
#endif
#include <phNfcTypes.h>
#include <phNfcStatus.h>
@@ -50,7 +52,7 @@
#define PH_FRINFC_NDEFMAP_DESF_NDEF_CHK_OP 4 /*!< Desfire Operation Flag is Check Ndef */
#define PH_FRINFC_NDEFMAP_DESF_GET_LEN_OP 5
#define PH_FRINFC_NDEFMAP_DESF_SET_LEN_OP 6
-#define PH_FRINFC_NDEFMAP_DESF_RESP_OFFSET 2 /*!< Two Status Flag at the end of the
+#define PH_FRINFC_NDEFMAP_DESF_RESP_OFFSET 2 /*!< Two Status Flag at the end of the
Receive buffer*/
#define PH_FRINFC_NDEFMAP_DESF_CAPDU_SMARTTAG_PKT_SIZE 12 /*!< Send Length for Smart Tag function*/
#define PH_FRINFC_NDEFMAP_DESF_CAPDU_SELECT_FILE_PKT_SIZE 7 /*!< Send Length for Select File function */
@@ -61,9 +63,11 @@
*
*/
/*@{*/
-
+#ifdef DESFIRE_EV1
+ #define PH_FRINFC_NDEFMAP_DESF_STATE_SELECT_SMART_TAG_EV1 4 /*!< Selection of Smart Tag is going on for Desfire EV1 */
+#endif /* #ifdef DESFIRE_EV1 */
#define PH_FRINFC_NDEFMAP_DESF_STATE_SELECT_SMART_TAG 5 /*!< Selection of Smart Tag is going on */
-#define PH_FRINFC_NDEFMAP_DESF_STATE_SELECT_FILE 6 /*!< Selecting a file to read/write */
+#define PH_FRINFC_NDEFMAP_DESF_STATE_SELECT_FILE 6 /*!< Selecting a file to read/write */
#define PH_FRINFC_NDEFMAP_DESF_STATE_READ_CAP_CONT 7 /*!< Reading a capability container */
#define PH_FRINFC_NDEFMAP_DESF_STATE_READ_BIN 8 /*!< Reading from the card */
#define PH_FRINFC_NDEFMAP_DESF_STATE_UPDATE_BIN_BEGIN 60 /*!< Writing to the card */
@@ -77,45 +81,45 @@
/* Following Constants are used to navigate the Capability Container(CC)*/
/*!< Following two indexes represents the CCLEN in CC*/
-#define PH_FRINFC_NDEFMAP_DESF_CCLEN_BYTE_FIRST_INDEX 0
-#define PH_FRINFC_NDEFMAP_DESF_CCLEN_BYTE_SECOND_INDEX 1
+#define PH_FRINFC_NDEFMAP_DESF_CCLEN_BYTE_FIRST_INDEX 0
+#define PH_FRINFC_NDEFMAP_DESF_CCLEN_BYTE_SECOND_INDEX 1
/*!< Specifies the index of the Mapping Version in CC */
-#define PH_FRINFC_NDEFMAP_DESF_VER_INDEX 2
+#define PH_FRINFC_NDEFMAP_DESF_VER_INDEX 2
/*!< Following two indexes represents the MLe bytes in CC*/
-#define PH_FRINFC_NDEFMAP_DESF_MLE_BYTE_FIRST_INDEX 3
-#define PH_FRINFC_NDEFMAP_DESF_MLE_BYTE_SECOND_INDEX 4
+#define PH_FRINFC_NDEFMAP_DESF_MLE_BYTE_FIRST_INDEX 3
+#define PH_FRINFC_NDEFMAP_DESF_MLE_BYTE_SECOND_INDEX 4
/*!< Following two indexes represents the MLc bytes in CC*/
-#define PH_FRINFC_NDEFMAP_DESF_MLC_BYTE_FIRST_INDEX 5
-#define PH_FRINFC_NDEFMAP_DESF_MLC_BYTE_SECOND_INDEX 6
+#define PH_FRINFC_NDEFMAP_DESF_MLC_BYTE_FIRST_INDEX 5
+#define PH_FRINFC_NDEFMAP_DESF_MLC_BYTE_SECOND_INDEX 6
/*!< Specifies the index of the TLV in CC */
-#define PH_FRINFC_NDEFMAP_DESF_TLV_INDEX 7
+#define PH_FRINFC_NDEFMAP_DESF_TLV_INDEX 7
/*!< Specifies the index of the TLV length in CC */
-#define PH_FRINFC_NDEFMAP_DESF_TLV_LEN_INDEX 8
+#define PH_FRINFC_NDEFMAP_DESF_TLV_LEN_INDEX 8
/*!< Following two indexes represents the NDEF file identifier in CC*/
-#define PH_FRINFC_NDEFMAP_DESF_NDEF_FILEID_BYTE_FIRST_INDEX 9
-#define PH_FRINFC_NDEFMAP_DESF_NDEF_FILEID_BYTE_SECOND_INDEX 10
+#define PH_FRINFC_NDEFMAP_DESF_NDEF_FILEID_BYTE_FIRST_INDEX 9
+#define PH_FRINFC_NDEFMAP_DESF_NDEF_FILEID_BYTE_SECOND_INDEX 10
/*!< Following two indexes represents the NDEF file size in CC */
-#define PH_FRINFC_NDEFMAP_DESF_NDEF_FILESZ_BYTE_FIRST_INDEX 11
-#define PH_FRINFC_NDEFMAP_DESF_NDEF_FILESZ_BYTE_SECOND_INDEX 12
+#define PH_FRINFC_NDEFMAP_DESF_NDEF_FILESZ_BYTE_FIRST_INDEX 11
+#define PH_FRINFC_NDEFMAP_DESF_NDEF_FILESZ_BYTE_SECOND_INDEX 12
/*!< Specifies the index of the NDEF file READ access byte in CC */
-#define PH_FRINFC_NDEFMAP_DESF_NDEF_FILERD_ACCESS_INDEX 13
+#define PH_FRINFC_NDEFMAP_DESF_NDEF_FILERD_ACCESS_INDEX 13
/*!< Specifies the index of the NDEF file WRITE access byte in CC */
-#define PH_FRINFC_NDEFMAP_DESF_NDEF_FILEWR_ACCESS_INDEX 14
+#define PH_FRINFC_NDEFMAP_DESF_NDEF_FILEWR_ACCESS_INDEX 14
/* Macros to find Maximum NDEF File Size*/
#define PH_NFCFRI_NDEFMAP_DESF_NDEF_FILE_SIZE (NdefMap->DesfireCapContainer.NdefFileSize - 2)
/* Specifies the size of the NLEN Bytes*/
-#define PH_FRINFC_NDEFMAP_DESF_NLEN_SIZE_IN_BYTES 2
+#define PH_FRINFC_NDEFMAP_DESF_NLEN_SIZE_IN_BYTES 2
/* Following constants are used with buffer index's*/
@@ -124,8 +128,8 @@
/* Following constants are used for SW1 SW2 status codes*/
-#define PH_FRINFC_NDEFMAP_DESF_RAPDU_SW1_BYTE 0x90
-#define PH_FRINFC_NDEFMAP_DESF_RAPDU_SW2_BYTE 0x00
+#define PH_FRINFC_NDEFMAP_DESF_RAPDU_SW1_BYTE 0x90
+#define PH_FRINFC_NDEFMAP_DESF_RAPDU_SW2_BYTE 0x00
/* Following constatnts for shift bytes*/
@@ -135,7 +139,7 @@
#define PH_FRINFC_DESF_GET_VER_CMD 0x60
#define PH_FRINFC_DESF_NATIVE_CLASS_BYTE 0x90
#define PH_FRINFC_DESF_NATIVE_OFFSET_P1 0x00
-#define PH_FRINFC_DESF_NATIVE_OFFSET_P2 0x00
+#define PH_FRINFC_DESF_NATIVE_OFFSET_P2 0x00
#define PH_FRINFC_DESF_NATIVE_GETVER_RESP 0xAF
/*!
* \name NDEF Mapping - states of the Finite State machine
@@ -153,7 +157,7 @@ typedef enum
typedef enum
{
- PH_FRINFC_DESF_IDX_0,
+ PH_FRINFC_DESF_IDX_0,
PH_FRINFC_DESF_IDX_1,
PH_FRINFC_DESF_IDX_2,
PH_FRINFC_DESF_IDX_3,
@@ -214,7 +218,7 @@ typedef enum
* If the caller sets the value to \ref PH_FRINFC_NDEFMAP_SEEK_CUR, the component shall
* start reading from the last offset set (continue where it has stopped before).
* If set to \ref PH_FRINFC_NDEFMAP_SEEK_BEGIN, the component shall start reading
- * from the begining of the card (restarted)
+ * from the begining of the card (restarted)
*
* \retval NFCSTATUS_PENDING The action has been successfully triggered.
* \retval NFCSTATUS_INVALID_DEVICE_REQUEST If Previous Operation is Write Ndef and Offset
@@ -256,7 +260,7 @@ NFCSTATUS phFriNfc_Desfire_RdNdef( phFriNfc_NdefMap_t *NdefMap,
* If the caller sets the value to \ref PH_FRINFC_NDEFMAP_SEEK_CUR, the component shall
* start writing from the last offset set (continue where it has stopped before).
* If set to \ref PH_FRINFC_NDEFMAP_SEEK_BEGIN, the component shall start writing
- * from the begining of the card (restarted)
+ * from the begining of the card (restarted)
*
* \retval NFCSTATUS_PENDING The action has been successfully triggered.
* \retval NFCSTATUS_INVALID_DEVICE_REQUEST If Previous Operation is Write Ndef and Offset
@@ -310,7 +314,7 @@ NFCSTATUS phFriNfc_Desfire_ChkNdef( phFriNfc_NdefMap_t *NdefMap);
* ready to be processed.
*
*/
-
+
void phFriNfc_Desfire_Process( void *Context,
NFCSTATUS Status);
diff --git a/src/phFriNfc_MapTools.c b/src/phFriNfc_MapTools.c
index 2d035d2..2283473 100644
--- a/src/phFriNfc_MapTools.c
+++ b/src/phFriNfc_MapTools.c
@@ -20,10 +20,10 @@
*
* Project: NFC-FRI
*
- * $Date: Fri Sep 26 11:13:22 2008 $
- * $Author: ing08205 $
- * $Revision: 1.5 $
- * $Aliases: NFC_FRI1.1_WK840_R10_PREP1,NFC_FRI1.1_WK840_R10_1,NFC_FRI1.1_WK842_R11_PREP1,NFC_FRI1.1_WK842_R11_PREP2,NFC_FRI1.1_WK842_R11_1,NFC_FRI1.1_WK844_PREP1,NFC_FRI1.1_WK844_R12_1,NFC_FRI1.1_WK846_PREP1,NFC_FRI1.1_WK846_R13_1,NFC_FRI1.1_WK848_PREP1,NFC_FRI1.1_WK848_R14_1,NFC_FRI1.1_WK850_PACK1,NFC_FRI1.1_WK851_PREP1,NFC_FRI1.1_WK850_R15_1,NFC_FRI1.1_WK902_PREP1,NFC_FRI1.1_WK902_R16_1,NFC_FRI1.1_WK904_PREP1,NFC_FRI1.1_WK904_R17_1,NFC_FRI1.1_WK906_R18_1,NFC_FRI1.1_WK908_PREP1,NFC_FRI1.1_WK908_R19_1,NFC_FRI1.1_WK910_PREP1,NFC_FRI1.1_WK910_R20_1,NFC_FRI1.1_WK912_PREP1,NFC_FRI1.1_WK912_R21_1,NFC_FRI1.1_WK914_PREP1,NFC_FRI1.1_WK914_R22_1,NFC_FRI1.1_WK914_R22_2,NFC_FRI1.1_WK916_R23_1,NFC_FRI1.1_WK918_R24_1,NFC_FRI1.1_WK920_PREP1,NFC_FRI1.1_WK920_R25_1,NFC_FRI1.1_WK922_PREP1,NFC_FRI1.1_WK922_R26_1,NFC_FRI1.1_WK924_PREP1,NFC_FRI1.1_WK924_R27_1,NFC_FRI1.1_WK926_R28_1,NFC_FRI1.1_WK928_R29_1,NFC_FRI1.1_WK930_R30_1,NFC_FRI1.1_WK934_PREP_1,NFC_FRI1.1_WK934_R31_1,NFC_FRI1.1_WK941_PREP1,NFC_FRI1.1_WK941_PREP2,NFC_FRI1.1_WK941_1,NFC_FRI1.1_WK943_R32_1,NFC_FRI1.1_WK949_PREP1,NFC_FRI1.1_WK943_R32_10,NFC_FRI1.1_WK943_R32_13,NFC_FRI1.1_WK943_R32_14,NFC_FRI1.1_WK1007_R33_1,NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $
+ * $Date: Fri Oct 15 13:50:54 2010 $
+ * $Author: ing02260 $
+ * $Revision: 1.6 $
+ * $Aliases: $
*
*/
@@ -57,8 +57,8 @@
*
*/
/*@{*/
-#define PHFRINFCNDEFMAP_FILEREVISION "$Revision: 1.5 $"
-#define PHFRINFCNDEFMAP_FILEALIASES "$Aliases: NFC_FRI1.1_WK840_R10_PREP1,NFC_FRI1.1_WK840_R10_1,NFC_FRI1.1_WK842_R11_PREP1,NFC_FRI1.1_WK842_R11_PREP2,NFC_FRI1.1_WK842_R11_1,NFC_FRI1.1_WK844_PREP1,NFC_FRI1.1_WK844_R12_1,NFC_FRI1.1_WK846_PREP1,NFC_FRI1.1_WK846_R13_1,NFC_FRI1.1_WK848_PREP1,NFC_FRI1.1_WK848_R14_1,NFC_FRI1.1_WK850_PACK1,NFC_FRI1.1_WK851_PREP1,NFC_FRI1.1_WK850_R15_1,NFC_FRI1.1_WK902_PREP1,NFC_FRI1.1_WK902_R16_1,NFC_FRI1.1_WK904_PREP1,NFC_FRI1.1_WK904_R17_1,NFC_FRI1.1_WK906_R18_1,NFC_FRI1.1_WK908_PREP1,NFC_FRI1.1_WK908_R19_1,NFC_FRI1.1_WK910_PREP1,NFC_FRI1.1_WK910_R20_1,NFC_FRI1.1_WK912_PREP1,NFC_FRI1.1_WK912_R21_1,NFC_FRI1.1_WK914_PREP1,NFC_FRI1.1_WK914_R22_1,NFC_FRI1.1_WK914_R22_2,NFC_FRI1.1_WK916_R23_1,NFC_FRI1.1_WK918_R24_1,NFC_FRI1.1_WK920_PREP1,NFC_FRI1.1_WK920_R25_1,NFC_FRI1.1_WK922_PREP1,NFC_FRI1.1_WK922_R26_1,NFC_FRI1.1_WK924_PREP1,NFC_FRI1.1_WK924_R27_1,NFC_FRI1.1_WK926_R28_1,NFC_FRI1.1_WK928_R29_1,NFC_FRI1.1_WK930_R30_1,NFC_FRI1.1_WK934_PREP_1,NFC_FRI1.1_WK934_R31_1,NFC_FRI1.1_WK941_PREP1,NFC_FRI1.1_WK941_PREP2,NFC_FRI1.1_WK941_1,NFC_FRI1.1_WK943_R32_1,NFC_FRI1.1_WK949_PREP1,NFC_FRI1.1_WK943_R32_10,NFC_FRI1.1_WK943_R32_13,NFC_FRI1.1_WK943_R32_14,NFC_FRI1.1_WK1007_R33_1,NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $"
+#define PHFRINFCNDEFMAP_FILEREVISION "$Revision: 1.6 $"
+#define PHFRINFCNDEFMAP_FILEALIASES "$Aliases: $"
/*@}*/
NFCSTATUS phFriNfc_MapTool_SetCardState(phFriNfc_NdefMap_t *NdefMap,
@@ -67,11 +67,11 @@ NFCSTATUS phFriNfc_MapTool_SetCardState(phFriNfc_NdefMap_t *NdefMap,
NFCSTATUS Result = NFCSTATUS_SUCCESS;
if(Length == PH_FRINFC_NDEFMAP_MFUL_VAL0)
{
- /* As the NDEF LEN / TLV Len is Zero, irrespective of any state the card
+ /* As the NDEF LEN / TLV Len is Zero, irrespective of any state the card
shall be set to INITIALIZED STATE*/
- NdefMap->CardState =(uint8_t) (((NdefMap->CardState ==
- PH_NDEFMAP_CARD_STATE_READ_ONLY) ||
- (NdefMap->CardState ==
+ NdefMap->CardState =(uint8_t) (((NdefMap->CardState ==
+ PH_NDEFMAP_CARD_STATE_READ_ONLY) ||
+ (NdefMap->CardState ==
PH_NDEFMAP_CARD_STATE_INVALID))?
PH_NDEFMAP_CARD_STATE_INVALID:
PH_NDEFMAP_CARD_STATE_INITIALIZED);
@@ -81,21 +81,21 @@ NFCSTATUS phFriNfc_MapTool_SetCardState(phFriNfc_NdefMap_t *NdefMap,
switch(NdefMap->CardState)
{
case PH_NDEFMAP_CARD_STATE_INITIALIZED:
- NdefMap->CardState =(uint8_t) ((NdefMap->CardState ==
+ NdefMap->CardState =(uint8_t) ((NdefMap->CardState ==
PH_NDEFMAP_CARD_STATE_INVALID)?
NdefMap->CardState:
PH_NDEFMAP_CARD_STATE_READ_WRITE);
break;
case PH_NDEFMAP_CARD_STATE_READ_ONLY:
- NdefMap->CardState = (uint8_t)((NdefMap->CardState ==
+ NdefMap->CardState = (uint8_t)((NdefMap->CardState ==
PH_NDEFMAP_CARD_STATE_INVALID)?
NdefMap->CardState:
PH_NDEFMAP_CARD_STATE_READ_ONLY);
break;
case PH_NDEFMAP_CARD_STATE_READ_WRITE:
- NdefMap->CardState = (uint8_t)((NdefMap->CardState ==
+ NdefMap->CardState = (uint8_t)((NdefMap->CardState ==
PH_NDEFMAP_CARD_STATE_INVALID)?
NdefMap->CardState:
PH_NDEFMAP_CARD_STATE_READ_WRITE);
@@ -103,14 +103,14 @@ NFCSTATUS phFriNfc_MapTool_SetCardState(phFriNfc_NdefMap_t *NdefMap,
default:
NdefMap->CardState = PH_NDEFMAP_CARD_STATE_INVALID;
- Result = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
+ Result = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
NFCSTATUS_NO_NDEF_SUPPORT);
break;
}
}
- Result = ((NdefMap->CardState ==
+ Result = ((NdefMap->CardState ==
PH_NDEFMAP_CARD_STATE_INVALID)?
- PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
+ PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
NFCSTATUS_NO_NDEF_SUPPORT):
Result);
return Result;
@@ -130,46 +130,87 @@ NFCSTATUS phFriNfc_MapTool_ChkSpcVer( const phFriNfc_NdefMap_t *NdefMap,
/*Return Status Error “ Invalid Format”*/
status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,NFCSTATUS_INVALID_FORMAT);
}
- else if((NdefMap->CardType == PH_FRINFC_NDEFMAP_MIFARE_STD_1K_CARD) ||
- (NdefMap->CardType == PH_FRINFC_NDEFMAP_MIFARE_STD_4K_CARD))
- {
- /* calculate the major and minor version number of Mifare std version number */
- status = (( (( PH_NFCFRI_MFSTDMAP_NFCDEV_MAJOR_VER_NUM ==
- PH_NFCFRI_MFSTDMAP_GET_MAJOR_TAG_VERNO(TagVerNo ) )&&
- ( PH_NFCFRI_MFSTDMAP_NFCDEV_MINOR_VER_NUM ==
- PH_NFCFRI_MFSTDMAP_GET_MINOR_TAG_VERNO(TagVerNo))) ||
- (( PH_NFCFRI_MFSTDMAP_NFCDEV_MAJOR_VER_NUM ==
- PH_NFCFRI_MFSTDMAP_GET_MAJOR_TAG_VERNO(TagVerNo ) )&&
- ( PH_NFCFRI_MFSTDMAP_NFCDEV_MINOR_VER_NUM <
- PH_NFCFRI_MFSTDMAP_GET_MINOR_TAG_VERNO(TagVerNo) )))?
- NFCSTATUS_SUCCESS:
- PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
- NFCSTATUS_INVALID_FORMAT));
- }
else
{
- /* calculate the major and minor version number of T3VerNo */
- if( (( PH_NFCFRI_NDEFMAP_NFCDEV_MAJOR_VER_NUM ==
- PH_NFCFRI_NDEFMAP_GET_MAJOR_TAG_VERNO(TagVerNo ) )&&
- ( PH_NFCFRI_NDEFMAP_NFCDEV_MINOR_VER_NUM ==
- PH_NFCFRI_NDEFMAP_GET_MINOR_TAG_VERNO(TagVerNo))) ||
- (( PH_NFCFRI_NDEFMAP_NFCDEV_MAJOR_VER_NUM ==
- PH_NFCFRI_NDEFMAP_GET_MAJOR_TAG_VERNO(TagVerNo ) )&&
- ( PH_NFCFRI_NDEFMAP_NFCDEV_MINOR_VER_NUM <
- PH_NFCFRI_NDEFMAP_GET_MINOR_TAG_VERNO(TagVerNo) )))
+ switch (NdefMap->CardType)
{
- status = PHNFCSTVAL(CID_NFC_NONE,NFCSTATUS_SUCCESS);
- }
- else
- {
- if (( PH_NFCFRI_NDEFMAP_NFCDEV_MAJOR_VER_NUM <
- PH_NFCFRI_NDEFMAP_GET_MAJOR_TAG_VERNO(TagVerNo) ) ||
- ( PH_NFCFRI_NDEFMAP_NFCDEV_MAJOR_VER_NUM >
- PH_NFCFRI_NDEFMAP_GET_MAJOR_TAG_VERNO(TagVerNo)))
+ case PH_FRINFC_NDEFMAP_MIFARE_STD_1K_CARD:
+ case PH_FRINFC_NDEFMAP_MIFARE_STD_4K_CARD:
+ {
+ /* calculate the major and minor version number of Mifare std version number */
+ status = (( (( PH_NFCFRI_MFSTDMAP_NFCDEV_MAJOR_VER_NUM ==
+ PH_NFCFRI_MFSTDMAP_GET_MAJOR_TAG_VERNO(TagVerNo ) )&&
+ ( PH_NFCFRI_MFSTDMAP_NFCDEV_MINOR_VER_NUM ==
+ PH_NFCFRI_MFSTDMAP_GET_MINOR_TAG_VERNO(TagVerNo))) ||
+ (( PH_NFCFRI_MFSTDMAP_NFCDEV_MAJOR_VER_NUM ==
+ PH_NFCFRI_MFSTDMAP_GET_MAJOR_TAG_VERNO(TagVerNo ) )&&
+ ( PH_NFCFRI_MFSTDMAP_NFCDEV_MINOR_VER_NUM <
+ PH_NFCFRI_MFSTDMAP_GET_MINOR_TAG_VERNO(TagVerNo) )))?
+ NFCSTATUS_SUCCESS:
+ PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
+ NFCSTATUS_INVALID_FORMAT));
+ break;
+ }
+
+#ifdef DESFIRE_EV1
+ case PH_FRINFC_NDEFMAP_ISO14443_4A_CARD_EV1:
+ {
+ /* calculate the major and minor version number of T3VerNo */
+ if( (( PH_NFCFRI_NDEFMAP_NFCDEV_MAJOR_VER_NUM_2 ==
+ PH_NFCFRI_NDEFMAP_GET_MAJOR_TAG_VERNO(TagVerNo ) )&&
+ ( PH_NFCFRI_NDEFMAP_NFCDEV_MINOR_VER_NUM ==
+ PH_NFCFRI_NDEFMAP_GET_MINOR_TAG_VERNO(TagVerNo))) ||
+ (( PH_NFCFRI_NDEFMAP_NFCDEV_MAJOR_VER_NUM_2 ==
+ PH_NFCFRI_NDEFMAP_GET_MAJOR_TAG_VERNO(TagVerNo ) )&&
+ ( PH_NFCFRI_NDEFMAP_NFCDEV_MINOR_VER_NUM <
+ PH_NFCFRI_NDEFMAP_GET_MINOR_TAG_VERNO(TagVerNo) )))
+ {
+ status = PHNFCSTVAL(CID_NFC_NONE,NFCSTATUS_SUCCESS);
+ }
+ else
+ {
+ if (( PH_NFCFRI_NDEFMAP_NFCDEV_MAJOR_VER_NUM_2 <
+ PH_NFCFRI_NDEFMAP_GET_MAJOR_TAG_VERNO(TagVerNo) ) ||
+ ( PH_NFCFRI_NDEFMAP_NFCDEV_MAJOR_VER_NUM_2 >
+ PH_NFCFRI_NDEFMAP_GET_MAJOR_TAG_VERNO(TagVerNo)))
+ {
+ status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,NFCSTATUS_INVALID_FORMAT);
+ }
+ }
+ break;
+ }
+#endif /* #ifdef DESFIRE_EV1 */
+
+ default:
{
- status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,NFCSTATUS_INVALID_FORMAT);
+ /* calculate the major and minor version number of T3VerNo */
+ if( (( PH_NFCFRI_NDEFMAP_NFCDEV_MAJOR_VER_NUM ==
+ PH_NFCFRI_NDEFMAP_GET_MAJOR_TAG_VERNO(TagVerNo ) )&&
+ ( PH_NFCFRI_NDEFMAP_NFCDEV_MINOR_VER_NUM ==
+ PH_NFCFRI_NDEFMAP_GET_MINOR_TAG_VERNO(TagVerNo))) ||
+ (( PH_NFCFRI_NDEFMAP_NFCDEV_MAJOR_VER_NUM ==
+ PH_NFCFRI_NDEFMAP_GET_MAJOR_TAG_VERNO(TagVerNo ) )&&
+ ( PH_NFCFRI_NDEFMAP_NFCDEV_MINOR_VER_NUM <
+ PH_NFCFRI_NDEFMAP_GET_MINOR_TAG_VERNO(TagVerNo) )))
+ {
+ status = PHNFCSTVAL(CID_NFC_NONE,NFCSTATUS_SUCCESS);
+ }
+ else
+ {
+ if (( PH_NFCFRI_NDEFMAP_NFCDEV_MAJOR_VER_NUM <
+ PH_NFCFRI_NDEFMAP_GET_MAJOR_TAG_VERNO(TagVerNo) ) ||
+ ( PH_NFCFRI_NDEFMAP_NFCDEV_MAJOR_VER_NUM >
+ PH_NFCFRI_NDEFMAP_GET_MAJOR_TAG_VERNO(TagVerNo)))
+ {
+ status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,NFCSTATUS_INVALID_FORMAT);
+ }
+ }
+ break;
}
+
+
}
}
+
return (status);
}
diff --git a/src/phFriNfc_MapTools.h b/src/phFriNfc_MapTools.h
index 60de506..e9eda20 100644
--- a/src/phFriNfc_MapTools.h
+++ b/src/phFriNfc_MapTools.h
@@ -20,10 +20,10 @@
*
* Project: NFC-FRI
*
- * $Date: Mon Sep 15 15:05:48 2008 $
- * $Author: ing08205 $
- * $Revision: 1.5 $
- * $Aliases: NFC_FRI1.1_WK838_R9_PREP2,NFC_FRI1.1_WK838_R9_1,NFC_FRI1.1_WK840_R10_PREP1,NFC_FRI1.1_WK840_R10_1,NFC_FRI1.1_WK842_R11_PREP1,NFC_FRI1.1_WK842_R11_PREP2,NFC_FRI1.1_WK842_R11_1,NFC_FRI1.1_WK844_PREP1,NFC_FRI1.1_WK844_R12_1,NFC_FRI1.1_WK846_PREP1,NFC_FRI1.1_WK846_R13_1,NFC_FRI1.1_WK848_PREP1,NFC_FRI1.1_WK848_R14_1,NFC_FRI1.1_WK850_PACK1,NFC_FRI1.1_WK851_PREP1,NFC_FRI1.1_WK850_R15_1,NFC_FRI1.1_WK902_PREP1,NFC_FRI1.1_WK902_R16_1,NFC_FRI1.1_WK904_PREP1,NFC_FRI1.1_WK904_R17_1,NFC_FRI1.1_WK906_R18_1,NFC_FRI1.1_WK908_PREP1,NFC_FRI1.1_WK908_R19_1,NFC_FRI1.1_WK910_PREP1,NFC_FRI1.1_WK910_R20_1,NFC_FRI1.1_WK912_PREP1,NFC_FRI1.1_WK912_R21_1,NFC_FRI1.1_WK914_PREP1,NFC_FRI1.1_WK914_R22_1,NFC_FRI1.1_WK914_R22_2,NFC_FRI1.1_WK916_R23_1,NFC_FRI1.1_WK918_R24_1,NFC_FRI1.1_WK920_PREP1,NFC_FRI1.1_WK920_R25_1,NFC_FRI1.1_WK922_PREP1,NFC_FRI1.1_WK922_R26_1,NFC_FRI1.1_WK924_PREP1,NFC_FRI1.1_WK924_R27_1,NFC_FRI1.1_WK926_R28_1,NFC_FRI1.1_WK928_R29_1,NFC_FRI1.1_WK930_R30_1,NFC_FRI1.1_WK934_PREP_1,NFC_FRI1.1_WK934_R31_1,NFC_FRI1.1_WK941_PREP1,NFC_FRI1.1_WK941_PREP2,NFC_FRI1.1_WK941_1,NFC_FRI1.1_WK943_R32_1,NFC_FRI1.1_WK949_PREP1,NFC_FRI1.1_WK943_R32_10,NFC_FRI1.1_WK943_R32_13,NFC_FRI1.1_WK943_R32_14,NFC_FRI1.1_WK1007_R33_1,NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $
+ * $Date: Fri Oct 15 13:50:54 2010 $
+ * $Author: ing02260 $
+ * $Revision: 1.6 $
+ * $Aliases: $
*
*/
@@ -31,8 +31,10 @@
#define PHFRINFC_MAPTOOLS_H
#include <phFriNfc.h>
-#if !defined PH_HAL4_ENABLE
+#ifdef PH_HAL4_ENABLE
#include <phHal4Nfc.h>
+#else
+#include <phHalNfc.h>
#endif
#include <phNfcTypes.h>
#include <phNfcStatus.h>
@@ -53,9 +55,12 @@
should be compatible to the version number of currently implemented mapping document.
Example : NFC Device version Number : 1.0 , specifies
Major VNo is 1,
- Minor VNo is 0 */
-#define PH_NFCFRI_NDEFMAP_NFCDEV_MAJOR_VER_NUM 0x01
-#define PH_NFCFRI_NDEFMAP_NFCDEV_MINOR_VER_NUM 0x00
+ Minor VNo is 0 */
+#define PH_NFCFRI_NDEFMAP_NFCDEV_MAJOR_VER_NUM 0x01
+#ifdef DESFIRE_EV1
+#define PH_NFCFRI_NDEFMAP_NFCDEV_MAJOR_VER_NUM_2 0x02
+#endif /* */
+#define PH_NFCFRI_NDEFMAP_NFCDEV_MINOR_VER_NUM 0x00
/* Macros to find major and minor TAG : Ex:Type1/Type2/Type3/Type4 version numbers*/
#define PH_NFCFRI_NDEFMAP_GET_MAJOR_TAG_VERNO(a) (((a) & (0xf0))>>(4))
@@ -66,9 +71,9 @@
should be compatible to the version number of currently implemented mapping document.
Example : NFC Device version Number : 1.0 , specifies
Major VNo is 1,
- Minor VNo is 0 */
-#define PH_NFCFRI_MFSTDMAP_NFCDEV_MAJOR_VER_NUM 0x40
-#define PH_NFCFRI_MFSTDMAP_NFCDEV_MINOR_VER_NUM 0x00
+ Minor VNo is 0 */
+#define PH_NFCFRI_MFSTDMAP_NFCDEV_MAJOR_VER_NUM 0x40
+#define PH_NFCFRI_MFSTDMAP_NFCDEV_MINOR_VER_NUM 0x00
/* Macros to find major and minor TAG : Ex:Type1/Type2/Type3/Type4 version numbers*/
#define PH_NFCFRI_MFSTDMAP_GET_MAJOR_TAG_VERNO(a) ((a) & (0x40)) // must be 0xC0
diff --git a/src/phFriNfc_NdefMap.c b/src/phFriNfc_NdefMap.c
index 34b8e59..a0389e4 100644
--- a/src/phFriNfc_NdefMap.c
+++ b/src/phFriNfc_NdefMap.c
@@ -20,10 +20,10 @@
*
* Project: NFC-FRI
*
-* $Date: Mon Mar 29 17:32:37 2010 $
+* $Date: Tue Jul 27 08:58:22 2010 $
* $Author: ing02260 $
-* $Revision: 1.37 $
-* $Aliases: NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $
+* $Revision: 1.38 $
+* $Aliases: $
*
*/
@@ -64,8 +64,8 @@
*
*/
/*@{*/
-#define PHFRINFCNDEFMAP_FILEREVISION "$Revision: 1.37 $"
-#define PHFRINFCNDEFMAP_FILEALIASES "$Aliases: NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $"
+#define PHFRINFCNDEFMAP_FILEREVISION "$Revision: 1.38 $"
+#define PHFRINFCNDEFMAP_FILEALIASES "$Aliases: $"
/*@}*/
#ifndef PH_FRINFC_MAP_DESFIRE_DISABLED
@@ -79,8 +79,8 @@ static void phFriNfc_Felica_HReset(phFriNfc_NdefMap_t *NdefMap);
#endif /* PH_FRINFC_MAP_FELICA_DISABLED */
-/* \note This function has to be called at the beginning, after creating an
-* instance of \ref phFriNfc_NdefMap_t . Use this function to reset
+/* \note This function has to be called at the beginning, after creating an
+* instance of \ref phFriNfc_NdefMap_t . Use this function to reset
* the instance and/or switch to a different underlying device (
* different NFC device or device mode, or different Remote Device).
*/
@@ -98,8 +98,8 @@ NFCSTATUS phFriNfc_NdefMap_Reset( phFriNfc_NdefMap_t *NdefMap,
NFCSTATUS status = NFCSTATUS_SUCCESS;
uint8_t index;
- if ( (ReceiveLength == NULL) || (NdefMap == NULL) || (psRemoteDevInfo == NULL) ||
- (TrxBuffer == NULL) || (TrxBufferSize == 0) || (LowerDevice == NULL) ||
+ if ( (ReceiveLength == NULL) || (NdefMap == NULL) || (psRemoteDevInfo == NULL) ||
+ (TrxBuffer == NULL) || (TrxBufferSize == 0) || (LowerDevice == NULL) ||
(*ReceiveLength == 0) || (ReceiveBuffer == NULL) || (DataCount == NULL) ||
(psDevInputParam == NULL) ||
(*ReceiveLength < PH_FRINFC_NDEFMAP_MAX_SEND_RECV_BUF_SIZE ))
@@ -211,8 +211,8 @@ NFCSTATUS phFriNfc_NdefMap_Reset( phFriNfc_NdefMap_t *NdefMap,
phFriNfc_Mockup_H_Reset(NdefMap);
#endif /* PHFRINFC_OVRHAL_MOCKUP */
- /*
- * Fix for PR - 0001256
+ /*
+ * Fix for PR - 0001256
* Date- 08-08-08
*/
NdefMap->CardState = PH_NDEFMAP_CARD_STATE_INVALID;
@@ -237,7 +237,7 @@ NFCSTATUS phFriNfc_NdefMap_SetCompletionRoutine(phFriNfc_NdefMap_t *NdefMap,
{
NFCSTATUS status = NFCSTATUS_SUCCESS;
- if ( ( NdefMap == NULL ) || (FunctionID >= PH_FRINFC_NDEFMAP_CR) ||
+ if ( ( NdefMap == NULL ) || (FunctionID >= PH_FRINFC_NDEFMAP_CR) ||
( CompletionRoutine == NULL) || (CompletionRoutineContext == NULL))
{
status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP, NFCSTATUS_INVALID_PARAMETER);
@@ -258,7 +258,7 @@ NFCSTATUS phFriNfc_NdefMap_SetCompletionRoutine(phFriNfc_NdefMap_t *NdefMap,
* Initiates Reading of NDEF information from the Remote Device.
*
* Remote Peer device may be of type any card. Ex: desfire,felica,jewel
-* mifareUL,mifare 1K etc. The function initiates the reading of NDEF
+* mifareUL,mifare 1K etc. The function initiates the reading of NDEF
* information from a Remote Device.
*
* This is the main NdefMap read function call.Internally,depending upon
@@ -280,9 +280,9 @@ NFCSTATUS phFriNfc_NdefMap_RdNdef( phFriNfc_NdefMap_t *NdefMap,
{
NFCSTATUS status = NFCSTATUS_PENDING;
-
+
/* check for validity of input parameters*/
- if (( PacketData == NULL )
+ if (( PacketData == NULL )
|| ( NdefMap == NULL )
|| ( PacketDataLength == NULL )
|| ( *PacketDataLength == 0 )
@@ -295,15 +295,15 @@ NFCSTATUS phFriNfc_NdefMap_RdNdef( phFriNfc_NdefMap_t *NdefMap,
}
else if (NdefMap->CardState == PH_NDEFMAP_CARD_STATE_INVALID)
{
- /* Card is in invalid state, cannot have any read/write
+ /* Card is in invalid state, cannot have any read/write
operations*/
status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,\
NFCSTATUS_INVALID_FORMAT);
- }
+ }
else if(NdefMap->CardState == PH_NDEFMAP_CARD_STATE_INITIALIZED)
{
/* Can't read any data from the card:TLV length is zero*/
- status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP, NFCSTATUS_EOF_NDEF_CONTAINER_REACHED);
+ status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP, NFCSTATUS_EOF_NDEF_CONTAINER_REACHED);
NdefMap->NumOfBytesRead = PacketDataLength;
*NdefMap->NumOfBytesRead = 0;
@@ -317,7 +317,7 @@ NFCSTATUS phFriNfc_NdefMap_RdNdef( phFriNfc_NdefMap_t *NdefMap,
else
{
/* Check the offset given by the user
- If the offset is 1 (SEEK_BEGIN), reset everything and start
+ If the offset is 1 (SEEK_BEGIN), reset everything and start
reading from the first Page of the card.
else if offset is 0 (PH_FRINFC_NDEFMAP_SEEK_CUR), continue reading
No need to reset the parameters. */
@@ -353,6 +353,9 @@ NFCSTATUS phFriNfc_NdefMap_RdNdef( phFriNfc_NdefMap_t *NdefMap,
#ifndef PH_FRINFC_MAP_DESFIRE_DISABLED
case PH_FRINFC_NDEFMAP_ISO14443_4A_CARD :
+#ifdef DESFIRE_EV1
+ case PH_FRINFC_NDEFMAP_ISO14443_4A_CARD_EV1 :
+#endif /* #ifdef DESFIRE_EV1 */
/* Desfire card selected. Call Desfire read */
status = phFriNfc_Desfire_RdNdef( NdefMap,
PacketData,
@@ -411,7 +414,7 @@ NFCSTATUS phFriNfc_NdefMap_RdNdef( phFriNfc_NdefMap_t *NdefMap,
break;
#endif /* PHFRINFC_OVRHAL_MOCKUP */
- default :
+ default :
/* Unknown card type. Return error */
status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,\
NFCSTATUS_INVALID_REMOTE_DEVICE);
@@ -429,15 +432,15 @@ NFCSTATUS phFriNfc_NdefMap_RdNdef( phFriNfc_NdefMap_t *NdefMap,
* The function initiates the writing of NDEF information to a Remote Device
*
* Remote Peer device may be of type any card. Ex: desfire,felica,jewel
-* mifareUL,mifare 1K etc. The function initiates the reading of NDEF
+* mifareUL,mifare 1K etc. The function initiates the reading of NDEF
* information from a Remote Device.
*
-* This is a main write api.Internally,depending upon the CardType,
+* This is a main write api.Internally,depending upon the CardType,
* respective mifare/desfire write apis are called.In future this can be
* extended to support any types of card.
*
* It performs a reset of the state and starts the action (state machine).
-* A periodic call of the \ref phFriNfcNdefMap_Process has to be done once
+* A periodic call of the \ref phFriNfcNdefMap_Process has to be done once
* the action has been triggered.
*
* NOTE: Please refer the header file for more information.
@@ -451,7 +454,7 @@ NFCSTATUS phFriNfc_NdefMap_WrNdef( phFriNfc_NdefMap_t *NdefMap,
uint8_t Offset)
{
NFCSTATUS status = NFCSTATUS_PENDING;
- uint8_t StatusChk=0;
+ uint8_t StatusChk=0;
if ( (PacketData == NULL)
|| ( NdefMap == NULL )
@@ -466,12 +469,12 @@ NFCSTATUS phFriNfc_NdefMap_WrNdef( phFriNfc_NdefMap_t *NdefMap,
{
/* Invalid input parameter error */
status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,NFCSTATUS_INVALID_PARAMETER);
- }
- else if (( NdefMap->CardState == PH_NDEFMAP_CARD_STATE_INVALID) &&
- (PH_FRINFC_NDEFMAP_TOPAZ_CARD != NdefMap->CardType) &&
+ }
+ else if (( NdefMap->CardState == PH_NDEFMAP_CARD_STATE_INVALID) &&
+ (PH_FRINFC_NDEFMAP_TOPAZ_CARD != NdefMap->CardType) &&
(PH_FRINFC_NDEFMAP_TOPAZ_DYNAMIC_CARD != NdefMap->CardType))
{
- /* Card is in invalid state, cannot have any read/write
+ /* Card is in invalid state, cannot have any read/write
operations*/
status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,\
NFCSTATUS_INVALID_FORMAT);
@@ -489,19 +492,19 @@ NFCSTATUS phFriNfc_NdefMap_WrNdef( phFriNfc_NdefMap_t *NdefMap,
*NdefMap->WrNdefPacketLength = 0;
}
- else
+ else
{
/* Check the offset given by the user
- If the offset is 1 (SEEK_BEGIN), reset everything and start
+ If the offset is 1 (SEEK_BEGIN), reset everything and start
writing from the first Byte of the card.
else if offset is 0 (PH_FRINFC_NDEFMAP_SEEK_CUR), continue writing
No need to reset the parameters. */
- if (( NdefMap->CardState == PH_NDEFMAP_CARD_STATE_INVALID) &&
+ if (( NdefMap->CardState == PH_NDEFMAP_CARD_STATE_INVALID) &&
(PH_FRINFC_NDEFMAP_TOPAZ_DYNAMIC_CARD == NdefMap->CardType))
{
/* If Topaz Dynamic card CC bytes are not valid then also allow writing,
If card is really good then writing will be done properly and reading can be performed,
- otherwise writing or reading will fail. so, setting card state to
+ otherwise writing or reading will fail. so, setting card state to
NdefMap->CardState = PH_NDEFMAP_CARD_STATE_READ_WRITE */
NdefMap->CardState = PH_NDEFMAP_CARD_STATE_READ_WRITE;
}
@@ -512,10 +515,10 @@ NFCSTATUS phFriNfc_NdefMap_WrNdef( phFriNfc_NdefMap_t *NdefMap,
*NdefMap->DataCount = 0;
}
- if ( (NdefMap->CardType == PH_FRINFC_NDEFMAP_MIFARE_UL_CARD) ||
+ if ( (NdefMap->CardType == PH_FRINFC_NDEFMAP_MIFARE_UL_CARD) ||
(NdefMap->CardType == PH_FRINFC_NDEFMAP_ISO14443_4A_CARD))
{
- if (( (NdefMap->PrevOperation == PH_FRINFC_NDEFMAP_READ_OPE) && (Offset != PH_FRINFC_NDEFMAP_SEEK_BEGIN )) ||
+ if (( (NdefMap->PrevOperation == PH_FRINFC_NDEFMAP_READ_OPE) && (Offset != PH_FRINFC_NDEFMAP_SEEK_BEGIN )) ||
( (Offset == PH_FRINFC_NDEFMAP_SEEK_CUR) && (*NdefMap->DataCount == 0 )))
{
/* A WRITE operation cannot be done if the previuos operation was READ
@@ -542,11 +545,14 @@ NFCSTATUS phFriNfc_NdefMap_WrNdef( phFriNfc_NdefMap_t *NdefMap,
#ifndef PH_FRINFC_MAP_DESFIRE_DISABLED
case PH_FRINFC_NDEFMAP_ISO14443_4A_CARD :
+#ifdef DESFIRE_EV1
+ case PH_FRINFC_NDEFMAP_ISO14443_4A_CARD_EV1 :
+#endif /* #ifdef DESFIRE_EV1 */
/* Desfire card selected. Call Desfire Write */
status = phFriNfc_Desfire_WrNdef( NdefMap,
PacketData,
PacketDataLength,
- Offset);
+ Offset);
break;
#endif /* PH_FRINFC_MAP_DESFIRE_DISABLED */
@@ -600,7 +606,7 @@ NFCSTATUS phFriNfc_NdefMap_WrNdef( phFriNfc_NdefMap_t *NdefMap,
Offset);
break;
#endif /* PHFRINFC_OVRHAL_MOCKUP */
- default :
+ default :
/* Unknown card type. Return error */
status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
NFCSTATUS_INVALID_REMOTE_DEVICE);
@@ -614,15 +620,15 @@ NFCSTATUS phFriNfc_NdefMap_WrNdef( phFriNfc_NdefMap_t *NdefMap,
/*!
* Check whether a particular Remote Device is NDEF compliant.
*
-* The function initiates the ndef compliancy check.
+* The function initiates the ndef compliancy check.
*
* This is a main check ndef api.Internally,depending upon the different
* opmodes,respective mifare/desfire checkNdef apis are called.
-* In future this can be extended to check any types of card ndef
+* In future this can be extended to check any types of card ndef
* compliancy.
*
* It performs a reset of the state and starts the action (state machine).
-* A periodic call of the \ref phFriNfcNdefMap_Process has to be done once
+* A periodic call of the \ref phFriNfcNdefMap_Process has to be done once
* the action has been triggered.
*
* NOTE: Please refer the header file for more information.
@@ -656,12 +662,12 @@ NFCSTATUS phFriNfc_NdefMap_ChkNdef( phFriNfc_NdefMap_t *NdefMap)
{
/*
* 1.Changed
- * CardInfo106 Replace with the ReaderA_Info.
+ * CardInfo106 Replace with the ReaderA_Info.
*/
sak = NdefMap->psRemoteDevInfo->RemoteDevInfo.Iso14443A_Info.Sak;
- /*
+ /*
* 3. Changed
* Description: Opmode replace with RemDevType.
*/
@@ -673,41 +679,41 @@ NFCSTATUS phFriNfc_NdefMap_ChkNdef( phFriNfc_NdefMap_t *NdefMap)
case phHal_eISO14443_3A_PICC:
/* Remote device is Mifare card . Check for Mifare
NDEF compliancy */
- if(0x00 == sak)
+ if(0x00 == sak)
{
/* The SAK/Sel_Res says the card is of the type
Mifare UL */
#ifndef PH_FRINFC_MAP_MIFAREUL_DISABLED
status = phFriNfc_MifareUL_ChkNdef( NdefMap);
#else /* PH_FRINFC_MAP_MIFAREUL_DISABLED*/
- status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
- NFCSTATUS_INVALID_REMOTE_DEVICE);
+ status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
+ NFCSTATUS_INVALID_REMOTE_DEVICE);
#endif /* PH_FRINFC_MAP_MIFAREUL_DISABLED*/
}
- else if ((0x08 == (sak & 0x18)) ||
- (0x18 == (sak & 0x18)))
+ else if ((0x08 == (sak & 0x18)) ||
+ (0x18 == (sak & 0x18)))
{
/* The SAK/Sel_Res says the card is of the type
Mifare Standard */
#ifndef PH_FRINFC_MAP_MIFARESTD_DISABLED
status = phFriNfc_MifareStdMap_ChkNdef( NdefMap);
#else /* PH_FRINFC_MAP_MIFARESTD_DISABLED*/
- status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
- NFCSTATUS_INVALID_REMOTE_DEVICE);
+ status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
+ NFCSTATUS_INVALID_REMOTE_DEVICE);
#endif /* PH_FRINFC_MAP_MIFARESTD_DISABLED*/
}
else
{
- /* Invalid Mifare UL card, as the remote device
- info - opmode says its a Mifare UL card but,
+ /* Invalid Mifare UL card, as the remote device
+ info - opmode says its a Mifare UL card but,
The SAK/Sel_Res is wrong */
- status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
+ status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
NFCSTATUS_INVALID_REMOTE_DEVICE);
}
break;
case phHal_eISO14443_B_PICC:
- {
- status = phFriNfc_Desfire_ChkNdef(NdefMap);
+ {
+ status = phFriNfc_Desfire_ChkNdef(NdefMap);
}
break;
case phHal_eISO14443_A_PICC :
@@ -720,16 +726,16 @@ NFCSTATUS phFriNfc_NdefMap_ChkNdef( phFriNfc_NdefMap_t *NdefMap)
#ifndef PH_FRINFC_MAP_DESFIRE_DISABLED
status = phFriNfc_Desfire_ChkNdef(NdefMap);
#else /* PH_FRINFC_MAP_DESFIRE_DISABLED*/
- status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
- NFCSTATUS_INVALID_REMOTE_DEVICE);
+ status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
+ NFCSTATUS_INVALID_REMOTE_DEVICE);
#endif /* PH_FRINFC_MAP_DESFIRE_DISABLED*/
}
else
{
- /* Invalid Desfire card, as the remote device
- info - opmode says its a desfire card but,
+ /* Invalid Desfire card, as the remote device
+ info - opmode says its a desfire card but,
The SAK/Sel_Res is wrong */
- status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
+ status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
NFCSTATUS_INVALID_REMOTE_DEVICE);
}
break;
@@ -744,8 +750,8 @@ NFCSTATUS phFriNfc_NdefMap_ChkNdef( phFriNfc_NdefMap_t *NdefMap)
#endif /* #ifndef PH_HAL4_ENABLE */
status = phFriNfc_Felica_ChkNdef(NdefMap);
#else /* PH_FRINFC_MAP_FELICA_DISABLED*/
- status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
- NFCSTATUS_INVALID_REMOTE_DEVICE);
+ status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
+ NFCSTATUS_INVALID_REMOTE_DEVICE);
#endif /* PH_FRINFC_MAP_FELICA_DISABLED*/
break;
@@ -758,8 +764,8 @@ NFCSTATUS phFriNfc_NdefMap_ChkNdef( phFriNfc_NdefMap_t *NdefMap)
NdefMap->OpModeType[1] = phHal_eOpModesArrayTerminator;
status = phFriNfc_Felica_ChkNdef(NdefMap);
#else /* PH_FRINFC_MAP_FELICA_DISABLED*/
- status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
- NFCSTATUS_INVALID_REMOTE_DEVICE);
+ status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
+ NFCSTATUS_INVALID_REMOTE_DEVICE);
#endif /* PH_FRINFC_MAP_FELICA_DISABLED*/
break;
#endif
@@ -770,16 +776,16 @@ NFCSTATUS phFriNfc_NdefMap_ChkNdef( phFriNfc_NdefMap_t *NdefMap)
#ifdef PH_HAL4_ENABLE
#ifndef PH_FRINFC_MAP_TOPAZ_DISABLED
/* Decide on the Header bytes to know the
- Type of the Topaz card.Card could be Static or
+ Type of the Topaz card.Card could be Static or
Dynamic type. These are of type NFFC-NDEF Data Application*/
- if ( NdefMap->psRemoteDevInfo->RemoteDevInfo.Jewel_Info.HeaderRom0
+ if ( NdefMap->psRemoteDevInfo->RemoteDevInfo.Jewel_Info.HeaderRom0
== PH_FRINFC_TOPAZ_HEADROM0_VAL)
{
status = phFriNfc_TopazMap_ChkNdef(NdefMap);
}
#ifndef PH_FRINFC_MAP_TOPAZ_DYNAMIC_DISABLED
- else if( NdefMap->psRemoteDevInfo->RemoteDevInfo.Jewel_Info.HeaderRom0
+ else if( NdefMap->psRemoteDevInfo->RemoteDevInfo.Jewel_Info.HeaderRom0
== PH_FRINFC_TOPAZ_DYNAMIC_HEADROM0_VAL)
{
@@ -789,7 +795,7 @@ NFCSTATUS phFriNfc_NdefMap_ChkNdef( phFriNfc_NdefMap_t *NdefMap)
else
{
- status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
+ status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
NFCSTATUS_INVALID_REMOTE_DEVICE);
}
@@ -804,19 +810,19 @@ NFCSTATUS phFriNfc_NdefMap_ChkNdef( phFriNfc_NdefMap_t *NdefMap)
#ifndef PH_FRINFC_MAP_TOPAZ_DISABLED
status = phFriNfc_TopazMap_ChkNdef(NdefMap);
#else /* PH_FRINFC_MAP_TOPAZ_DISABLED*/
- status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
- NFCSTATUS_INVALID_REMOTE_DEVICE);
+ status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
+ NFCSTATUS_INVALID_REMOTE_DEVICE);
#endif /* PH_FRINFC_MAP_TOPAZ_DISABLED*/
}
else
- {
- /* Invalid Topaz card, as the remote device
- info - opmode says its a desfire card but,
+ {
+ /* Invalid Topaz card, as the remote device
+ info - opmode says its a desfire card but,
The SAK/Sel_Res is wrong */
- status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
+ status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
NFCSTATUS_INVALID_REMOTE_DEVICE);
}
-#endif
+#endif
break;
#ifdef PHFRINFC_OVRHAL_MOCKUP
@@ -875,8 +881,8 @@ void phFriNfc_NdefMap_Process( void *Context,
/* Remote device is Mifare Standard card */
phFriNfc_MifareStdMap_Process(NdefMap,Status);
#else /* PH_FRINFC_MAP_MIFARESTD_DISABLED*/
- Status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
- NFCSTATUS_INVALID_REMOTE_DEVICE);
+ Status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
+ NFCSTATUS_INVALID_REMOTE_DEVICE);
#endif /* PH_FRINFC_MAP_MIFARESTD_DISABLED*/
}
else
@@ -885,8 +891,8 @@ void phFriNfc_NdefMap_Process( void *Context,
/* Remote device is Mifare UL card */
phFriNfc_MifareUL_Process(NdefMap,Status);
#else /* PH_FRINFC_MAP_MIFAREUL_DISABLED*/
- Status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
- NFCSTATUS_INVALID_REMOTE_DEVICE);
+ Status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
+ NFCSTATUS_INVALID_REMOTE_DEVICE);
#endif /* PH_FRINFC_MAP_MIFAREUL_DISABLED*/
}
break;
@@ -896,8 +902,8 @@ void phFriNfc_NdefMap_Process( void *Context,
/* Remote device is Desfire card */
phFriNfc_Desfire_Process(NdefMap, Status);
#else /* PH_FRINFC_MAP_DESFIRE_DISABLED*/
- Status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
- NFCSTATUS_INVALID_REMOTE_DEVICE);
+ Status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
+ NFCSTATUS_INVALID_REMOTE_DEVICE);
#endif /* PH_FRINFC_MAP_DESFIRE_DISABLED*/
break;
case phHal_eISO14443_B_PICC:
@@ -910,8 +916,8 @@ void phFriNfc_NdefMap_Process( void *Context,
/* Remote device is Felica Smart card */
phFriNfc_Felica_Process(NdefMap, Status);
#else /* PH_FRINFC_MAP_FELICA_DISABLED*/
- Status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
- NFCSTATUS_INVALID_REMOTE_DEVICE);
+ Status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
+ NFCSTATUS_INVALID_REMOTE_DEVICE);
#endif /* PH_FRINFC_MAP_FELICA_DISABLED*/
break;
@@ -930,8 +936,8 @@ void phFriNfc_NdefMap_Process( void *Context,
}
else
{
- Status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
- NFCSTATUS_INVALID_REMOTE_DEVICE);
+ Status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
+ NFCSTATUS_INVALID_REMOTE_DEVICE);
}
break;
@@ -942,10 +948,10 @@ void phFriNfc_NdefMap_Process( void *Context,
#ifdef PHFRINFC_OVRHAL_MOCKUP
case phHal_eOpModesMockup:
/* Remote device is Desfire card */
- phFriNfc_Mockup_Process(NdefMap, Status);
+ phFriNfc_Mockup_Process(NdefMap, Status);
break;
#endif /* PHFRINFC_OVRHAL_MOCKUP*/
- default :
+ default :
/* Remote device opmode not recognised.
Probably not NDEF compliant */
Status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
@@ -1004,7 +1010,7 @@ NFCSTATUS phFriNfc_ChkAndParseTLV(phFriNfc_NdefMap_t *NdefMap)
break;
#endif /* PH_FRINFC_MAP_FELICA_DISABLED */
- default :
+ default :
/* Unknown card type. Return error */
status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,\
NFCSTATUS_INVALID_REMOTE_DEVICE);
@@ -1094,6 +1100,9 @@ NFCSTATUS phFriNfc_NdefMap_EraseNdef(phFriNfc_NdefMap_t *NdefMap)
#endif /* PHFRINFC_OVRHAL_MOCKUP */
case PH_FRINFC_NDEFMAP_MIFARE_UL_CARD :
case PH_FRINFC_NDEFMAP_ISO14443_4A_CARD :
+#ifdef DESFIRE_EV1
+ case PH_FRINFC_NDEFMAP_ISO14443_4A_CARD_EV1 :
+#endif /* #ifdef DESFIRE_EV1 */
case PH_FRINFC_NDEFMAP_MIFARE_STD_1K_CARD :
case PH_FRINFC_NDEFMAP_MIFARE_STD_4K_CARD :
#ifndef PH_FRINFC_MAP_TOPAZ_DISABLED
@@ -1112,15 +1121,15 @@ NFCSTATUS phFriNfc_NdefMap_EraseNdef(phFriNfc_NdefMap_t *NdefMap)
case PH_FRINFC_NDEFMAP_FELICA_SMART_CARD :
#ifndef PH_FRINFC_MAP_FELICA_DISABLED
- /* Felica card selected. Call to write EMPTY NDEF Msg */
+ /* Felica card selected. Call to write EMPTY NDEF Msg */
status = phFriNfc_Felica_EraseNdef( NdefMap );
#else /* PH_FRINFC_MAP_FELICA_DISABLED*/
- status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
- NFCSTATUS_INVALID_REMOTE_DEVICE);
+ status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
+ NFCSTATUS_INVALID_REMOTE_DEVICE);
#endif /* PH_FRINFC_MAP_FELICA_DISABLED*/
break;
- default :
+ default :
/* Unknown card type. Return error */
status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,
NFCSTATUS_INVALID_REMOTE_DEVICE);
@@ -1156,11 +1165,11 @@ NFCSTATUS phFriNfc_NdefMap_GetContainerSize(const phFriNfc_NdefMap_t *NdefMap,ui
#ifndef PH_FRINFC_MAP_MIFAREUL_DISABLED
case PH_FRINFC_NDEFMAP_MIFARE_UL_CARD :
/* Mifare UL card */
- /* The integration needs to ensure that the checkNdef
+ /* The integration needs to ensure that the checkNdef
function has been called before calling this function,
otherwise NdefMap->CardMemSize will be 0 */
*maxSize = NdefMap->MifareULContainer.RemainingSize;
- /* In Mifare UL card, the actual size is the length field
+ /* In Mifare UL card, the actual size is the length field
value of the TLV */
*actualSize = NdefMap->TLVStruct.ActualSize;
break;
@@ -1168,14 +1177,17 @@ NFCSTATUS phFriNfc_NdefMap_GetContainerSize(const phFriNfc_NdefMap_t *NdefMap,ui
#ifndef PH_FRINFC_MAP_DESFIRE_DISABLED
case PH_FRINFC_NDEFMAP_ISO14443_4A_CARD :
+#ifdef DESFIRE_EV1
+ case PH_FRINFC_NDEFMAP_ISO14443_4A_CARD_EV1 :
+#endif /* #ifdef DESFIRE_EV1 */
/* Desfire card */
- /* The integration needs to ensure that the checkNdef
+ /* The integration needs to ensure that the checkNdef
function has been called before calling this function,
- otherwise NdefMap->DesfireCapContainer.NdefFileSize
+ otherwise NdefMap->DesfireCapContainer.NdefFileSize
will be 0 */
/* -2 bytes represents the size field bytes*/
*maxSize = NdefMap->DesfireCapContainer.NdefFileSize - 2;
- /* In Desfire card, the actual size cant be calculated so
+ /* In Desfire card, the actual size cant be calculated so
the actual size is given as 0xFFFFFFFF */
*actualSize = NdefMap->DesfireCapContainer.NdefDataLen;
break;
@@ -1184,22 +1196,22 @@ NFCSTATUS phFriNfc_NdefMap_GetContainerSize(const phFriNfc_NdefMap_t *NdefMap,ui
#ifndef PH_FRINFC_MAP_TOPAZ_DISABLED
case PH_FRINFC_NDEFMAP_TOPAZ_CARD :
/* Topaz card */
- /* The integration needs to ensure that the checkNdef
+ /* The integration needs to ensure that the checkNdef
function has been called before calling this function,
otherwise NdefMap->CardMemSize will be 0 */
*maxSize = NdefMap->TopazContainer.RemainingSize;
- /* In Topaz card, the actual size is the length field value of the
+ /* In Topaz card, the actual size is the length field value of the
TLV */
*actualSize = NdefMap->TLVStruct.BytesRemainLinTLV;
break;
#ifndef PH_FRINFC_MAP_TOPAZ_DYNAMIC_DISABLED
case PH_FRINFC_NDEFMAP_TOPAZ_DYNAMIC_CARD :
/* Topaz 512 card */
- /* The integration needs to ensure that the checkNdef
+ /* The integration needs to ensure that the checkNdef
function has been called before calling this function,
otherwise NdefMap->CardMemSize will be 0 */
*maxSize = NdefMap->TopazContainer.NDEFRWSize;
- /* In Topaz card, the actual size is the length field value of the
+ /* In Topaz card, the actual size is the length field value of the
TLV */
*actualSize = NdefMap->TopazContainer.ActualNDEFMsgSize;
break;
@@ -1219,44 +1231,44 @@ NFCSTATUS phFriNfc_NdefMap_GetContainerSize(const phFriNfc_NdefMap_t *NdefMap,ui
#else /* #ifndef PH_HAL4_ENABLE */
- while ((PH_FRINFC_MIFARESTD_NDEF_COMP ==
- NdefMap->StdMifareContainer.aid[count_index]) &&
- (count_index <
+ while ((PH_FRINFC_MIFARESTD_NDEF_COMP ==
+ NdefMap->StdMifareContainer.aid[count_index]) &&
+ (count_index <
PH_FRINFC_NDEFMAP_MIFARESTD_TOTALNO_BLK))
{
actual_sect_index++;
count_index++;
}
/* Total number of sectors in 1k = 16 (0 to 15, MAD sector number = 0)
- Total number of sectors in 4k = 40 (0 to 39,
- MAD sector number = 0 and 16, After block number 31, each sector
+ Total number of sectors in 4k = 40 (0 to 39,
+ MAD sector number = 0 and 16, After block number 31, each sector
has 16 blocks)
- Every last block of the sector is the sector header, So the blocks
- that can be read or written in each sector is always
+ Every last block of the sector is the sector header, So the blocks
+ that can be read or written in each sector is always
(number of blocks in each sector - 1)
- No of blocks in the one sector till the sector number 0 to 31
- (total 32 sectors) =
+ No of blocks in the one sector till the sector number 0 to 31
+ (total 32 sectors) =
4 blocks, So blocks that can be read/write = (4 - 1 = 3 blocks)
- No of blocks in the one sector after the sector number 31 to 39 =
+ No of blocks in the one sector after the sector number 31 to 39 =
16 blocks, So blocks that can be read/write = (16 - 1 = 15 blocks)
- Each block has 16 bytes
+ Each block has 16 bytes
To calculate number of bytes in the sector, depending on the number
of blocks multiplied by 16
*/
- if (PH_FRINFC_NDEFMAP_MIFARE_STD_4K_CARD ==
+ if (PH_FRINFC_NDEFMAP_MIFARE_STD_4K_CARD ==
NdefMap->CardType)
- {
+ {
if (actual_sect_index > 32)
{
sect_index = (actual_sect_index - 32);
- /* Here, 30 is used because block number 0 and 16 are MAD blocks
- which cannot be used for reading and writing data
+ /* Here, 30 is used because block number 0 and 16 are MAD blocks
+ which cannot be used for reading and writing data
3 and 15 are blocks in each sector which can be read/write
3 indicates the sector is in between (0 and 31)
15 indicates the sector is in between (32 to 39)
- 16 is always number of bytes in each block
- 4 is used because each NDEF write has to write using the
- TLV format and T & L takes 4 bytes length and V is the
+ 16 is always number of bytes in each block
+ 4 is used because each NDEF write has to write using the
+ TLV format and T & L takes 4 bytes length and V is the
input data
*/
*maxSize = (((30 * (16 * 3)) + (sect_index * (16 * 15))) - 4);
@@ -1272,7 +1284,7 @@ NFCSTATUS phFriNfc_NdefMap_GetContainerSize(const phFriNfc_NdefMap_t *NdefMap,ui
}
else
{
- /* Here, 16 is always number of bytes in each block
+ /* Here, 16 is always number of bytes in each block
3 indicates the sector is in between (0 and 31) */
if (actual_sect_index > NdefMap->StdMifareContainer.SectorIndex)
{
@@ -1280,7 +1292,7 @@ NFCSTATUS phFriNfc_NdefMap_GetContainerSize(const phFriNfc_NdefMap_t *NdefMap,ui
}
*maxSize = (((actual_sect_index - 1) * (16 * 3)) - 4);
}
-
+
#endif /* #ifndef PH_HAL4_ENABLE */
*actualSize = NdefMap->TLVStruct.BytesRemainLinTLV;
@@ -1298,20 +1310,20 @@ NFCSTATUS phFriNfc_NdefMap_GetContainerSize(const phFriNfc_NdefMap_t *NdefMap,ui
*actualSize = *actualSize << 16;
*actualSize += NdefMap->FelicaAttrInfo.LenBytes[1];
*actualSize = *actualSize << 8;
- *actualSize += NdefMap->FelicaAttrInfo.LenBytes[2];
+ *actualSize += NdefMap->FelicaAttrInfo.LenBytes[2];
break;
#endif /* PH_FRINFC_MAP_FELICA_DISABLED */
#ifdef PHFRINFC_OVRHAL_MOCKUP
case PH_FRINFC_NDEFMAP_MOCKUP_CARD :
*maxSize = 0xFFFFFFFF;
- /* In Desfire card, the actual size cant be calculated so
+ /* In Desfire card, the actual size cant be calculated so
the actual size is given as 0xFFFFFFFF */
- *actualSize = 0xFFFFFFFF;
+ *actualSize = 0xFFFFFFFF;
break;
#endif /* PHFRINFC_OVRHAL_MOCKUP */
- default :
+ default :
/* Unknown card type. Return error */
result = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP,\
NFCSTATUS_INVALID_REMOTE_DEVICE);
@@ -1322,10 +1334,10 @@ NFCSTATUS phFriNfc_NdefMap_GetContainerSize(const phFriNfc_NdefMap_t *NdefMap,ui
}
#ifdef PHFRINFC_OVRHAL_MOCKUP
-NFCSTATUS phFriNfc_NdefMap_MockupCardSetter(phFriNfc_NdefMap_t *NdefMap,
- uint8_t *NdefData,
- uint32_t NdefActualSize,
- uint32_t NdefMaxSize,
+NFCSTATUS phFriNfc_NdefMap_MockupCardSetter(phFriNfc_NdefMap_t *NdefMap,
+ uint8_t *NdefData,
+ uint32_t NdefActualSize,
+ uint32_t NdefMaxSize,
uint32_t CardSize)
{
NFCSTATUS Status = NFCSTATUS_SUCCESS;
@@ -1333,15 +1345,15 @@ NFCSTATUS phFriNfc_NdefMap_MockupCardSetter(phFriNfc_NdefMap_t *NdefMap,
if((NdefData != NULL) && (NdefMap != NULL))
{
// OK we can set
- NdefMap->MochupContainer.NdefData = NdefData;
+ NdefMap->MochupContainer.NdefData = NdefData;
NdefMap->MochupContainer.NdefActualSize = NdefActualSize;
NdefMap->MochupContainer.NdefMaxSize = NdefMaxSize;
NdefMap->MochupContainer.CardSize = CardSize;
NdefMap->MochupContainer.CurrentBlock = 0;
- } else
+ } else
{
- Status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP, NFCSTATUS_INVALID_PARAMETER);
+ Status = PHNFCSTVAL(CID_FRI_NFC_NDEF_MAP, NFCSTATUS_INVALID_PARAMETER);
}
return Status;
}
diff --git a/src/phFriNfc_NdefMap.h b/src/phFriNfc_NdefMap.h
index a70a489..f708d74 100644
--- a/src/phFriNfc_NdefMap.h
+++ b/src/phFriNfc_NdefMap.h
@@ -20,10 +20,10 @@
*
* Project: NFC-FRI
*
- * $Date: Mon Mar 29 16:55:50 2010 $
+ * $Date: Tue Jul 27 08:58:22 2010 $
* $Author: ing02260 $
- * $Revision: 1.23 $
- * $Aliases: NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $
+ * $Revision: 1.24 $
+ * $Aliases: $
*
*/
@@ -35,24 +35,26 @@
#include <phNfcTypes.h>
#include <phNfcStatus.h>
#include <phFriNfc.h>
-#if !defined PH_HAL4_ENABLE
-#include <phHal4Nfc.h>
+#ifdef PH_HAL4_ENABLE
+ #include <phHal4Nfc.h>
+#else
+ #include <phHalNfc.h>
#endif
-
+
#include <phFriNfc_OvrHal.h>
#ifndef PH_FRINFC_EXCLUDE_FROM_TESTFW /* */
-/**
+/**
* \name NDEF Mapping
*
* File: \ref phFriNfc_NdefMap.h
*
*/
/*@{*/
-#define PH_FRINFC_NDEFMAP_FILEREVISION "$Revision: 1.23 $" /**< \ingroup grp_file_attributes */
-#define PH_FRINFC_NDEFMAP_FILEALIASES "$Aliases: NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $" /**< \ingroup grp_file_attributes */
+#define PH_FRINFC_NDEFMAP_FILEREVISION "$Revision: 1.24 $" /**< \ingroup grp_file_attributes */
+#define PH_FRINFC_NDEFMAP_FILEALIASES "$Aliases: $" /**< \ingroup grp_file_attributes */
/*@}*/
#endif /* PH_FRINFC_EXCLUDE_FROM_TESTFW */
@@ -88,10 +90,13 @@
/**
* \name NDEF Mapping - specifies the different card types
- * These are the only recognised card types in this version.
+ * These are the only recognised card types in this version.
*
*/
/*@{*/
+
+#define DESFIRE_EV1
+
#define PH_FRINFC_NDEFMAP_MIFARE_UL_CARD 1 /**< \internal Mifare UL */
#define PH_FRINFC_NDEFMAP_ISO14443_4A_CARD 2 /**< \internal Iso 14443-4A */
#define PH_FRINFC_NDEFMAP_MIFARE_STD_1K_CARD 3 /**< \internal Mifare Standard */
@@ -99,7 +104,9 @@
#define PH_FRINFC_NDEFMAP_FELICA_SMART_CARD 5 /**< \internal Felica Smart Tag */
#define PH_FRINFC_NDEFMAP_TOPAZ_CARD 7 /**< \internal Felica Smart Tag */
#define PH_FRINFC_NDEFMAP_TOPAZ_DYNAMIC_CARD 8 /**< \internal Felica Smart Tag */
+#ifdef DESFIRE_EV1
#define PH_FRINFC_NDEFMAP_ISO14443_4A_CARD_EV1 9 /**< \internal Iso 14443-4A EV1 */
+#endif /* #ifdef DESFIRE_EV1 */
#ifdef PH_NDEF_MIFARE_ULC
@@ -192,35 +199,35 @@ typedef enum
#define PH_FRINFC_NDEFMAP_CR_CHK_NDEF 0 /* */
/** \ingroup grp_fri_nfc_ndef_map
* Completion Routine Index for \ref phFriNfc_NdefMap_RdNdef */
-#define PH_FRINFC_NDEFMAP_CR_RD_NDEF 1 /* */
+#define PH_FRINFC_NDEFMAP_CR_RD_NDEF 1 /* */
/** \ingroup grp_fri_nfc_ndef_map
* Completion Routine Index for \ref phFriNfc_NdefMap_WrNdef */
-#define PH_FRINFC_NDEFMAP_CR_WR_NDEF 2 /* */
+#define PH_FRINFC_NDEFMAP_CR_WR_NDEF 2 /* */
/** \ingroup grp_fri_nfc_ndef_map
* Completion Routine Index for \ref phFriNfc_NdefMap_EraseNdef */
-#define PH_FRINFC_NDEFMAP_CR_ERASE_NDEF 3 /* */
+#define PH_FRINFC_NDEFMAP_CR_ERASE_NDEF 3 /* */
/** \ingroup grp_fri_nfc_ndef_map Completion
* Routine Index for Unknown States/Operations */
-#define PH_FRINFC_NDEFMAP_CR_INVALID_OPE 4 /* */
+#define PH_FRINFC_NDEFMAP_CR_INVALID_OPE 4 /* */
/** \ingroup grp_fri_nfc_ndef_map
* Number of completion routines that have to be initialised */
-#define PH_FRINFC_NDEFMAP_CR 5 /* */
+#define PH_FRINFC_NDEFMAP_CR 5 /* */
/*@}*/
/**
* \name File Offset Attributes
*
- * Following values are used to determine the offset value for Read/Write. This specifies whether
+ * Following values are used to determine the offset value for Read/Write. This specifies whether
* the Read/Write operation needs to be restarted/continued from the last offset set.
*
*/
/*@{*/
/** \ingroup grp_fri_nfc_ndef_map
* Read/Write operation shall start from the last offset set */
-#define PH_FRINFC_NDEFMAP_SEEK_CUR 0 /* */
+#define PH_FRINFC_NDEFMAP_SEEK_CUR 0 /* */
/** \ingroup grp_fri_nfc_ndef_map
* Read/Write operation shall start from the begining of the file/card */
-#define PH_FRINFC_NDEFMAP_SEEK_BEGIN 1 /* */
+#define PH_FRINFC_NDEFMAP_SEEK_BEGIN 1 /* */
/*@}*/
@@ -262,7 +269,7 @@ typedef struct phFriNfc_Felica
/**< Buffer to store odd number of block data */
uint8_t Wr_RemainedBytesBuff[PH_FRINFC_NDEFMAP_FELICA_BLOCK_SIZE];
-
+
/**< Following are different variables used for read operation*/
uint8_t Rd_NoBytesToCopy; /*specifies the extra number of read bytes */
@@ -274,12 +281,12 @@ typedef struct phFriNfc_Felica
/**< Stores Intermediate Copy data len*/
uint8_t IntermediateCpyLen;
-
+
/**< Flag specifies Pad Byte Information*/
uint8_t PadByteFlag;
/**< Flag specifies Intermediate WR Information*/
- uint8_t IntermediateWrFlag;
+ uint8_t IntermediateWrFlag;
/**< Flag specifies Intermediate Rd Information*/
uint8_t IntermediateRdFlag;
@@ -316,10 +323,10 @@ typedef struct phFriNfc_Felica_PollDetails
#ifndef PH_HAL4_ENABLE
phHal_eOpModes_t *OpMode;
#endif
- /**< Temporary place holder to the Remote Device
+ /**< Temporary place holder to the Remote Device
Information, required to store the Felica
session opened information. */
- phHal_sRemoteDevInformation_t psTempRemoteDevInfo;
+ phHal_sRemoteDevInformation_t psTempRemoteDevInfo;
}phFriNfc_Felica_PollDetails_t;
/**
@@ -367,7 +374,7 @@ typedef struct phFriNfc_MifareStdCont
{
/** Device input parameter for poll and connect after failed authentication */
phHal_sDevInputParam_t *DevInputParam;
- /** to store bytes that will be used in the
+ /** to store bytes that will be used in the
next write/read operation, if any */
uint8_t internalBuf[PH_FRINFC_NDEFMAP_MIFARESTD_ST15_BYTES];
/** to Store the length of the internalBuf */
@@ -378,16 +385,16 @@ typedef struct phFriNfc_MifareStdCont
uint8_t NdefBlocks;
/** Total Number of Ndef Complaint Blocks */
uint16_t NoOfNdefCompBlocks;
- /** used in write ndef, to know that internal bytes
+ /** used in write ndef, to know that internal bytes
are accessed */
uint8_t internalBufFlag;
/** used in write ndef, to know that last 16 bytes
are used to write*/
uint8_t RemainingBufFlag;
- /** indicates that Read has reached the end of the
+ /** indicates that Read has reached the end of the
card */
uint8_t ReadWriteCompleteFlag;
- /** indicates that Read has reached the end of the
+ /** indicates that Read has reached the end of the
card */
uint8_t ReadCompleteFlag;
/** indicates that Write is possible or not */
@@ -396,7 +403,7 @@ typedef struct phFriNfc_MifareStdCont
uint8_t ReadFlag;
/** indicates that Write is possible or not */
uint8_t RdBeforeWrFlag;
- /** Authentication Flag indicating that a particular
+ /** Authentication Flag indicating that a particular
sector is authenticated or not */
uint8_t AuthDone;
/** to store the last Sector ID in Check Ndef */
@@ -417,13 +424,13 @@ typedef struct phFriNfc_MifareStdCont
uint16_t remainingSize;
/** To update the remaining size when writing to the Mifare 1k or 4k card */
uint8_t remSizeUpdFlag;
- /** The flag is to know that there is a different AID apart from
+ /** The flag is to know that there is a different AID apart from
NFC forum sector AID */
uint16_t aidCompleteFlag;
- /** The flag is to know that there is a a NFC forum sector exists
+ /** The flag is to know that there is a a NFC forum sector exists
in the card */
uint16_t NFCforumSectFlag;
- /** The flag is to know that the particular sector is a proprietary
+ /** The flag is to know that the particular sector is a proprietary
NFC forum sector */
uint16_t ProprforumSectFlag;
/** The flag is set after reading the MAD sectors */
@@ -438,11 +445,11 @@ typedef struct phFriNfc_MifareStdCont
uint8_t RdAfterWrFlag;
/** Flag to say that poll is required before write ndef (authentication) */
uint8_t PollFlag;
- /** Flag is to know that this is first time the read has been called. This
- is required when read is called after write (especially for the card formatted
+ /** Flag is to know that this is first time the read has been called. This
+ is required when read is called after write (especially for the card formatted
with the 2nd configuration) */
uint8_t FirstReadFlag;
- /** Flag is to know that this is first time the write has been called. This
+ /** Flag is to know that this is first time the write has been called. This
is required when the card formatted with the 3rd configuration */
uint8_t FirstWriteFlag;
}phFriNfc_MifareStdCont_t;
@@ -480,8 +487,8 @@ typedef struct phFriNfc_DesfireCapCont
*
*/
typedef struct phFriNfc_MifareULCont
-{
- /** to store bytes that will be used in the
+{
+ /** to store bytes that will be used in the
next write/read operation, if any */
uint8_t InternalBuf[PH_FRINFC_NDEFMAP_MFUL_4BYTES_BUF];
/** to Store the length of the internalBuf */
@@ -498,10 +505,10 @@ typedef struct phFriNfc_MifareULCont
uint8_t ReadBuf[PH_FRINFC_NDEFMAP_MFUL_64BYTES_BUF];
/** index of the above buffer */
uint16_t ReadBufIndex;
- /** This variable stores the index of the "ReadBuf" from which actual
+ /** This variable stores the index of the "ReadBuf" from which actual
data has to be copied into the user buffer */
uint16_t ByteNumber;
- /** indicates that read/write has reached the end of the
+ /** indicates that read/write has reached the end of the
card */
uint8_t ReadWriteCompleteFlag;
/** Buffer to store 4 bytes of data which is written to a block */
@@ -517,8 +524,8 @@ typedef struct phFriNfc_MifareULCont
*
*/
typedef struct phFriNfc_MockupCont
-{
- /** to store bytes that will be used in the
+{
+ /** to store bytes that will be used in the
next write/read operation, if any */
uint8_t *NdefData;
/** to Store the length of the internalBuf */
@@ -548,7 +555,7 @@ typedef struct phFriNfc_NDEFTLVCont
uint8_t NdefTLVSector;
/** Following two variables are used to store the
T byte and the Block number in which the T is
- found in Tag */
+ found in Tag */
/** Byte number of the next/present available TLV */
uint16_t NdefTLVByte;
/** Block number of the next/present available TLV */
@@ -563,21 +570,21 @@ typedef struct phFriNfc_NDEFTLVCont
and next read contains length (L) bytes of TLV. This flag
is set when the Length (L) of TLV is found in the last read */
uint8_t LcheckedinTLVFlag;
- /** This flag is set, if Terminator TLV is already written
+ /** This flag is set, if Terminator TLV is already written
and next read contains value (V) bytes of TLV. This flag
is set when the value (V) of TLV is found in the last read */
uint8_t SetTermTLVFlag;
- /** To know the number of Length (L) field is present in the
+ /** To know the number of Length (L) field is present in the
next block */
uint8_t NoLbytesinTLV;
- /** The value of 3 bytes length(L) field in TLV. In 3 bytes
- length field, 2 bytes are in one block and other 1 byte
- is in the next block. To store the former block length
+ /** The value of 3 bytes length(L) field in TLV. In 3 bytes
+ length field, 2 bytes are in one block and other 1 byte
+ is in the next block. To store the former block length
field value, this variable is used */
uint16_t prevLenByteValue;
/** The value of length(L) field in TLV. */
uint16_t BytesRemainLinTLV;
- /** Actual size to read and write. This will be always equal to the
+ /** Actual size to read and write. This will be always equal to the
length (L) of TLV as there is only one NDEF TLV . */
uint16_t ActualSize;
/** Flag is to write the length (L) field of the TLV */
@@ -593,7 +600,7 @@ typedef struct phFriNfc_NDEFTLVCont
/**
* \ingroup grp_fri_nfc_ndef_map
* \brief Lock Control TLV structure which stores the Position,
- * Size and PageCntrl details.
+ * Size and PageCntrl details.
*/
typedef struct phFriNfc_LockCntrlTLVCont
@@ -602,7 +609,7 @@ typedef struct phFriNfc_LockCntrlTLVCont
in the card memory*/
uint16_t ByteAddr;
- /** Specifies the Size of the lock area in terms of
+ /** Specifies the Size of the lock area in terms of
bits/bytes*/
uint16_t Size;
@@ -631,7 +638,7 @@ typedef struct phFriNfc_LockCntrlTLVCont
/**
* \ingroup grp_fri_nfc_ndef_map
* \brief Memeory Control TLV structure which stores the Position,
- * Size and PageCntrl details of the reserved byte area.
+ * Size and PageCntrl details of the reserved byte area.
*/
typedef struct phFriNfc_ResMemCntrlTLVCont
@@ -640,7 +647,7 @@ typedef struct phFriNfc_ResMemCntrlTLVCont
in the card memory*/
uint16_t ByteAddr;
- /** Specifies the Size of the lock area in terms of
+ /** Specifies the Size of the lock area in terms of
bits/bytes*/
uint16_t Size;
@@ -673,7 +680,7 @@ typedef struct phFriNfc_ResMemCntrlTLVCont
*/
typedef struct phFriNfc_TopazCont
{
- /** This stores the free memory size left in the card. In case of topaz,
+ /** This stores the free memory size left in the card. In case of topaz,
this is updated only during check ndef */
uint16_t RemainingSize;
/** Stores the current block number */
@@ -694,7 +701,7 @@ typedef struct phFriNfc_TopazCont
uint8_t CCByteBuf[4];
/** Store the Buffer Index */
uint16_t Cur_RW_Index;
-
+
/* No of bytes read or write*/
uint16_t ByteRWFrmCard;
@@ -704,11 +711,11 @@ typedef struct phFriNfc_TopazCont
/** Store the read bytes */
uint8_t ReadBuffer[PH_FRINFC_NDEFMAP_TOPAZ_MAX_SIZE];
- /** Size to know the exact data filled in the ReadBuffer. Useful, when the
+ /** Size to know the exact data filled in the ReadBuffer. Useful, when the
offset = PH_FRINFC_NDEFMAP_SEEK_CUR */
uint8_t ReadBufferSize;
- /** NDEF TLV byte address, This stores the byte address of
+ /** NDEF TLV byte address, This stores the byte address of
TYPE field of the TLV */
uint16_t NdefTLVByteAddress;
@@ -721,14 +728,14 @@ typedef struct phFriNfc_TopazCont
/** Actual NDEF message size */
uint16_t ActualNDEFMsgSize;
- /** NDEF Read Write size in the card, this excludes lock and reserved bytes,
+ /** NDEF Read Write size in the card, this excludes lock and reserved bytes,
mentioned in the LOCK and MEMORY control TLVs */
uint16_t NDEFRWSize;
- /** Remaining read size in the card, after reading the card.
- User has asked for the data less than " ActualNDEFMsgSize ",
+ /** Remaining read size in the card, after reading the card.
+ User has asked for the data less than " ActualNDEFMsgSize ",
then remaining read bytes are stored in this variable.
- If the next read is with offset = PH_FRINFC_NDEFMAP_SEEK_CUR,
+ If the next read is with offset = PH_FRINFC_NDEFMAP_SEEK_CUR,
then this variable is used.
*/
uint16_t RemainingReadSize;
@@ -746,13 +753,13 @@ typedef struct phFriNfc_TopazCont
typedef struct phFriNfc_NdefMap
{
/**< \internal The state of the operation. */
- uint8_t State;
-
+ uint8_t State;
+
/**< \internal Completion Routine Context. */
- phFriNfc_CplRt_t CompletionRoutine[PH_FRINFC_NDEFMAP_CR];
-
+ phFriNfc_CplRt_t CompletionRoutine[PH_FRINFC_NDEFMAP_CR];
+
/**< \internal Pointer to the lower (HAL) instance. */
- void *LowerDevice;
+ void *LowerDevice;
/**<\internal Holds the device additional informations*/
phHal_sDepAdditionalInfo_t psDepAdditionalInfo;
@@ -761,24 +768,24 @@ typedef struct phFriNfc_NdefMap
phFriNfc_CplRt_t MapCompletionInfo;
/**< \internal Pointer to the Remote Device Information */
- phHal_sRemoteDevInformation_t *psRemoteDevInfo;
+ phHal_sRemoteDevInformation_t *psRemoteDevInfo;
/**<\internal Holds the Command Type(read/write)*/
phHal_uCmdList_t Cmd;
-
+
/**< \internal Pointer to a temporary buffer. Could be
used for read/write purposes */
- uint8_t *ApduBuffer;
-
+ uint8_t *ApduBuffer;
+
/**< \internal Size allocated to the ApduBuffer. */
- uint32_t ApduBufferSize;
+ uint32_t ApduBufferSize;
/**< \internal Index to the APDU Buffer. Used for internal calculations */
uint16_t ApduBuffIndex;
-
+
/**< \internal Pointer to the user-provided Data Size to be written trough WrNdef function. */
uint32_t *WrNdefPacketLength;
-
+
/**< \internal Holds the length of the received data. */
uint16_t *SendRecvLength;
@@ -787,10 +794,10 @@ typedef struct phFriNfc_NdefMap
uint8_t *SendRecvBuf;
/**< \internal Holds the length of the data to be sent. */
- uint16_t SendLength;
+ uint16_t SendLength;
/**< \internal Data Byte Count, which gives the offset to the integration.*/
- uint16_t *DataCount;
+ uint16_t *DataCount;
/**< \ internal Holds the previous operation on the card*/
uint8_t PrevOperation;
@@ -799,34 +806,34 @@ typedef struct phFriNfc_NdefMap
uint8_t PrevState;
/**< \internal Stores the type of the smart card. */
- uint8_t CardType;
+ uint8_t CardType;
/**< \internal Stores the card state. */
- uint8_t CardState;
+ uint8_t CardState;
/**< \internal Stores the memory size of the card */
uint16_t CardMemSize;
/**<\internal to Store the page offset on the mifare ul card*/
- uint8_t Offset;
+ uint8_t Offset;
/** \internal specifies the desfire operation to be performed*/
- uint8_t DespOpFlag;
-
- /** \internal Used to remeber how many bytes were written, to update
+ uint8_t DespOpFlag;
+
+ /** \internal Used to remeber how many bytes were written, to update
the dataCount and the BufferIndex */
uint16_t NumOfBytesWritten;
/**\internal used to remember number of L byte Remaining to be written */
- uint16_t NumOfLReminWrite;
+ uint16_t NumOfLReminWrite;
- /** \internal Pointer Used to remeber and return how many bytes were read,
+ /** \internal Pointer Used to remeber and return how many bytes were read,
to update the PacketDataLength in case of Read operation */
- /* Fix for 0000238: [gk] MAP: Number of bytes actually read out is
+ /* Fix for 0000238: [gk] MAP: Number of bytes actually read out is
not returned. */
uint32_t *NumOfBytesRead;
- /** \internal Flag used to tell the process function that WRITE has
+ /** \internal Flag used to tell the process function that WRITE has
requested for an internal READ.*/
uint8_t ReadingForWriteOperation;
@@ -849,7 +856,7 @@ typedef struct phFriNfc_NdefMap
/** \internal stores the TLV structure related informations */
phFriNfc_NDEFTLVCont_t TLVStruct;
-
+
/** \internal stores the Lock Contrl Tlv related informations */
phFriNfc_LockCntrlTLVCont_t LockTlv;
@@ -862,7 +869,7 @@ typedef struct phFriNfc_NdefMap
#ifndef PH_FRINFC_EXCLUDE_FROM_TESTFW /* */
/** \internal Desfire capability Container Structure. */
#ifndef PH_FRINFC_MAP_DESFIRE_DISABLED
- phFriNfc_DesfireCapCont_t DesfireCapContainer;
+ phFriNfc_DesfireCapCont_t DesfireCapContainer;
#endif /* PH_FRINFC_MAP_DESFIRE_DISABLED */
#ifndef PH_FRINFC_MAP_MIFARESTD_DISABLED
@@ -870,7 +877,7 @@ typedef struct phFriNfc_NdefMap
phFriNfc_MifareStdCont_t StdMifareContainer;
#endif /* PH_FRINFC_MAP_MIFARESTD_DISABLED */
-#ifndef PH_FRINFC_MAP_FELICA_DISABLED
+#ifndef PH_FRINFC_MAP_FELICA_DISABLED
/** \internal Following are the Felica Smart tag related strucutre & variables */
phFriNfc_Felica_t Felica;
@@ -908,7 +915,7 @@ typedef struct phFriNfc_NdefMap
*
* \brief Ndef Mapping \b Reset function
*
- * \copydoc page_reg Resets the component instance to the initial state and initialises the
+ * \copydoc page_reg Resets the component instance to the initial state and initialises the
* internal variables.
*
* \param[in] NdefMap is a Pointer to a valid and initialised or uninitialised instance
@@ -919,7 +926,7 @@ typedef struct phFriNfc_NdefMap
* the information about the device (Smart card, NFC device) to access.
* \param[in] psDevInputParam The Device input parameter, as used for the HAL POLL function.
* This parameter is needed by the component in special cases, when an internal call
- * to POLL is required again, such as for FeliCa. The storage of the structure behind
+ * to POLL is required again, such as for FeliCa. The storage of the structure behind
* the pointer must be retained by the calling software. The component itself only
* keeps the reference. No change is applied to the structure's content.
* \param[in] TrxBuffer Pointer to an internally used buffer. The buffer has to be allocated by
@@ -927,12 +934,12 @@ typedef struct phFriNfc_NdefMap
* this storage is to serve as an intermediate buffer for data frame
* composition and analysis.
* The size shall be at least \ref PH_FRINFC_NDEFMAP_MAX_SEND_RECV_BUF_SIZE .
- * \param[in] TrxBufferSize The size of TrxBuffer:
+ * \param[in] TrxBufferSize The size of TrxBuffer:
* The size shall be at least \ref PH_FRINFC_NDEFMAP_MAX_SEND_RECV_BUF_SIZE .
* \param[in] ReceiveBuffer Pointer to a buffer that the component uses internally use to
* store the data received from the lower component.
* The size shall be at least \ref PH_FRINFC_NDEFMAP_MAX_SEND_RECV_BUF_SIZE .
- * \param[in] ReceiveLength The size of ReceiveBuffer. This specifies the actual length
+ * \param[in] ReceiveLength The size of ReceiveBuffer. This specifies the actual length
* of the data received from the lower component.
* The size shall be at least \ref PH_FRINFC_NDEFMAP_MAX_SEND_RECV_BUF_SIZE .
* \param[in] DataCount Specifies the offset count during read/write operations. This can be
@@ -973,7 +980,7 @@ NFCSTATUS phFriNfc_NdefMap_Reset(phFriNfc_NdefMap_t *NdefMap,
* is available. The list of valid function IDs can be found under the section
* "Completion Routine Indices", like e.g. \ref PH_FRINFC_NDEFMAP_CR_CHK_NDEF.
*
- * \param[in] NdefMap Pointer to a valid instance of the \ref phFriNfc_NdefMap_t structure
+ * \param[in] NdefMap Pointer to a valid instance of the \ref phFriNfc_NdefMap_t structure
* serving as the component context.
* \param[in] FunctionID ID of the component API function to set a with a completion routine for.
* A valid routine has to be assigned for each function ID.
@@ -1004,7 +1011,7 @@ NFCSTATUS phFriNfc_NdefMap_SetCompletionRoutine(phFriNfc_NdefMap_t *NdefMap,
* The function initiates the reading of NDEF information from a Remote Device.
* It performs a reset of the state and restarts the state machine.
*
- * \param[in] NdefMap Pointer to a valid instance of the \ref phFriNfc_NdefMap_t
+ * \param[in] NdefMap Pointer to a valid instance of the \ref phFriNfc_NdefMap_t
* component context structure.
* \param[in,out] PacketData Pointer to a location that shall receive the NDEF Packet.
* \param[in,out] PacketDataLength Pointer to a variable that shall receive the length of the NDEF packet.
@@ -1016,7 +1023,7 @@ NFCSTATUS phFriNfc_NdefMap_SetCompletionRoutine(phFriNfc_NdefMap_t *NdefMap,
* If the caller sets the value to \ref PH_FRINFC_NDEFMAP_SEEK_CUR, the component shall
* start reading from the last offset set (continue where it has stopped before).
* If set to \ref PH_FRINFC_NDEFMAP_SEEK_BEGIN, the component shall start reading
- * from the begining of the card (restarted)
+ * from the begining of the card (restarted)
*
* \retval NFCSTATUS_PENDING The action has been successfully triggered.
* \retval NFCSTATUS_SUCCESS Operation Successful.
@@ -1049,7 +1056,7 @@ NFCSTATUS phFriNfc_NdefMap_RdNdef(phFriNfc_NdefMap_t *NdefMap,
* A periodic call of the \ref phFriNfc_NdefMap_Process has to be done once the action
* has been triggered.
*
- * \param[in] NdefMap Pointer to a valid instance of the \ref phFriNfc_NdefMap_t
+ * \param[in] NdefMap Pointer to a valid instance of the \ref phFriNfc_NdefMap_t
* component context structure.
* \param[in] PacketData Pointer to a location that holds the prepared NDEF Packet.
* \param[in,out] PacketDataLength Pointer to a variable that shall specify the length of the prepared NDEF packet.
@@ -1061,7 +1068,7 @@ NFCSTATUS phFriNfc_NdefMap_RdNdef(phFriNfc_NdefMap_t *NdefMap,
* If the caller sets the value to \ref PH_FRINFC_NDEFMAP_SEEK_CUR, the component shall
* start writing from the last offset set (continue where it has stopped before).
* If set to \ref PH_FRINFC_NDEFMAP_SEEK_BEGIN, the component shall start writing
- * from the begining of the card (restarted)
+ * from the begining of the card (restarted)
*
* \retval NFCSTATUS_PENDING The action has been successfully triggered.
* \retval NFCSTATUS_SUCCESS Operation Successful.
@@ -1090,7 +1097,7 @@ extern NFCSTATUS phFriNfc_NdefMap_WrNdef(phFriNfc_NdefMap_t *NdefMap,
*
* \copydoc page_ovr Check whether a particular Remote Device is NDEF compliant.
*
- * \param[in] NdefMap Pointer to a valid instance of the \ref phFriNfc_NdefMap_t
+ * \param[in] NdefMap Pointer to a valid instance of the \ref phFriNfc_NdefMap_t
* component context structure.
*
* \retval NFCSTATUS_PENDING The action has been successfully triggered.
@@ -1112,10 +1119,10 @@ NFCSTATUS phFriNfc_NdefMap_ChkNdef(phFriNfc_NdefMap_t *NdefMap);
*
* \brief Ndef Mapping \b Erase \b NDEF function
*
- * \copydoc page_ovr find the position of the existing NDEF TLV and overwrite with \b empty NDEF
+ * \copydoc page_ovr find the position of the existing NDEF TLV and overwrite with \b empty NDEF
* message \b at that position.
*
- * \param[in] NdefMap Pointer to a valid instance of the \ref phFriNfc_NdefMap_t
+ * \param[in] NdefMap Pointer to a valid instance of the \ref phFriNfc_NdefMap_t
* component context structure.
*
* \retval NFCSTATUS_PENDING The action has been successfully triggered.
@@ -1139,7 +1146,7 @@ NFCSTATUS phFriNfc_NdefMap_EraseNdef(phFriNfc_NdefMap_t *NdefMap);
*
* \copydoc page_ovr Returns the size of the NDEF data that the card can hold to the caller.
*
- * \param[in] NdefMap Pointer to a valid instance of the \ref phFriNfc_NdefMap_t
+ * \param[in] NdefMap Pointer to a valid instance of the \ref phFriNfc_NdefMap_t
* component context structure.
*
* \param[out] size Pointer to a uint32_t variable, which receives the size of the NDEF data
@@ -1187,7 +1194,7 @@ void phFriNfc_NdefMap_Process(void *Context,
*
* \copydoc page_ovr Checks the presence of a valid TLV's(NDEF/Propritery).
*
- * \param[in] NdefMap Pointer to a valid instance of the \ref phFriNfc_NdefMap_t
+ * \param[in] NdefMap Pointer to a valid instance of the \ref phFriNfc_NdefMap_t
* component context structure.
*
* \retval NFCSTATUS_INVALID_FORMAT No valid TLV Found.
@@ -1199,13 +1206,13 @@ NFCSTATUS phFriNfc_ChkAndParseTLV(phFriNfc_NdefMap_t *NdefMap);
#ifdef PHFRINFC_OVRHAL_MOCKUP /* */
-/**
+/**
* \ingroup grp_fri_nfc_ndef_map
*
* \brief Set data NDEF in mockup mode
*
* \param[in] NdefMap Pointer to a valid instance of the \ref phFriNfc_NdefMap_t component context structure.
- * \param[in] NdefData Pointer to card mockup data
+ * \param[in] NdefData Pointer to card mockup data
* \param[in] NdefActualSize The actual data length
* \param[in] NdefMaxSize The max data length
* \param[in] NdefCardSize The total card size
@@ -1219,7 +1226,7 @@ NFCSTATUS phFriNfc_NdefMap_MockupNDefModeEn(uint8_t *pNdefCompliancy, uint8_t
/**
- * \internal
+ * \internal
* \name States of the FSM.
*
*/
@@ -1229,13 +1236,13 @@ NFCSTATUS phFriNfc_NdefMap_MockupNDefModeEn(uint8_t *pNdefCompliancy, uint8_t
#define PH_FRINFC_NDEFMAP_STATE_EOF_CARD 2 /**< \internal EOF card reached */
/*@}*/
-/* Following values specify the previous operation on the card. This value is assigned to
+/* Following values specify the previous operation on the card. This value is assigned to
the context structure variable: PrevOperation. */
/**< Previous operation is check*/
-#define PH_FRINFC_NDEFMAP_CHECK_OPE 1
+#define PH_FRINFC_NDEFMAP_CHECK_OPE 1
/**< Previous operation is read*/
-#define PH_FRINFC_NDEFMAP_READ_OPE 2
+#define PH_FRINFC_NDEFMAP_READ_OPE 2
/**< Previous operation is write */
#define PH_FRINFC_NDEFMAP_WRITE_OPE 3
/**< Previous operation is Actual size */