[Treble-Dev --> 81T_Dev] Added FW download Recovery in HAL init
diff --git a/halimpl/pn54x/common/phNfcStatus.h b/halimpl/pn54x/common/phNfcStatus.h
index 4af591f..5057b01 100644
--- a/halimpl/pn54x/common/phNfcStatus.h
+++ b/halimpl/pn54x/common/phNfcStatus.h
@@ -89,6 +89,12 @@
#define NFCSTATUS_BUFFER_TOO_SMALL (0x0003)
/*
+ * The function indicates given module not initialized
+ */
+#define NFC_STATUS_NOT_INITIALIZED (0x0004)
+
+/*
+
* Device specifier/handle value is invalid for the operation
*/
#define NFCSTATUS_INVALID_DEVICE (0x0006)
diff --git a/halimpl/pn54x/hal/phNxpNciHal.c b/halimpl/pn54x/hal/phNxpNciHal.c
index f5fd1f2..e2bc885 100644
--- a/halimpl/pn54x/hal/phNxpNciHal.c
+++ b/halimpl/pn54x/hal/phNxpNciHal.c
@@ -46,7 +46,7 @@
static uint8_t pwr_link_required = false;
static uint8_t config_access = false;
static uint8_t config_success = true;
-static NFCSTATUS phNxpNciHal_FwDwnld(void);
+static NFCSTATUS phNxpNciHal_FwDwnld(uint16_t aType);
static NFCSTATUS phNxpNciHal_SendCmd(uint8_t cmd_len, uint8_t* pcmd_buff);
static void phNxpNciHal_check_delete_nfaStorage_DHArea();
/* NCI HAL Control structure */
@@ -448,12 +448,15 @@
* In case of failure returns other failure value.
*
******************************************************************************/
-static NFCSTATUS phNxpNciHal_FwDwnld(void) {
- NFCSTATUS status = NFCSTATUS_SUCCESS, wConfigStatus = NFCSTATUS_SUCCESS;
- if (wFwVerRsp == 0) {
- phDnldNfc_InitImgInfo();
- }
- status = phNxpNciHal_CheckValidFwVersion();
+static NFCSTATUS phNxpNciHal_FwDwnld(uint16_t aType) {
+ NFCSTATUS status = NFCSTATUS_SUCCESS;
+
+ if(aType != NFC_STATUS_NOT_INITIALIZED) {
+ if (wFwVerRsp == 0) {
+ phDnldNfc_InitImgInfo();
+ }
+ status= phNxpNciHal_CheckValidFwVersion();
+ }
if (NFCSTATUS_SUCCESS == status) {
NXPLOG_NCIHAL_D("Found Valid Firmware Type");
status = phNxpNciHal_fw_download();
@@ -762,6 +765,8 @@
if ((status != NFCSTATUS_SUCCESS) &&
(nxpncihal_ctrl.retry_cnt >= MAX_RETRY_COUNT)) {
NXPLOG_NCIHAL_E("NFCC not coming out from Standby");
+ NXPLOG_NCIHAL_E("Trying Force FW download");
+ goto force_download;
wConfigStatus = NFCSTATUS_FAILED;
} else if (status != NFCSTATUS_SUCCESS) {
NXPLOG_NCIHAL_E("NCI_CORE_RESET: Failed");
@@ -808,6 +813,11 @@
return wConfigStatus;
+force_download:
+ wFwVerRsp = 0;
+ phNxpNciHal_FwDwnld(NFC_STATUS_NOT_INITIALIZED);
+ goto init_retry;
+
clean_and_return:
CONCURRENCY_UNLOCK();
if (nfc_dev_node != NULL) {
@@ -3086,7 +3096,7 @@
}
break;
case HAL_NFC_IOCTL_FW_DWNLD:
- status = phNxpNciHal_FwDwnld();
+ status = phNxpNciHal_FwDwnld(*(uint16_t*)p_data);
pInpOutData->out.data.fwDwnldStatus = (uint16_t)status;
if (NFCSTATUS_SUCCESS == status) {
ret = 0;