// ============================================================================= // boot_HstMonitor // ----------------------------------------------------------------------------- /// Main host monitor function. Read the command passed to the platform through /// the Host port and call the host command handler if appropriate. /// It read the H2P register to execute commands /// until the Exit command is received (BOOT_HST_MONITOR_END_CMD). // ============================================================================= PROTECTED BOOT_MONITOR_OP_STATUS_T boot_HstMonitor(VOID) { BOOT_HST_CMD_T hostCommand = 0; // Clear the "enter the monitor" host command // if a host command present if((hostCommand = GET_BITFIELD(hwp_debugHost->h2p_status, DEBUG_HOST_H2P_STATUS)) != 0) { // We received a command: we are not waiting anymore but actually acting // as a monitor. hwp_debugHost->p2h_status = BOOT_HST_STATUS_NONE; switch (hostCommand) { case BOOT_HST_MONITOR_START_CMD: // That command used to be used to enter into the monitor. // We now use a boot mode for that, so this command is // just used to send the BOOT_HST_MONITOR_START event // to acknowledge to the host (eg Remote PC's coolwatcher) // that we actually are in the monitor. mon_Event(BOOT_HST_MONITOR_START); hwp_debugHost->h2p_status = DEBUG_HOST_H2P_STATUS_RST; break; case BOOT_HST_MONITOR_X_CMD: // Execute a command placed in the execution structure. // H2P_Status is cleared in the basic handler boot_HstCmdBasicHandler(); break; case BOOT_HST_MONITOR_END_CMD: // We are required to leave the monitor. mon_Event(BOOT_HST_MONITOR_END); hwp_debugHost->h2p_status = DEBUG_HOST_H2P_STATUS_RST; return BOOT_MONITOR_OP_STATUS_EXIT; default: // unsupported command mon_Event(BOOT_HST_UNSUPPORTED_CMD); hwp_debugHost->h2p_status = DEBUG_HOST_H2P_STATUS_RST; break; } // We received a command, possibly unknown, but different from // BOOT_HST_MONITOR_END_CMD; return BOOT_MONITOR_OP_STATUS_CONTINUE; } else { // No command received. return BOOT_MONITOR_OP_STATUS_NONE; } }
static void CallNotificationCB(int callid, t_CallEvent evt, void *data) { t_HWindow handle = data; t_CallWindowData *wdata = (t_CallWindowData*)wgt_get_tag(handle); t_HWidget widget;// = wnd_get_widget(handle, RESID_LABEL_EVENT); const char *text; #if defined(TARGET_CSD) mon_Event(0xcdcdcd01); mon_Event(callid<<24|evt); #endif #if 0 text = brd_get_string(brd_get(PACK_GUID_call), gaCallEvtResid[evt], NULL); g_printf("id=%d,evt=%d(%s)", callid, evt, text?text:""); if(g_object_valid(widget) && text){ wgt_set_caption_by_resid(widget, brd_get(PACK_GUID_call), gaCallEvtResid[evt]); wgt_redraw(widget, FALSE); } #endif if(evt == CALL_EVT_DISCONNECT){ call_StartTimerClose(handle); if(wdata->connected){ calllog_save(wdata->contact, wdata->number, &wdata->dt, tick_current()-wdata->tick, wdata->info->outgoing?CALL_LOG_OUTGOING:CALL_LOG_INCOMING, 0); }else{ calllog_save(wdata->contact, wdata->number, &wdata->dt, 0, wdata->info->outgoing?CALL_LOG_OUTGOING:CALL_LOG_MISSED, 0); } }else if(evt == CALL_EVT_CONNECT){ if(!wdata->info->outgoing){ wnd_send_close(handle, 0); handle = wnd_create_by_resid(call_WndMsgHandler, wdata->cid, wdata->contact, brd_get(PACK_GUID_SELF), RESID_WIN_CALL); //call_notifier(cid, CallNotificationCB, handle); wnd_show(handle); return; } wdata->tick = tick_current(); datetime_current(&wdata->dt); wdata->connected = TRUE; call_StartTimer(handle); wnd_redraw(handle, NULL); if(wdata->info->outgoing && (wdata->info->dtmf[0] == 'p' || wdata->info->dtmf[0] == 'w')){ int timer = timer_create(dtmf_callback, wdata); timer_start(timer, 3000, TIMER_MODE_ONCE); } } }
/// Host command handler /// It is called by the host monitor and to handle /// the debug IRQ (triggered from the host ... ) PUBLIC VOID boot_HstCmdBasicHandler(VOID) { UINT32 cmdType = 0; // Flush all caches boot_FlushCache(); mon_Event(BOOT_HST_START_CMD_TREATMENT); // Clear calling cause hwp_debugHost->h2p_status = DEBUG_HOST_H2P_STATUS_RST; hwp_debugHost->irq = DEBUG_HOST_XCPU_IRQ; cmdType = boot_HstMonitorXCtx.cmdType; switch (cmdType) { case BOOT_HST_MONITOR_X_CMD: // Execute at the PC in the execution context with the provided SP boot_HstMonitorX(); mon_Event(BOOT_HST_END_CMD_TREATMENT); break; default: if (0 != boot_HstMonitorExtendedHandler.ExtendedCmdHandler) { ((VOID(*)(VOID*)) boot_HstMonitorExtendedHandler.ExtendedCmdHandler) ((VOID*)&boot_HstMonitorXCtx); } mon_Event(BOOT_HST_END_CMD_TREATMENT); break; } }