Lines Matching refs:pDlContext
82 static NFCSTATUS phDnldNfc_BuildFramePkt(pphDnldNfc_DlContext_t pDlContext);
83 static NFCSTATUS phDnldNfc_CreateFramePld(pphDnldNfc_DlContext_t pDlContext);
84 static NFCSTATUS phDnldNfc_SetupResendTimer(pphDnldNfc_DlContext_t pDlContext);
85 static NFCSTATUS phDnldNfc_UpdateRsp(pphDnldNfc_DlContext_t pDlContext,
535 static NFCSTATUS phDnldNfc_BuildFramePkt(pphDnldNfc_DlContext_t pDlContext) { in phDnldNfc_BuildFramePkt() argument
541 if (NULL == pDlContext) { in phDnldNfc_BuildFramePkt()
545 if (phDnldNfc_FTWrite == (pDlContext->FrameInp.Type)) { in phDnldNfc_BuildFramePkt()
546 if ((0 == (pDlContext->tUserData.wLen)) || in phDnldNfc_BuildFramePkt()
547 (NULL == (pDlContext->tUserData.pBuff))) { in phDnldNfc_BuildFramePkt()
551 if ((pDlContext->tRWInfo.bFirstWrReq) == true) { in phDnldNfc_BuildFramePkt()
552 (pDlContext->tRWInfo.wRemBytes) = (pDlContext->tUserData.wLen); in phDnldNfc_BuildFramePkt()
553 (pDlContext->tRWInfo.wOffset) = 0; in phDnldNfc_BuildFramePkt()
556 } else if (phDnldNfc_FTRead == (pDlContext->FrameInp.Type)) { in phDnldNfc_BuildFramePkt()
557 if ((0 == (pDlContext->tRspBuffInfo.wLen)) || in phDnldNfc_BuildFramePkt()
558 (NULL == (pDlContext->tRspBuffInfo.pBuff))) { in phDnldNfc_BuildFramePkt()
562 if ((pDlContext->tRWInfo.bFramesSegmented) == false) { in phDnldNfc_BuildFramePkt()
564 wFrameLen = (pDlContext->tRspBuffInfo.wLen) + PHDNLDNFC_MIN_PLD_LEN; in phDnldNfc_BuildFramePkt()
566 (pDlContext->tRWInfo.wRWPldSize) = in phDnldNfc_BuildFramePkt()
568 (pDlContext->tRWInfo.wRemBytes) = (pDlContext->tRspBuffInfo.wLen); in phDnldNfc_BuildFramePkt()
569 (pDlContext->tRWInfo.dwAddr) = (pDlContext->FrameInp.dwAddr); in phDnldNfc_BuildFramePkt()
570 (pDlContext->tRWInfo.wOffset) = 0; in phDnldNfc_BuildFramePkt()
571 (pDlContext->tRWInfo.wBytesRead) = 0; in phDnldNfc_BuildFramePkt()
574 (pDlContext->tRWInfo.bFramesSegmented) = true; in phDnldNfc_BuildFramePkt()
578 } else if (phDnldNfc_FTLog == (pDlContext->FrameInp.Type)) { in phDnldNfc_BuildFramePkt()
579 if ((0 == (pDlContext->tUserData.wLen)) || in phDnldNfc_BuildFramePkt()
580 (NULL == (pDlContext->tUserData.pBuff))) { in phDnldNfc_BuildFramePkt()
588 wStatus = phDnldNfc_CreateFramePld(pDlContext); in phDnldNfc_BuildFramePkt()
593 wFrameLen = (pDlContext->tCmdRspFrameInfo.dwSendlength); in phDnldNfc_BuildFramePkt()
599 if (phDnldNfc_FTRaw != (pDlContext->FrameInp.Type)) { in phDnldNfc_BuildFramePkt()
600 if (phDnldNfc_FTWrite != (pDlContext->FrameInp.Type)) { in phDnldNfc_BuildFramePkt()
603 pDlContext->tCmdRspFrameInfo.aFrameBuff[PHDNLDNFC_FRAME_HDR_OFFSET] = in phDnldNfc_BuildFramePkt()
605 pDlContext->tCmdRspFrameInfo in phDnldNfc_BuildFramePkt()
609 pDlContext->tCmdRspFrameInfo.aFrameBuff[PHDNLDNFC_FRAMEID_OFFSET] = in phDnldNfc_BuildFramePkt()
610 (pDlContext->tCmdId); in phDnldNfc_BuildFramePkt()
614 if (0 != (pDlContext->tRWInfo.wRWPldSize)) { in phDnldNfc_BuildFramePkt()
615 if ((pDlContext->tRWInfo.bFramesSegmented) == true) { in phDnldNfc_BuildFramePkt()
622 pDlContext->tCmdRspFrameInfo in phDnldNfc_BuildFramePkt()
624 pDlContext->tCmdRspFrameInfo in phDnldNfc_BuildFramePkt()
639 wCrcVal = phDnldNfc_CalcCrc16((pDlContext->tCmdRspFrameInfo.aFrameBuff), in phDnldNfc_BuildFramePkt()
645 pDlContext->tCmdRspFrameInfo.aFrameBuff[wFrameLen] = pFrameByte[1]; in phDnldNfc_BuildFramePkt()
646 pDlContext->tCmdRspFrameInfo.aFrameBuff[wFrameLen + 1] = pFrameByte[0]; in phDnldNfc_BuildFramePkt()
651 (pDlContext->tCmdRspFrameInfo.dwSendlength) = wFrameLen; in phDnldNfc_BuildFramePkt()
673 static NFCSTATUS phDnldNfc_CreateFramePld(pphDnldNfc_DlContext_t pDlContext) { in phDnldNfc_CreateFramePld() argument
679 if (NULL == pDlContext) { in phDnldNfc_CreateFramePld()
683 memset((pDlContext->tCmdRspFrameInfo.aFrameBuff), 0, in phDnldNfc_CreateFramePld()
685 (pDlContext->tCmdRspFrameInfo.dwSendlength) = 0; in phDnldNfc_CreateFramePld()
687 if (phDnldNfc_FTNone == (pDlContext->FrameInp.Type)) { in phDnldNfc_CreateFramePld()
688 (pDlContext->tCmdRspFrameInfo.dwSendlength) += PHDNLDNFC_MIN_PLD_LEN; in phDnldNfc_CreateFramePld()
689 } else if (phDnldNfc_ChkIntg == (pDlContext->FrameInp.Type)) { in phDnldNfc_CreateFramePld()
690 (pDlContext->tCmdRspFrameInfo.dwSendlength) += PHDNLDNFC_MIN_PLD_LEN; in phDnldNfc_CreateFramePld()
694 memcpy(&(pDlContext->tCmdRspFrameInfo in phDnldNfc_CreateFramePld()
699 memcpy(&(pDlContext->tCmdRspFrameInfo in phDnldNfc_CreateFramePld()
704 (pDlContext->tCmdRspFrameInfo.dwSendlength) += in phDnldNfc_CreateFramePld()
706 (pDlContext->tCmdRspFrameInfo.dwSendlength) += in phDnldNfc_CreateFramePld()
708 } else if (phDnldNfc_FTWrite == (pDlContext->FrameInp.Type)) { in phDnldNfc_CreateFramePld()
709 wBuffIdx = (pDlContext->tRWInfo.wOffset); in phDnldNfc_CreateFramePld()
711 if ((pDlContext->tRWInfo.bFramesSegmented) == false) { in phDnldNfc_CreateFramePld()
712 wFrameLen = (pDlContext->tUserData.pBuff[wBuffIdx]); in phDnldNfc_CreateFramePld()
714 wFrameLen |= (pDlContext->tUserData.pBuff[wBuffIdx + 1]); in phDnldNfc_CreateFramePld()
716 (pDlContext->tRWInfo.wRWPldSize) = wFrameLen; in phDnldNfc_CreateFramePld()
719 if ((pDlContext->tRWInfo.wRWPldSize) > PHDNLDNFC_CMDRESP_MAX_PLD_SIZE) { in phDnldNfc_CreateFramePld()
720 if ((pDlContext->tRWInfo.bFirstChunkResp) == false) { in phDnldNfc_CreateFramePld()
721 (pDlContext->tRWInfo.wRemChunkBytes) = wFrameLen; in phDnldNfc_CreateFramePld()
722 (pDlContext->tRWInfo.wOffset) += PHDNLDNFC_FRAME_HDR_LEN; in phDnldNfc_CreateFramePld()
723 wBuffIdx = (pDlContext->tRWInfo.wOffset); in phDnldNfc_CreateFramePld()
727 (pDlContext->tRWInfo.wRemChunkBytes)) { in phDnldNfc_CreateFramePld()
728 (pDlContext->tRWInfo.wBytesToSendRecv) = in phDnldNfc_CreateFramePld()
730 (pDlContext->tRWInfo.bFramesSegmented) = true; in phDnldNfc_CreateFramePld()
732 (pDlContext->tRWInfo.wBytesToSendRecv) = in phDnldNfc_CreateFramePld()
733 (pDlContext->tRWInfo.wRemChunkBytes); in phDnldNfc_CreateFramePld()
734 (pDlContext->tRWInfo.bFramesSegmented) = false; in phDnldNfc_CreateFramePld()
737 memcpy(&(pDlContext->tCmdRspFrameInfo in phDnldNfc_CreateFramePld()
739 &(pDlContext->tUserData.pBuff[wBuffIdx]), in phDnldNfc_CreateFramePld()
740 (pDlContext->tRWInfo.wBytesToSendRecv)); in phDnldNfc_CreateFramePld()
742 (pDlContext->tRWInfo.wRWPldSize) = 0; in phDnldNfc_CreateFramePld()
743 (pDlContext->tRWInfo.wBytesToSendRecv) = in phDnldNfc_CreateFramePld()
746 memcpy(&(pDlContext->tCmdRspFrameInfo.aFrameBuff[0]), in phDnldNfc_CreateFramePld()
747 &(pDlContext->tUserData.pBuff[wBuffIdx]), in phDnldNfc_CreateFramePld()
748 (pDlContext->tRWInfo.wBytesToSendRecv)); in phDnldNfc_CreateFramePld()
750 (pDlContext->tCmdRspFrameInfo.dwSendlength) += in phDnldNfc_CreateFramePld()
751 (pDlContext->tRWInfo.wBytesToSendRecv); in phDnldNfc_CreateFramePld()
752 } else if (phDnldNfc_FTRead == (pDlContext->FrameInp.Type)) { in phDnldNfc_CreateFramePld()
753 (pDlContext->tRWInfo.wBytesToSendRecv) = in phDnldNfc_CreateFramePld()
754 ((pDlContext->tRWInfo.wRemBytes) > (pDlContext->tRWInfo.wRWPldSize)) in phDnldNfc_CreateFramePld()
755 ? (pDlContext->tRWInfo.wRWPldSize) in phDnldNfc_CreateFramePld()
756 : (pDlContext->tRWInfo.wRemBytes); in phDnldNfc_CreateFramePld()
759 ((sizeof(pDlContext->tRWInfo.wBytesToSendRecv)) % in phDnldNfc_CreateFramePld()
763 memcpy(&(pDlContext->tCmdRspFrameInfo.aFrameBuff[wBuffIdx]), in phDnldNfc_CreateFramePld()
764 &(pDlContext->tRWInfo.wBytesToSendRecv), in phDnldNfc_CreateFramePld()
765 (sizeof(pDlContext->tRWInfo.wBytesToSendRecv))); in phDnldNfc_CreateFramePld()
767 wBuffIdx += sizeof(pDlContext->tRWInfo.wBytesToSendRecv); in phDnldNfc_CreateFramePld()
769 memcpy(&(pDlContext->tCmdRspFrameInfo.aFrameBuff[wBuffIdx]), in phDnldNfc_CreateFramePld()
770 &(pDlContext->tRWInfo.dwAddr), sizeof(pDlContext->tRWInfo.dwAddr)); in phDnldNfc_CreateFramePld()
772 (pDlContext->tCmdRspFrameInfo.dwSendlength) += in phDnldNfc_CreateFramePld()
773 (PHDNLDNFC_MIN_PLD_LEN + (sizeof(pDlContext->tRWInfo.dwAddr))); in phDnldNfc_CreateFramePld()
774 } else if (phDnldNfc_FTLog == (pDlContext->FrameInp.Type)) { in phDnldNfc_CreateFramePld()
775 (pDlContext->tCmdRspFrameInfo.dwSendlength) += PHDNLDNFC_MIN_PLD_LEN; in phDnldNfc_CreateFramePld()
779 memcpy(&(pDlContext->tCmdRspFrameInfo.aFrameBuff[wBuffIdx]), in phDnldNfc_CreateFramePld()
780 (pDlContext->tUserData.pBuff), (pDlContext->tUserData.wLen)); in phDnldNfc_CreateFramePld()
782 (pDlContext->tCmdRspFrameInfo.dwSendlength) += in phDnldNfc_CreateFramePld()
783 (pDlContext->tUserData.wLen); in phDnldNfc_CreateFramePld()
784 } else if (phDnldNfc_FTForce == (pDlContext->FrameInp.Type)) { in phDnldNfc_CreateFramePld()
785 (pDlContext->tCmdRspFrameInfo.dwSendlength) += PHDNLDNFC_MIN_PLD_LEN; in phDnldNfc_CreateFramePld()
789 memcpy(&(pDlContext->tCmdRspFrameInfo.aFrameBuff[wBuffIdx]), in phDnldNfc_CreateFramePld()
790 (pDlContext->tUserData.pBuff), (pDlContext->tUserData.wLen)); in phDnldNfc_CreateFramePld()
791 } else if (phDnldNfc_FTRaw == (pDlContext->FrameInp.Type)) { in phDnldNfc_CreateFramePld()
792 if ((0 == (pDlContext->tUserData.wLen)) || in phDnldNfc_CreateFramePld()
793 (NULL == (pDlContext->tUserData.pBuff))) { in phDnldNfc_CreateFramePld()
797 memcpy(&(pDlContext->tCmdRspFrameInfo.aFrameBuff[wBuffIdx]), in phDnldNfc_CreateFramePld()
798 (pDlContext->tUserData.pBuff), (pDlContext->tUserData.wLen)); in phDnldNfc_CreateFramePld()
800 (pDlContext->tCmdRspFrameInfo.dwSendlength) += in phDnldNfc_CreateFramePld()
801 (pDlContext->tUserData.wLen); in phDnldNfc_CreateFramePld()
934 static NFCSTATUS phDnldNfc_SetupResendTimer(pphDnldNfc_DlContext_t pDlContext) { in phDnldNfc_SetupResendTimer() argument
937 wStatus = phOsalNfc_Timer_Start((pDlContext->TimerInfo.dwRspTimerId), in phDnldNfc_SetupResendTimer()
939 &phDnldNfc_ResendTimeOutCb, pDlContext); in phDnldNfc_SetupResendTimer()
943 (pDlContext->TimerInfo.TimerStatus) = 1; in phDnldNfc_SetupResendTimer()
944 pDlContext->tCurrState = phDnldNfc_StateTimer; in phDnldNfc_SetupResendTimer()
947 (pDlContext->TimerInfo.TimerStatus) = 0; /*timer stopped*/ in phDnldNfc_SetupResendTimer()
948 pDlContext->tCurrState = phDnldNfc_StateResponse; in phDnldNfc_SetupResendTimer()
1060 static NFCSTATUS phDnldNfc_UpdateRsp(pphDnldNfc_DlContext_t pDlContext, in phDnldNfc_UpdateRsp() argument
1066 if ((NULL == pDlContext) || (NULL == pInfo)) { in phDnldNfc_UpdateRsp()
1070 if (PH_DL_CMD_WRITE == (pDlContext->tCmdId)) { in phDnldNfc_UpdateRsp()
1073 if ((pDlContext->tRWInfo.bFirstWrReq) == true) { in phDnldNfc_UpdateRsp()
1075 (pDlContext->tRWInfo.bFirstWrReq) = false; in phDnldNfc_UpdateRsp()
1078 if ((pDlContext->tRWInfo.bFirstChunkResp) == true) { in phDnldNfc_UpdateRsp()
1079 if ((pDlContext->tRWInfo.bFramesSegmented) == false) { in phDnldNfc_UpdateRsp()
1081 (pDlContext->tRWInfo.wRemChunkBytes) -= in phDnldNfc_UpdateRsp()
1082 (pDlContext->tRWInfo.wBytesToSendRecv); in phDnldNfc_UpdateRsp()
1083 (pDlContext->tRWInfo.bFirstChunkResp) = false; in phDnldNfc_UpdateRsp()
1091 (pDlContext->tRWInfo.wRemBytes) -= in phDnldNfc_UpdateRsp()
1092 (pDlContext->tRWInfo.wBytesToSendRecv); in phDnldNfc_UpdateRsp()
1093 (pDlContext->tRWInfo.wOffset) += in phDnldNfc_UpdateRsp()
1094 (pDlContext->tRWInfo.wBytesToSendRecv); in phDnldNfc_UpdateRsp()
1096 } else if (((pDlContext->tRWInfo.bFirstChunkResp) == false) && in phDnldNfc_UpdateRsp()
1097 ((pDlContext->tRWInfo.bFramesSegmented) == true) && in phDnldNfc_UpdateRsp()
1100 (pDlContext->tRWInfo.bFirstChunkResp) = true; in phDnldNfc_UpdateRsp()
1101 (pDlContext->tRWInfo.wRemChunkBytes) -= in phDnldNfc_UpdateRsp()
1102 (pDlContext->tRWInfo.wBytesToSendRecv); in phDnldNfc_UpdateRsp()
1103 (pDlContext->tRWInfo.wRemBytes) -= in phDnldNfc_UpdateRsp()
1104 ((pDlContext->tRWInfo.wBytesToSendRecv) + PHDNLDNFC_FRAME_HDR_LEN); in phDnldNfc_UpdateRsp()
1105 (pDlContext->tRWInfo.wOffset) += (pDlContext->tRWInfo.wBytesToSendRecv); in phDnldNfc_UpdateRsp()
1108 if ((pDlContext->tRWInfo.bFirstWrReq) == true) { in phDnldNfc_UpdateRsp()
1110 (pDlContext->tRWInfo.bFirstWrReq) = false; in phDnldNfc_UpdateRsp()
1112 } else if (((pDlContext->tRWInfo.bFirstChunkResp) == true) && in phDnldNfc_UpdateRsp()
1113 ((pDlContext->tRWInfo.bFramesSegmented) == true) && in phDnldNfc_UpdateRsp()
1116 (pDlContext->tRWInfo.wRemChunkBytes) -= in phDnldNfc_UpdateRsp()
1117 (pDlContext->tRWInfo.wBytesToSendRecv); in phDnldNfc_UpdateRsp()
1118 (pDlContext->tRWInfo.wRemBytes) -= in phDnldNfc_UpdateRsp()
1119 (pDlContext->tRWInfo.wBytesToSendRecv); in phDnldNfc_UpdateRsp()
1120 (pDlContext->tRWInfo.wOffset) += (pDlContext->tRWInfo.wBytesToSendRecv); in phDnldNfc_UpdateRsp()
1126 (pDlContext->tRWInfo.bFirstWrReq) = false; in phDnldNfc_UpdateRsp()
1128 (pDlContext->tRWInfo.wRemBytes) = 0; in phDnldNfc_UpdateRsp()
1129 (pDlContext->tRWInfo.wOffset) = 0; in phDnldNfc_UpdateRsp()
1134 (pDlContext->tLastStatus) = PH_DL_STATUS_PLL_ERROR; in phDnldNfc_UpdateRsp()
1141 (pDlContext->tLastStatus) = PH_DL_STATUS_SIGNATURE_ERROR; in phDnldNfc_UpdateRsp()
1146 (pDlContext->tLastStatus) = PH_DL_STATUS_MEM_BSY; in phDnldNfc_UpdateRsp()
1152 } else if (PH_DL_CMD_READ == (pDlContext->tCmdId)) { in phDnldNfc_UpdateRsp()
1158 if (wReadLen != (pDlContext->tRWInfo.wBytesToSendRecv)) { in phDnldNfc_UpdateRsp()
1163 &(pDlContext->tRspBuffInfo.pBuff[(pDlContext->tRWInfo.wOffset)]), in phDnldNfc_UpdateRsp()
1166 (pDlContext->tRWInfo.wBytesRead) += wReadLen; in phDnldNfc_UpdateRsp()
1168 (pDlContext->tRspBuffInfo.wLen) = (pDlContext->tRWInfo.wBytesRead); in phDnldNfc_UpdateRsp()
1170 (pDlContext->tRWInfo.wRemBytes) -= in phDnldNfc_UpdateRsp()
1171 (pDlContext->tRWInfo.wBytesToSendRecv); in phDnldNfc_UpdateRsp()
1172 (pDlContext->tRWInfo.dwAddr) += in phDnldNfc_UpdateRsp()
1173 (pDlContext->tRWInfo.wBytesToSendRecv); in phDnldNfc_UpdateRsp()
1174 (pDlContext->tRWInfo.wOffset) += in phDnldNfc_UpdateRsp()
1175 (pDlContext->tRWInfo.wBytesToSendRecv); in phDnldNfc_UpdateRsp()
1183 if ((0 != (pDlContext->tRspBuffInfo.wLen)) && in phDnldNfc_UpdateRsp()
1184 (NULL != (pDlContext->tRspBuffInfo.pBuff))) { in phDnldNfc_UpdateRsp()
1185 memcpy((pDlContext->tRspBuffInfo.pBuff), in phDnldNfc_UpdateRsp()
1188 (pDlContext->tRspBuffInfo.wLen) = wPldLen; in phDnldNfc_UpdateRsp()