//------------------------------------------------------------------------------ tOplkError ctrlucal_executeCmd(tCtrlCmdType cmd_p) { tHostifReturn hifret; tHostifCommand hifcmd = (tHostifCommand)cmd_p; tHostifError hiferr = 0; int timeout; hostif_setError(instance_l.hifInstance, hiferr); hostif_setCommand(instance_l.hifInstance, hifcmd); /* wait for response */ for (timeout = 0; timeout < CMD_TIMEOUT_SEC; timeout++) { target_msleep(1000U); hifret = hostif_getCommand(instance_l.hifInstance, &hifcmd); if (hifret != kHostifSuccessful) return kErrorGeneralError; hifret = hostif_getError(instance_l.hifInstance, &hiferr); if (hifret != kHostifSuccessful) return kErrorGeneralError; if (hifcmd == 0) { return hiferr; } } TRACE("%s() Timeout waiting for return!\n", __func__); return kErrorGeneralError; }
//------------------------------------------------------------------------------ tOplkError ctrlucal_executeCmd(tCtrlCmdType cmd_p, UINT16* pRetVal_p) { tHostifReturn hifret; tHostifCommand hifcmd = (tHostifCommand)cmd_p; tHostifError hiferr = 0; int timeout; // Check parameter validity ASSERT(pRetVal_p != NULL); hostif_setError(instance_l.hifInstance, hiferr); hostif_setCommand(instance_l.hifInstance, hifcmd); /* wait for response */ for (timeout = 0; timeout < CMD_TIMEOUT_SEC * 100; timeout++) { target_msleep(10U); hifret = hostif_getCommand(instance_l.hifInstance, &hifcmd); if (hifret != kHostifSuccessful) return kErrorGeneralError; hifret = hostif_getError(instance_l.hifInstance, &hiferr); if (hifret != kHostifSuccessful) return kErrorGeneralError; if (hifcmd == 0) { *pRetVal_p = hiferr; return kErrorOk; } } DEBUG_LVL_ERROR_TRACE("%s() Timeout waiting for return!\n", __func__); return kErrorGeneralError; }