1 /*
2 * Copyright (C) 2010 NXP Semiconductors
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 /*!
18 * \file phFriNfc_SmtCrdFmt.c
19 * \brief This component encapsulates different smart and simple tag formatting functionalities,
20 * for the mapping layer.
21 *
22 * Project: NFC-FRI
23 *
24 * $Date: Mon Dec 13 14:14:13 2010 $
25 * $Author: ing02260 $
26 * $Revision: 1.9 $
27 * $Aliases: $
28 *
29 */
30
31 #ifndef PH_FRINFC_CARD_FORMAT_DISABLED
32
33 #include <phNfcTypes.h>
34 #include <phFriNfc_OvrHal.h>
35 #include <phFriNfc_SmtCrdFmt.h>
36 #ifdef DISABLE_FORMAT
37 #include <phFriNfc_TopazFormat.h>
38 #endif /* #ifdef DISABLE_FORMAT */
39 #include <phFriNfc_MifULFormat.h>
40 #include <phFriNfc_DesfireFormat.h>
41 #include <phFriNfc_MifStdFormat.h>
42 #ifndef PH_FRINFC_FMT_ISO15693_DISABLED
43 #include <phFriNfc_ISO15693Format.h>
44 #endif /* #ifndef PH_FRINFC_FMT_ISO15693_DISABLED */
45
46
47 /*! \ingroup grp_file_attributes
48 * \name NDEF Mapping
49 *
50 * File: \ref phFriNfc_CardFormatFunctions.c
51 *
52 */
53 /*@{*/
54 // file versions
55 /*@}*/
56
57
58
59
phFriNfc_SmtCrdFmt_HCrHandler(phFriNfc_sNdefSmtCrdFmt_t * NdefSmtCrdFmt,NFCSTATUS Status)60 void phFriNfc_SmtCrdFmt_HCrHandler(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt,
61 NFCSTATUS Status)
62 {
63 /* set the state back to the Reset_Init state*/
64 NdefSmtCrdFmt->State = PH_FRINFC_SMTCRDFMT_STATE_RESET_INIT;
65
66 /* set the completion routine*/
67 NdefSmtCrdFmt->CompletionRoutine[PH_FRINFC_SMTCRDFMT_CR_FORMAT].
68 CompletionRoutine(NdefSmtCrdFmt->CompletionRoutine->Context, Status);
69 }
70
71 /*!
72 * \brief Used to Reset the context variables , before the actual smart card formatting
73 * procedure.
74 *
75 */
phFriNfc_NdefSmtCrd_Reset(phFriNfc_sNdefSmtCrdFmt_t * NdefSmtCrdFmt,void * LowerDevice,phHal_sRemoteDevInformation_t * psRemoteDevInfo,phHal_sDevInputParam_t * psDevInputParam,uint8_t * SendRecvBuffer,uint16_t * SendRecvBuffLen)76 NFCSTATUS phFriNfc_NdefSmtCrd_Reset(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt,
77 void *LowerDevice,
78 phHal_sRemoteDevInformation_t *psRemoteDevInfo,
79 phHal_sDevInputParam_t *psDevInputParam,
80 uint8_t *SendRecvBuffer,
81 uint16_t *SendRecvBuffLen)
82 {
83 NFCSTATUS result = NFCSTATUS_SUCCESS;
84 uint8_t index;
85
86 if ( (SendRecvBuffLen == NULL) || (NdefSmtCrdFmt == NULL) || (psRemoteDevInfo == NULL) ||
87 (SendRecvBuffer == NULL) || (LowerDevice == NULL) ||
88 (*SendRecvBuffLen == 0) || (psDevInputParam == NULL) ||
89 (*SendRecvBuffLen < PH_FRINFC_SMTCRDFMT_MAX_SEND_RECV_BUF_SIZE) )
90 {
91 result = PHNFCSTVAL(CID_FRI_NFC_NDEF_SMTCRDFMT, NFCSTATUS_INVALID_PARAMETER);
92 }
93 else
94 {
95 /* Initialise the state to Init */
96 NdefSmtCrdFmt->State = PH_FRINFC_SMTCRDFMT_STATE_RESET_INIT;
97
98 for(index = 0;index<PH_FRINFC_SMTCRDFMT_CR;index++)
99 {
100 /* Initialise the NdefMap Completion Routine to Null */
101 NdefSmtCrdFmt->CompletionRoutine[index].CompletionRoutine = NULL;
102 /* Initialise the NdefMap Completion Routine context to Null */
103 NdefSmtCrdFmt->CompletionRoutine[index].Context = NULL;
104 }
105
106 /* Lower Device(Always Overlapped HAL Struct initialised in application
107 is registred in NdefMap Lower Device) */
108 NdefSmtCrdFmt->LowerDevice = LowerDevice;
109
110 /* Remote Device info received from Manual Device Discovery is registered here */
111 NdefSmtCrdFmt->psRemoteDevInfo = psRemoteDevInfo;
112
113 /* Trx Buffer registered */
114 NdefSmtCrdFmt->SendRecvBuf = SendRecvBuffer;
115
116 /* Trx Buffer Size */
117 NdefSmtCrdFmt->SendRecvLength = SendRecvBuffLen;
118
119 /* Register Transfer Buffer Length */
120 NdefSmtCrdFmt->SendLength = 0;
121
122 /* Initialise the Format status flag*/
123 NdefSmtCrdFmt->FmtProcStatus = 0;
124
125 /* Reset the Card Type */
126 NdefSmtCrdFmt->CardType = 0;
127
128 /* Reset MapCompletion Info*/
129 NdefSmtCrdFmt->SmtCrdFmtCompletionInfo.CompletionRoutine = NULL;
130 NdefSmtCrdFmt->SmtCrdFmtCompletionInfo.Context = NULL;
131
132 #ifndef PH_FRINFC_FMT_TOPAZ_DISABLED
133 phFriNfc_Topaz_Reset(NdefSmtCrdFmt);
134
135 #endif /* PH_FRINFC_FMT_TOPAZ_DISABLED */
136
137 #ifndef PH_FRINFC_FMT_DESFIRE_DISABLED
138 /*Reset Desfire Cap Container elements*/
139 phFriNfc_Desfire_Reset(NdefSmtCrdFmt);
140 #endif /* PH_FRINFC_FMT_DESFIRE_DISABLED */
141
142 #ifndef PH_FRINFC_FMT_MIFARESTD_DISABLED
143 /*Reset Mifare Standard Container elements*/
144 NdefSmtCrdFmt->AddInfo.MfStdInfo.DevInputParam = psDevInputParam;
145 phFriNfc_MfStd_Reset(NdefSmtCrdFmt);
146 #endif /* PH_FRINFC_MAP_MIFARESTD_DISABLED */
147
148 #ifndef PH_FRINFC_FMT_MIFAREUL_DISABLED
149 phFriNfc_MfUL_Reset(NdefSmtCrdFmt);
150 #endif /* #ifndef PH_FRINFC_FMT_MIFAREUL_DISABLED */
151
152 #ifndef PH_FRINFC_FMT_ISO15693_DISABLED
153 phFriNfc_ISO15693_FmtReset (NdefSmtCrdFmt);
154 #endif /* #ifndef PH_FRINFC_FMT_ISO15693_DISABLED */
155
156 #ifdef PHFRINFC_OVRHAL_MOCKUP
157 /*Reset Desfire Cap Container elements*/
158 // phFriNfc_Mockup_H_Reset(NdefSmtCrdFmt);
159 #endif /* PHFRINFC_OVRHAL_MOCKUP */
160
161 }
162 return (result);
163
164 }
165
166 /*!
167 * \brief Completion Routine initialisation
168 *
169 */
phFriNfc_NdefSmtCrd_SetCR(phFriNfc_sNdefSmtCrdFmt_t * NdefSmtCrdFmt,uint8_t FunctionID,pphFriNfc_Cr_t CompletionRoutine,void * CompletionRoutineContext)170 NFCSTATUS phFriNfc_NdefSmtCrd_SetCR(phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt,
171 uint8_t FunctionID,
172 pphFriNfc_Cr_t CompletionRoutine,
173 void *CompletionRoutineContext)
174 {
175 NFCSTATUS status = NFCSTATUS_SUCCESS;
176
177 if ((NdefSmtCrdFmt == NULL) || (FunctionID >= PH_FRINFC_SMTCRDFMT_CR) ||
178 (CompletionRoutine == NULL) || (CompletionRoutineContext == NULL))
179 {
180 status = PHNFCSTVAL(CID_FRI_NFC_NDEF_SMTCRDFMT, NFCSTATUS_INVALID_PARAMETER);
181 }
182 else
183 {
184 /* Register the application callback with the NdefMap Completion Routine */
185 NdefSmtCrdFmt->CompletionRoutine[FunctionID].CompletionRoutine = CompletionRoutine;
186
187 /* Register the application context with the NdefMap Completion Routine context */
188 NdefSmtCrdFmt->CompletionRoutine[FunctionID].Context = CompletionRoutineContext;
189 }
190
191 return status;
192 }
193
194 #ifdef FRINFC_READONLY_NDEF
195
196 NFCSTATUS
phFriNfc_NdefSmtCrd_ConvertToReadOnly(phFriNfc_sNdefSmtCrdFmt_t * NdefSmtCrdFmt)197 phFriNfc_NdefSmtCrd_ConvertToReadOnly (
198 phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt)
199 {
200 NFCSTATUS result = PHNFCSTVAL(CID_FRI_NFC_NDEF_SMTCRDFMT,
201 NFCSTATUS_INVALID_PARAMETER);
202 uint8_t sak = 0;
203
204 if((NdefSmtCrdFmt != NULL)
205 && (NdefSmtCrdFmt->CompletionRoutine->CompletionRoutine != NULL)
206 && (NdefSmtCrdFmt->CompletionRoutine->Context != NULL))
207 {
208 sak = NdefSmtCrdFmt->psRemoteDevInfo->RemoteDevInfo.Iso14443A_Info.Sak;
209 switch (NdefSmtCrdFmt->psRemoteDevInfo->RemDevType)
210 {
211 case phHal_eMifare_PICC:
212 {
213 if (0x00 == sak)
214 {
215 result = phFriNfc_MfUL_ConvertToReadOnly (NdefSmtCrdFmt);
216 }
217 else
218 {
219 /* MIFARE classic 1k/4k is not supported */
220 result = PHNFCSTVAL(CID_FRI_NFC_NDEF_SMTCRDFMT,
221 NFCSTATUS_INVALID_REMOTE_DEVICE);
222 }
223 break;
224 }
225
226 case phHal_eISO14443_A_PICC:
227 {
228 result = phFriNfc_Desfire_ConvertToReadOnly (NdefSmtCrdFmt);
229 break;
230 }
231
232 default :
233 {
234 /* Remote device is not recognised.
235 Probably not NDEF compliant */
236 result = PHNFCSTVAL(CID_FRI_NFC_NDEF_SMTCRDFMT,
237 NFCSTATUS_INVALID_REMOTE_DEVICE);
238 break;
239 }
240 }
241 }
242 return result;
243 }
244
245 #endif /* #ifdef FRINFC_READONLY_NDEF */
246
247
248 /*!
249 * \brief Used to format the different smart cards.
250 *
251 */
phFriNfc_NdefSmtCrd_Format(phFriNfc_sNdefSmtCrdFmt_t * NdefSmtCrdFmt,const uint8_t * ScrtKeyB)252 NFCSTATUS phFriNfc_NdefSmtCrd_Format( phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt, const uint8_t *ScrtKeyB )
253 {
254 /* Component ID needs to be changed */
255 NFCSTATUS Result = PHNFCSTVAL(CID_FRI_NFC_NDEF_SMTCRDFMT,
256 NFCSTATUS_INVALID_PARAMETER);
257 uint8_t sak = 0;
258
259 /* Check for the correct context structure */
260 if((NdefSmtCrdFmt != NULL) &&
261 (NdefSmtCrdFmt->CompletionRoutine->CompletionRoutine != NULL) &&
262 (NdefSmtCrdFmt->CompletionRoutine->Context != NULL))
263 {
264 #ifdef PH_HAL4_ENABLE
265 /* SAK (Select response) */
266 sak = NdefSmtCrdFmt->psRemoteDevInfo->RemoteDevInfo.Iso14443A_Info.Sak;
267
268 /* Depending on the Opmodes, call the respective card functions */
269 switch ( NdefSmtCrdFmt->psRemoteDevInfo->RemDevType )
270 #else
271 /* SAK (Select response) */
272 sak = NdefSmtCrdFmt->psRemoteDevInfo->RemoteDevInfo.CardInfo106.
273 Startup106.SelRes;
274
275 /* Depending on the Opmodes, call the respective card functions */
276 switch ( NdefSmtCrdFmt->psRemoteDevInfo->OpMode )
277 #endif /* #ifdef PH_HAL4_ENABLE */
278 {
279 #ifdef PH_HAL4_ENABLE
280 case phHal_eMifare_PICC :
281 #else
282 case phHal_eOpModesMifare :
283 #endif /* #ifdef PH_HAL4_ENABLE */
284 /* Remote device is Mifare card . Check for Mifare
285 NDEF compliance */
286 if(0x00 == sak)
287 {
288 #ifndef PH_FRINFC_FMT_MIFAREUL_DISABLED
289 /* The SAK/Sel_Res says the card is of the type
290 Mifare UL */
291 NdefSmtCrdFmt->CardType = PH_FRINFC_SMTCRDFMT_MIFARE_UL_CARD;
292 if (NdefSmtCrdFmt->psRemoteDevInfo->RemoteDevInfo.Iso14443A_Info.UidLength == 7 &&
293 NdefSmtCrdFmt->psRemoteDevInfo->RemoteDevInfo.Iso14443A_Info.Uid[0] == 0x04)
294 {
295
296 Result = phFriNfc_MfUL_Format( NdefSmtCrdFmt);
297 }
298 else
299 {
300 Result = PHNFCSTVAL(CID_FRI_NFC_NDEF_SMTCRDFMT,
301 NFCSTATUS_INVALID_REMOTE_DEVICE);
302 }
303 #else
304 Result = PHNFCSTVAL(CID_FRI_NFC_NDEF_SMTCRDFMT,
305 NFCSTATUS_INVALID_REMOTE_DEVICE);
306 #endif /* #ifndef PH_FRINFC_FMT_MIFAREUL_DISABLED */
307 }
308 else if((0x08 == (sak & 0x18)) ||
309 (0x18 == (sak & 0x18)))
310 {
311 #ifndef PH_FRINFC_FMT_MIFARESTD_DISABLED
312 NdefSmtCrdFmt->CardType = (uint8_t)
313 (((sak & 0x18) == 0x08)?
314 PH_FRINFC_SMTCRDFMT_MFSTD_1K_CRD:
315 PH_FRINFC_SMTCRDFMT_MFSTD_4K_CRD);
316
317 /* The SAK/Sel_Res says the card is of the type
318 Mifare standard */
319 Result = phFriNfc_MfStd_Format( NdefSmtCrdFmt, ScrtKeyB);
320 #else
321 Result = PHNFCSTVAL(CID_FRI_NFC_NDEF_SMTCRDFMT,
322 NFCSTATUS_INVALID_REMOTE_DEVICE);
323 #endif /* #ifndef PH_FRINFC_FMT_MIFARESTD_DISABLED */
324 }
325 else
326 {
327 /* Invalid Mifare card, as the remote device
328 info - opmode says its a Mifare card but,
329 The SAK/Sel_Res is wrong */
330 Result = PHNFCSTVAL(CID_FRI_NFC_NDEF_SMTCRDFMT,
331 NFCSTATUS_INVALID_REMOTE_DEVICE);
332 }
333 break;
334 #ifdef PH_HAL4_ENABLE
335 case phHal_eISO14443_A_PICC :
336 #else
337 case phHal_eOpModesISO14443_4A :
338 #endif /* #ifdef PH_HAL4_ENABLE */
339 /* Remote device is Desfire card . Check for Desfire
340 NDEF compliancy */
341 if(0x20 == (sak & 0xFF))
342 {
343 #ifndef PH_FRINFC_FMT_DESFIRE_DISABLED
344 NdefSmtCrdFmt->CardType = PH_FRINFC_SMTCRDFMT_ISO14443_4A_CARD;
345 /* The SAK/Sel_Res says the card is of the type
346 ISO14443_4A */
347
348 Result = phFriNfc_Desfire_Format(NdefSmtCrdFmt);
349 #else
350 Result = PHNFCSTVAL(CID_FRI_NFC_NDEF_SMTCRDFMT,
351 NFCSTATUS_INVALID_REMOTE_DEVICE);
352 #endif /* #ifndef PH_FRINFC_FMT_DESFIRE_DISABLED */
353 }
354 else
355 {
356 /* Invalid Desfire card, as the remote device
357 info - opmode says its a desfire card but,
358 The SAK/Sel_Res is wrong */
359 Result = PHNFCSTVAL(CID_FRI_NFC_NDEF_SMTCRDFMT,
360 NFCSTATUS_INVALID_REMOTE_DEVICE);
361 }
362 break;
363 #ifdef PH_HAL4_ENABLE
364 case phHal_eJewel_PICC :
365 #else
366 case phHal_eOpModesJewel :
367 #endif /* #ifdef PH_HAL4_ENABLE */
368 /* Remote device is Topaz card . Check for Topaz
369 NDEF compliancy */
370 if(0xC2 == sak)
371 {
372 #ifndef PH_FRINFC_FMT_TOPAZ_DISABLED
373 NdefSmtCrdFmt->CardType = PH_FRINFC_SMTCRDFMT_TOPAZ_CARD;
374 /* The SAK/Sel_Res says the card is of the type
375 ISO14443_4A */
376 Result = phFriNfc_Topaz_Format(NdefSmtCrdFmt);
377 #else
378 Result = PHNFCSTVAL(CID_FRI_NFC_NDEF_SMTCRDFMT,
379 NFCSTATUS_INVALID_REMOTE_DEVICE);
380 #endif /* #ifndef PH_FRINFC_FMT_TOPAZ_DISABLED */
381
382 }
383 else
384 {
385 /* Invalid Topaz card, as the remote device
386 info - opmode says its a desfire card but,
387 The SAK/Sel_Res is wrong */
388 Result = PHNFCSTVAL(CID_FRI_NFC_NDEF_SMTCRDFMT,
389 NFCSTATUS_INVALID_REMOTE_DEVICE);
390 }
391 break;
392
393 #ifdef PHFRINFC_OVRHAL_MOCKUP
394 case phHal_eOpModesMockup :
395 /*Set the OpMode Ttype Flag*/
396 NdefSmtCrdFmt->OpModeType[0] = phHal_eOpModesMockup;
397 NdefSmtCrdFmt->OpModeType[1] = phHal_eOpModesArrayTerminator;
398 //Result = phFriNfc_Mockup_ChkNdef(NdefSmtCrdFmt);
399 break;
400 #endif /* PHFRINFC_OVRHAL_MOCKUP */
401
402 #ifndef PH_FRINFC_FMT_ISO15693_DISABLED
403 case phHal_eISO15693_PICC:
404 {
405 Result = phFriNfc_ISO15693_Format (NdefSmtCrdFmt);
406 break;
407 }
408 #endif /* #ifndef PH_FRINFC_FMT_ISO15693_DISABLED */
409 default :
410 /* Remote device is not recognised.
411 Probably not NDEF compliant */
412 Result = PHNFCSTVAL(CID_FRI_NFC_NDEF_SMTCRDFMT,
413 NFCSTATUS_INVALID_REMOTE_DEVICE);
414 break;
415 }
416 }
417 return Result;
418 }
419 /*!
420 * \brief Handles different request and responses from the integration layer.
421 *
422 */
phFriNfc_NdefSmtCrd_Process(void * Context,NFCSTATUS Status)423 void phFriNfc_NdefSmtCrd_Process(void *Context,
424 NFCSTATUS Status)
425 {
426 if ( Context != NULL )
427 {
428 phFriNfc_sNdefSmtCrdFmt_t *NdefSmtCrdFmt = (phFriNfc_sNdefSmtCrdFmt_t *)Context;
429 #ifdef PH_HAL4_ENABLE
430 switch ( NdefSmtCrdFmt->psRemoteDevInfo->RemDevType )
431 #else
432 switch ( NdefSmtCrdFmt->psRemoteDevInfo->OpMode )
433 #endif /* #ifdef PH_HAL4_ENABLE */
434 {
435 #ifdef PH_HAL4_ENABLE
436 case phHal_eMifare_PICC :
437 #else
438 case phHal_eOpModesMifare :
439 #endif /* #ifdef PH_HAL4_ENABLE */
440 if((NdefSmtCrdFmt->CardType == PH_FRINFC_SMTCRDFMT_MFSTD_1K_CRD) ||
441 (NdefSmtCrdFmt->CardType == PH_FRINFC_SMTCRDFMT_MFSTD_4K_CRD))
442 {
443 #ifndef PH_FRINFC_FMT_MIFARESTD_DISABLED
444 /* Remote device is Mifare Standard card */
445 phFriNfc_MfStd_Process(NdefSmtCrdFmt,Status);
446
447 #else /* PH_FRINFC_FMT_MIFARESTD_DISABLED*/
448 Status = PHNFCSTVAL(CID_FRI_NFC_NDEF_SMTCRDFMT,
449 NFCSTATUS_INVALID_REMOTE_DEVICE);
450 #endif /* PH_FRINFC_FMT_MIFARESTD_DISABLED*/
451 }
452 else
453 {
454 #ifndef PH_FRINFC_FMT_MIFAREUL_DISABLED
455 /* Remote device is Mifare UL card */
456 phFriNfc_MfUL_Process(NdefSmtCrdFmt,Status);
457 #else /* PH_FRINFC_FMT_MIFAREUL_DISABLED*/
458 Status = PHNFCSTVAL(CID_FRI_NFC_NDEF_SMTCRDFMT,
459 NFCSTATUS_INVALID_REMOTE_DEVICE);
460 #endif /* PH_FRINFC_FMT_MIFAREUL_DISABLED*/
461 }
462 break;
463
464 #ifdef PH_HAL4_ENABLE
465 case phHal_eISO14443_A_PICC :
466 #else
467 case phHal_eOpModesISO14443_4A :
468 #endif /* #ifdef PH_HAL4_ENABLE */
469 #ifndef PH_FRINFC_FMT_DESFIRE_DISABLED
470 /* Remote device is Desfire card */
471 phFriNfc_Desf_Process(NdefSmtCrdFmt, Status);
472 #else /* PH_FRINFC_FMT_DESFIRE_DISABLED*/
473 Status = PHNFCSTVAL(CID_FRI_NFC_NDEF_SMTCRDFMT,
474 NFCSTATUS_INVALID_REMOTE_DEVICE);
475 #endif /* PH_FRINFC_FMT_DESFIRE_DISABLED*/
476 break;
477 #ifdef PH_HAL4_ENABLE
478 case phHal_eJewel_PICC :
479 #else
480 case phHal_eOpModesJewel:
481 #endif /* #ifdef PH_HAL4_ENABLE */
482 #ifndef PH_FRINFC_FMT_TOPAZ_DISABLED
483 /* Remote device is Topaz Smart card */
484 phFriNfc_Topaz_Process(NdefSmtCrdFmt, Status);
485 #else /* PH_FRINFC_FMT_TOPAZ_DISABLED*/
486 Status = PHNFCSTVAL(CID_FRI_NFC_NDEF_SMTCRDFMT,
487 NFCSTATUS_INVALID_REMOTE_DEVICE);
488 #endif /* PH_FRINFC_FMT_TOPAZ_DISABLED*/
489 break;
490
491 #ifndef PH_FRINFC_FMT_ISO15693_DISABLED
492 case phHal_eISO15693_PICC :
493 {
494 phFriNfc_ISO15693_FmtProcess (NdefSmtCrdFmt, Status);
495 break;
496 }
497 #endif /* #ifndef PH_FRINFC_FMT_ISO15693_DISABLED */
498
499 #ifdef PHFRINFC_OVRHAL_MOCKUP
500 case phHal_eOpModesMockup:
501 /* Remote device is Desfire card */
502 //phFriNfc_Mockup_Process(NdefSmtCrdFmt, Status);
503 break;
504 #endif /* PHFRINFC_OVRHAL_MOCKUP*/
505 default :
506 /* Remote device opmode not recognised.
507 Probably not NDEF compliant */
508 Status = PHNFCSTVAL(CID_FRI_NFC_NDEF_SMTCRDFMT,
509 NFCSTATUS_INVALID_REMOTE_DEVICE);
510 /* set the state back to the Reset_Init state*/
511 NdefSmtCrdFmt->State = PH_FRINFC_SMTCRDFMT_STATE_RESET_INIT;
512
513 /* set the completion routine*/
514 NdefSmtCrdFmt->CompletionRoutine[PH_FRINFC_SMTCRDFMT_CR_INVALID_OPE].
515 CompletionRoutine(NdefSmtCrdFmt->CompletionRoutine->Context, Status);
516 break;
517 }
518 }
519 else
520 {
521 Status = PHNFCSTVAL(CID_FRI_NFC_NDEF_SMTCRDFMT,\
522 NFCSTATUS_INVALID_PARAMETER);
523 /* The control should not come here. As Context itself is NULL ,
524 Can't call the CR*/
525 }
526 }
527
528 #endif /* PH_FRINFC_CARD_FORMAT_DISABLED */
529
530