Example #1
0
/*-----------------------------------------------------------------------------

FUNCTION: phDal4Nfc_Init

PURPOSE:  DAL Init function.

-----------------------------------------------------------------------------*/
NFCSTATUS phDal4Nfc_Init(void *pContext, void *pHwRef )
{
    NFCSTATUS        result = NFCSTATUS_SUCCESS;

    refresh_low_level_traces();

    if ((NULL != pContext) && (NULL != pHwRef))
    {
        pContext  = pgDalContext;
        pgDalHwContext = (phHal_sHwReference_t *)pHwRef;

        if ( gDalContext.hw_valid == TRUE )
        {
            /* The link has been opened from the application interface */
            gLinkFunc.open_from_handle(pgDalHwContext);

            if (!gLinkFunc.is_opened())
            {
                result = PHNFCSTVAL(CID_NFC_DAL, NFCSTATUS_INVALID_DEVICE);
            }
            else
            {
                /* Clear link buffers */
                gLinkFunc.flush();
            }
        }
        else
        {
            static phDal4Nfc_sConfig_t hw_config;
            hw_config.deviceNode = NULL;
            result = phDal4Nfc_Config(&hw_config, pHwRef );
        }
    }
    else /*Input parametrs invalid*/
    {
        result = NFCSTATUS_INVALID_PARAMETER;
    }

    return result;
}
Example #2
0
NFCSTATUS phDal4Nfc_Shutdown( void *pContext, void *pHwRef)
{
    NFCSTATUS result = NFCSTATUS_SUCCESS;
    void * pThreadReturn;

//   if (pContext == NULL)
//      return NFCSTATUS_INVALID_PARAMETER;

    if (gDalContext.hw_valid == TRUE)
    {
        /* Flush the link */
        gLinkFunc.flush();

        /* Close the message queue */
#ifdef USE_MQ_MESSAGE_QUEUE
        mq_close(nDeferedCallMessageQueueId);
#endif

    }

    return result;
}