s32 do_reset(u16 action) { s32 ret = RESET_ERROR; ret = do_power_off(action); if(ret < 0) { return RESET_ERROR; } ret = do_power_on(action); if(ret < 0) { return RESET_ERROR; } return RESET_OK; }
int modem_reset_task(void *arg) { u16 action = 0; unsigned long flags = 0; for( ; ;) { osl_sem_down(&(g_modem_reset_ctrl.task_sem)); action = (u16)g_modem_reset_ctrl.modem_action; reset_print_debug("(%d)has taken task_sem, action=%d\n", ++g_reset_debug.main_stage, action); if (MODEM_POWER_OFF == action) { (void)do_power_off(action); } else if (MODEM_POWER_ON == action) { (void)do_power_on(action); } else if (MODEM_RESET == action) { (void)do_reset(action); reset_print_err("reset count: %d\n", ++g_modem_reset_ctrl.reset_cnt); } if (action == g_modem_reset_ctrl.modem_action) { spin_lock_irqsave(&g_modem_reset_ctrl.action_lock, flags); g_modem_reset_ctrl.modem_action = MODEM_NORMAL; spin_unlock_irqrestore(&g_modem_reset_ctrl.action_lock, flags); } wake_unlock(&(g_modem_reset_ctrl.wake_lock)); g_modem_reset_ctrl.exec_time = get_timer_slice_delta(g_modem_reset_ctrl.exec_time, bsp_get_slice_value()); reset_print_debug("execute done, elapse time %d\n", g_modem_reset_ctrl.exec_time); } }
public: void power_on() { do_power_on(); this->enable(true); }