Lines Matching refs:pDlContext

78 static NFCSTATUS phDnldNfc_BuildFramePkt(pphDnldNfc_DlContext_t pDlContext);
79 static NFCSTATUS phDnldNfc_CreateFramePld(pphDnldNfc_DlContext_t pDlContext);
80 static NFCSTATUS phDnldNfc_SetupResendTimer(pphDnldNfc_DlContext_t pDlContext);
81 static NFCSTATUS phDnldNfc_UpdateRsp(pphDnldNfc_DlContext_t pDlContext, phTmlNfc_TransactInfo_t …
584 static NFCSTATUS phDnldNfc_BuildFramePkt(pphDnldNfc_DlContext_t pDlContext) in phDnldNfc_BuildFramePkt() argument
591 if(NULL == pDlContext) in phDnldNfc_BuildFramePkt()
598 if(phDnldNfc_FTWrite == (pDlContext->FrameInp.Type)) in phDnldNfc_BuildFramePkt()
600 if((0 == (pDlContext->tUserData.wLen)) || (NULL == (pDlContext->tUserData.pBuff))) in phDnldNfc_BuildFramePkt()
607 if(TRUE == (pDlContext->tRWInfo.bFirstWrReq)) in phDnldNfc_BuildFramePkt()
609 (pDlContext->tRWInfo.wRemBytes) = (pDlContext->tUserData.wLen); in phDnldNfc_BuildFramePkt()
610 (pDlContext->tRWInfo.wOffset) = 0; in phDnldNfc_BuildFramePkt()
614 else if(phDnldNfc_FTRead == (pDlContext->FrameInp.Type)) in phDnldNfc_BuildFramePkt()
616 if((0 == (pDlContext->tRspBuffInfo.wLen)) || (NULL == (pDlContext->tRspBuffInfo.pBuff))) in phDnldNfc_BuildFramePkt()
623 if(FALSE == (pDlContext->tRWInfo.bFramesSegmented)) in phDnldNfc_BuildFramePkt()
626 wFrameLen = (pDlContext->tRspBuffInfo.wLen) + PHDNLDNFC_MIN_PLD_LEN; in phDnldNfc_BuildFramePkt()
628 … (pDlContext->tRWInfo.wRWPldSize) = (PHDNLDNFC_CMDRESP_MAX_PLD_SIZE - PHDNLDNFC_MIN_PLD_LEN); in phDnldNfc_BuildFramePkt()
629 (pDlContext->tRWInfo.wRemBytes) = (pDlContext->tRspBuffInfo.wLen); in phDnldNfc_BuildFramePkt()
630 (pDlContext->tRWInfo.dwAddr) = (pDlContext->FrameInp.dwAddr); in phDnldNfc_BuildFramePkt()
631 (pDlContext->tRWInfo.wOffset) = 0; in phDnldNfc_BuildFramePkt()
632 (pDlContext->tRWInfo.wBytesRead) = 0; in phDnldNfc_BuildFramePkt()
636 (pDlContext->tRWInfo.bFramesSegmented) = TRUE; in phDnldNfc_BuildFramePkt()
641 else if(phDnldNfc_FTLog == (pDlContext->FrameInp.Type)) in phDnldNfc_BuildFramePkt()
643 if((0 == (pDlContext->tUserData.wLen)) || (NULL == (pDlContext->tUserData.pBuff))) in phDnldNfc_BuildFramePkt()
655 wStatus = phDnldNfc_CreateFramePld(pDlContext); in phDnldNfc_BuildFramePkt()
661 wFrameLen = (pDlContext->tCmdRspFrameInfo.dwSendlength); in phDnldNfc_BuildFramePkt()
663 if(phDnldNfc_FTRaw != (pDlContext->FrameInp.Type)) in phDnldNfc_BuildFramePkt()
665 if(phDnldNfc_FTWrite != (pDlContext->FrameInp.Type)) in phDnldNfc_BuildFramePkt()
669pDlContext->tCmdRspFrameInfo.aFrameBuff[PHDNLDNFC_FRAME_HDR_OFFSET] = pFrameByte[1]; in phDnldNfc_BuildFramePkt()
670pDlContext->tCmdRspFrameInfo.aFrameBuff[PHDNLDNFC_FRAME_HDR_OFFSET + 1] = pFrameByte[0]; in phDnldNfc_BuildFramePkt()
673 pDlContext->tCmdRspFrameInfo.aFrameBuff[PHDNLDNFC_FRAMEID_OFFSET] = in phDnldNfc_BuildFramePkt()
674 (pDlContext->tCmdId); in phDnldNfc_BuildFramePkt()
680 if(0 != (pDlContext->tRWInfo.wRWPldSize)) in phDnldNfc_BuildFramePkt()
682 if(TRUE == (pDlContext->tRWInfo.bFramesSegmented)) in phDnldNfc_BuildFramePkt()
690pDlContext->tCmdRspFrameInfo.aFrameBuff[PHDNLDNFC_FRAME_HDR_OFFSET] = pFrameByte[1]; in phDnldNfc_BuildFramePkt()
691pDlContext->tCmdRspFrameInfo.aFrameBuff[PHDNLDNFC_FRAME_HDR_OFFSET + 1] = pFrameByte[0]; in phDnldNfc_BuildFramePkt()
701 wCrcVal = phDnldNfc_CalcCrc16((pDlContext->tCmdRspFrameInfo.aFrameBuff),wFrameLen); in phDnldNfc_BuildFramePkt()
706 pDlContext->tCmdRspFrameInfo.aFrameBuff[wFrameLen] = pFrameByte[1]; in phDnldNfc_BuildFramePkt()
707 pDlContext->tCmdRspFrameInfo.aFrameBuff[wFrameLen+ 1] = pFrameByte[0]; in phDnldNfc_BuildFramePkt()
712 (pDlContext->tCmdRspFrameInfo.dwSendlength) = wFrameLen; in phDnldNfc_BuildFramePkt()
736 static NFCSTATUS phDnldNfc_CreateFramePld(pphDnldNfc_DlContext_t pDlContext) in phDnldNfc_CreateFramePld() argument
743 if(NULL == pDlContext) in phDnldNfc_CreateFramePld()
750 memset((pDlContext->tCmdRspFrameInfo.aFrameBuff),0,PHDNLDNFC_CMDRESP_MAX_BUFF_SIZE); in phDnldNfc_CreateFramePld()
751 (pDlContext->tCmdRspFrameInfo.dwSendlength) = 0; in phDnldNfc_CreateFramePld()
753 if(phDnldNfc_FTNone == (pDlContext->FrameInp.Type)) in phDnldNfc_CreateFramePld()
755 (pDlContext->tCmdRspFrameInfo.dwSendlength) += PHDNLDNFC_MIN_PLD_LEN; in phDnldNfc_CreateFramePld()
757 else if(phDnldNfc_ChkIntg == (pDlContext->FrameInp.Type)) in phDnldNfc_CreateFramePld()
759 (pDlContext->tCmdRspFrameInfo.dwSendlength) += PHDNLDNFC_MIN_PLD_LEN; in phDnldNfc_CreateFramePld()
762 memcpy(&(pDlContext->tCmdRspFrameInfo.aFrameBuff[PHDNLDNFC_FRAME_RDDATA_OFFSET]), in phDnldNfc_CreateFramePld()
766 memcpy(&(pDlContext->tCmdRspFrameInfo.aFrameBuff[PHDNLDNFC_FRAME_RDDATA_OFFSET + in phDnldNfc_CreateFramePld()
769 (pDlContext->tCmdRspFrameInfo.dwSendlength) += PHDNLDNFC_USERDATA_EEPROM_LENSIZE; in phDnldNfc_CreateFramePld()
770 (pDlContext->tCmdRspFrameInfo.dwSendlength) += PHDNLDNFC_USERDATA_EEPROM_OFFSIZE; in phDnldNfc_CreateFramePld()
772 else if(phDnldNfc_FTWrite == (pDlContext->FrameInp.Type)) in phDnldNfc_CreateFramePld()
774 wBuffIdx = (pDlContext->tRWInfo.wOffset); in phDnldNfc_CreateFramePld()
776 if(FALSE == (pDlContext->tRWInfo.bFramesSegmented)) in phDnldNfc_CreateFramePld()
778 wFrameLen = (pDlContext->tUserData.pBuff[wBuffIdx]); in phDnldNfc_CreateFramePld()
780 wFrameLen |= (pDlContext->tUserData.pBuff[wBuffIdx + 1]); in phDnldNfc_CreateFramePld()
782 (pDlContext->tRWInfo.wRWPldSize) = wFrameLen; in phDnldNfc_CreateFramePld()
785 if((pDlContext->tRWInfo.wRWPldSize) > PHDNLDNFC_CMDRESP_MAX_PLD_SIZE) in phDnldNfc_CreateFramePld()
787 if(FALSE == (pDlContext->tRWInfo.bFirstChunkResp)) in phDnldNfc_CreateFramePld()
789 (pDlContext->tRWInfo.wRemChunkBytes) = wFrameLen; in phDnldNfc_CreateFramePld()
790 (pDlContext->tRWInfo.wOffset) += PHDNLDNFC_FRAME_HDR_LEN; in phDnldNfc_CreateFramePld()
791 wBuffIdx = (pDlContext->tRWInfo.wOffset); in phDnldNfc_CreateFramePld()
794 if(PHDNLDNFC_CMDRESP_MAX_PLD_SIZE < (pDlContext->tRWInfo.wRemChunkBytes)) in phDnldNfc_CreateFramePld()
796 (pDlContext->tRWInfo.wBytesToSendRecv) = PHDNLDNFC_CMDRESP_MAX_PLD_SIZE; in phDnldNfc_CreateFramePld()
797 (pDlContext->tRWInfo.bFramesSegmented) = TRUE; in phDnldNfc_CreateFramePld()
801 (pDlContext->tRWInfo.wBytesToSendRecv) = (pDlContext->tRWInfo.wRemChunkBytes); in phDnldNfc_CreateFramePld()
802 (pDlContext->tRWInfo.bFramesSegmented) = FALSE; in phDnldNfc_CreateFramePld()
805 memcpy(&(pDlContext->tCmdRspFrameInfo.aFrameBuff[PHDNLDNFC_FRAMEID_OFFSET]), in phDnldNfc_CreateFramePld()
806 … &(pDlContext->tUserData.pBuff[wBuffIdx]),(pDlContext->tRWInfo.wBytesToSendRecv)); in phDnldNfc_CreateFramePld()
810 (pDlContext->tRWInfo.wRWPldSize) = 0; in phDnldNfc_CreateFramePld()
811 (pDlContext->tRWInfo.wBytesToSendRecv) = (wFrameLen + PHDNLDNFC_FRAME_HDR_LEN); in phDnldNfc_CreateFramePld()
813 memcpy(&(pDlContext->tCmdRspFrameInfo.aFrameBuff[0]), in phDnldNfc_CreateFramePld()
814 … &(pDlContext->tUserData.pBuff[wBuffIdx]),(pDlContext->tRWInfo.wBytesToSendRecv)); in phDnldNfc_CreateFramePld()
816 (pDlContext->tCmdRspFrameInfo.dwSendlength) += (pDlContext->tRWInfo.wBytesToSendRecv); in phDnldNfc_CreateFramePld()
818 else if(phDnldNfc_FTRead == (pDlContext->FrameInp.Type)) in phDnldNfc_CreateFramePld()
820 (pDlContext->tRWInfo.wBytesToSendRecv) = ((pDlContext->tRWInfo.wRemBytes) > in phDnldNfc_CreateFramePld()
821 (pDlContext->tRWInfo.wRWPldSize)) ? (pDlContext->tRWInfo.wRWPldSize) : in phDnldNfc_CreateFramePld()
822 (pDlContext->tRWInfo.wRemBytes); in phDnldNfc_CreateFramePld()
824 wBuffIdx = (PHDNLDNFC_PLD_OFFSET + ((sizeof(pDlContext->tRWInfo.wBytesToSendRecv)) in phDnldNfc_CreateFramePld()
827 memcpy(&(pDlContext->tCmdRspFrameInfo.aFrameBuff[wBuffIdx]), in phDnldNfc_CreateFramePld()
828 … &(pDlContext->tRWInfo.wBytesToSendRecv),(sizeof(pDlContext->tRWInfo.wBytesToSendRecv))); in phDnldNfc_CreateFramePld()
830 wBuffIdx += sizeof(pDlContext->tRWInfo.wBytesToSendRecv); in phDnldNfc_CreateFramePld()
832 memcpy(&(pDlContext->tCmdRspFrameInfo.aFrameBuff[wBuffIdx]), in phDnldNfc_CreateFramePld()
833 &(pDlContext->tRWInfo.dwAddr),sizeof(pDlContext->tRWInfo.dwAddr)); in phDnldNfc_CreateFramePld()
835 (pDlContext->tCmdRspFrameInfo.dwSendlength) += (PHDNLDNFC_MIN_PLD_LEN + in phDnldNfc_CreateFramePld()
836 (sizeof(pDlContext->tRWInfo.dwAddr))); in phDnldNfc_CreateFramePld()
838 else if(phDnldNfc_FTLog == (pDlContext->FrameInp.Type)) in phDnldNfc_CreateFramePld()
840 (pDlContext->tCmdRspFrameInfo.dwSendlength) += PHDNLDNFC_MIN_PLD_LEN; in phDnldNfc_CreateFramePld()
844 memcpy(&(pDlContext->tCmdRspFrameInfo.aFrameBuff[wBuffIdx]), in phDnldNfc_CreateFramePld()
845 (pDlContext->tUserData.pBuff),(pDlContext->tUserData.wLen)); in phDnldNfc_CreateFramePld()
847 (pDlContext->tCmdRspFrameInfo.dwSendlength) += (pDlContext->tUserData.wLen); in phDnldNfc_CreateFramePld()
849 else if(phDnldNfc_FTForce == (pDlContext->FrameInp.Type)) in phDnldNfc_CreateFramePld()
851 (pDlContext->tCmdRspFrameInfo.dwSendlength) += PHDNLDNFC_MIN_PLD_LEN; in phDnldNfc_CreateFramePld()
855 memcpy(&(pDlContext->tCmdRspFrameInfo.aFrameBuff[wBuffIdx]), in phDnldNfc_CreateFramePld()
856 (pDlContext->tUserData.pBuff),(pDlContext->tUserData.wLen)); in phDnldNfc_CreateFramePld()
858 else if(phDnldNfc_FTRaw == (pDlContext->FrameInp.Type)) in phDnldNfc_CreateFramePld()
860 if((0 == (pDlContext->tUserData.wLen)) || (NULL == (pDlContext->tUserData.pBuff))) in phDnldNfc_CreateFramePld()
867 memcpy(&(pDlContext->tCmdRspFrameInfo.aFrameBuff[wBuffIdx]), in phDnldNfc_CreateFramePld()
868 (pDlContext->tUserData.pBuff),(pDlContext->tUserData.wLen)); in phDnldNfc_CreateFramePld()
870 (pDlContext->tCmdRspFrameInfo.dwSendlength) += (pDlContext->tUserData.wLen); in phDnldNfc_CreateFramePld()
1028 static NFCSTATUS phDnldNfc_SetupResendTimer(pphDnldNfc_DlContext_t pDlContext) in phDnldNfc_SetupResendTimer() argument
1032 wStatus = phOsalNfc_Timer_Start((pDlContext->TimerInfo.dwRspTimerId), in phDnldNfc_SetupResendTimer()
1035 pDlContext); in phDnldNfc_SetupResendTimer()
1040 (pDlContext->TimerInfo.TimerStatus) = 1; in phDnldNfc_SetupResendTimer()
1041 pDlContext->tCurrState = phDnldNfc_StateTimer; in phDnldNfc_SetupResendTimer()
1046 (pDlContext->TimerInfo.TimerStatus) = 0;/*timer stopped*/ in phDnldNfc_SetupResendTimer()
1047 pDlContext->tCurrState = phDnldNfc_StateResponse; in phDnldNfc_SetupResendTimer()
1165 static NFCSTATUS phDnldNfc_UpdateRsp(pphDnldNfc_DlContext_t pDlContext, phTmlNfc_TransactInfo_t … in phDnldNfc_UpdateRsp() argument
1170 if((NULL == pDlContext) || (NULL == pInfo)) in phDnldNfc_UpdateRsp()
1177 if(PH_DL_CMD_WRITE == (pDlContext->tCmdId)) in phDnldNfc_UpdateRsp()
1182 if(TRUE == (pDlContext->tRWInfo.bFirstWrReq)) in phDnldNfc_UpdateRsp()
1185 (pDlContext->tRWInfo.bFirstWrReq) = FALSE; in phDnldNfc_UpdateRsp()
1188 if(TRUE == (pDlContext->tRWInfo.bFirstChunkResp)) in phDnldNfc_UpdateRsp()
1190 if(FALSE == (pDlContext->tRWInfo.bFramesSegmented)) in phDnldNfc_UpdateRsp()
1193 … (pDlContext->tRWInfo.wRemChunkBytes) -= (pDlContext->tRWInfo.wBytesToSendRecv); in phDnldNfc_UpdateRsp()
1194 (pDlContext->tRWInfo.bFirstChunkResp) = FALSE; in phDnldNfc_UpdateRsp()
1205 (pDlContext->tRWInfo.wRemBytes) -= (pDlContext->tRWInfo.wBytesToSendRecv); in phDnldNfc_UpdateRsp()
1206 (pDlContext->tRWInfo.wOffset) += (pDlContext->tRWInfo.wBytesToSendRecv); in phDnldNfc_UpdateRsp()
1209 else if((FALSE == (pDlContext->tRWInfo.bFirstChunkResp)) && in phDnldNfc_UpdateRsp()
1210 (TRUE == (pDlContext->tRWInfo.bFramesSegmented)) && in phDnldNfc_UpdateRsp()
1213 (pDlContext->tRWInfo.bFirstChunkResp) = TRUE; in phDnldNfc_UpdateRsp()
1214 (pDlContext->tRWInfo.wRemChunkBytes) -= (pDlContext->tRWInfo.wBytesToSendRecv); in phDnldNfc_UpdateRsp()
1215 …(pDlContext->tRWInfo.wRemBytes) -= ((pDlContext->tRWInfo.wBytesToSendRecv) + PHDNLDNFC_FRAME_HDR_L… in phDnldNfc_UpdateRsp()
1216 (pDlContext->tRWInfo.wOffset) += (pDlContext->tRWInfo.wBytesToSendRecv); in phDnldNfc_UpdateRsp()
1219 if(TRUE == (pDlContext->tRWInfo.bFirstWrReq)) in phDnldNfc_UpdateRsp()
1222 (pDlContext->tRWInfo.bFirstWrReq) = FALSE; in phDnldNfc_UpdateRsp()
1225 else if((TRUE == (pDlContext->tRWInfo.bFirstChunkResp)) && in phDnldNfc_UpdateRsp()
1226 (TRUE == (pDlContext->tRWInfo.bFramesSegmented)) && in phDnldNfc_UpdateRsp()
1229 (pDlContext->tRWInfo.wRemChunkBytes) -= (pDlContext->tRWInfo.wBytesToSendRecv); in phDnldNfc_UpdateRsp()
1230 (pDlContext->tRWInfo.wRemBytes) -= (pDlContext->tRWInfo.wBytesToSendRecv); in phDnldNfc_UpdateRsp()
1231 (pDlContext->tRWInfo.wOffset) += (pDlContext->tRWInfo.wBytesToSendRecv); in phDnldNfc_UpdateRsp()
1236 (pDlContext->tRWInfo.bFirstWrReq) = FALSE; in phDnldNfc_UpdateRsp()
1238 (pDlContext->tRWInfo.wRemBytes) = 0; in phDnldNfc_UpdateRsp()
1239 (pDlContext->tRWInfo.wOffset) = 0; in phDnldNfc_UpdateRsp()
1245 (pDlContext->tLastStatus) = PH_DL_STATUS_PLL_ERROR; in phDnldNfc_UpdateRsp()
1252 (pDlContext->tLastStatus) = PH_DL_STATUS_SIGNATURE_ERROR; in phDnldNfc_UpdateRsp()
1258 (pDlContext->tLastStatus) = PH_DL_STATUS_MEM_BSY; in phDnldNfc_UpdateRsp()
1267 else if(PH_DL_CMD_READ == (pDlContext->tCmdId)) in phDnldNfc_UpdateRsp()
1274 if(wReadLen != (pDlContext->tRWInfo.wBytesToSendRecv)) in phDnldNfc_UpdateRsp()
1281 memcpy(&(pDlContext->tRspBuffInfo.pBuff[(pDlContext->tRWInfo.wOffset)]), in phDnldNfc_UpdateRsp()
1285 (pDlContext->tRWInfo.wBytesRead) += wReadLen; in phDnldNfc_UpdateRsp()
1287 (pDlContext->tRspBuffInfo.wLen) = (pDlContext->tRWInfo.wBytesRead); in phDnldNfc_UpdateRsp()
1289 (pDlContext->tRWInfo.wRemBytes) -= (pDlContext->tRWInfo.wBytesToSendRecv); in phDnldNfc_UpdateRsp()
1290 (pDlContext->tRWInfo.dwAddr) += (pDlContext->tRWInfo.wBytesToSendRecv); in phDnldNfc_UpdateRsp()
1291 (pDlContext->tRWInfo.wOffset) += (pDlContext->tRWInfo.wBytesToSendRecv); in phDnldNfc_UpdateRsp()
1304 if((0 != (pDlContext->tRspBuffInfo.wLen)) && in phDnldNfc_UpdateRsp()
1305 (NULL != (pDlContext->tRspBuffInfo.pBuff))) in phDnldNfc_UpdateRsp()
1307 … memcpy((pDlContext->tRspBuffInfo.pBuff),&(pInfo->pBuff[PHDNLDNFC_FRAMESTATUS_OFFSET + 1]), in phDnldNfc_UpdateRsp()
1310 (pDlContext->tRspBuffInfo.wLen) = wPldLen; in phDnldNfc_UpdateRsp()