Lines Matching refs:pfwImageCtx

30 static phFWD_Status_t openFwBinFile(phUwbFWImageContext_t *pfwImageCtx);
31 static phFWD_Status_t openFwSoFile(phUwbFWImageContext_t *pfwImageCtx);
32 static phFWD_Status_t phNxpUciHal_fw_recovery(phUwbFWImageContext_t *pfwImageCtx);
186 phFWD_Status_t getFwImageCtx(phUwbFWImageContext_t *pfwImageCtx) { in getFwImageCtx() argument
194 int maxSrcLen = (FILEPATH_MAXLEN - strlen(pfwImageCtx->default_fw_path)) - 1; in getFwImageCtx()
207 strncat(pfwImageCtx->default_fw_path, pDefaultFwFileName, maxSrcLen); in getFwImageCtx()
210 strncat(pfwImageCtx->default_fw_path, configured_fw_name, maxSrcLen); in getFwImageCtx()
213 NXPLOG_FWDNLD_D("fw file path : %s", pfwImageCtx->default_fw_path); in getFwImageCtx()
217 pfwImageCtx->fw_dnld_config = SO_FILE_BASED_FW_DOWNLOAD; in getFwImageCtx()
219 status = openFwSoFile(pfwImageCtx); in getFwImageCtx()
222 status = openFwBinFile(pfwImageCtx); in getFwImageCtx()
228 memset(pfwImageCtx->default_fw_path, '\0', sizeof(char) * FILEPATH_MAXLEN); in getFwImageCtx()
229 strcpy(pfwImageCtx->default_fw_path, "/vendor/firmware/uwb/"); in getFwImageCtx()
283 static phFWD_Status_t openFwSoFile(phUwbFWImageContext_t *pfwImageCtx) { in openFwSoFile() argument
286 pfwImageCtx->gFwLib = NULL; in openFwSoFile()
291 pfwImageCtx->gFwLib = dlopen(pfwImageCtx->default_fw_path, RTLD_LAZY); in openFwSoFile()
292 if (pfwImageCtx->gFwLib == NULL) { in openFwSoFile()
295 pfwImageCtx->default_fw_path); in openFwSoFile()
299 flibptr = dlsym(pfwImageCtx->gFwLib, "gUWBManifest"); in openFwSoFile()
316 if (pfwImageCtx->deviceInfo->rom_version == VER_A1V1) { in openFwSoFile()
322 if(pfwImageCtx->deviceInfo->AT_page_status == STATUS_PAGE_ERROR) { in openFwSoFile()
323 pfwImageCtx->fwRecovery = true; in openFwSoFile()
324 pfwImageCtx->fwImgSize = currentFwLib->mwCESFW[MWCESFW_A1V1_RECOVERY_FW_OFFSET]->lenCESFW; in openFwSoFile()
325 pfwImageCtx->fwImage = currentFwLib->mwCESFW[MWCESFW_A1V1_RECOVERY_FW_OFFSET]->pCESFW; in openFwSoFile()
326 … } else if((pfwImageCtx->deviceInfo->device_life_cycle == CUSTOMER_MODE) && glcRotation == true) { in openFwSoFile()
332 pfwImageCtx->fwImgSize = currentFwLib->mwCESFW[MWCESFW_A1V1_LC_FW_OFFSET]->lenCESFW; in openFwSoFile()
333 pfwImageCtx->fwImage = currentFwLib->mwCESFW[MWCESFW_A1V1_LC_FW_OFFSET]->pCESFW; in openFwSoFile()
336 pfwImageCtx->fwImgSize = currentFwLib->mwCESFW[MWCESFW_A1V1_FW_OFFSET]->lenCESFW; in openFwSoFile()
337 pfwImageCtx->fwImage = currentFwLib->mwCESFW[MWCESFW_A1V1_FW_OFFSET]->pCESFW; in openFwSoFile()
340 else if (pfwImageCtx->deviceInfo->rom_version == VER_A1V2) { in openFwSoFile()
346 if(pfwImageCtx->deviceInfo->AT_page_status == STATUS_PAGE_ERROR) { in openFwSoFile()
347 pfwImageCtx->fwRecovery = true; in openFwSoFile()
348 pfwImageCtx->fwImgSize = currentFwLib->mwCESFW[MWCESFW_A1V2_RECOVERY_FW_OFFSET]->lenCESFW; in openFwSoFile()
349 pfwImageCtx->fwImage = currentFwLib->mwCESFW[MWCESFW_A1V2_RECOVERY_FW_OFFSET]->pCESFW; in openFwSoFile()
350 … } else if((pfwImageCtx->deviceInfo->device_life_cycle == CUSTOMER_MODE) && glcRotation == true) { in openFwSoFile()
356 pfwImageCtx->fwImgSize = currentFwLib->mwCESFW[MWCESFW_A1V2_LC_FW_OFFSET]->lenCESFW; in openFwSoFile()
357 pfwImageCtx->fwImage = currentFwLib->mwCESFW[MWCESFW_A1V2_LC_FW_OFFSET]->pCESFW; in openFwSoFile()
360 pfwImageCtx->fwImgSize = currentFwLib->mwCESFW[MWCESFW_A1V2_FW_OFFSET]->lenCESFW; in openFwSoFile()
361 pfwImageCtx->fwImage = currentFwLib->mwCESFW[MWCESFW_A1V2_FW_OFFSET]->pCESFW; in openFwSoFile()
364 if ((!(pfwImageCtx->fwImgSize)) || (NULL == pfwImageCtx->fwImage)) { in openFwSoFile()
365 NXPLOG_FWDNLD_E("%s: Error! File %s is empty\n", __func__, pfwImageCtx->default_fw_path); in openFwSoFile()
370 NXPLOG_FWDNLD_E("exiting %s fwImgSize %d" , __func__, pfwImageCtx->fwImgSize); in openFwSoFile()
375 if (pfwImageCtx->gFwLib != NULL) { in openFwSoFile()
376 dlclose(pfwImageCtx->gFwLib); in openFwSoFile()
377 pfwImageCtx->gFwLib = NULL; in openFwSoFile()
399 static phFWD_Status_t openFwBinFile(phUwbFWImageContext_t *pfwImageCtx) { in openFwBinFile() argument
408 if ((fptr = fopen(pfwImageCtx->default_fw_path, "rb")) == NULL) { in openFwBinFile()
410 pfwImageCtx->default_fw_path); in openFwBinFile()
419 NXPLOG_FWDNLD_E("%s: Error! File %s is empty\n", __func__, pfwImageCtx->default_fw_path); in openFwBinFile()
424 pfwImageCtx->fwImgSize = file_size; in openFwBinFile()
428 pfwImageCtx->fwImage = (uint8_t *)malloc(sizeof(uint8_t) * pfwImageCtx->fwImgSize); in openFwBinFile()
429 if (NULL == pfwImageCtx->fwImage) in openFwBinFile()
436 ret_size = fread(pfwImageCtx->fwImage, sizeof(uint8_t), pfwImageCtx->fwImgSize, fptr); in openFwBinFile()
437 if (ret_size != pfwImageCtx->fwImgSize) { in openFwBinFile()
441 __func__, pfwImageCtx->default_fw_path); in openFwBinFile()
445 NXPLOG_FWDNLD_E("%s: Error reading file %s\n", __func__, pfwImageCtx->default_fw_path); in openFwBinFile()
1757 phFWD_Status_t phLoadFwBinary(phUwbFWImageContext_t *pfwImageCtx) { in phLoadFwBinary() argument
1766 if (NULL == pfwImageCtx->fwImage) { in phLoadFwBinary()
1774 frame_payload_length = (pfwImageCtx->fwImage[next_frame_first_byte_index] << 8) + in phLoadFwBinary()
1775 (pfwImageCtx->fwImage[next_frame_first_byte_index + 1]); in phLoadFwBinary()
1791 memcpy(current_frame, &pfwImageCtx->fwImage[next_frame_first_byte_index], in phLoadFwBinary()
1807 if (next_frame_first_byte_index >= pfwImageCtx->fwImgSize) { in phLoadFwBinary()
1813 if (pfwImageCtx->fwImage != NULL) { in phLoadFwBinary()
1814 if (pfwImageCtx->fw_dnld_config == BIN_FILE_BASED_FW_DOWNLOAD) { in phLoadFwBinary()
1815 free(pfwImageCtx->fwImage); in phLoadFwBinary()
1816 } else if (pfwImageCtx->fw_dnld_config == SO_FILE_BASED_FW_DOWNLOAD) { in phLoadFwBinary()
1817 if (pfwImageCtx->gFwLib != NULL) { in phLoadFwBinary()
1818 dlclose(pfwImageCtx->gFwLib); in phLoadFwBinary()
1819 pfwImageCtx->gFwLib = NULL; in phLoadFwBinary()
1823 pfwImageCtx->fwImage = NULL; in phLoadFwBinary()
2047 static phFWD_Status_t phNxpUciHal_fw_recovery(phUwbFWImageContext_t *pfwImageCtx) { in phNxpUciHal_fw_recovery() argument
2051 ret = phLoadFwBinary(pfwImageCtx); in phNxpUciHal_fw_recovery()