Home | History | Annotate | Download | only in src
      1 /*
      2 /*
      3  * Copyright (C) 2010 NXP Semiconductors
      4  *
      5  * Licensed under the Apache License, Version 2.0 (the "License");
      6  * you may not use this file except in compliance with the License.
      7  * You may obtain a copy of the License at
      8  *
      9  *      http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  * Unless required by applicable law or agreed to in writing, software
     12  * distributed under the License is distributed on an "AS IS" BASIS,
     13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  * See the License for the specific language governing permissions and
     15  * limitations under the License.
     16  */
     17 
     18 /*!
     19 * \file  phFriNfc_ISO15693Format.c
     20 * \brief This component encapsulates different format functinalities ,
     21 *        for the ISO-15693 card.
     22 *
     23 * Project: NFC-FRI
     24 *
     25 * $Date:  $
     26 * $Author: ing02260 $
     27 * $Revision: 1.0 $
     28 * $Aliases:  $
     29 *
     30 */
     31 
     32 #ifndef PH_FRINFC_FMT_ISO15693_DISABLED
     33 
     34 #include <phNfcTypes.h>
     35 #include <phFriNfc_OvrHal.h>
     36 #include <phFriNfc_SmtCrdFmt.h>
     37 #include <phFriNfc_ISO15693Format.h>
     38 
     39 
     40 /****************************** Macro definitions start ********************************/
     41 /* State for the format */
     42 #define ISO15693_FORMAT                                 0x01U
     43 
     44 /* Bytes per block in the ISO-15693 */
     45 #define ISO15693_BYTES_PER_BLOCK                        0x04U
     46 
     47 /* ISO-15693 Commands
     48 GET SYSTEM INFORMATION COMMAND
     49 */
     50 #define ISO15693_GET_SYSTEM_INFO_CMD                    0x2BU
     51 /* READ SINGLE BLOCK COMMAND */
     52 #define ISO15693_RD_SINGLE_BLK_CMD                      0x20U
     53 /* WRITE SINGLE BLOCK COMMAND */
     54 #define ISO15693_WR_SINGLE_BLK_CMD                      0x21U
     55 /* READ MULTIPLE BLOCK COMMAND */
     56 #define ISO15693_RD_MULTIPLE_BLKS_CMD                   0x23U
     57 
     58 /* CC bytes
     59 CC BYTE 0 - Magic Number - 0xE1
     60 */
     61 #define ISO15693_CC_MAGIC_NUM                           0xE1U
     62 /* CC BYTE 1 - Mapping version and READ WRITE settings 0x40
     63 */
     64 #define ISO15693_CC_VER_RW                              0x40U
     65 /* CC BYTE 2 - max size is calaculated using the byte 3 multiplied by 8 */
     66 #define ISO15693_CC_MULTIPLE_FACTOR                     0x08U
     67 
     68 /* Inventory command support mask for the CC byte 4 */
     69 #define ISO15693_INVENTORY_CMD_MASK                     0x02U
     70 /* Read MULTIPLE blocks support mask for CC byte 4 */
     71 #define ISO15693_RDMULBLKS_CMD_MASK                     0x01U
     72 /* Flags for the command */
     73 #define ISO15693_FMT_FLAGS                              0x20U
     74 
     75 /* Read two blocks */
     76 #define ISO15693_RD_2_BLOCKS                            0x02U
     77 
     78 /* TYPE identifier of the NDEF TLV */
     79 #define ISO15693_NDEF_TLV_TYPE_ID                       0x03U
     80 /* Terminator TLV identifier  */
     81 #define ISO15693_TERMINATOR_TLV_ID                      0xFEU
     82 
     83 /* UID 7th byte value shall be 0xE0 */
     84 #define ISO15693_7TH_BYTE_UID_VALUE                     0xE0U
     85 #define ISO15693_BYTE_7_INDEX                           0x07U
     86 
     87 /* UID 6th byte value shall be 0x04 - NXP manufacturer */
     88 #define ISO15693_6TH_BYTE_UID_VALUE                     0x04U
     89 #define ISO15693_BYTE_6_INDEX                           0x06U
     90 
     91 #define ISO15693_EXTRA_RESPONSE_FLAG                    0x01U
     92 
     93 #define ISO15693_GET_SYS_INFO_RESP_LEN                  0x0EU
     94 #define ISO15693_DSFID_MASK                             0x01U
     95 #define ISO15693_AFI_MASK                               0x02U
     96 #define ISO15693_MAX_SIZE_MASK                          0x04U
     97 #define ISO15693_ICREF_MASK                             0x08U
     98 #define ISO15693_SKIP_DFSID                             0x01U
     99 #define ISO15693_SKIP_AFI                               0x01U
    100 #define ISO15693_BLOCK_SIZE_IN_BYTES_MASK               0x1FU
    101 
    102 
    103 /* MAXimum size of ICODE SLI/X */
    104 #define ISO15693_SLI_X_MAX_SIZE                         112U
    105 /* MAXimum size of ICODE SLI/X - S */
    106 #define ISO15693_SLI_X_S_MAX_SIZE                       160U
    107 /* MAXimum size of ICODE SLI/X - L */
    108 #define ISO15693_SLI_X_L_MAX_SIZE                       32U
    109 /****************************** Macro definitions end ********************************/
    110 
    111 /****************************** Data structures start ********************************/
    112 typedef enum phFriNfc_ISO15693_FormatSeq
    113 {
    114     ISO15693_GET_SYS_INFO,
    115     ISO15693_RD_MULTIPLE_BLKS_CHECK,
    116     ISO15693_WRITE_CC_FMT,
    117     ISO15693_WRITE_NDEF_TLV
    118 }phFriNfc_ISO15693_FormatSeq_t;
    119 /****************************** Data structures end ********************************/
    120 
    121 /*********************** Static function declarations start ***********************/
    122 static
    123 NFCSTATUS
    124 phFriNfc_ISO15693_H_ProFormat (
    125     phFriNfc_sNdefSmtCrdFmt_t   *psNdefSmtCrdFmt);
    126 
    127 static
    128 NFCSTATUS
    129 phFriNfc_ISO15693_H_GetMaxDataSize (
    130     phFriNfc_sNdefSmtCrdFmt_t   *psNdefSmtCrdFmt,
    131     uint8_t                     *p_recv_buf,
    132     uint8_t                     recv_length);
    133 
    134 static
    135 NFCSTATUS
    136 phFriNfc_ISO15693_H_FmtReadWrite (
    137     phFriNfc_sNdefSmtCrdFmt_t   *psNdefSmtCrdFmt,
    138     uint8_t                     command,
    139     uint8_t                     *p_data,
    140     uint8_t                     data_length);
    141 /*********************** Static function declarations end ***********************/
    142 
    143 /*********************** Static function definitions start ***********************/
    144 
    145 static
    146 NFCSTATUS
    147 phFriNfc_ISO15693_H_FmtReadWrite (
    148     phFriNfc_sNdefSmtCrdFmt_t   *psNdefSmtCrdFmt,
    149     uint8_t                     command,
    150     uint8_t                     *p_data,
    151     uint8_t                     data_length)
    152 {
    153     NFCSTATUS                   result = NFCSTATUS_SUCCESS;
    154     uint8_t                     send_index = 0;
    155 
    156     /* set the data for additional data exchange*/
    157     psNdefSmtCrdFmt->psDepAdditionalInfo.DepFlags.MetaChaining = 0;
    158     psNdefSmtCrdFmt->psDepAdditionalInfo.DepFlags.NADPresent = 0;
    159     psNdefSmtCrdFmt->psDepAdditionalInfo.NAD = 0;
    160 
    161     psNdefSmtCrdFmt->SmtCrdFmtCompletionInfo.CompletionRoutine =
    162                                             phFriNfc_ISO15693_FmtProcess;
    163     psNdefSmtCrdFmt->SmtCrdFmtCompletionInfo.Context = psNdefSmtCrdFmt;
    164 
    165     *psNdefSmtCrdFmt->SendRecvLength = PH_FRINFC_SMTCRDFMT_MAX_SEND_RECV_BUF_SIZE;
    166 
    167     psNdefSmtCrdFmt->Cmd.Iso15693Cmd = phHal_eIso15693_Cmd;
    168 
    169     *(psNdefSmtCrdFmt->SendRecvBuf + send_index) = (uint8_t)ISO15693_FMT_FLAGS;
    170     send_index = (uint8_t)(send_index + 1);
    171 
    172     *(psNdefSmtCrdFmt->SendRecvBuf + send_index) = (uint8_t)command;
    173     send_index = (uint8_t)(send_index + 1);
    174 
    175     (void)memcpy ((void *)(psNdefSmtCrdFmt->SendRecvBuf + send_index),
    176         (void *)psNdefSmtCrdFmt->psRemoteDevInfo->RemoteDevInfo.Iso15693_Info.Uid,
    177         psNdefSmtCrdFmt->psRemoteDevInfo->RemoteDevInfo.Iso15693_Info.UidLength);
    178     send_index = (uint8_t)(send_index +
    179             psNdefSmtCrdFmt->psRemoteDevInfo->RemoteDevInfo.Iso15693_Info.UidLength);
    180 
    181     switch (command)
    182     {
    183         case ISO15693_WR_SINGLE_BLK_CMD:
    184         case ISO15693_RD_MULTIPLE_BLKS_CMD:
    185         {
    186             *(psNdefSmtCrdFmt->SendRecvBuf + send_index) = (uint8_t)
    187                         psNdefSmtCrdFmt->AddInfo.s_iso15693_info.current_block;
    188             send_index = (uint8_t)(send_index + 1);
    189 
    190             if (data_length)
    191             {
    192                 (void)memcpy ((void *)(psNdefSmtCrdFmt->SendRecvBuf + send_index),
    193                             (void *)p_data, data_length);
    194                 send_index = (uint8_t)(send_index + data_length);
    195             }
    196             else
    197             {
    198                 result = PHNFCSTVAL (CID_FRI_NFC_NDEF_SMTCRDFMT,
    199                                     NFCSTATUS_INVALID_DEVICE_REQUEST);
    200             }
    201             break;
    202         }
    203 
    204         case ISO15693_RD_SINGLE_BLK_CMD:
    205         {
    206             *(psNdefSmtCrdFmt->SendRecvBuf + send_index) = (uint8_t)
    207                         psNdefSmtCrdFmt->AddInfo.s_iso15693_info.current_block;
    208             send_index = (uint8_t)(send_index + 1);
    209             break;
    210         }
    211 
    212         case ISO15693_GET_SYSTEM_INFO_CMD:
    213         {
    214             /* Dont do anything */
    215             break;
    216         }
    217 
    218         default:
    219         {
    220             result = PHNFCSTVAL (CID_FRI_NFC_NDEF_SMTCRDFMT,
    221                                 NFCSTATUS_INVALID_DEVICE_REQUEST);
    222             break;
    223         }
    224     }
    225 
    226     psNdefSmtCrdFmt->SendLength = send_index;
    227 
    228     if (!result)
    229     {
    230         result = phFriNfc_OvrHal_Transceive(psNdefSmtCrdFmt->LowerDevice,
    231                                             &psNdefSmtCrdFmt->SmtCrdFmtCompletionInfo,
    232                                             psNdefSmtCrdFmt->psRemoteDevInfo,
    233                                             psNdefSmtCrdFmt->Cmd,
    234                                             &psNdefSmtCrdFmt->psDepAdditionalInfo,
    235                                             psNdefSmtCrdFmt->SendRecvBuf,
    236                                             psNdefSmtCrdFmt->SendLength,
    237                                             psNdefSmtCrdFmt->SendRecvBuf,
    238                                             psNdefSmtCrdFmt->SendRecvLength);
    239     }
    240 
    241     return result;
    242 }
    243 
    244 static
    245 NFCSTATUS
    246 phFriNfc_ISO15693_H_GetMaxDataSize (
    247     phFriNfc_sNdefSmtCrdFmt_t   *psNdefSmtCrdFmt,
    248     uint8_t                     *p_recv_buf,
    249     uint8_t                     recv_length)
    250 {
    251     NFCSTATUS                       result = NFCSTATUS_SUCCESS;
    252     phFriNfc_ISO15693_AddInfo_t     *ps_iso15693_info =
    253                                     &(psNdefSmtCrdFmt->AddInfo.s_iso15693_info);
    254     phHal_sIso15693Info_t           *ps_rem_iso_15693_info =
    255                         &(psNdefSmtCrdFmt->psRemoteDevInfo->RemoteDevInfo.Iso15693_Info);
    256     uint8_t                         recv_index = 0;
    257 
    258     if ((ISO15693_GET_SYS_INFO_RESP_LEN == recv_length)
    259         && (ISO15693_MAX_SIZE_MASK == (*p_recv_buf & ISO15693_MAX_SIZE_MASK)))
    260     {
    261         uint8_t information_flag = *p_recv_buf;
    262         /* MAX size is present in the system information and
    263         also response length is correct */
    264         recv_index = (uint8_t)(recv_index + 1);
    265 
    266         if (!phOsalNfc_MemCompare ((void *)ps_rem_iso_15693_info->Uid,
    267                                 (void *)(p_recv_buf + recv_index),
    268                                 ps_rem_iso_15693_info->UidLength))
    269         {
    270             /* UID comaparision successful */
    271             uint8_t                 no_of_blocks = 0;
    272             uint8_t                 blk_size_in_bytes = 0;
    273             uint8_t                 ic_reference = 0;
    274 
    275             /* So skip the UID size compared in the received buffer */
    276             recv_index = (uint8_t)(recv_index +
    277                                     ps_rem_iso_15693_info->UidLength);
    278 
    279             if (information_flag & ISO15693_DSFID_MASK) {
    280                 /* Skip DFSID  */
    281                 recv_index = (uint8_t)(recv_index + ISO15693_SKIP_DFSID);
    282             }
    283             if (information_flag & ISO15693_AFI_MASK) {
    284                 /* Skip AFI  */
    285                 recv_index = (uint8_t)(recv_index + ISO15693_SKIP_AFI);
    286             }
    287 
    288             /* To get the number of blocks in the card */
    289             no_of_blocks = (uint8_t)(*(p_recv_buf + recv_index) + 1);
    290             recv_index = (uint8_t)(recv_index + 1);
    291 
    292             /* To get the each block size in bytes */
    293             blk_size_in_bytes = (uint8_t)((*(p_recv_buf + recv_index)
    294                                 & ISO15693_BLOCK_SIZE_IN_BYTES_MASK) + 1);
    295             recv_index = (uint8_t)(recv_index + 1);
    296 
    297             if (information_flag & ISO15693_ICREF_MASK) {
    298                 /* Get the IC reference */
    299                 ic_reference = (uint8_t)(*(p_recv_buf + recv_index));
    300                 if (ic_reference == 0x03) {
    301                     no_of_blocks = 8;
    302                 }
    303             }
    304 
    305             /* calculate maximum data size in the card */
    306             ps_iso15693_info->max_data_size = (uint16_t)
    307                                         (no_of_blocks * blk_size_in_bytes);
    308 
    309         }
    310         else
    311         {
    312             result = PHNFCSTVAL (CID_FRI_NFC_NDEF_SMTCRDFMT,
    313                                 NFCSTATUS_INVALID_DEVICE_REQUEST);
    314         }
    315     }
    316     else
    317     {
    318         result = PHNFCSTVAL (CID_FRI_NFC_NDEF_SMTCRDFMT,
    319                             NFCSTATUS_INVALID_DEVICE_REQUEST);
    320     }
    321 
    322 
    323     return result;
    324 }
    325 
    326 static
    327 NFCSTATUS
    328 phFriNfc_ISO15693_H_ProFormat (
    329     phFriNfc_sNdefSmtCrdFmt_t *psNdefSmtCrdFmt)
    330 {
    331     NFCSTATUS                       result = NFCSTATUS_SUCCESS;
    332     phFriNfc_ISO15693_AddInfo_t     *ps_iso15693_info =
    333                                     &(psNdefSmtCrdFmt->AddInfo.s_iso15693_info);
    334     phFriNfc_ISO15693_FormatSeq_t   e_format_seq =
    335                                     (phFriNfc_ISO15693_FormatSeq_t)
    336                                     ps_iso15693_info->format_seq;
    337     uint8_t                         command_type = 0;
    338     uint8_t                         a_send_byte[ISO15693_BYTES_PER_BLOCK] = {0};
    339     uint8_t                         send_length = 0;
    340     uint8_t                         send_index = 0;
    341     uint8_t                         format_complete = FALSE;
    342 
    343     switch (e_format_seq)
    344     {
    345         case ISO15693_GET_SYS_INFO:
    346         {
    347             /* RESPONSE received for GET SYSTEM INFO  */
    348 
    349             if (!phFriNfc_ISO15693_H_GetMaxDataSize (psNdefSmtCrdFmt,
    350                 (psNdefSmtCrdFmt->SendRecvBuf + ISO15693_EXTRA_RESPONSE_FLAG),
    351                 (uint8_t)(*psNdefSmtCrdFmt->SendRecvLength -
    352                 ISO15693_EXTRA_RESPONSE_FLAG)))
    353             {
    354                 /* Send the READ MULTIPLE BLOCKS COMMAND */
    355                 command_type = ISO15693_RD_MULTIPLE_BLKS_CMD;
    356                 e_format_seq = ISO15693_RD_MULTIPLE_BLKS_CHECK;
    357 
    358                 /* Prepare data for the command,
    359                 First add the current block */
    360                 *a_send_byte = (uint8_t)ps_iso15693_info->current_block;
    361                 send_index = (uint8_t)(send_index + 1);
    362 
    363                 /* Second, add number of blocks to read, here 2 blocks means
    364                 8 bytes. 1 is decremented because to read multiple block.
    365                 the first block is read by default, apart from the first block,
    366                 next block shall be read, that means remaining block to read is 1
    367                 So, if for eg: 2 blocks needs to be read from block number 0, then 1
    368                 is number of blocks to read. This will read both block 0 and 1
    369                 */
    370                 *(a_send_byte + send_index) = (uint8_t)
    371                                     (ISO15693_RD_2_BLOCKS - 1);
    372                 send_index = (uint8_t)(send_index + 1);
    373 
    374                 send_length = send_index;
    375             }
    376             else
    377             {
    378                 result = PHNFCSTVAL (CID_FRI_NFC_NDEF_SMTCRDFMT,
    379                                     NFCSTATUS_INVALID_RECEIVE_LENGTH);
    380             }
    381             break;
    382         }
    383 
    384         case ISO15693_RD_MULTIPLE_BLKS_CHECK:
    385         {
    386             /* RESPONSE received for READ MULTIPLE BLOCKS
    387             received, prepare data for writing CC bytes */
    388 
    389             command_type = ISO15693_WR_SINGLE_BLK_CMD;
    390             e_format_seq = ISO15693_WRITE_CC_FMT;
    391 
    392             /* CC magic number */
    393             *a_send_byte = (uint8_t)ISO15693_CC_MAGIC_NUM;
    394             send_index = (uint8_t)(send_index + 1);
    395 
    396             /* CC Version and read/write access */
    397             *(a_send_byte + send_index) = (uint8_t)
    398                             ISO15693_CC_VER_RW;
    399             send_index = (uint8_t)(send_index + 1);
    400 
    401             /* CC MAX data size, calculated during GET system information */
    402             *(a_send_byte + send_index) = (uint8_t)
    403                             (ps_iso15693_info->max_data_size /
    404                             ISO15693_CC_MULTIPLE_FACTOR);
    405             send_index = (uint8_t)(send_index + 1);
    406 
    407             switch (ps_iso15693_info->max_data_size)
    408             {
    409                 case ISO15693_SLI_X_MAX_SIZE:
    410                 {
    411                     /* For SLI tags : Inventory Page read not supported */
    412                     *(a_send_byte + send_index) = (uint8_t)
    413                                         ISO15693_RDMULBLKS_CMD_MASK;
    414                     break;
    415                 }
    416 
    417                 case ISO15693_SLI_X_S_MAX_SIZE:
    418                 {
    419                     /* For SLI - S tags : Read multiple blocks not supported */
    420                     *(a_send_byte + send_index) = (uint8_t)
    421                                         ISO15693_INVENTORY_CMD_MASK;
    422                     break;
    423                 }
    424 
    425                 case ISO15693_SLI_X_L_MAX_SIZE:
    426                 {
    427                     /* For SLI - L tags : Read multiple blocks not supported */
    428                     *(a_send_byte + send_index) = (uint8_t)
    429                                         ISO15693_INVENTORY_CMD_MASK;
    430                     break;
    431                 }
    432 
    433                 default:
    434                 {
    435                     result = PHNFCSTVAL (CID_FRI_NFC_NDEF_SMTCRDFMT,
    436                                         NFCSTATUS_INVALID_DEVICE_REQUEST);
    437                     break;
    438                 }
    439             }
    440 
    441             send_index = (uint8_t)(send_index + 1);
    442 
    443             send_length = sizeof (a_send_byte);
    444 
    445             break;
    446         }
    447 
    448         case ISO15693_WRITE_CC_FMT:
    449         {
    450             /* CC byte write succcessful.
    451             Prepare data for NDEF TLV writing */
    452             command_type = ISO15693_WR_SINGLE_BLK_CMD;
    453             e_format_seq = ISO15693_WRITE_NDEF_TLV;
    454 
    455             ps_iso15693_info->current_block = (uint16_t)
    456                         (ps_iso15693_info->current_block + 1);
    457 
    458             /* NDEF TLV - Type byte updated to 0x03 */
    459             *a_send_byte = (uint8_t)ISO15693_NDEF_TLV_TYPE_ID;
    460             send_index = (uint8_t)(send_index + 1);
    461 
    462             /* NDEF TLV - Length byte updated to 0 */
    463             *(a_send_byte + send_index) = 0;
    464             send_index = (uint8_t)(send_index + 1);
    465 
    466             /* Terminator TLV - value updated to 0xFEU */
    467             *(a_send_byte + send_index) = (uint8_t)
    468                             ISO15693_TERMINATOR_TLV_ID;
    469             send_index = (uint8_t)(send_index + 1);
    470 
    471             send_length = sizeof (a_send_byte);
    472             break;
    473         }
    474 
    475         case ISO15693_WRITE_NDEF_TLV:
    476         {
    477             /* SUCCESSFUL formatting complete */
    478             format_complete = TRUE;
    479             break;
    480         }
    481 
    482         default:
    483         {
    484             result = PHNFCSTVAL (CID_FRI_NFC_NDEF_SMTCRDFMT,
    485                                 NFCSTATUS_INVALID_DEVICE_REQUEST);
    486             break;
    487         }
    488     }
    489 
    490     if ((!format_complete) && (!result))
    491     {
    492         result = phFriNfc_ISO15693_H_FmtReadWrite (psNdefSmtCrdFmt,
    493                             command_type, a_send_byte, send_length);
    494     }
    495 
    496     ps_iso15693_info->format_seq = (uint8_t)e_format_seq;
    497     return result;
    498 }
    499 
    500 /*********************** Static function definitions end ***********************/
    501 
    502 /*********************** External function definitions start ***********************/
    503 void
    504 phFriNfc_ISO15693_FmtReset (
    505     phFriNfc_sNdefSmtCrdFmt_t *psNdefSmtCrdFmt)
    506 {
    507     /* reset to ISO15693 data structure */
    508     (void)memset((void *)&(psNdefSmtCrdFmt->AddInfo.s_iso15693_info),
    509                 0x00, sizeof (phFriNfc_ISO15693_AddInfo_t));
    510     psNdefSmtCrdFmt->FmtProcStatus = 0;
    511 }
    512 
    513 NFCSTATUS
    514 phFriNfc_ISO15693_Format (
    515     phFriNfc_sNdefSmtCrdFmt_t *psNdefSmtCrdFmt)
    516 {
    517     NFCSTATUS                       result = NFCSTATUS_SUCCESS;
    518     phHal_sIso15693Info_t           *ps_rem_iso_15693_info =
    519                         &(psNdefSmtCrdFmt->psRemoteDevInfo->RemoteDevInfo.Iso15693_Info);
    520 
    521 
    522     if ((ISO15693_7TH_BYTE_UID_VALUE ==
    523         ps_rem_iso_15693_info->Uid[ISO15693_BYTE_7_INDEX])
    524         && (ISO15693_6TH_BYTE_UID_VALUE ==
    525         ps_rem_iso_15693_info->Uid[ISO15693_BYTE_6_INDEX]))
    526     {
    527         /* Check if the card is manufactured by NXP (6th byte
    528         index of UID value = 0x04 and the
    529         last byte of UID is 0xE0, only then the card detected
    530         is NDEF compliant */
    531         psNdefSmtCrdFmt->State = ISO15693_FORMAT;
    532 
    533         /* GET system information command to get the card size */
    534         result = phFriNfc_ISO15693_H_FmtReadWrite (psNdefSmtCrdFmt,
    535                             ISO15693_GET_SYSTEM_INFO_CMD, NULL, 0);
    536     }
    537     else
    538     {
    539         result = PHNFCSTVAL (CID_FRI_NFC_NDEF_SMTCRDFMT,
    540                             NFCSTATUS_INVALID_DEVICE_REQUEST);
    541     }
    542 
    543     return result;
    544 }
    545 
    546 void
    547 phFriNfc_ISO15693_FmtProcess (
    548     void        *pContext,
    549     NFCSTATUS   Status)
    550 {
    551     phFriNfc_sNdefSmtCrdFmt_t      *psNdefSmtCrdFmt =
    552                                     (phFriNfc_sNdefSmtCrdFmt_t *)pContext;
    553     phFriNfc_ISO15693_AddInfo_t     *ps_iso15693_info =
    554                                     &(psNdefSmtCrdFmt->AddInfo.s_iso15693_info);
    555 
    556     if((NFCSTATUS_SUCCESS & PHNFCSTBLOWER) == (Status & PHNFCSTBLOWER))
    557     {
    558         if (ISO15693_FORMAT == psNdefSmtCrdFmt->State)
    559         {
    560             /* Check for further formatting */
    561             Status = phFriNfc_ISO15693_H_ProFormat (psNdefSmtCrdFmt);
    562         }
    563         else
    564         {
    565             Status = PHNFCSTVAL (CID_FRI_NFC_NDEF_SMTCRDFMT,
    566                                 NFCSTATUS_INVALID_DEVICE_REQUEST);
    567         }
    568     }
    569     else
    570     {
    571         if (ISO15693_RD_MULTIPLE_BLKS_CHECK ==
    572             (phFriNfc_ISO15693_FormatSeq_t)ps_iso15693_info->format_seq)
    573         {
    574             /* If READ MULTIPLE BLOCKS is not working then
    575                 do further formatting, disable the READ MULTIPLE BLOCK
    576                 flag in the CC 4th byte, this says that COMMAND is not
    577                 supported and dont use this command
    578                 */
    579             Status = phFriNfc_ISO15693_H_ProFormat (psNdefSmtCrdFmt);
    580         }
    581     }
    582 
    583     /* Handle the all the error cases */
    584     if ((NFCSTATUS_PENDING & PHNFCSTBLOWER) != (Status & PHNFCSTBLOWER))
    585     {
    586         /* call respective CR */
    587         phFriNfc_SmtCrdFmt_HCrHandler (psNdefSmtCrdFmt, Status);
    588     }
    589 }
    590 /*********************** External function definitions end ***********************/
    591 
    592 
    593 #endif /* #ifndef PH_FRINFC_FMT_ISO15693_DISABLED */
    594 
    595