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* =========================================================================== * 19* * 20* * 21* \file phHciNfc_Emulation.c * 22* \brief HCI Emulation management routines. * 23* * 24* * 25* Project: NFC-FRI-1.1 * 26* * 27* $Date: Tue Jun 8 09:30:37 2010 $ * 28* $Author: ing04880 $ * 29* $Revision: 1.52 $ * 30* $Aliases: NFC_FRI1.1_WK1023_R35_1 $ 31* * 32* =========================================================================== * 33*/ 34 35/* 36***************************** Header File Inclusion **************************** 37*/ 38#include <phNfcConfig.h> 39#include <phNfcCompId.h> 40#include <phNfcHalTypes.h> 41#include <phHciNfc_Pipe.h> 42#include <phHciNfc_Emulation.h> 43#include <phHciNfc_WI.h> 44#include <phHciNfc_SWP.h> 45#ifdef ENABLE_P2P 46#include <phHciNfc_NfcIPMgmt.h> 47#endif 48#ifdef HOST_EMULATION 49#include <phHciNfc_CE_A.h> 50#include <phHciNfc_CE_B.h> 51#endif 52#include <phOsalNfc.h> 53/* 54****************************** Macro Definitions ******************************* 55*/ 56 57 58 59/* 60*************************** Structure and Enumeration *************************** 61*/ 62 63/** \defgroup grp_hci_nfc HCI Emulation Management Component 64* 65* 66*/ 67 68typedef enum phHciNfc_EmulationMgmt_Seq{ 69 NFCIP_TARGET_PIPE_OPEN = 0x00U, 70 NFCIP_TARGET_MODE_CONFIG, 71 NFCIP_TARGET_MERGE_SAK, 72 NFCIP_TARGET_PIPE_CLOSE, 73 74 HOST_CE_A_INIT, 75 HOST_CE_A_RELEASE, 76 77 HOST_CE_B_INIT, 78 HOST_CE_B_RELEASE, 79 80 WI_PIPE_OPEN, 81 WI_ENABLE_EMULATION, 82 WI_DEFAULT_EMULATION, 83 WI_DISABLE_EMULATION, 84 85 WI_ENABLE_NOTIFICATION, 86 WI_DISABLE_NOTIFICATION, 87 88 WI_SWITCH_WIRED_MODE, 89 WI_SWITCH_DEFAULT_MODE, 90 91 WI_PIPE_CLOSE, 92 93 SWP_PIPE_OPEN, 94 SWP_ENABLE_EMULATION, 95 SWP_DEFAULT_EMULATION, 96 SWP_DETECTION, 97 SWP_DISABLE_EMULATION, 98 SWP_GET_BIT_RATE, 99 SWP_PIPE_CLOSE, 100 101 CONFIG_DEFAULT_EMULATION, 102 103 END_EMULATION_SEQ 104} phHciNfc_EmulationMgmt_Seq_t; 105 106typedef struct phHciNfc_EmulationMgmt_Info{ 107 phHal_eEmulationType_t se_default; 108 uint8_t smx_powerless; 109 uint8_t uicc_enable; 110 uint8_t uicc_powerless; 111 uint8_t uicc_id; 112 /* Application ID of the UICC Transaction performed */ 113 uint8_t uicc_aid[MAX_AID_LEN]; 114 uint8_t uicc_param[MAX_UICC_PARAM_LEN]; 115 uint8_t uicc_param_len; 116 phHciNfc_Pipe_Info_t *p_uicc_pipe_info; 117 phHciNfc_EmulationMgmt_Seq_t emulation_cur_seq; 118 phHciNfc_EmulationMgmt_Seq_t emulation_next_seq; 119 120 121} phHciNfc_EmulationMgmt_Info_t; 122 123 124/* 125*************************** Static Function Declaration ************************** 126*/ 127 128static 129NFCSTATUS 130phHciNfc_Recv_Uicc_Cmd ( 131 void *psContext, 132 void *pHwRef, 133 uint8_t *pCmd, 134#ifdef ONE_BYTE_LEN 135 uint8_t length 136#else 137 uint16_t length 138#endif 139 ); 140 141static 142NFCSTATUS 143phHciNfc_Recv_Uicc_Event ( 144 void *psContext, 145 void *pHwRef, 146 uint8_t *pEvent, 147#ifdef ONE_BYTE_LEN 148 uint8_t length 149#else 150 uint16_t length 151#endif 152 ); 153 154 155/* 156*************************** Function Definitions *************************** 157*/ 158 159void 160phHciNfc_Uicc_Connectivity( 161 phHciNfc_sContext_t *psHciContext, 162 void *pHwRef 163 ) 164{ 165 NFCSTATUS status = NFCSTATUS_SUCCESS; 166 phHciNfc_Pipe_Info_t *pPipeInfo = NULL; 167 phHciNfc_EmulationMgmt_Info_t *p_emulation_mgmt_info = NULL; 168 169 if( NULL != psHciContext->p_emulation_mgmt_info ) 170 { 171 p_emulation_mgmt_info = (phHciNfc_EmulationMgmt_Info_t *) 172 psHciContext->p_emulation_mgmt_info ; 173 pPipeInfo = psHciContext->p_pipe_list[NXP_PIPE_CONNECTIVITY]; 174 if( (TRUE == ((phHal_sHwReference_t *)pHwRef)->uicc_connected) 175 && (NULL == pPipeInfo)) 176 { 177 status = phHciNfc_Allocate_Resource((void **)&pPipeInfo, 178 sizeof(phHciNfc_Pipe_Info_t)); 179 if((NULL != pPipeInfo) 180 && (NFCSTATUS_SUCCESS == status)) 181 { 182 /* The Source Host is the UICC Host */ 183 pPipeInfo->pipe.source.host_id = 184 (uint8_t) phHciNfc_UICCHostID; 185 /* The Source Gate is same as the Destination Gate */ 186 pPipeInfo->pipe.source.gate_id = 187 (uint8_t) phHciNfc_ConnectivityGate; 188 /* The Destination Host is the Terminal Host */ 189 pPipeInfo->pipe.dest.host_id = 190 (uint8_t) phHciNfc_TerminalHostID; 191 /* The Source Gate is same as the Destination Gate */ 192 pPipeInfo->pipe.dest.gate_id = 193 (uint8_t) phHciNfc_ConnectivityGate; 194 /* The Pipe ID is Hardcoded to Connectivity */ 195 pPipeInfo->pipe.pipe_id = (uint8_t) NXP_PIPE_CONNECTIVITY; 196 197 198 status = phHciNfc_Uicc_Update_PipeInfo(psHciContext, 199 NXP_PIPE_CONNECTIVITY, pPipeInfo); 200 if (NFCSTATUS_SUCCESS == status) 201 { 202 psHciContext->p_pipe_list[NXP_PIPE_CONNECTIVITY] = pPipeInfo; 203 p_emulation_mgmt_info->uicc_enable = TRUE; 204 } 205 else 206 { 207 (void)phOsalNfc_FreeMemory(pPipeInfo); 208 } 209 } 210 } 211 } 212 return; 213} 214 215/*! 216 * \brief Get the pipe_id of Connectivity Managment Gate. 217 * 218 * This function Get the pipe_id of Connectivity Managment Gate. 219 * 220 */ 221 222 223NFCSTATUS 224phHciNfc_Uicc_Get_PipeID( 225 phHciNfc_sContext_t *psHciContext, 226 uint8_t *ppipe_id 227 ) 228{ 229 NFCSTATUS status = NFCSTATUS_SUCCESS; 230 phHciNfc_EmulationMgmt_Info_t *p_emulation_mgmt_info = NULL; 231 if( (NULL != psHciContext) 232 && ( NULL != ppipe_id ) 233 && ( NULL != psHciContext->p_emulation_mgmt_info ) 234 ) 235 { 236 p_emulation_mgmt_info = (phHciNfc_EmulationMgmt_Info_t *) 237 psHciContext->p_emulation_mgmt_info ; 238 *ppipe_id = p_emulation_mgmt_info->uicc_id ; 239 } 240 else 241 { 242 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 243 } 244 return status; 245} 246 247 248/* Function to Update the Pipe Information */ 249NFCSTATUS 250phHciNfc_Uicc_Update_PipeInfo( 251 phHciNfc_sContext_t *psHciContext, 252 uint8_t pipe_id, 253 phHciNfc_Pipe_Info_t *pPipeInfo 254 ) 255{ 256 phHciNfc_EmulationMgmt_Info_t *p_emulation_mgmt_info=NULL; 257 NFCSTATUS status = NFCSTATUS_SUCCESS; 258 259 if( NULL == psHciContext ) 260 { 261 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 262 } 263 else if ( NULL == psHciContext->p_emulation_mgmt_info ) 264 { 265 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_HCI_INFORMATION); 266 } 267 else 268 { 269 p_emulation_mgmt_info = (phHciNfc_EmulationMgmt_Info_t *) 270 psHciContext->p_emulation_mgmt_info ; 271 /* Update the pipe_id of the Connectivity Gate 272 * obtained from the HCI Response */ 273 p_emulation_mgmt_info->uicc_id = pipe_id; 274 p_emulation_mgmt_info->p_uicc_pipe_info = pPipeInfo; 275 if ( NULL != pPipeInfo) 276 { 277 /* Update the Response Receive routine of the Connectivity Gate */ 278 /* pPipeInfo->recv_resp = phHciNfc_Recv_Uicc_Response; */ 279 pPipeInfo->recv_cmd = &phHciNfc_Recv_Uicc_Cmd; 280 pPipeInfo->recv_event = &phHciNfc_Recv_Uicc_Event; 281 } 282 } 283 284 return status; 285} 286 287 288/*! 289* \brief Updates the Sequence of Emulation Managment Gate. 290* 291* This function Resets/Updates the sequence of the Emulation Management 292* gate. 293* 294*/ 295 296 297NFCSTATUS 298phHciNfc_EmuMgmt_Update_Seq( 299 phHciNfc_sContext_t *psHciContext, 300 phHciNfc_eSeqType_t seq_type 301 ) 302{ 303 phHciNfc_EmulationMgmt_Info_t *p_emulation_mgmt_info=NULL; 304 NFCSTATUS status = NFCSTATUS_SUCCESS; 305 if( NULL == psHciContext ) 306 { 307 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 308 } 309 else 310 { 311 if( NULL == psHciContext->p_emulation_mgmt_info ) 312 { 313 status = PHNFCSTVAL(CID_NFC_HCI, 314 NFCSTATUS_INVALID_HCI_INFORMATION); 315 } 316 else 317 { 318 p_emulation_mgmt_info = (phHciNfc_EmulationMgmt_Info_t *) 319 psHciContext->p_emulation_mgmt_info ; 320 switch(seq_type) 321 { 322 case RESET_SEQ: 323 case INIT_SEQ: 324 { 325#ifdef ENABLE_P2P 326 p_emulation_mgmt_info->emulation_cur_seq = NFCIP_TARGET_PIPE_OPEN; 327#else 328 p_emulation_mgmt_info->emulation_cur_seq = WI_PIPE_OPEN; 329#endif 330 p_emulation_mgmt_info->emulation_next_seq = END_EMULATION_SEQ ; 331 break; 332 } 333 case UPDATE_SEQ: 334 { 335 p_emulation_mgmt_info->emulation_cur_seq = 336 p_emulation_mgmt_info->emulation_next_seq; 337 break; 338 } 339 case INFO_SEQ: 340 { 341 p_emulation_mgmt_info->emulation_cur_seq = SWP_ENABLE_EMULATION; 342 p_emulation_mgmt_info->emulation_next_seq = END_EMULATION_SEQ ; 343 break; 344 } 345 case REL_SEQ: 346 { 347 p_emulation_mgmt_info->emulation_cur_seq = WI_DISABLE_EMULATION; 348 p_emulation_mgmt_info->emulation_next_seq = END_EMULATION_SEQ ; 349 break; 350 } 351 default: 352 { 353 break; 354 } 355 } 356 } 357 } 358 359 return status; 360} 361 362 363/*! 364* \brief Initialisation of RF Emulation Gates. 365* 366* This function initialses the RF Emulation Management and 367* populates the Reader Management Information Structure 368* 369*/ 370 371 372NFCSTATUS 373phHciNfc_EmuMgmt_Initialise( 374 phHciNfc_sContext_t *psHciContext, 375 void *pHwRef 376 ) 377{ 378 NFCSTATUS status = NFCSTATUS_SUCCESS; 379 phHciNfc_Pipe_Info_t *p_pipe_info = NULL; 380 phHciNfc_EmulationMgmt_Info_t *p_emulation_mgmt_info=NULL; 381 382 if( NULL == psHciContext ) 383 { 384 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 385 } 386 else 387 { 388 389 if( ( NULL == psHciContext->p_emulation_mgmt_info ) 390 && (phHciNfc_Allocate_Resource((void **)(&p_emulation_mgmt_info), 391 sizeof(phHciNfc_EmulationMgmt_Info_t))== NFCSTATUS_SUCCESS) 392 ) 393 { 394 psHciContext->p_emulation_mgmt_info = p_emulation_mgmt_info; 395#ifdef ENABLE_P2P 396 p_emulation_mgmt_info->emulation_cur_seq = NFCIP_TARGET_PIPE_OPEN; 397#else 398 p_emulation_mgmt_info->emulation_cur_seq = WI_PIPE_OPEN; 399#endif 400 p_emulation_mgmt_info->emulation_next_seq = END_EMULATION_SEQ; 401 p_emulation_mgmt_info->uicc_id = (uint8_t)HCI_UNKNOWN_PIPE_ID; 402 } 403 else 404 { 405 p_emulation_mgmt_info = (phHciNfc_EmulationMgmt_Info_t *) 406 psHciContext->p_emulation_mgmt_info ; 407 } 408 409 if( NULL == psHciContext->p_emulation_mgmt_info ) 410 { 411 status = PHNFCSTVAL(CID_NFC_HCI, 412 NFCSTATUS_INSUFFICIENT_RESOURCES); 413 } 414#ifdef ESTABLISH_SESSION 415 else if(( hciMode_Session == psHciContext->hci_mode ) 416 && (NFCIP_TARGET_PIPE_OPEN == p_emulation_mgmt_info->emulation_cur_seq ) 417 ) 418 { 419 status = NFCSTATUS_SUCCESS; 420 } 421#endif 422 else 423 { 424 switch(p_emulation_mgmt_info->emulation_cur_seq ) 425 { 426#ifdef ENABLE_P2P 427 /* NFCIP Target Open sequence */ 428 case NFCIP_TARGET_PIPE_OPEN: 429 { 430 p_pipe_info = ((phHciNfc_NfcIP_Info_t *) 431 psHciContext->p_nfcip_info)->p_tgt_pipe_info; 432 if(NULL == p_pipe_info ) 433 { 434 status = PHNFCSTVAL(CID_NFC_HCI, 435 NFCSTATUS_INVALID_HCI_INFORMATION); 436 } 437 else 438 { 439 status = phHciNfc_Open_Pipe( psHciContext, 440 pHwRef, p_pipe_info ); 441 if(status == NFCSTATUS_SUCCESS) 442 { 443 p_emulation_mgmt_info->emulation_next_seq = 444 NFCIP_TARGET_MODE_CONFIG; 445 status = NFCSTATUS_PENDING; 446 } 447 } 448 break; 449 } 450 /* NFCIP Target Mode Config sequence */ 451 case NFCIP_TARGET_MODE_CONFIG: 452 { 453#define NFCIP_ACTIVE_SHIFT 0x03U 454#define NFCIP_PASSIVE_MASK 0x07U 455 uint8_t mode = ( NXP_NFCIP_ACTIVE_DEFAULT << NFCIP_ACTIVE_SHIFT ) | 456 ( DEFAULT_NFCIP_TARGET_MODE_SUPPORT & NFCIP_PASSIVE_MASK ); 457 status = phHciNfc_NfcIP_SetMode( psHciContext, pHwRef, 458 NFCIP_TARGET, mode); 459 if(status == NFCSTATUS_PENDING ) 460 { 461#ifdef TGT_MERGE_SAK 462 p_emulation_mgmt_info->emulation_next_seq = 463 NFCIP_TARGET_MERGE_SAK; 464#else 465 p_emulation_mgmt_info->emulation_next_seq = 466 WI_PIPE_OPEN; 467#endif /* #ifdef TGT_MERGE_SAK */ 468 /* status = NFCSTATUS_SUCCESS; */ 469 } 470 break; 471 } 472#ifdef TGT_MERGE_SAK 473 /* NFCIP Target SAK Merge sequence */ 474 case NFCIP_TARGET_MERGE_SAK: 475 { 476 status = phHciNfc_NfcIP_SetMergeSak( psHciContext, pHwRef, 477 TRUE ); 478 if(status == NFCSTATUS_PENDING ) 479 { 480 p_emulation_mgmt_info->emulation_next_seq = 481 WI_PIPE_OPEN; 482 /* status = NFCSTATUS_SUCCESS; */ 483 } 484 break; 485 } 486#endif /* #ifdef TGT_MERGE_SAK */ 487#endif /* #ifdef ENABLE_P2P */ 488 /* Secure Element WI pipe open sequence */ 489 case WI_PIPE_OPEN: 490 { 491 p_pipe_info = ((phHciNfc_WI_Info_t *) 492 psHciContext->p_wi_info)->p_pipe_info; 493 if(NULL == p_pipe_info ) 494 { 495 status = PHNFCSTVAL(CID_NFC_HCI, 496 NFCSTATUS_INVALID_HCI_INFORMATION); 497 } 498 else 499 { 500 status = phHciNfc_Open_Pipe( psHciContext, 501 pHwRef, p_pipe_info ); 502 if(status == NFCSTATUS_SUCCESS) 503 { 504#ifdef DISABLE_WI_NOTIFICATION 505 p_emulation_mgmt_info->emulation_next_seq = 506 SWP_PIPE_OPEN; 507#else 508 p_emulation_mgmt_info->emulation_next_seq = 509 WI_ENABLE_NOTIFICATION; 510#endif 511 status = NFCSTATUS_PENDING; 512 } 513 } 514 break; 515 } 516 /* Enable the SmartMx Notifications through WI */ 517 case WI_ENABLE_NOTIFICATION: 518 { 519 p_pipe_info = ((phHciNfc_WI_Info_t *) 520 psHciContext->p_wi_info)->p_pipe_info; 521 if(NULL == p_pipe_info ) 522 { 523 status = PHNFCSTVAL(CID_NFC_HCI, 524 NFCSTATUS_INVALID_HCI_INFORMATION); 525 } 526 else 527 { 528 status = phHciNfc_WI_Configure_Notifications( 529 psHciContext, pHwRef, eEnableEvents ); 530 if(status == NFCSTATUS_PENDING) 531 { 532 p_emulation_mgmt_info->emulation_next_seq = 533 SWP_PIPE_OPEN; 534 } 535 } 536 break; 537 } 538 /* Enable the SmartMx Emulation by Default through WI */ 539 case WI_ENABLE_EMULATION: 540 { 541 p_pipe_info = ((phHciNfc_WI_Info_t *) 542 psHciContext->p_wi_info)->p_pipe_info; 543 if(NULL == p_pipe_info ) 544 { 545 status = PHNFCSTVAL(CID_NFC_HCI, 546 NFCSTATUS_INVALID_HCI_INFORMATION); 547 } 548 else 549 { 550 status = phHciNfc_WI_Configure_Default( psHciContext, 551 pHwRef, TRUE ); 552 if(status == NFCSTATUS_PENDING) 553 { 554 p_emulation_mgmt_info->emulation_next_seq = 555 SWP_PIPE_OPEN; 556 } 557 } 558 break; 559 } 560 /* SWP pipe open sequence */ 561 case SWP_PIPE_OPEN: 562 { 563 p_pipe_info = ((phHciNfc_SWP_Info_t *) 564 psHciContext->p_swp_info)->p_pipe_info; 565 if(NULL == p_pipe_info ) 566 { 567 status = PHNFCSTVAL(CID_NFC_HCI, 568 NFCSTATUS_INVALID_HCI_INFORMATION); 569 } 570 else 571 { 572 status = phHciNfc_Open_Pipe( psHciContext, 573 pHwRef, p_pipe_info ); 574 if(status == NFCSTATUS_SUCCESS) 575 { 576 p_emulation_mgmt_info->emulation_next_seq = 577 SWP_ENABLE_EMULATION; 578#ifndef ESTABLISH_SESSION 579 status = NFCSTATUS_PENDING; 580#endif 581 } 582 } 583 break; 584 } 585 /* Enable the UICC Emulation through SWP */ 586 case SWP_ENABLE_EMULATION: 587 { 588 p_pipe_info = ((phHciNfc_SWP_Info_t *) 589 psHciContext->p_swp_info)->p_pipe_info; 590 if(NULL == p_pipe_info ) 591 { 592 status = PHNFCSTVAL(CID_NFC_HCI, 593 NFCSTATUS_INVALID_HCI_INFORMATION); 594 } 595 else 596 { 597#ifdef SWP_EVENT_USAGE 598 status = phHciNfc_SWP_Configure_Mode( psHciContext, pHwRef, 599 UICC_SWITCH_MODE_ON ); 600 /* UICC_SWITCH_MODE_DEFAULT */ 601#else 602 status = phHciNfc_SWP_Configure_Default( psHciContext, 603 pHwRef, TRUE ); 604#endif 605 if(status == NFCSTATUS_PENDING) 606 { 607 p_emulation_mgmt_info->emulation_next_seq = 608 SWP_DETECTION; 609 /* status = NFCSTATUS_SUCCESS; */ 610 } 611 } 612 break; 613 } 614 /* Disable the UICC Emulation through SWP */ 615 case SWP_DETECTION: 616 { 617 p_pipe_info = ((phHciNfc_SWP_Info_t *) 618 psHciContext->p_swp_info)->p_pipe_info; 619 if(NULL == p_pipe_info ) 620 { 621 status = PHNFCSTVAL(CID_NFC_HCI, 622 NFCSTATUS_INVALID_HCI_INFORMATION); 623 break; 624 } 625 else 626 { 627 status = phHciNfc_Uicc_Connect_Status( 628 psHciContext, pHwRef ); 629 if(status == NFCSTATUS_SUCCESS) 630 { 631 uint8_t uicc_connect = ((phHciNfc_SWP_Info_t *) 632 psHciContext->p_swp_info)->uicc_status; 633 if(UICC_CONNECTED == uicc_connect) 634 { 635#ifdef SWP_EVENT_USAGE 636 p_emulation_mgmt_info->emulation_next_seq = 637 SWP_DISABLE_EMULATION; 638#else 639 p_emulation_mgmt_info->emulation_next_seq = 640 WI_DISABLE_EMULATION; 641#endif 642 ((phHal_sHwReference_t *) 643 pHwRef)->uicc_connected = TRUE; 644 status = NFCSTATUS_PENDING; 645 } 646 else 647 { 648 status = phHciNfc_SWP_Configure_Mode( psHciContext, 649 pHwRef, UICC_SWITCH_MODE_DEFAULT ); 650 (NFCSTATUS_PENDING == status)? 651 (p_emulation_mgmt_info->emulation_next_seq = 652 WI_DISABLE_EMULATION): 653 (p_emulation_mgmt_info->emulation_next_seq = 654 SWP_DETECTION); 655 break; 656 } 657 } 658 else 659 { 660 break; 661 } 662 } 663 } 664 /* fall through */ 665 /* Disable the SmartMx Emulation through WI */ 666 case WI_DISABLE_EMULATION: 667 { 668 p_pipe_info = ((phHciNfc_WI_Info_t *) 669 psHciContext->p_wi_info)->p_pipe_info; 670 if(NULL == p_pipe_info ) 671 { 672 status = PHNFCSTVAL(CID_NFC_HCI, 673 NFCSTATUS_INVALID_HCI_INFORMATION); 674 } 675 else 676 { 677 status = phHciNfc_WI_Configure_Mode( psHciContext, 678 pHwRef, eSmartMx_Default ); 679 if(status == NFCSTATUS_PENDING) 680 { 681 p_emulation_mgmt_info->emulation_next_seq = 682 SWP_DISABLE_EMULATION; 683 status = NFCSTATUS_SUCCESS; 684 } 685 } 686 break; 687 } 688#ifndef SWP_EVENT_USAGE 689 /* fall through */ 690 /* Get the UICC Baud Rate Status */ 691 case SWP_GET_BIT_RATE: 692 { 693 p_pipe_info = ((phHciNfc_SWP_Info_t *) 694 psHciContext->p_swp_info)->p_pipe_info; 695 if(NULL == p_pipe_info ) 696 { 697 status = PHNFCSTVAL(CID_NFC_HCI, 698 NFCSTATUS_INVALID_HCI_INFORMATION); 699 } 700 else 701 { 702 status = phHciNfc_SWP_Get_Bitrate( 703 psHciContext, pHwRef ); 704 if(status == NFCSTATUS_PENDING) 705 { 706 p_emulation_mgmt_info->emulation_next_seq = 707 SWP_DISABLE_EMULATION; 708 status = NFCSTATUS_SUCCESS; 709 } 710 } 711 break; 712 } 713#endif 714 /* fall through */ 715 /* Disable the UICC Emulation through SWP */ 716 case SWP_DISABLE_EMULATION: 717 { 718 p_pipe_info = ((phHciNfc_SWP_Info_t *) 719 psHciContext->p_swp_info)->p_pipe_info; 720 if(NULL == p_pipe_info ) 721 { 722 status = PHNFCSTVAL(CID_NFC_HCI, 723 NFCSTATUS_INVALID_HCI_INFORMATION); 724 } 725 else 726 { 727 status = phHciNfc_SWP_Configure_Mode( psHciContext, 728 pHwRef, UICC_SWITCH_MODE_DEFAULT ); 729 if(status == NFCSTATUS_PENDING) 730 { 731 p_emulation_mgmt_info->emulation_next_seq = 732 WI_DISABLE_EMULATION; 733 /* Disable WI Emulation for Previous Wired 734 * Mode Set */ 735 /* status = NFCSTATUS_SUCCESS; */ 736 } 737 } 738 break; 739 } 740 default: 741 { 742 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_HCI_SEQUENCE); 743 break; 744 } 745 746 }/* End of the Sequence Switch */ 747 748 }/* End of the Reader Info Memory Check */ 749 750 } /* End of Null Context Check */ 751 752 return status; 753} 754 755/*! 756* \brief Connection Routine for the Uicc. 757* 758* This function tries to enable and initialise the UICC connected 759* through SWP. 760* 761*/ 762 763 764NFCSTATUS 765phHciNfc_Uicc_Connect_Status( 766 phHciNfc_sContext_t *psHciContext, 767 void *pHwRef 768 ) 769{ 770 NFCSTATUS status = NFCSTATUS_SUCCESS; 771 /* phHciNfc_Pipe_Info_t *p_pipe_info = NULL; */ 772 /* phHciNfc_EmulationMgmt_Info_t *p_emulation_mgmt_info=NULL; */ 773 static uint32_t uicc_connection_retry = 0; 774 775 if( NULL == psHciContext ) 776 { 777 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 778 } 779 else 780 { 781 phHciNfc_SWP_Status_t uicc_status = 782 ((phHciNfc_SWP_Info_t *) 783 psHciContext->p_swp_info)->uicc_status; 784 if(uicc_connection_retry == 0) 785 { 786#ifdef UICC_STATUS_DELAY 787 for( ;uicc_connection_retry < UICC_STATUS_DELAY_COUNT; 788 uicc_connection_retry ++ ); 789 uicc_connection_retry = 0; 790#endif 791 status = phHciNfc_SWP_Get_Status( 792 psHciContext, pHwRef ); 793 if (NFCSTATUS_PENDING == status) 794 { 795 uicc_connection_retry++; 796 } 797 } 798 else 799 { 800 switch(uicc_status) 801 { 802 case UICC_CONNECTION_ONGOING: 803 case UICC_DISCONNECTION_ONGOING: 804 case UICC_NOT_CONNECTED: 805 { 806 if(uicc_connection_retry < 807 UICC_MAX_CONNECT_RETRY) 808 { 809 status = phHciNfc_SWP_Get_Status( 810 psHciContext, pHwRef ); 811 if (NFCSTATUS_PENDING == status) 812 { 813 uicc_connection_retry++; 814 } 815 } 816 break; 817 } 818 case UICC_CONNECTED: 819 { 820 break; 821 } 822 case UICC_CONNECTION_LOST: 823 case UICC_CONNECTION_FAILED: 824 default: 825 { 826 uicc_connection_retry = 0; 827 break; 828 } 829 } /* End of the Status Switch */ 830 } 831 832 if( NFCSTATUS_PENDING != status ) 833 { 834 uicc_connection_retry = 0; 835 /* Error Scenario due to SWP Disable Config */ 836 } 837 838 } /* End of Null Context Check */ 839 840 return status; 841} 842 843/*! 844* \brief Release of RF Emulation Gate Configuration. 845* 846* This function initialses the RF Emulation Management and 847* populates the Reader Management Information Structure 848* 849*/ 850 851 852NFCSTATUS 853phHciNfc_EmuMgmt_Release( 854 phHciNfc_sContext_t *psHciContext, 855 void *pHwRef 856 ) 857{ 858 NFCSTATUS status = NFCSTATUS_SUCCESS; 859 phHciNfc_Pipe_Info_t *p_pipe_info = NULL; 860 phHciNfc_EmulationMgmt_Info_t *p_emulation_mgmt_info=NULL; 861 862 if( NULL == psHciContext ) 863 { 864 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 865 } 866 else 867 { 868 869 p_emulation_mgmt_info = (phHciNfc_EmulationMgmt_Info_t *) 870 psHciContext->p_emulation_mgmt_info ; 871 872 if( NULL == psHciContext->p_emulation_mgmt_info ) 873 { 874 status = PHNFCSTVAL(CID_NFC_HCI, 875 NFCSTATUS_INSUFFICIENT_RESOURCES); 876 } 877 else 878 { 879 switch(p_emulation_mgmt_info->emulation_cur_seq ) 880 { 881 /* Enable/Disable the SmartMx Emulation through WI 882 * After the power down 883 */ 884 /* Enable the SmartMx Emulation by Default through WI */ 885 case WI_DEFAULT_EMULATION: 886 { 887 p_pipe_info = ((phHciNfc_WI_Info_t *) 888 psHciContext->p_wi_info)->p_pipe_info; 889 if(NULL == p_pipe_info ) 890 { 891 status = PHNFCSTVAL(CID_NFC_HCI, 892 NFCSTATUS_INVALID_HCI_INFORMATION); 893 } 894 else 895 { 896 status = phHciNfc_WI_Configure_Default( psHciContext, 897 pHwRef, p_emulation_mgmt_info->smx_powerless ); 898 if(status == NFCSTATUS_PENDING) 899 { 900 p_emulation_mgmt_info->emulation_next_seq = 901 WI_DISABLE_EMULATION; 902 } 903 } 904 break; 905 } 906 /* SmartMx In Default Mode */ 907 case WI_DISABLE_EMULATION: 908 { 909 p_pipe_info = ((phHciNfc_WI_Info_t *) 910 psHciContext->p_wi_info)->p_pipe_info; 911 if(NULL == p_pipe_info ) 912 { 913 status = PHNFCSTVAL(CID_NFC_HCI, 914 NFCSTATUS_INVALID_HCI_INFORMATION); 915 } 916 else 917 { 918 status = phHciNfc_WI_Configure_Mode( psHciContext, 919 pHwRef, eSmartMx_Default ); 920 if(status == NFCSTATUS_SUCCESS ) 921 { 922 p_emulation_mgmt_info->emulation_next_seq = 923 SWP_DISABLE_EMULATION; 924 status = phHciNfc_EmuMgmt_Update_Seq(psHciContext, 925 UPDATE_SEQ); 926 /* status = NFCSTATUS_PENDING; */ 927 } 928 } 929 break; 930 } 931 /* Enable/Disable the UICC Emulation through SWP 932 * After the power down 933 */ 934 /* Enable the UICC Emulation by Default through SWP */ 935 case SWP_DEFAULT_EMULATION: 936 { 937 p_pipe_info = ((phHciNfc_SWP_Info_t *) 938 psHciContext->p_swp_info)->p_pipe_info; 939 if(NULL == p_pipe_info ) 940 { 941 status = PHNFCSTVAL(CID_NFC_HCI, 942 NFCSTATUS_INVALID_HCI_INFORMATION); 943 } 944 else 945 { 946 status = phHciNfc_SWP_Configure_Default( psHciContext, 947 pHwRef, p_emulation_mgmt_info->uicc_powerless ); 948 if(status == NFCSTATUS_PENDING) 949 { 950 p_emulation_mgmt_info->emulation_next_seq = 951 SWP_DISABLE_EMULATION; 952 /* status = NFCSTATUS_SUCCESS; */ 953 } 954 } 955 break; 956 } 957 /* Disable the UICC Emulation through SWP */ 958 case SWP_DISABLE_EMULATION: 959 { 960 p_pipe_info = ((phHciNfc_SWP_Info_t *) 961 psHciContext->p_swp_info)->p_pipe_info; 962 if(NULL == p_pipe_info ) 963 { 964 status = PHNFCSTVAL(CID_NFC_HCI, 965 NFCSTATUS_INVALID_HCI_INFORMATION); 966 } 967 else 968 { 969 status = phHciNfc_SWP_Configure_Mode( psHciContext, 970 pHwRef, UICC_SWITCH_MODE_DEFAULT ); 971 if(status == NFCSTATUS_PENDING) 972 { 973 p_emulation_mgmt_info->emulation_next_seq = 974 CONFIG_DEFAULT_EMULATION; 975 status = phHciNfc_EmuMgmt_Update_Seq(psHciContext, 976 UPDATE_SEQ); 977 status = NFCSTATUS_SUCCESS; 978 } 979 } 980 break; 981 } 982 /* Configure the Default Secure Element Emulation */ 983 case CONFIG_DEFAULT_EMULATION: 984 { 985#if 0 986 if(NULL == p_pipe_info ) 987 { 988 status = PHNFCSTVAL(CID_NFC_HCI, 989 NFCSTATUS_INVALID_HCI_INFORMATION); 990 } 991 else 992 { 993 /* status = phHciNfc_DevMgmt_Configure( psHciContext, 994 pHwRef, , ); */ 995 if(status == NFCSTATUS_PENDING) 996 { 997 p_emulation_mgmt_info->emulation_next_seq = 998 END_EMULATION_SEQ; 999 status = phHciNfc_EmuMgmt_Update_Seq(psHciContext, 1000 UPDATE_SEQ); 1001 status = NFCSTATUS_SUCCESS; 1002 } 1003 } 1004#endif 1005 break; 1006 } 1007 default: 1008 { 1009 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_HCI_SEQUENCE); 1010 break; 1011 } 1012 1013 }/* End of the Sequence Switch */ 1014 1015 }/* End of the Reader Info Memory Check */ 1016 1017 } /* End of Null Context Check */ 1018 1019 return status; 1020} 1021 1022#if 0 1023NFCSTATUS 1024phHciNfc_Emulation_Start ( 1025 phHciNfc_sContext_t *psHciContext, 1026 void *pHwRef 1027 ) 1028{ 1029 NFCSTATUS status = NFCSTATUS_SUCCESS; 1030 1031 return status; 1032} 1033#endif 1034 1035NFCSTATUS 1036phHciNfc_Emulation_Cfg ( 1037 phHciNfc_sContext_t *psHciContext, 1038 void *pHwRef, 1039 phHciNfc_eConfigType_t cfg_type 1040 ) 1041{ 1042 NFCSTATUS status = NFCSTATUS_SUCCESS; 1043 phHciNfc_EmulationMgmt_Info_t *p_emulation_mgmt_info=NULL; 1044 phHal_sEmulationCfg_t *p_emulation_cfg = NULL; 1045 1046 if( (NULL == psHciContext) || (NULL == pHwRef) ) 1047 { 1048 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 1049 } 1050 else if ( ( NULL == psHciContext->p_emulation_mgmt_info ) 1051 || ( NULL == psHciContext->p_config_params ) ) 1052 { 1053 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_HCI_INFORMATION); 1054 } 1055 else 1056 { 1057 p_emulation_mgmt_info = (phHciNfc_EmulationMgmt_Info_t *) 1058 psHciContext->p_emulation_mgmt_info ; 1059 p_emulation_cfg = psHciContext->p_config_params; 1060 switch(cfg_type) 1061 { 1062 case SMX_WI_CFG: 1063 { 1064 phHal_sSmartMX_Cfg_t *smx_config = 1065 &p_emulation_cfg->config.smartMxCfg; 1066 p_emulation_mgmt_info->smx_powerless = 1067 (uint8_t)(FALSE != smx_config->lowPowerMode ); 1068 status = phHciNfc_WI_Configure_Default( psHciContext, pHwRef, 1069 smx_config->enableEmulation ); 1070 break; 1071 } 1072 case UICC_SWP_CFG: 1073 { 1074#ifdef SWP_CFG_SEQ 1075 phHal_sUiccEmuCfg_t *uicc_config = 1076 &p_emulation_cfg->config.uiccEmuCfg; 1077 p_emulation_mgmt_info->uicc_powerless = 1078 (uint8_t)(FALSE != uicc_config->lowPowerMode ); 1079 { 1080#ifdef SWP_EVENT_USAGE 1081 status = phHciNfc_SWP_Configure_Mode( psHciContext, pHwRef, 1082 ((TRUE == uicc_config->enableUicc)? /* UICC_SWITCH_MODE_DEFAULT */ 1083 UICC_SWITCH_MODE_ON :UICC_SWITCH_MODE_OFF)); 1084#else 1085 status = phHciNfc_SWP_Configure_Default( psHciContext, pHwRef, 1086 uicc_config->enableUicc ); 1087#endif 1088 } 1089#else 1090 status = phHciNfc_SWP_Config_Sequence( psHciContext, 1091 pHwRef, p_emulation_cfg); 1092#endif 1093 break; 1094 } 1095 case SWP_EVT_CFG: 1096 { 1097 phHal_sUiccEmuCfg_t *uicc_config = 1098 &p_emulation_cfg->config.uiccEmuCfg; 1099 p_emulation_mgmt_info->uicc_powerless = 1100 (uint8_t)(FALSE != uicc_config->lowPowerMode ); 1101 { 1102 status = phHciNfc_SWP_Configure_Mode( psHciContext, pHwRef, 1103 ((TRUE == uicc_config->enableUicc)? /* UICC_SWITCH_MODE_DEFAULT */ 1104 UICC_SWITCH_MODE_ON :UICC_SWITCH_MODE_DEFAULT)); 1105 } 1106 break; 1107 } 1108#ifdef HOST_EMULATION 1109 case NFC_CE_A_CFG: 1110 { 1111 phHal_sHostEmuCfg_A_t *host_ce_a_cfg = 1112 &p_emulation_cfg->config.hostEmuCfg_A; 1113 if(host_ce_a_cfg->enableEmulation == TRUE ) 1114 { 1115 status = phHciNfc_CE_A_Initialise( psHciContext, pHwRef); 1116 } 1117 else 1118 { 1119 status = phHciNfc_CE_A_Release( psHciContext, pHwRef); 1120 } 1121 break; 1122 } 1123 case NFC_CE_B_CFG: 1124 { 1125 phHal_sHostEmuCfg_B_t *host_ce_b_cfg = 1126 &p_emulation_cfg->config.hostEmuCfg_B; 1127 if(host_ce_b_cfg->enableEmulation == TRUE ) 1128 { 1129 status = phHciNfc_CE_B_Initialise( psHciContext, pHwRef); 1130 } 1131 else 1132 { 1133 status = phHciNfc_CE_B_Release( psHciContext, pHwRef); 1134 } 1135 break; 1136 } 1137#endif 1138 /* case INVALID_CFG: 1139 case POLL_LOOP_CFG: */ 1140 default: 1141 { 1142 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_HCI_INFORMATION); 1143 break; 1144 } 1145 1146 } /* End of the Configuration Switch */ 1147 } 1148 1149 return status; 1150} 1151 1152 1153static 1154NFCSTATUS 1155phHciNfc_Recv_Uicc_Cmd ( 1156 void *psContext, 1157 void *pHwRef, 1158 uint8_t *pCmd, 1159#ifdef ONE_BYTE_LEN 1160 uint8_t length 1161#else 1162 uint16_t length 1163#endif 1164 ) 1165{ 1166 uint8_t pipe_id = (uint8_t) HCI_UNKNOWN_PIPE_ID; 1167 uint8_t cmd = (uint8_t) HCP_MSG_INSTRUCTION_INVALID; 1168 uint8_t response = (uint8_t) ANY_OK; 1169 NFCSTATUS status = NFCSTATUS_SUCCESS; 1170 phHciNfc_sContext_t *psHciContext = 1171 (phHciNfc_sContext_t *)psContext ; 1172 phHciNfc_HCP_Packet_t *hcp_packet = NULL; 1173 phHciNfc_HCP_Message_t *hcp_message = NULL; 1174 phHciNfc_Pipe_Info_t *p_pipe_info = NULL; 1175 phHciNfc_EmulationMgmt_Info_t *p_emulation_mgmt_info=NULL; 1176 1177 if( (NULL == psHciContext) 1178 || (NULL == pHwRef) 1179 || (HCP_HEADER_LEN > length ) 1180 ) 1181 { 1182 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER); 1183 } 1184 else 1185 { 1186 hcp_packet = (phHciNfc_HCP_Packet_t *)pCmd; 1187 hcp_message = &hcp_packet->msg.message; 1188 p_emulation_mgmt_info = psHciContext->p_emulation_mgmt_info; 1189 1190 /* Get the Command instruction bits from the Message Header */ 1191 cmd = (uint8_t) GET_BITS8( hcp_message->msg_header, 1192 HCP_MSG_INSTRUCTION_OFFSET, HCP_MSG_INSTRUCTION_LEN); 1193 pipe_id = p_emulation_mgmt_info->uicc_id; 1194 p_pipe_info = psHciContext->p_pipe_list[pipe_id]; 1195 1196 switch( cmd ) 1197 { 1198 /* These are Commands are sent from the UICC Controller */ 1199 case ANY_OPEN_PIPE: 1200 { 1201 p_emulation_mgmt_info->uicc_enable = TRUE ; 1202 break; 1203 } 1204 case ANY_CLOSE_PIPE: 1205 { 1206 if(TRUE != p_emulation_mgmt_info->uicc_enable) 1207 { 1208 response = ANY_E_PIPE_NOT_OPENED; 1209 /* status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FAILED); */ 1210 } 1211 else 1212 { 1213 p_emulation_mgmt_info->uicc_enable = FALSE; 1214 } 1215 break; 1216 } 1217 case ANY_SET_PARAMETER: 1218 case ANY_GET_PARAMETER: 1219 case PRO_HOST_REQUEST: 1220 { 1221 response = ANY_E_CMD_NOT_SUPPORTED; 1222 /* status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_COMMAND_NOT_SUPPORTED);*/ 1223 break; 1224 } 1225 default: 1226 { 1227 response = ANY_E_NOK; 1228 /* status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_HCI_COMMAND); */ 1229 break; 1230 } 1231 } 1232 hcp_packet = (phHciNfc_HCP_Packet_t *) psHciContext->send_buffer; 1233 phHciNfc_Build_HCPFrame(hcp_packet,HCP_CHAINBIT_DEFAULT, 1234 pipe_id, HCP_MSG_TYPE_RESPONSE, response ); 1235 psHciContext->tx_total = HCP_HEADER_LEN; 1236 status = phHciNfc_Send_HCP( (void *)psHciContext, (void *)pHwRef ); 1237 1238 p_pipe_info->recv_msg_type = HCP_MSG_TYPE_COMMAND; 1239 p_pipe_info->sent_msg_type = HCP_MSG_TYPE_RESPONSE; 1240 p_pipe_info->prev_msg = response ; 1241 p_pipe_info->prev_status = status; 1242 status = NFCSTATUS_SUCCESS; 1243 1244 } 1245 return status; 1246} 1247 1248static 1249NFCSTATUS 1250phHciNfc_Recv_Uicc_Event ( 1251 void *psContext, 1252 void *pHwRef, 1253 uint8_t *pEvent, 1254#ifdef ONE_BYTE_LEN 1255 uint8_t length 1256#else 1257 uint16_t length 1258#endif 1259 ) 1260{ 1261 uint8_t event = (uint8_t) HCP_MSG_INSTRUCTION_INVALID; 1262 uint32_t i = 0; 1263 NFCSTATUS status = NFCSTATUS_SUCCESS; 1264 phHciNfc_sContext_t *psHciContext = 1265 (phHciNfc_sContext_t *)psContext ; 1266 phHciNfc_HCP_Packet_t *hcp_packet = NULL; 1267 phHciNfc_HCP_Message_t *hcp_message = NULL; 1268 phHal_sEventInfo_t event_info; 1269 phHciNfc_EmulationMgmt_Info_t *p_emulation_mgmt_info = 1270 psHciContext->p_emulation_mgmt_info ; 1271 1272 1273 if( (NULL == p_emulation_mgmt_info) 1274 || ( TRUE != p_emulation_mgmt_info->uicc_enable) 1275 ) 1276 { 1277 status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED); 1278 } 1279 else 1280 { 1281 hcp_packet = (phHciNfc_HCP_Packet_t *)pEvent; 1282 hcp_message = &hcp_packet->msg.message; 1283 1284 /* Get the Event instruction bits from the Message Header */ 1285 event = (uint8_t) GET_BITS8( hcp_message->msg_header, 1286 HCP_MSG_INSTRUCTION_OFFSET, HCP_MSG_INSTRUCTION_LEN); 1287 event_info.eventHost = phHal_eUICCHost ; 1288 event_info.eventSource = phHal_ePICC_DevType ; 1289 1290 switch( event ) 1291 { 1292 case EVT_END_OF_TRANSACTION: 1293 { 1294 event_info.eventType = NFC_EVT_END_OF_TRANSACTION; 1295 break; 1296 } 1297 case EVT_TRANSACTION: 1298 { 1299 if(length > HCP_HEADER_LEN + TRANSACTION_MIN_LEN) 1300 { 1301 event_info.eventType = NFC_EVT_TRANSACTION; 1302 1303 for(;i<(length-HCP_HEADER_LEN);) 1304 { 1305 switch (hcp_message->payload[i]) 1306 { 1307 case TRANSACTION_AID: 1308 { 1309 /* AID LENGTH INDEX */ 1310 i++; 1311 /* Fill the event_info.eventInfo.aid 1312 * Structure with the Received Transaction AID. 1313 */ 1314 event_info.eventInfo.aid.length = 1315 hcp_message->payload[i++]; 1316 (void) memcpy((void *)p_emulation_mgmt_info->uicc_aid, 1317 &(hcp_message->payload[i]), 1318 event_info.eventInfo.aid.length ); 1319 event_info.eventInfo.aid.buffer = (uint8_t *) 1320 p_emulation_mgmt_info->uicc_aid; 1321 i = i + event_info.eventInfo.aid.length; 1322 break; 1323 } 1324 case TRANSACTION_PARAM: 1325 { 1326 /* Parameter Length Index */ 1327 i++; 1328 /* Fill the event_info.eventInfo.param 1329 * Structure with the Received Parameter. 1330 */ 1331 p_emulation_mgmt_info->uicc_param_len = 1332 hcp_message->payload[i++]; 1333 (void) memcpy((void *)p_emulation_mgmt_info->uicc_param, 1334 &(hcp_message->payload[i]), 1335 p_emulation_mgmt_info->uicc_param_len ); 1336 event_info.eventInfo.uicc_info.param.length = 1337 p_emulation_mgmt_info->uicc_param_len; 1338 event_info.eventInfo.uicc_info.param.buffer = (uint8_t *) 1339 p_emulation_mgmt_info->uicc_param; 1340 i = i + event_info.eventInfo.uicc_info.param.length; 1341 break; 1342 } 1343 default: 1344 { 1345 1346 status = PHNFCSTVAL( CID_NFC_HCI, 1347 NFCSTATUS_FEATURE_NOT_SUPPORTED ); 1348 i = length; 1349 HCI_DEBUG("%s: Statement Should Not Occur \n", 1350 "phHciNfc_Recv_Uicc_Event"); 1351 break; 1352 } 1353 } /* End of Transaction Switch */ 1354 } 1355 } 1356 break; 1357 } 1358 case EVT_CONNECTIVITY: 1359 { 1360 event_info.eventType = NFC_EVT_CONNECTIVITY; 1361 break; 1362 } 1363 case EVT_OPERATION_ENDED: 1364 { 1365 event_info.eventType = NFC_EVT_OPERATION_ENDED; 1366 break; 1367 } 1368 default: 1369 { 1370 status = PHNFCSTVAL( CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED ); 1371 HCI_DEBUG("%s: Statement Should Not Occur \n","phHciNfc_Recv_Uicc_Event"); 1372 break; 1373 } 1374 } 1375 if ( NFCSTATUS_SUCCESS == status ) 1376 { 1377 phHciNfc_Notify_Event( psHciContext, pHwRef, 1378 NFC_NOTIFY_EVENT, (void *)&event_info ); 1379 } 1380 } 1381 return status; 1382} 1383 1384 1385