static NFCSTATUS phNciNfc_RegAllNtfs(void*     pContext)
{
    NFCSTATUS wStatus = NFCSTATUS_SUCCESS;
    pphNciNfc_Context_t pCtx = pContext;
    phNciNfc_sCoreHeaderInfo_t tHeaderInfo;
    PH_LOG_NCI_FUNC_ENTRY();
    if(NULL != pCtx)
    {
        /*Register Notification function for Rf field info*/
        tHeaderInfo.Group_ID = phNciNfc_e_CoreRfMgtGid;
        tHeaderInfo.Opcode_ID.OidType.RfMgtNtfOid = phNciNfc_e_RfMgtRfFieldInfoNtfOid;
        tHeaderInfo.eMsgType = phNciNfc_e_NciCoreMsgTypeCntrlNtf;
        wStatus = phNciNfc_CoreIfRegRspNtf(&(pCtx->NciCoreContext),
                                            &(tHeaderInfo),
                                            &phNciNfc_RfFieldInfoNtfHandler,
                                            pContext
                                           );
        /*Register Notification function for Rf-Nfcee Action info*/
        if(NFCSTATUS_SUCCESS == wStatus)
        {
            PH_LOG_NCI_INFO_STR("Registering for Rf-Nfcee Action Notification");
            tHeaderInfo.Group_ID = phNciNfc_e_CoreRfMgtGid;
            tHeaderInfo.Opcode_ID.OidType.RfMgtNtfOid = phNciNfc_e_RfMgtRfNfceeActionNtfOid;
            tHeaderInfo.eMsgType = phNciNfc_e_NciCoreMsgTypeCntrlNtf;
            wStatus = phNciNfc_CoreIfRegRspNtf(&(pCtx->NciCoreContext),
                                        &(tHeaderInfo),
                                        &phNciNfc_NfceeActionNtfHandler,
                                        pContext
                                       );
        }
        if(NFCSTATUS_SUCCESS == wStatus)
        {
            /*Register Notification function for Rf Deactivate info*/
            tHeaderInfo.Group_ID = phNciNfc_e_CoreRfMgtGid;
            tHeaderInfo.Opcode_ID.OidType.RfMgtNtfOid = phNciNfc_e_RfMgtRfDeactivateNtfOid;
            tHeaderInfo.eMsgType = phNciNfc_e_NciCoreMsgTypeCntrlNtf;
            wStatus = phNciNfc_CoreIfRegRspNtf(&(pCtx->NciCoreContext),
                                                &(tHeaderInfo),
                                                &phNciNfc_ProcessDeActvNtf,
                                                pContext
                                               );
        }
        if(NFCSTATUS_SUCCESS == wStatus)
        {
            PH_LOG_NCI_INFO_STR("Registering for Interface Activated Notification");
            /* Register for Interface Activation Notification */
            tHeaderInfo.eMsgType = phNciNfc_e_NciCoreMsgTypeCntrlNtf;
            tHeaderInfo.Group_ID = phNciNfc_e_CoreRfMgtGid;
            tHeaderInfo.Opcode_ID.OidType.RfMgtNtfOid = phNciNfc_e_RfMgtRfIntfActivatedNtfOid;
            wStatus = phNciNfc_CoreIfRegRspNtf(&(pCtx->NciCoreContext),
                                                &(tHeaderInfo),
                                                &phNciNfc_ProcessActvNtf,
                                                pContext
                                               );
        }
        if(NFCSTATUS_SUCCESS == wStatus)
        {
            PH_LOG_NCI_INFO_STR("Registering for Discover Notification");
            /* Register for Interface Activation Notification */
            tHeaderInfo.eMsgType = phNciNfc_e_NciCoreMsgTypeCntrlNtf;
            tHeaderInfo.Group_ID = phNciNfc_e_CoreRfMgtGid;
            tHeaderInfo.Opcode_ID.OidType.RfMgtNtfOid = phNciNfc_e_RfMgtRfDiscoverNtfOid;
            wStatus = phNciNfc_CoreIfRegRspNtf(&(pCtx->NciCoreContext),
                                                &(tHeaderInfo),
                                                &phNciNfc_ProcessDiscNtf,
                                                pContext
                                               );
        }
        /* Register for Interface error notification */
        if(NFCSTATUS_SUCCESS == wStatus)
        {
            PH_LOG_NCI_INFO_STR("Registering for Interface Error Notification");
            /* Register for Interface Activation Notification */
            tHeaderInfo.eMsgType = phNciNfc_e_NciCoreMsgTypeCntrlNtf;
            tHeaderInfo.Group_ID = phNciNfc_e_CoreNciCoreGid;
            tHeaderInfo.Opcode_ID.OidType.NciCoreNtfOid = phNciNfc_e_NciCoreInterfaceErrNtfOid;
            wStatus = phNciNfc_CoreIfRegRspNtf(&(pCtx->NciCoreContext),
                                                &(tHeaderInfo),
                                                &phNciNfc_ProcessIntfErrNtf,
                                                pContext
                                               );
        }
        /* Register for Generic error notification */
        if(NFCSTATUS_SUCCESS == wStatus)
        {
            PH_LOG_NCI_INFO_STR("Registering for Generic Error Notification");
            /* Register for Interface Activation Notification */
            tHeaderInfo.eMsgType = phNciNfc_e_NciCoreMsgTypeCntrlNtf;
            tHeaderInfo.Group_ID = phNciNfc_e_CoreNciCoreGid;
            tHeaderInfo.Opcode_ID.OidType.NciCoreNtfOid = phNciNfc_e_NciCoreGenericErrNtfOid;
            wStatus = phNciNfc_CoreIfRegRspNtf(&(pCtx->NciCoreContext),
                                                &(tHeaderInfo),
                                                &phNciNfc_ProcessGenericErrNtf,
                                                pContext
                                               );
        }
        /* Register for Reset notification */
        if(NFCSTATUS_SUCCESS == wStatus)
        {
            PH_LOG_NCI_INFO_STR("Registering for Reset Notification");
            /* Register for Interface Activation Notification */
            tHeaderInfo.eMsgType = phNciNfc_e_NciCoreMsgTypeCntrlNtf;
            tHeaderInfo.Group_ID = phNciNfc_e_CoreNciCoreGid;
            tHeaderInfo.Opcode_ID.OidType.NciCoreNtfOid = phNciNfc_e_NciCoreResetNtfOid;
            wStatus = phNciNfc_CoreIfRegRspNtf(&(pCtx->NciCoreContext),
                                                &(tHeaderInfo),
                                                &phNciNfc_ResetNtfCb,
                                                pContext
                                               );
        }
        /*Register for Rf Nfcee Discovery Request Notification */
        if(NFCSTATUS_SUCCESS == wStatus)
        {
            PH_LOG_NCI_INFO_STR("Registering for Rf Nfcee Discovery Request Notification");
            tHeaderInfo.Group_ID = phNciNfc_e_CoreRfMgtGid;
            tHeaderInfo.Opcode_ID.OidType.RfMgtNtfOid = phNciNfc_e_RfMgtRfNfceeDiscoveryReqNtfOid;
            tHeaderInfo.eMsgType = phNciNfc_e_NciCoreMsgTypeCntrlNtf;
            wStatus = phNciNfc_CoreIfRegRspNtf(&(pCtx->NciCoreContext),
                                        &(tHeaderInfo),
                                        &phNciNfc_NfceeDiscReqNtfHandler,
                                        pContext
                                       );
        }
    }
    else
    {
        wStatus = NFCSTATUS_INVALID_PARAMETER;
    }
    PH_LOG_NCI_FUNC_EXIT();
    return wStatus;
}
NFCSTATUS
phNciNfc_ReceiveData(void *pNciCtx,
                     pphNciNfc_IfNotificationCb_t pReceiveCb,
                     void* pContext)
{
    NFCSTATUS wStatus = NFCSTATUS_NOT_INITIALISED;
    phNciNfc_Context_t *pNciContext = (phNciNfc_Context_t *)pNciCtx;
    pphNciNfc_ActiveDeviceInfo_t  pActivDev = NULL;
    phNciNfc_sCoreHeaderInfo_t tRegInfo;
    uint8_t                 bConnId;
    uint8_t bFreeTempBuff = 0;

    PH_LOG_NCI_FUNC_ENTRY();
    if((NULL == pNciContext) || (pNciContext != phNciNfc_GetContext()))
    {
        PH_LOG_NCI_CRIT_STR("Stack not initialized");
    }
    else if(NULL == pReceiveCb)
    {
        wStatus = NFCSTATUS_INVALID_PARAMETER;
        PH_LOG_NCI_CRIT_STR("Invalid input parameter (Nci Context)!");
    }
    else
    {
        /* Store upper layer call back function and upper layer context */
        phNciNfc_SetUpperLayerCallback(pNciContext, pReceiveCb, pContext);

        /* Check whether data has been received from remote device already */
        if(1 == pNciContext->tLstnModeRecvInfo.bDataBuffEnable)
        {
            /* Data has already been received and stored in temporary buffer.
            Instead of registering for the data message which has already been received,
            queue a deferred callback */

            wStatus = phOsalNfc_QueueDeferredCallback(phNciNfc_TempReceiveCb,
                                                      pNciContext);
            if(NFCSTATUS_SUCCESS == wStatus)
            {
                wStatus = NFCSTATUS_PENDING;
            }
            else
            {
                bFreeTempBuff = 1;
            }

            pNciContext->tLstnModeRecvInfo.bDataBuffEnable = 0;

            if(1 == bFreeTempBuff)
            {
                pNciContext->IfNtf = NULL;
                pNciContext->IfNtfCtx = NULL;
                if(NULL != pNciContext->tLstnModeRecvInfo.pBuff)
                {
                    phOsalNfc_FreeMemory(pNciContext->tLstnModeRecvInfo.pBuff);
                    pNciContext->tLstnModeRecvInfo.pBuff = NULL;
                }
                pNciContext->tLstnModeRecvInfo.wBuffSize = 0;
                pNciContext->tLstnModeRecvInfo.wLstnCbStatus = NFCSTATUS_FAILED;
            }
        }
        else
        {
            pActivDev = (pphNciNfc_ActiveDeviceInfo_t)&pNciContext->tActvDevIf;

            wStatus = phNciNfc_GetConnId(pActivDev->pDevInfo,&bConnId);
            /* If dummy data receive call back function is still registered, unregister the same first*/
            if(NFCSTATUS_SUCCESS == wStatus)
            {
                tRegInfo.bConn_ID = bConnId;
                tRegInfo.eMsgType = phNciNfc_e_NciCoreMsgTypeData;
                /* UnRegister for Data message (with auto de-register enabled) */
                (void)phNciNfc_CoreIfUnRegRspNtf(&(pNciContext->NciCoreContext),
                    &(tRegInfo),&phNciNfc_ReceiveDataBufferCb);
            }
            /*Now register for the data message */
            if(NFCSTATUS_SUCCESS == wStatus)
            {
                tRegInfo.bEnabled = (uint8_t)PHNCINFC_ENABLE_AUTO_DEREG;
                tRegInfo.eMsgType = phNciNfc_e_NciCoreMsgTypeData;
                tRegInfo.bConn_ID= bConnId;

                /* Register for Data message (with auto de-register enabled) */
                wStatus = phNciNfc_CoreIfRegRspNtf((void *)&pNciContext->NciCoreContext,
                                         &tRegInfo,
                                         &phNciNfc_ReceiveCb,
                                         pNciContext);
                if(NFCSTATUS_SUCCESS == wStatus)
                {
                   /* Data message call back registered successfully, send pending status to upper layer */
                   wStatus = NFCSTATUS_PENDING;
                }
                else
                {
                    pNciContext->IfNtf = NULL;
                    pNciContext->IfNtfCtx = NULL;
                    PH_LOG_NCI_CRIT_STR("Data message call back registration failed!");
                    wStatus = NFCSTATUS_FAILED;
                }
            }
            else
            {
                pNciContext->IfNtf = NULL;
                pNciContext->IfNtfCtx = NULL;
                PH_LOG_NCI_CRIT_STR("Couldn't Get ConnId!");
                wStatus = NFCSTATUS_FAILED;
            }
        }
    }
    PH_LOG_NCI_FUNC_EXIT();
    return wStatus;
}