void lnb_power_short_detect(UINT32 nouse) { #if(SYS_LNB_SHORT_DET == SYS_FUNC_ON) SYSTEM_DATA* sys_data; static UINT32 count = 0; UINT32 lnb_short; static UINT8 lnb_short_cut =0 ; static UINT8 det_start = 0; #define LNB_POWER_RESET_WAIT_TIME 100 if(!lnb_power_detect_start && !det_start) return; det_start = 1; sys_data = sys_data_get(); if(sys_data->bLNB_power == LNB_POWER_ON) { if(!lnb_short_cut) /* If not cut it forcedly*/ { lnb_short = api_LNB_state(); if(lnb_short == 1) /* LNB short detected*/ { /* Cut LNB Power*/ api_LNB_power(0); /* Set corresponding flags*/ lnb_power_short = SIGNAL_STATUS_LNBSHORT; lnb_short_cut = 1; count = 0; /* Set LED display */ led_display_flag = 1; key_pan_display("LnbP",4); led_display_flag = 2; } else { if(lnb_power_short == SIGNAL_STATUS_LNBSHORT || led_display_flag != 0) { /* Restore LED display*/ led_display_flag = 1; key_pan_display(led_display_data,led_data_len); led_display_flag = 0; lnb_power_short = SIGNAL_STATUS_LNBNORMAL; } } } else /* If have already cut it forcedly*/ { count++; if(count >= LNB_POWER_RESET_WAIT_TIME) { /* Restore LNB Power*/ api_LNB_power(sys_data->bLNB_power); lnb_short_cut = 0; count = 0; } } } else /* User set LNB Power off */ { if(lnb_power_short == SIGNAL_STATUS_LNBSHORT || led_display_flag != 0) { /* Restore LED display*/ led_display_flag = 1; key_pan_display(led_display_data,led_data_len); led_display_flag = 0; lnb_power_short = SIGNAL_STATUS_LNBNORMAL; } lnb_short_cut = 0; count = 0; } #endif }
static PRESULT miscset_item_sel_callback(POBJECT_HEAD pObj, VEVENT event, UINT32 param1, UINT32 param2) { PRESULT ret = PROC_PASS; UINT32 sel; UINT8 bID; SYSTEM_DATA* sys_data; UINT16* Uni_str; bID = OSD_GetObjID(pObj); sys_data = sys_data_get(); switch(event) { case EVN_PRE_CHANGE: sel = *((UINT32*)param1); break; case EVN_POST_CHANGE: sel = param1; if(bID == LNBPOWER_ID) { if(sel == 0) SetLNBShortDetect(sel); sys_data->bLNB_power = sel; api_LNB_power(sys_data->bLNB_power); SetLNBShortDetectStart(sys_data->bLNB_power); if(sel == 1) SetLNBShortDetect(sel); } else if(bID == CHANCHG_CHAN_ID) sys_data->chan_sw = sel; else if(bID == CHANCHG_VIDEO_ID) sys_data->chchgvideo_type = sel; else if(bID == INSTALLBEEP_ID) sys_data->ber_printf = sel; else if(bID == AUTO_STANDBY_ID) sys_data->auto_standby_en= sel; /* else if(bID == RAM_TMS_ID) sys_data->ram_tms_en = sel; */ #ifdef ORDER_GZ1207009 else if(bID == AUTO_STANDBY_MODE_ID) sys_data->standbymode=sel; #endif break; case EVN_REQUEST_STRING: sel = param1; Uni_str= (UINT16*)param2; switch(bID) { case AUTO_STANDBY_ID: ComAscStr2Uni(auto_stdy_onoff_stings[sel], Uni_str); break; } break; } return ret; }
void power_off_process(void) { struct YCbCrColor bgcolor; extern struct rfm_device* g_rfm_dev; extern struct scart_device* g_scart_dev; #ifdef DVR_PVR_SUPPORT api_pvr_clear_up_all(); #endif // SE: Mute before scart power off to avoid noise api_audio_set_mute(TRUE); #if defined(HW_SS830C)||defined(HW_SS830C2) //Wirte GPIO#5 to high to avoid noise (used on SS830C) HAL_GPIO_BIT_DIR_SET(5, HAL_GPIO_O_DIR); HAL_GPIO_BIT_SET(5, 1); #endif api_Scart_TVSAT_Switch(0); api_Scart_Power_OnOff(0); api_Scart_RGB_OnOff(0);/*CVBS mode*/ #ifdef VDAC_USE_SVIDEO_TYPE api_Svideo_OnOff(0); #endif api_Scart_OutPut_Switch(0); SetLNBShortDetect(0); Set12VShortDetect(0); api_LNB_power(0); #if(SYS_12V_SWITCH == SYS_FUNC_ON) api_diseqc_set_12v(g_nim_dev, 0); #endif #ifdef USB_MP_SUPPORT if(system_state == SYS_STATE_USB_MP) { ap_udisk_close(); } #endif #ifndef NEW_DEMO_FRAME if(hde_get_mode() != VIEW_MODE_MULTI) UIChChgStopProg(TRUE); #endif #if (TTX_ON == 1) ttx_enable(FALSE); #endif #if (SUBTITLE_ON == 1) subt_enable(FALSE); #endif sie_close(); OSD_ShowOnOff(OSDDRV_OFF); #ifdef NEW_DEMO_FRAME sim_close_monitor(0); #else si_monitor_off(0xFFFFFFFF); #endif stop_tdt(); epg_off(); vpo_win_onoff(g_vpo_dev, FALSE); #ifdef DUAL_VIDEO_OUTPUT if(g_sd_vpo_dev != NULL) vpo_win_onoff(g_sd_vpo_dev,TRUE); #endif dm_set_onoff(0); bgcolor.uY = 16; bgcolor.uCb = 128; bgcolor.uCr = 128; vpo_ioctl(g_vpo_dev,VPO_IO_SET_BG_COLOR,(UINT32)&bgcolor); //close drivers dmx_stop( g_dmx_dev); dmx_close( g_dmx_dev); if (g_dmx_dev2) { dmx_stop(g_dmx_dev2); dmx_close(g_dmx_dev2); } deca_stop(g_deca_dev,0,ADEC_STOP_IMM); deca_close(g_deca_dev); vdec_close(g_decv_dev); // Power HDMI phy at standby mode. #ifdef HDTV_SUPPORT struct hdmi_device *hdmi_dev; hdmi_dev = (struct hdmi_device *)dev_get_by_id(HLD_DEV_TYPE_HDMI, 0); if (hdmi_dev != NULL) { if (SUCCESS != hdmi_dev->close(hdmi_dev)) { PRINTF("hdmi_close failed!!\n"); ASSERT(0); } } #endif vpo_close(g_vpo_dev); #ifdef DUAL_VIDEO_OUTPUT if(RET_SUCCESS!=vpo_close((struct vpo_device *)dev_get_by_id(HLD_DEV_TYPE_DIS, 1))) ASSERT(0); #endif snd_close(g_snd_dev); nim_close(g_nim_dev); if(g_nim_dev2) nim_close(g_nim_dev2); if(g_rfm_dev) rfm_close(g_rfm_dev); #if (SYS_MAIN_BOARD == BOARD_M3329E_DEMO01V01 || SYS_MAIN_BOARD == BOARD_DB_M3602_02V01 || SYS_MAIN_BOARD == BOARD_DB_M3602_04V01) if(g_scart_dev) scart_close(g_scart_dev); #endif led_display_flag = 0; #if (SYS_MAIN_BOARD == BOARD_S3602_DEMO) // Power off HAL_GPIO_BIT_DIR_SET(25, HAL_GPIO_O_DIR); HAL_GPIO_BIT_SET(25, 0); #elif (SYS_MAIN_BOARD == BOARD_DB_M3602_02V01 || SYS_MAIN_BOARD == BOARD_DB_M3602_04V01) // Power off /*alfred.wu 不允许ali的power off*/ /* HAL_GPIO_BIT_DIR_SET(61, HAL_GPIO_O_DIR); HAL_GPIO_BIT_SET(61, 1); // Tuner LNB power off HAL_GPIO_BIT_DIR_SET(73, HAL_GPIO_O_DIR); HAL_GPIO_BIT_SET(73, 1); *//*end*/ #endif }