/** * @brief This function checks if the firmware is ready to accept * command or not. * * @param priv A pointer to bt_private structure * @param pollnum Number of times to polling fw status * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE */ int sd_verify_fw_download(bt_private * priv, int pollnum) { int ret = BT_STATUS_SUCCESS; u16 firmwarestat; int tries; ENTER(); /* Wait for firmware initialization event */ for (tries = 0; tries < pollnum; tries++) { if (sd_read_firmware_status(priv, &firmwarestat) < 0) continue; if (firmwarestat == FIRMWARE_READY) { ret = BT_STATUS_SUCCESS; break; } else { mdelay(100); ret = BT_STATUS_FAILURE; } } if (ret < 0) goto done; ret = BT_STATUS_SUCCESS; done: LEAVE(); return ret; }
/** * @brief This function checks if the firmware is ready to accept * command or not. * * @param priv A pointer to bt_private structure * @param pollnum Number of times to poll fw status * @return BT_STATUS_SUCCESS or BT_STATUS_FAILURE */ int sd_verify_fw_download(bt_private *priv, int pollnum) { int ret = BT_STATUS_FAILURE; u16 firmwarestat = 0; int tries; ENTER(); /* Wait for firmware initialization event */ for (tries = 0; tries < pollnum; tries++) { if (sd_read_firmware_status(priv, &firmwarestat) < 0) continue; if (firmwarestat == FIRMWARE_READY) { PRINTM(MSG, "BT FW is active(%d)\n", tries); ret = BT_STATUS_SUCCESS; break; } mdelay(100); } if ((pollnum > 1) && (ret != BT_STATUS_SUCCESS)) PRINTM(ERROR, "Fail to poll firmware status: firmwarestat=0x%x\n", firmwarestat); LEAVE(); return ret; }