Ejemplo n.º 1
0
void rtc_soft_adjust_irq()
{
    unsigned cur_timer = 0;
    OS_CPU_SR  cpu_sr;
    unsigned remainder;
    
    cur_timer = C_TIMER_E;
    
    if(cur_timer < last_timer){
        rtc_soft_counter_hi += 1;
    }
        


    rtc_soft_counter = (unsigned)((double) rtc_start + ((double)cur_timer*rtc_devt*rtc_adj/1000.0) + ((double)rtc_soft_counter_hi * 4294967.296));
    //remainder = ((unsigned)(((double)cur_timer*rtc_devt*rtc_adj) + ((double)rtc_soft_counter_hi * 296.0)))%1000;

    if(!(wr_back_interval--))
    {
        wr_back_interval = WRITE_BACK_INTERVAL;
        
        do{
            cur_timer = C_TIMER_E;
            rtc_soft_counter = (unsigned)((double) rtc_start + ((double)cur_timer*rtc_devt*rtc_adj/1000.0) + ((double)rtc_soft_counter_hi * 4294967.296));
            remainder = ((unsigned)(((double)cur_timer*rtc_devt*rtc_adj) + ((double)rtc_soft_counter_hi * 296.0)))%1000;
            AVTimeDly(2);
        }while(remainder<990)
        
        OS_ENTER_CRITICAL();
        ser_access_write(RTC_COUNTER_ADDR, rtc_soft_counter + 1);
        OS_EXIT_CRITICAL();
    }
Ejemplo n.º 2
0
static int uVideoFmt_SetVideoType(control_t* cntl, cond_item_t* param)
{
    int ret=0;
    uvideofmt_t* uvideofmt = (uvideofmt_t*)(cntl->private_data);
    int fmt = (int)(param[0]);
    int outputmode = (int)(param[1]);
    /* Add Method code here, Set ret to be -1 if fail */
    int displayctl_fd, resolution_data;
    video_appmode_t video_appmode = 
    {
        DISPCTL_MODE_1080P, 
        0, 
        0, 
        0, 
        DISPCTL_MODE_1080P
    };
    page_t *page = af_find_page(SYSTEM_DEFAULT_PAGE);

    if (this_curVideoFmt!=fmt || this_outputmode!= outputmode)
    {
            /* when NTSC/PAL CVBS output is enabled in first 3 video dacs,
             * enable pedestal. Component 480i has pedestal disabled.
             */   
#ifdef AML_NIKE
        fmt = 6;
#endif
#ifndef EDGE_ADJUST
		set_display_edge_adjust(0,0,0,0); 	
#endif
        af_osd_layer_destroy(OSD_LAYER_HW_LAYER0);
        
       
        switch(outputmode)
        {
            case 0://Analog
                clear_mio_mux(5, (1<<0) | (1<<2) | (1<<3) | (1<<4) | (1<<7));
                //disable RGB data
                //clear_mio_mux(4, (1<<20) | (1<<22) | (1<<24));//6bits
                clear_mio_mux(4, (0x3f<<20));//8bits    
#ifdef APOLLO_PMP_TVOUT                            
                clear_mio_mux(4, 0x7c000000);       //disable hdmi output , 
#endif                                           	
                resolution_data = set_analog_output(fmt, &video_appmode);
                break;
                
            case 2://HDMI            	
                clear_mio_mux(5, (1<<0) | (1<<2) | (1<<3) | (1<<4) | (1<<7));
                //disable RGB data
                //clear_mio_mux(4, (1<<20) | (1<<22) | (1<<24));//6bits
                clear_mio_mux(4, (0x3f<<20));//8bits
                resolution_data = set_hdmi_output(fmt, &video_appmode);      
                set_mio_mux(4, 0x7c000000);       //mux GPIOC_28 to hsync, mux GPIOC_29 to vsync, mux GPIOC_30 to DE, mux GPIOC_31 to pixel clock, mux GPIOC_32~GPIOC_55 to HDMI data lines,  
                Codec_PowerDown_Entile_Codec(0);    
                break;

#if (defined APOLLO_PMP_LCD) || (defined NIKE_PMP_LCD)
            case 1://Panel 
				#ifdef EDGE_ADJUST
            	set_display_edge_adjust(0,0,0,0); 	
				#endif
                clear_mio_mux(4, 0x7c000000);       //disable hdmi output , 
                //enable Tcon
                //set_mio_mux(5, (1<<0) | (1<<2) | (1<<3) | (1<<4) | (1<<7) | (1<<8) | (1<<9));
                set_mio_mux(5, (1<<0) | (1<<2) | (1<<3) | (1<<4) | (1<<7));  
                //enable RGB data
                //set_mio_mux(4, (1<<20) | (1<<22) | (1<<24));//6bits
                set_mio_mux(4, (0x3f<<20));//8bits            	                       	
                resolution_data = set_lcd_output(fmt, &video_appmode);
                power_off_USBb();
                break;
#endif
            default:
                AVOS_printf("Please select the valid output mode!\n");
                break;
        }
        

        GF_SetHdmode(cntl, &video_appmode.hdmode);
    	af_set_current_resolution(resolution_data);
        af_init_osd(page);                	
    }
    this_curVideoFmt_Set(fmt);
    if(outputmode<=2&&outputmode>=0)
    {
	    this_outputmode_Set(outputmode);
	}
	
	 ///////////////////////////////////////////
		int video_fd;
		video_fd=open("/dev/video",O_RDONLY);
		//video_appmode_t video_appmode = {DISPCTL_MODE_480P, VIDEO_APPVMODE_480_480, VIDEO_APPHMODE_720, 0, DISPCTL_MODE_VGA};
		video_appmode_t video_appmode2 = {DISPCTL_MODE_480P, VIDEO_APPVMODE_480_480, VIDEO_APPHMODE_720, 0, DISPCTL_MODE_VGA};
		ioctl(video_fd, VIDEOIO_SETAPPMODE, &video_appmode2);
		WRITE_MPEG_REG(VENC_VDAC_SETTING,0);
    power_on_vdac();
 ///////////////////////////////////////////
       
    AVTimeDly(100);
   
    /* end */
    return ret;
}
Ejemplo n.º 3
0
static int 
#else
static void
#endif
hdmi_task_handle(void *data) 
{
    extern void hdmitx_edid_ram_buffer_clear(hdmitx_dev_t*);
    hdmitx_dev_t* hdmitx_device = (hdmitx_dev_t*)data;

    hdmitx_init_parameters(&hdmitx_device->hdmi_info);

    HDMITX_M1B_Init(hdmitx_device);

    //When init hdmi, clear the hdmitx module edid ram and edid buffer.
    hdmitx_edid_ram_buffer_clear(hdmitx_device);

    hdmitx_device->HWOp.SetupIRQ(hdmitx_device);

    if(hdmitx_device->HWOp.Cntl){
        if(init_flag&INIT_FLAG_VDACOFF){
            hdmitx_device->HWOp.Cntl(hdmitx_device, HDMITX_HWCMD_VDAC_OFF, 0);    
        }
        if(init_powermode&0x80){
            hdmitx_device->HWOp.Cntl(hdmitx_device, HDMITX_HWCMD_POWERMODE_SWITCH, init_powermode&0x1f);    
        }
    }
    if(init_flag&INIT_FLAG_POWERDOWN){
        hdmitx_device->HWOp.SetDispMode(NULL); //power down
        hdmitx_device->unplug_powerdown=1;
        if(hdmitx_device->HWOp.Cntl){
            hdmitx_device->HWOp.Cntl(hdmitx_device, HDMITX_HWCMD_TURNOFF_HDMIHW, (hpdmode!=0)?1:0);    
        }
    }
    else{
        if(hdmitx_device->HWOp.Cntl){
            hdmitx_device->HWOp.Cntl(hdmitx_device, HDMITX_HWCMD_MUX_HPD, 0);    
        }
    }
    
    HDMI_DEBUG();

    while (hdmitx_device->hpd_event != 0xff)
    {
        if((hdmitx_device->vic_count == 0)&&(hdmitx_device->mux_hpd_if_pin_high_flag)){
            if(hdmitx_device->HWOp.Cntl){
                hdmitx_device->HWOp.Cntl(hdmitx_device, HDMITX_HWCMD_MUX_HPD_IF_PIN_HIGH, 0);
            }
        }
        
        if((!hdmi_audio_off_flag)&&(hdmitx_device->audio_param_update_flag)&&(hdmitx_device->cur_VIC != HDMI_Unkown)){
            hdmitx_set_audio(hdmitx_device, &(hdmitx_device->cur_audio_param));
            hdmitx_device->audio_param_update_flag = 0;
            hdmi_print(1, "HDMI: set audio param\n");
        }

        if (hdmitx_device->hpd_event == 1)
        {
            if(hdmitx_device->HWOp.GetEDIDData(hdmitx_device)){
                hdmitx_edid_clear(hdmitx_device);
                hdmitx_edid_parse(hdmitx_device);
                set_disp_mode_auto();

                hdmitx_device->hpd_event = 0;
            }    
        }
        else if(hdmitx_device->hpd_event == 2)
        {
            //When unplug hdmi, clear the hdmitx module edid ram and edid buffer.
            hdmitx_edid_ram_buffer_clear(hdmitx_device);
            hdmitx_edid_clear(hdmitx_device);

            if(hdmitx_device->unplug_powerdown){
                hdmitx_set_display(hdmitx_device, HDMI_Unkown);
                if(hdmitx_device->HWOp.Cntl){
                    hdmitx_device->HWOp.Cntl(hdmitx_device, HDMITX_HWCMD_TURNOFF_HDMIHW, (hpdmode!=0)?1:0);    
                }
            }
            hdmitx_device->cur_VIC = HDMI_Unkown;

            hdmitx_device->hpd_event = 0;
        }    
        else{
        }            
#ifdef AVOS
        AVTimeDly(500);
#else
        msleep(500);
#endif        
    }
#ifndef AVOS
    return 0;
#endif    

}