• Home
  • Raw
  • Download

Lines Matching refs:gpphTmlNfc_Context

44 phTmlNfc_Context_t *gpphTmlNfc_Context = NULL;  variable
81 if (NULL != gpphTmlNfc_Context) in phTmlNfc_Init()
96 gpphTmlNfc_Context = malloc(sizeof(phTmlNfc_Context_t)); in phTmlNfc_Init()
98 if (NULL == gpphTmlNfc_Context) in phTmlNfc_Init()
105 memset(gpphTmlNfc_Context, PH_TMLNFC_RESET_VALUE, sizeof(phTmlNfc_Context_t)); in phTmlNfc_Init()
107 gpphTmlNfc_Context->bThreadDone = 1; in phTmlNfc_Init()
110 … wInitStatus = phTmlNfc_i2c_open_and_configure(pConfig, &(gpphTmlNfc_Context->pDevHandle)); in phTmlNfc_Init()
115 gpphTmlNfc_Context->pDevHandle = NULL; in phTmlNfc_Init()
119 gpphTmlNfc_Context->tReadInfo.bEnable = 0; in phTmlNfc_Init()
120 gpphTmlNfc_Context->tWriteInfo.bEnable = 0; in phTmlNfc_Init()
121 gpphTmlNfc_Context->tReadInfo.bThreadBusy = FALSE; in phTmlNfc_Init()
122 gpphTmlNfc_Context->tWriteInfo.bThreadBusy = FALSE; in phTmlNfc_Init()
124 if(0 != sem_init(&gpphTmlNfc_Context->rxSemaphore, 0, 0)) in phTmlNfc_Init()
128 else if(0 != sem_init(&gpphTmlNfc_Context->txSemaphore, 0, 0)) in phTmlNfc_Init()
132 else if(0 != sem_init(&gpphTmlNfc_Context->postMsgSemaphore, 0, 0)) in phTmlNfc_Init()
138 sem_post(&gpphTmlNfc_Context->postMsgSemaphore); in phTmlNfc_Init()
147 gpphTmlNfc_Context->dwTimerId = phOsalNfc_Timer_Create(); in phTmlNfc_Init()
148 if (PH_OSALNFC_TIMER_ID_INVALID != gpphTmlNfc_Context->dwTimerId) in phTmlNfc_Init()
151 gpphTmlNfc_Context->dwCallbackThreadId = pConfig->dwGetMsgThreadId; in phTmlNfc_Init()
153 gpphTmlNfc_Context->eConfig = phTmlNfc_e_DisableRetrans; in phTmlNfc_Init()
155gpphTmlNfc_Context->bRetryCount = (2000 / PHTMLNFC_MAXTIME_RETRANSMIT) + 1; in phTmlNfc_Init()
156 gpphTmlNfc_Context->bWriteCbInvoked = FALSE; in phTmlNfc_Init()
195 gpphTmlNfc_Context->eConfig = eConfiguration; in phTmlNfc_ConfigNciPktReTx()
201 gpphTmlNfc_Context->bRetryCount = bRetryCounter; in phTmlNfc_ConfigNciPktReTx()
207 gpphTmlNfc_Context->bRetryCount = (2000 / PHTMLNFC_MAXTIME_RETRANSMIT) + 1; in phTmlNfc_ConfigNciPktReTx()
235 …pthread_create_status = pthread_create(&gpphTmlNfc_Context->readerThread,NULL,(void *)&phTmlNfc_Tm… in phTmlNfc_StartThread()
244 …pthread_create_status = pthread_create(&gpphTmlNfc_Context->writerThread,NULL,(void *)&phTmlNfc_Tm… in phTmlNfc_StartThread()
269 if ((gpphTmlNfc_Context->dwTimerId == dwTimerId) && in phTmlNfc_ReTxTimerCb()
282 gpphTmlNfc_Context->tWriteInfo.bThreadBusy = TRUE; in phTmlNfc_ReTxTimerCb()
283 gpphTmlNfc_Context->tWriteInfo.bEnable = 1; in phTmlNfc_ReTxTimerCb()
285 sem_post(&gpphTmlNfc_Context->txSemaphore); in phTmlNfc_ReTxTimerCb()
307 wStatus = phOsalNfc_Timer_Start(gpphTmlNfc_Context->dwTimerId, in phTmlNfc_InitiateTimer()
341 while (gpphTmlNfc_Context->bThreadDone) in phTmlNfc_TmlThread()
346 sem_wait(&gpphTmlNfc_Context->rxSemaphore); in phTmlNfc_TmlThread()
349 if (1 == gpphTmlNfc_Context->tReadInfo.bEnable) in phTmlNfc_TmlThread()
359 if (NULL != gpphTmlNfc_Context->pDevHandle) in phTmlNfc_TmlThread()
362 dwNoBytesWrRd = phTmlNfc_i2c_read(gpphTmlNfc_Context->pDevHandle, temp, 260); in phTmlNfc_TmlThread()
367 sem_post(&gpphTmlNfc_Context->rxSemaphore); in phTmlNfc_TmlThread()
372 sem_post (&gpphTmlNfc_Context->rxSemaphore); in phTmlNfc_TmlThread()
376 memcpy(gpphTmlNfc_Context->tReadInfo.pBuffer, temp, dwNoBytesWrRd); in phTmlNfc_TmlThread()
380 gpphTmlNfc_Context->tReadInfo.bEnable = 0; in phTmlNfc_TmlThread()
381 if ((phTmlNfc_e_EnableRetrans == gpphTmlNfc_Context->eConfig) && in phTmlNfc_TmlThread()
382 (0x00 != (gpphTmlNfc_Context->tReadInfo.pBuffer[0] & 0xE0))) in phTmlNfc_TmlThread()
387 uint32_t timerStatus = phOsalNfc_Timer_Stop(gpphTmlNfc_Context->dwTimerId); in phTmlNfc_TmlThread()
394 gpphTmlNfc_Context->bWriteCbInvoked = FALSE; in phTmlNfc_TmlThread()
397 if (gpphTmlNfc_Context->tWriteInfo.bThreadBusy) in phTmlNfc_TmlThread()
403 gpphTmlNfc_Context->tReadInfo.wLength = (uint16_t) (dwNoBytesWrRd); in phTmlNfc_TmlThread()
404 phNxpNciHal_print_packet("RECV", gpphTmlNfc_Context->tReadInfo.pBuffer, in phTmlNfc_TmlThread()
405 gpphTmlNfc_Context->tReadInfo.wLength); in phTmlNfc_TmlThread()
411 tTransactionInfo.pBuff = gpphTmlNfc_Context->tReadInfo.pBuffer; in phTmlNfc_TmlThread()
413 tTransactionInfo.wLength = gpphTmlNfc_Context->tReadInfo.wLength; in phTmlNfc_TmlThread()
423 phTmlNfc_DeferredCall(gpphTmlNfc_Context->dwCallbackThreadId, &tMsg); in phTmlNfc_TmlThread()
470 while (gpphTmlNfc_Context->bThreadDone) in phTmlNfc_TmlWriterThread()
473 sem_wait(&gpphTmlNfc_Context->txSemaphore); in phTmlNfc_TmlWriterThread()
475 if (1 == gpphTmlNfc_Context->tWriteInfo.bEnable) in phTmlNfc_TmlWriterThread()
480 if (NULL != gpphTmlNfc_Context->pDevHandle) in phTmlNfc_TmlWriterThread()
483 gpphTmlNfc_Context->tWriteInfo.bEnable = 0; in phTmlNfc_TmlWriterThread()
488 dwNoBytesWrRd = phTmlNfc_i2c_write(gpphTmlNfc_Context->pDevHandle, in phTmlNfc_TmlWriterThread()
489 gpphTmlNfc_Context->tWriteInfo.pBuffer, in phTmlNfc_TmlWriterThread()
490 gpphTmlNfc_Context->tWriteInfo.wLength in phTmlNfc_TmlWriterThread()
510 phNxpNciHal_print_packet("SEND", gpphTmlNfc_Context->tWriteInfo.pBuffer, in phTmlNfc_TmlWriterThread()
511 gpphTmlNfc_Context->tWriteInfo.wLength); in phTmlNfc_TmlWriterThread()
521 tTransactionInfo.pBuff = gpphTmlNfc_Context->tWriteInfo.pBuffer; in phTmlNfc_TmlWriterThread()
539 if ((phTmlNfc_e_EnableRetrans == gpphTmlNfc_Context->eConfig) && in phTmlNfc_TmlWriterThread()
540 (0x00 != (gpphTmlNfc_Context->tWriteInfo.pBuffer[0] & 0xE0))) in phTmlNfc_TmlWriterThread()
542 if (FALSE == gpphTmlNfc_Context->bWriteCbInvoked) in phTmlNfc_TmlWriterThread()
548 phTmlNfc_DeferredCall(gpphTmlNfc_Context->dwCallbackThreadId, in phTmlNfc_TmlWriterThread()
550 gpphTmlNfc_Context->bWriteCbInvoked = TRUE; in phTmlNfc_TmlWriterThread()
557 phTmlNfc_DeferredCall(gpphTmlNfc_Context->dwCallbackThreadId, &tMsg); in phTmlNfc_TmlWriterThread()
566 if ((phTmlNfc_e_EnableRetrans == gpphTmlNfc_Context->eConfig) && in phTmlNfc_TmlWriterThread()
567 (0x00 != (gpphTmlNfc_Context->tWriteInfo.pBuffer[0] & 0xE0))) in phTmlNfc_TmlWriterThread()
575 gpphTmlNfc_Context->tWriteInfo.bEnable = 0; in phTmlNfc_TmlWriterThread()
606 if (NULL != gpphTmlNfc_Context->pDevHandle) in phTmlNfc_CleanUp()
608 (void) phTmlNfc_i2c_reset(gpphTmlNfc_Context->pDevHandle, 0); in phTmlNfc_CleanUp()
609 gpphTmlNfc_Context->bThreadDone = 0; in phTmlNfc_CleanUp()
611 sem_destroy(&gpphTmlNfc_Context->rxSemaphore); in phTmlNfc_CleanUp()
612 sem_destroy(&gpphTmlNfc_Context->txSemaphore); in phTmlNfc_CleanUp()
613 sem_destroy(&gpphTmlNfc_Context->postMsgSemaphore); in phTmlNfc_CleanUp()
614 phTmlNfc_i2c_close(gpphTmlNfc_Context->pDevHandle); in phTmlNfc_CleanUp()
615 gpphTmlNfc_Context->pDevHandle = NULL; in phTmlNfc_CleanUp()
617 free((void *) gpphTmlNfc_Context); in phTmlNfc_CleanUp()
619 gpphTmlNfc_Context = NULL; in phTmlNfc_CleanUp()
643 if (NULL != gpphTmlNfc_Context) in phTmlNfc_Shutdown()
646 gpphTmlNfc_Context->bThreadDone = 0; in phTmlNfc_Shutdown()
649 sem_post(&gpphTmlNfc_Context->rxSemaphore); in phTmlNfc_Shutdown()
651 sem_post(&gpphTmlNfc_Context->txSemaphore); in phTmlNfc_Shutdown()
653 sem_post(&gpphTmlNfc_Context->postMsgSemaphore); in phTmlNfc_Shutdown()
655 sem_post(&gpphTmlNfc_Context->postMsgSemaphore); in phTmlNfc_Shutdown()
657 if (0 != pthread_join(gpphTmlNfc_Context->readerThread, (void**)NULL)) in phTmlNfc_Shutdown()
661 if (0 != pthread_join(gpphTmlNfc_Context->writerThread, (void**)NULL)) in phTmlNfc_Shutdown()
708 if (NULL != gpphTmlNfc_Context) in phTmlNfc_Write()
710 if ((NULL != gpphTmlNfc_Context->pDevHandle) && (NULL != pBuffer) && in phTmlNfc_Write()
713 if (!gpphTmlNfc_Context->tWriteInfo.bThreadBusy) in phTmlNfc_Write()
716 gpphTmlNfc_Context->tWriteInfo.bThreadBusy = TRUE; in phTmlNfc_Write()
719 gpphTmlNfc_Context->tWriteInfo.pBuffer = pBuffer; in phTmlNfc_Write()
720 gpphTmlNfc_Context->tWriteInfo.wLength = wLength; in phTmlNfc_Write()
721 gpphTmlNfc_Context->tWriteInfo.pThread_Callback = pTmlWriteComplete; in phTmlNfc_Write()
722 gpphTmlNfc_Context->tWriteInfo.pContext = pContext; in phTmlNfc_Write()
726 if (phTmlNfc_e_EnableRetrans == gpphTmlNfc_Context->eConfig) in phTmlNfc_Write()
732 bCurrentRetryCount = gpphTmlNfc_Context->bRetryCount; in phTmlNfc_Write()
733 gpphTmlNfc_Context->bWriteCbInvoked = FALSE; in phTmlNfc_Write()
736 gpphTmlNfc_Context->tWriteInfo.bEnable = 1; in phTmlNfc_Write()
737 sem_post(&gpphTmlNfc_Context->txSemaphore); in phTmlNfc_Write()
783 if (NULL != gpphTmlNfc_Context) in phTmlNfc_Read()
785 if ((gpphTmlNfc_Context->pDevHandle != NULL) && (NULL != pBuffer) && in phTmlNfc_Read()
788 if (!gpphTmlNfc_Context->tReadInfo.bThreadBusy) in phTmlNfc_Read()
791 gpphTmlNfc_Context->tReadInfo.bThreadBusy = TRUE; in phTmlNfc_Read()
794 gpphTmlNfc_Context->tReadInfo.pBuffer = pBuffer; in phTmlNfc_Read()
795 gpphTmlNfc_Context->tReadInfo.wLength = wLength; in phTmlNfc_Read()
796 gpphTmlNfc_Context->tReadInfo.pThread_Callback = pTmlReadComplete; in phTmlNfc_Read()
797 gpphTmlNfc_Context->tReadInfo.pContext = pContext; in phTmlNfc_Read()
801 gpphTmlNfc_Context->tReadInfo.bEnable = 1; in phTmlNfc_Read()
802 sem_post(&gpphTmlNfc_Context->rxSemaphore); in phTmlNfc_Read()
840 gpphTmlNfc_Context->tReadInfo.bEnable = 0; in phTmlNfc_ReadAbort()
843 gpphTmlNfc_Context->tReadInfo.bThreadBusy=FALSE; in phTmlNfc_ReadAbort()
868 gpphTmlNfc_Context->tWriteInfo.bEnable = 0; in phTmlNfc_WriteAbort()
873 gpphTmlNfc_Context->tWriteInfo.bThreadBusy=FALSE; in phTmlNfc_WriteAbort()
900 if (NULL == gpphTmlNfc_Context) in phTmlNfc_IoCtl()
911 phTmlNfc_i2c_reset(gpphTmlNfc_Context->pDevHandle, 1); in phTmlNfc_IoCtl()
913 phTmlNfc_i2c_reset(gpphTmlNfc_Context->pDevHandle, 0); in phTmlNfc_IoCtl()
915 phTmlNfc_i2c_reset(gpphTmlNfc_Context->pDevHandle, 1); in phTmlNfc_IoCtl()
921 phTmlNfc_i2c_reset(gpphTmlNfc_Context->pDevHandle, 0); in phTmlNfc_IoCtl()
923 phTmlNfc_i2c_reset(gpphTmlNfc_Context->pDevHandle, 1); in phTmlNfc_IoCtl()
930 (void)phTmlNfc_i2c_reset(gpphTmlNfc_Context->pDevHandle,2); in phTmlNfc_IoCtl()
963 sem_wait(&gpphTmlNfc_Context->postMsgSemaphore); in phTmlNfc_DeferredCall()
964 bPostStatus = phDal4Nfc_msgsnd(gpphTmlNfc_Context->dwCallbackThreadId, in phTmlNfc_DeferredCall()
968 sem_post(&gpphTmlNfc_Context->postMsgSemaphore); in phTmlNfc_DeferredCall()
988 gpphTmlNfc_Context->tReadInfo.bThreadBusy = FALSE; in phTmlNfc_ReadDeferredCb()
989 gpphTmlNfc_Context->tReadInfo.pThread_Callback(gpphTmlNfc_Context->tReadInfo.pContext, in phTmlNfc_ReadDeferredCb()
1012 gpphTmlNfc_Context->tWriteInfo.bThreadBusy = FALSE; in phTmlNfc_WriteDeferredCb()
1013 gpphTmlNfc_Context->tWriteInfo.pThread_Callback(gpphTmlNfc_Context->tWriteInfo.pContext, in phTmlNfc_WriteDeferredCb()