⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 display.c

📁 以ST公司CPU为核心的彩色电视机的完整源程序。
💻 C
📖 第 1 页 / 共 2 页
字号:
#include "utility.h"
#include "alarm.h"
#include "clock.h"
#include "display.h"
#include "menuctrl.h"
#include "osdchar.h"
#include "osdutil.h"
#include "eeprom.h"
#include "i2c_bus.h"
#include "register.h"
#include "sleep.h"
#include "timer.h"
#include "service.h"
#include "macro.h"
#include "video.h"
#include "source.h"
#include "audio.h"
#include "channel.h"
#include "tuning.h"
#include "ir.h"
#include "autosrch.h"
#include "tv_glob.h"
#include "st92196.h"
//feman add
#include "osdconst.h"
#include "osddrv.h"

unsigned char language;


/*****************************************************************************
INPUTS     : none
OUTPUTS    : ST9 OSD registers
DESCRIPTION: This function initializes the display cell for TV mode (Menu,
		     Stats...) 
*****************************************************************************/
void init_display(void)   
{   

    transfer_screan_header(&screen_all_header);
	
	hpos_osd = read_eeprom(EEPROM_HPOS_OSD);
	vpos_osd = read_eeprom(EEPROM_VPOS_OSD) & 0x3f;

	if (vpos_osd > VERT_OFFSET)
		vpos_osd_60 = vpos_osd - VERT_OFFSET;
	else
		vpos_osd_60 = 0x01;

}

/*****************************************************************************
INPUTS     : STATUS_TIMER - Status display time-out
	     VOLUME_TIMER - Volume display time-out
			 MENU_TIMER - Menu display time-out
	     display_request_flags - Request specific display (status,menu...)
	     previous_display_request_flags - Previous request
OUTPUTS    : previous_display_request_flags - Keep track of the current request
	     see specific functions called by this function
DESCRIPTION: This function handles the display. Setting and clearing OSD
	     according to display request flags.
*****************************************************************************/
void update_display_manager(void)
{
    unsigned int i;                 /* Temporary storage */

    /* Update status time-out */
    if (slow_timers[STATUS_TIMER] == 0x00)
        {
        if(display_request_flags & NORMAL_ON_DISPLAY)
            {
            osd_disabled();
            display_request_flags &= ~NORMAL_ON_DISPLAY;            
            }               
#ifdef NICAM
        if(display_request_flags & NICAM_ON_DISPLAY)
            {
            osd_disabled();
            tv_flags = tv_flags & ~FORCE_NICAM_STD ;
            display_request_flags &= ~NICAM_ON_DISPLAY;            
            }               

        display_request_flags = display_request_flags & ~(NICAM_STANDARD_DISPLAY|LANGUAGE_DISPLAY);
#endif  
        display_request_flags = display_request_flags & ~(STATUS_DISPLAY|SLEEP_DISPLAY|NORMAL_DISPLAY|PROGRAM_DISPLAY);
        }

    /* Update commercial time-out */
    if (slow_timers[COMMERCIAL_TIMER] == 0x00)
        display_request_flags = display_request_flags & ~COMMERCIAL_DISPLAY;

    if (!(tv_flags & INITIAL_SETUP)  && !(tv_flags & TELETEXT_ACTIVE))    
        {
        /* Update the display if something has changed */
        if (previous_display_request_flags != display_request_flags)
            {
            /* --------------- Clear items --------------- */
            i =  previous_display_request_flags & ~display_request_flags;

            if (i & (STATUS_DISPLAY|SLEEP_DISPLAY|NORMAL_DISPLAY|PROGRAM_DISPLAY|MUTE_DISPLAY))
                if(!(display_request_flags & MENU_DISPLAY))     
                    osd_disabled();
#ifdef NICAM
            if (i & (NICAM_STANDARD_DISPLAY|LANGUAGE_DISPLAY))
                if(!(display_request_flags & MENU_DISPLAY))     
                    osd_disabled();
#endif											  
              if (i &   COMMERCIAL_DISPLAY)
                {       
                if(!(display_request_flags & MENU_DISPLAY))     /*2.19*/
                    osd_disabled();
                }

            if (i & MENU_DISPLAY)
                    osd_disabled();                    


            if (display_request_flags & (STATUS_DISPLAY|SLEEP_DISPLAY|NORMAL_DISPLAY|PROGRAM_DISPLAY
            |NICAM_STANDARD_DISPLAY|LANGUAGE_DISPLAY | MUTE_DISPLAY))
                {       
                if (!(display_request_flags & MENU_DISPLAY))
                    show_status(); //feman : display av? ,program?,....
                }

            if (display_request_flags &   COMMERCIAL_DISPLAY )
                {
                if (!(display_request_flags&(SERVICE_DISPLAY|MENU_DISPLAY)))
    				show_miscellaneous();
                }

            if (display_request_flags &  MENU_DISPLAY)
                show_menu();

            if (display_request_flags &  SERVICE_DISPLAY)
                 show_service();
            /* Save new request */
            display_request_flags = display_request_flags & ~REFRESH_DISPLAY;
            previous_display_request_flags = display_request_flags;
            }
        }
}


/*****************************************************************************
INPUTS     : SET_TIME
	    sleep_timer
		alarm_on_hour
OUTPUTS    : see get_DRAM_address
	    see display_space
		see display_channel
		see display_label
		see display_standard
		see write_character
		see display_string
		see xcopy
		see enable_display
DESCRIPTION: This function displays at the top of the TV screen, the two
	    status lines.
*****************************************************************************/
void show_status(void)
{
    unsigned char tmphigh,tmplow;
#ifdef NICAM
	unsigned char j,k;    
#endif
    
//    osd_disabled();
    reset_current_screen();
    for(tmphigh=0;tmphigh<4;tmphigh++)
       {
        append_line_to_buffer(&current_statu[tmphigh]);
       }
    
    if(display_request_flags & MUTE_DISPLAY)
        {
            fill_char_in_line(3,0,0x9d,1);
        }
            
	if ((display_request_flags & NORMAL_DISPLAY)&&(!(display_request_flags & NORMAL_ON_DISPLAY)))
	{
		tv_flags = tv_flags & ~FORCE_NICAM_STD ;
        fill_string_in_line(0,4,(unsigned char *)PICTURE_MODE_STRING[normal_flags][language]);
		display_request_flags |= NORMAL_ON_DISPLAY;
	}

#ifdef NICAM

	else 
	    if ((display_request_flags & NICAM_STANDARD_DISPLAY)&&(!(display_request_flags & NICAM_ON_DISPLAY)))
	    {
		if(stereo_std == 0)
		{
			if (!(user_flags & DISPLAY_NICAM_STATUS))
;//				p = display_string_number(p,SYSTEM_STRING[SYSTEM_AUTO],11);
			else
			{
				read_video_new();
				i = read_data[0] & 0x08;
				if ((i== 0x08) && (!(tuning_flags & TUNING_REQUEST))) /* only if IDENT high look for the status */
				{
					i = read_nicam (0x08);
					if (i == 0x10)
;//						p = display_string_number(p,&MONO_STRING[language][0],11);
					if (i == 0x20)
					{
//					  	if (AUDIO_system == SYSTEM_LL1)
//							p = display_string_number(p,&NICAM_LL1_STRING[language][0],11);
//						else
//						{

							if ((mono_sid == 0) && (stereo_sid == 0))/* NICAM BG*/
;//								p = display_string_number(p,&NICAM_BG_STRING[language][0],11);
							if ((mono_sid == 0) && (stereo_sid == 1))/* ZWEITON BG*/
;//								p = display_string_number(p,&ZWEITON_BG_STRING[language][0],11);
							if (mono_sid == 1) /* NICAM I*/
;//								p = display_string_number(p,&NICAM_I_STRING[language][0],11);
							if ((mono_sid == 2) && (stereo_sid == 0))/* NICAM DK same as NICAM BG*/
;//								p = display_string_number(p,&NICAM_DK_STRING[language][0],11);
							if ((mono_sid == 2) && (stereo_sid == 1))/* ZWEITON DK*/
;//								p = display_string_number(p,&ZWEITON_DK_STRING[language][0],11);
//						}
					}
				}
			}
		}
#ifdef NICAM_FORCED
		if(stereo_std == 1)
;//			p = display_string_number(p,&MONO_STRING[language][0],11);
		if(stereo_std == 2)
;//			p = display_string_number(p,&NICAM_BG_STRING[language][0],11);
		if(stereo_std == 3)
;//			p = display_string_number(p,&NICAM_I_STRING[language][0],11);
		if(stereo_std == 4)
;//			p = display_string_number(p,&NICAM_DK_STRING[language][0],11);
		if(stereo_std == 5)
;//			p = display_string_number(p,&NICAM_LL1_STRING[language][0],11);
		if(stereo_std == 6)
;//			p = display_string_number(p,&ZWEITON_BG_STRING[language][0],11);
		if(stereo_std == 7)
;//			p = display_string_number(p,&ZWEITON_DK_STRING[language][0],11);
#ifdef FM_WIDE
		if(stereo_std == 8)
;//			p = display_string_number(p,&FM_DK_WIDE_STRING[language][0],11);
#endif

#endif

		display_request_flags |= NICAM_ON_DISPLAY;
//		xcopy(get_DRAM_address(DISPLAY_CHARACTERS, ROW_3), get_DRAM_address(DISPLAY_CHARACTERS, ROW_2), 1, 40);  

//		p = get_DRAM_address(DISPLAY_CHARACTERS, ROW_4)+26;
		if (user_flags & DISPLAY_NICAM_STATUS)
		{	
			j = read_nicam (0x08);
			if (j == 0x10)
;//				p = write_character_number(p,0x20,40);
			else
			{	
				j = read_nicam (0x0D);
				k = read_nicam (0x0C);
				j = j & 0x8E;
				k = k & 0x47;
				if ((j == 0x80) || (k == 0x46))
;//					p = display_string_number(p,&STEREO_STRING[language][0],11);
				else 
				{	
					if ((j == 0x84) || (k == 0x45))
;//						p = display_string_number(p,&DUAL_STRING[language][0],11);
					else 
					{
						if ((j == 0x82) || (k == 0x44))
;//							p = display_string_number(p,&MONO_STRING[language][0],11);
						else
;//							p = write_character_number(p,0x20,40);
					}
				}
			}
		}
		else
		{
;//			p = write_character_number(p,0x20,40);
		}

	}

	else if ((display_request_flags & LANGUAGE_DISPLAY)&&(!(display_request_flags & NICAM_ON_DISPLAY)))
	{
		if(user_flags & DUAL_1)
;//			p = display_string_number(p,&DUAL1_STRING[language][0],11);
		else 
;//			p = display_string_number(p,&DUAL2_STRING[language][0],11);

		tv_flags = tv_flags & ~FORCE_NICAM_STD ;
		display_request_flags |= NICAM_ON_DISPLAY;
//		xcopy(get_DRAM_address(DISPLAY_CHARACTERS, ROW_3), get_DRAM_address(DISPLAY_CHARACTERS, ROW_2), 1, 40);  
//		p = get_DRAM_address(DISPLAY_CHARACTERS, ROW_4);
//		p = write_character_number(p,0x20,40);
	}

#endif
//nicam end;
	else
	{
	tv_flags = tv_flags & ~FORCE_NICAM_STD ;
//display sleep time    
    if(display_request_flags & SLEEP_DISPLAY)
	    {
	    fill_string_in_line(0,2,(unsigned char *)SLEEP_STRING[language]);
        if(sleep_timer)
            {
	        tmphigh = sleep_timer/60;
	        tmplow  = sleep_timer - (tmphigh*60);
            display_clock(0,8,tmphigh,tmplow);
	        }
	    else
        fill_string_in_line(0,8,(unsigned char *)ON_OFF_STRING[1][language]);
	    }
    else
        { //display program and pal ...
            if(display_request_flags & PROGRAM_DISPLAY)
                {
                if(channel_tens==DISABLE_CHANNEL)
                    fill_char_in_line(0,0,0xa4,2);
                else
                    {
                    fill_char_in_line(0,0,channel_tens+0x30,1);
                    fill_char_in_line(0,1,0xa4,1);
                    }
                }
            
            else
                if(display_request_flags & STATUS_DISPLAY)
                {
                if(source != TUNER)
                    fill_string_in_line(0,0,(unsigned char *)AV_STRING[source-1][language]);
	            else
	                {
                    display_value(0,0,channel);
                    fill_string_in_line(1,0,(unsigned char *)SYSTEM_STRING[system]);
	                fill_string_in_line(2,0,(unsigned char *)AUDIO_SYSTEM_STRING[AUDIO_system]);
	                }
                }
        
        }  
    }

set_current_screen();
osd_enabled();

}

/*****************************************************************************
INPUTS     : MUTE_DISPLAY
	     VOLUME_DISPLAY
	     COMMERCIAL_SKIP_DISPLAY
OUTPUTS    : see get_DRAM_address
	     see display_space
	     see write_character
	     see display_scale
	     see display_timer
	     see display_string
	     see xcopy
DESCRIPTION: This function displays miscellaneous info at the botom of the
	     TV screnn (MUTE    VOLUME ).
*****************************************************************************/
void show_miscellaneous(void)
{
	unsigned char tmphigh;                       /* Temporary pointer */
	if (display_request_flags & COMMERCIAL_DISPLAY)
	    {
#ifdef NICAM
;//		display_value_bar(&VOLUME_STRING[language][0],GREEN_BLUE,pwmout);
#else
    	//display_value_bar(&VOLUME_STRING[language][0],GREEN_BLUE,volume);
	      /* request mute */
    reset_current_screen();
    menu_page = MENU_PICTURE;
    menu_item = ITEM_BRIGHTNESS;
    show_info_bar_display();
    set_current_screen();
    osd_enabled();
#endif
        }
    else 
	{
	if (!(display_request_flags & NICAM_STANDARD_DISPLAY))
		tv_flags = tv_flags & ~FORCE_NICAM_STD ;

    reset_current_screen();
        for(tmphigh=0;tmphigh<3;tmphigh++)
            {
            append_line_to_buffer(&blockstatu[tmphigh]);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -