Initialize Tizen 2.3
[adaptation/devices/nfc-plugin-nxp.git] / src / phFriNfc_ISO15693Format.c
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_SINGLE_BLK_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 SINGLE BLOCK COMMAND */
355                 command_type = ISO15693_RD_SINGLE_BLK_CMD;
356                 e_format_seq = ISO15693_RD_SINGLE_BLK_CHECK;
357
358                 /* Block number 0 to read */
359                 psNdefSmtCrdFmt->AddInfo.s_iso15693_info.current_block = 0x00;
360             }
361             else
362             {
363                 result = PHNFCSTVAL (CID_FRI_NFC_NDEF_SMTCRDFMT, 
364                                     NFCSTATUS_INVALID_RECEIVE_LENGTH);
365             }
366             break;
367         }
368
369         case ISO15693_RD_SINGLE_BLK_CHECK:
370         {
371             /* RESPONSE received for READ SINGLE BLOCK
372             received*/
373
374             /* Check if Card is really fresh
375                First 4 bytes must be 0 for fresh card */
376
377             if ((psNdefSmtCrdFmt->AddInfo.s_iso15693_info.current_block == 0x00) &&
378                 (psNdefSmtCrdFmt->SendRecvBuf[1] != 0x00 ||
379                  psNdefSmtCrdFmt->SendRecvBuf[2] != 0x00 ||
380                  psNdefSmtCrdFmt->SendRecvBuf[3] != 0x00 ||
381                  psNdefSmtCrdFmt->SendRecvBuf[4] != 0x00))
382             {
383                 result = PHNFCSTVAL (CID_FRI_NFC_NDEF_SMTCRDFMT, NFCSTATUS_INVALID_FORMAT);
384             }
385             else
386             {
387                 /* 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) ISO15693_CC_VER_RW;
398                 send_index = (uint8_t)(send_index + 1);
399
400                 /* CC MAX data size, calculated during GET system information */
401                 *(a_send_byte + send_index) = (uint8_t) (ps_iso15693_info->max_data_size / ISO15693_CC_MULTIPLE_FACTOR);
402                 send_index = (uint8_t)(send_index + 1);
403
404                 switch (ps_iso15693_info->max_data_size)
405                 {
406                     case ISO15693_SLI_X_MAX_SIZE:
407                     {
408                         /* For SLI tags : Inventory Page read not supported */
409                         *(a_send_byte + send_index) = (uint8_t) ISO15693_RDMULBLKS_CMD_MASK;
410                         break;
411                     }
412
413                     case ISO15693_SLI_X_S_MAX_SIZE:
414                     {
415                         /* For SLI - S tags : Read multiple blocks not supported */
416                         *(a_send_byte + send_index) = (uint8_t) ISO15693_INVENTORY_CMD_MASK;
417                         break;
418                     }
419
420                     case ISO15693_SLI_X_L_MAX_SIZE:
421                     {
422                         /* For SLI - L tags : Read multiple blocks not supported */
423                         *(a_send_byte + send_index) = (uint8_t) ISO15693_INVENTORY_CMD_MASK;
424                         break;
425                     }
426
427                     default:
428                     {
429                         result = PHNFCSTVAL (CID_FRI_NFC_NDEF_SMTCRDFMT, NFCSTATUS_INVALID_DEVICE_REQUEST);
430                         break;
431                     }
432                 }
433
434                 send_index = (uint8_t)(send_index + 1);
435
436                 send_length = sizeof (a_send_byte);
437             }
438
439             break;
440         }
441
442         case ISO15693_WRITE_CC_FMT:
443         {
444             /* CC byte write succcessful. 
445             Prepare data for NDEF TLV writing */
446             command_type = ISO15693_WR_SINGLE_BLK_CMD;
447             e_format_seq = ISO15693_WRITE_NDEF_TLV;
448
449             ps_iso15693_info->current_block = (uint16_t)
450                         (ps_iso15693_info->current_block + 1);
451             
452             /* NDEF TLV - Type byte updated to 0x03 */
453             *a_send_byte = (uint8_t)ISO15693_NDEF_TLV_TYPE_ID;
454             send_index = (uint8_t)(send_index + 1);
455
456             /* NDEF TLV - Length byte updated to 0 */
457             *(a_send_byte + send_index) = 0;
458             send_index = (uint8_t)(send_index + 1);
459
460             /* Terminator TLV - value updated to 0xFEU */
461             *(a_send_byte + send_index) = (uint8_t)
462                             ISO15693_TERMINATOR_TLV_ID;
463             send_index = (uint8_t)(send_index + 1);
464
465             send_length = sizeof (a_send_byte);
466             break;
467         }
468
469         case ISO15693_WRITE_NDEF_TLV:
470         {
471             /* SUCCESSFUL formatting complete */
472             format_complete = TRUE;
473             break;
474         }
475
476         default:
477         {
478             result = PHNFCSTVAL (CID_FRI_NFC_NDEF_SMTCRDFMT, 
479                                 NFCSTATUS_INVALID_DEVICE_REQUEST);
480             break;
481         }
482     }
483
484     if ((!format_complete) && (!result))
485     {
486         result = phFriNfc_ISO15693_H_FmtReadWrite (psNdefSmtCrdFmt, 
487                             command_type, a_send_byte, send_length);
488     }
489
490     ps_iso15693_info->format_seq = (uint8_t)e_format_seq; 
491     return result;
492 }
493
494 /*********************** Static function definitions end ***********************/
495
496 /*********************** External function definitions start ***********************/
497 void 
498 phFriNfc_ISO15693_FmtReset (
499     phFriNfc_sNdefSmtCrdFmt_t *psNdefSmtCrdFmt)
500 {
501     /* reset to ISO15693 data structure */
502     (void)memset((void *)&(psNdefSmtCrdFmt->AddInfo.s_iso15693_info), 
503                 0x00, sizeof (phFriNfc_ISO15693_AddInfo_t));
504     psNdefSmtCrdFmt->FmtProcStatus = 0;
505 }
506
507 NFCSTATUS 
508 phFriNfc_ISO15693_Format (
509     phFriNfc_sNdefSmtCrdFmt_t *psNdefSmtCrdFmt)
510 {
511     NFCSTATUS                       result = NFCSTATUS_SUCCESS;
512     phHal_sIso15693Info_t           *ps_rem_iso_15693_info = 
513                         &(psNdefSmtCrdFmt->psRemoteDevInfo->RemoteDevInfo.Iso15693_Info);
514     
515     
516     if ((ISO15693_7TH_BYTE_UID_VALUE == 
517         ps_rem_iso_15693_info->Uid[ISO15693_BYTE_7_INDEX]) 
518         && (ISO15693_6TH_BYTE_UID_VALUE == 
519         ps_rem_iso_15693_info->Uid[ISO15693_BYTE_6_INDEX]))
520     {
521         /* Check if the card is manufactured by NXP (6th byte 
522         index of UID value = 0x04 and the 
523         last byte of UID is 0xE0, only then the card detected 
524         is NDEF compliant */
525         psNdefSmtCrdFmt->State = ISO15693_FORMAT;
526
527         /* GET system information command to get the card size */
528         result = phFriNfc_ISO15693_H_FmtReadWrite (psNdefSmtCrdFmt, 
529                             ISO15693_GET_SYSTEM_INFO_CMD, NULL, 0);
530     }
531     else
532     {
533         result = PHNFCSTVAL (CID_FRI_NFC_NDEF_SMTCRDFMT, 
534                             NFCSTATUS_INVALID_DEVICE_REQUEST);
535     }
536
537     return result;
538 }
539
540 void 
541 phFriNfc_ISO15693_FmtProcess (
542     void        *pContext,
543     NFCSTATUS   Status)
544 {
545     phFriNfc_sNdefSmtCrdFmt_t      *psNdefSmtCrdFmt = 
546                                     (phFriNfc_sNdefSmtCrdFmt_t *)pContext;
547     phFriNfc_ISO15693_AddInfo_t     *ps_iso15693_info = 
548                                     &(psNdefSmtCrdFmt->AddInfo.s_iso15693_info);
549
550     if((NFCSTATUS_SUCCESS & PHNFCSTBLOWER) == (Status & PHNFCSTBLOWER))
551     {
552         if (ISO15693_FORMAT == psNdefSmtCrdFmt->State)
553         {
554             /* Check for further formatting */
555             Status = phFriNfc_ISO15693_H_ProFormat (psNdefSmtCrdFmt);
556         }
557         else
558         {
559             Status = PHNFCSTVAL (CID_FRI_NFC_NDEF_SMTCRDFMT, 
560                                 NFCSTATUS_INVALID_DEVICE_REQUEST);
561         }
562     }
563     else
564     {   
565         Status = PHNFCSTVAL (CID_FRI_NFC_NDEF_SMTCRDFMT,
566                             NFCSTATUS_FORMAT_ERROR);
567     }
568
569     /* Handle the all the error cases */
570     if ((NFCSTATUS_PENDING & PHNFCSTBLOWER) != (Status & PHNFCSTBLOWER))
571     {
572         /* call respective CR */
573         phFriNfc_SmtCrdFmt_HCrHandler (psNdefSmtCrdFmt, Status);
574     }
575 }
576 /*********************** External function definitions end ***********************/
577
578
579 #endif /* #ifndef PH_FRINFC_FMT_ISO15693_DISABLED */
580