fsosd.c

来自「ESS3890+SL原代码(1*16内存)」· C语言 代码 · 共 1,013 行 · 第 1/2 页

C
1,013
字号
	    tmp |= bcd_num_of_track;	}	/* tmp = track | '/' | num_of_track */		for (i = 6; i >= 0; i--) {	    OSD_new_track[i] = T_digit2ascii[tmp&0xf];	    tmp >>= 4;	}                OSD_update_regions |= OSD_TRACK_REGION_MASK;    } #endif /* PLAY20 */    /* Actual updating of OSD's DRAM locations */    OSD_copy_data(0);}/* *  OSD_time_track(): *  This function turns on the flags for displaying OSD time and/or track. * *  Inputs: *      time_track_mask - Mask specifying whether to set time and/or track *                        regions for display. (see example below) *          Example:  *              1. OSD_TIME_REGION_MASK|OSD_TRACK_REGION_MASK: show both time & track *              2. OSD_TIME_REGION_MASK:    show time only *              3. OSD_TRACK_REGION_MASK:   show track only *      duration -  Specifies the length of time(in seconds) to display *                  the time and track information. If '0' is specified then  *                  the time will be displayed indefinitely until explicitly  *                  cleared. */voidOSD_time_track(unsigned short time_track_mask, int duration){    OSD_displayed_regions |= time_track_mask;    if (duration#ifdef BILINGUAL_OSD	&& (duration != OSD_KEEP_TIMEOUT)#endif	) {	if (time_track_mask & OSD_TIME_REGION_MASK)	    OSD_schedule_time[OSD_TIME_REGION-1] = glbTimer + 						   ((int)ONE_SECOND * duration);	if (time_track_mask & OSD_TRACK_REGION_MASK)	    OSD_schedule_time[OSD_TRACK_REGION-1] = glbTimer + 						   ((int)ONE_SECOND * duration);        OSD_scheduled_regions |= time_track_mask;  /* set schedule bits*/    }    else /* Display indefinitely */    {        OSD_scheduled_regions &= ~(time_track_mask);  /* clear schedule bits */    }    }/* *  OSD_clear_region(): *  This function is used to clear a specified OSD region. * *  Inputs: *      region -    OSD region to be cleared (1 to OSD_MAX_REGIONS). */voidOSD_clear_region(int region){    int     i;    char    *string;    unsigned short  tmp_mask;    unsigned short  region_mask = ptrLshift[region-1];      if ( !(OSD_displayed_regions & region_mask) )        return;  /* no osd showing in region..don't bother */    if ( region_mask & (OSD_TIME_REGION_MASK|OSD_TRACK_REGION_MASK) )    {        if (region_mask == OSD_TIME_REGION_MASK) {            string = OSD_new_time;	    	} else { /* TRACK_REGION */            string = OSD_new_track;        }        for (i = 0; i < ( (region_mask == OSD_TIME_REGION_MASK) ?		         OSD_TIME_SIZE : OSD_TRACK_SIZE ); i++)        {            string[i] = ' ';                                    }    } else {         /* Generic OSD region */        EPRINTF(("I'm clearing generic\n"));        for (i = 0; i < OSD_MAX_CHAR; i++)        {	    asm("nop");            OSD_new[i] = ' ';        }        /* Do clean up if this region's message overlapped on other regions */        if ( region_mask & (OSD_SECT_1|OSD_SECT_2) )        {   /* "Unsuppress" regions */	    /* Check adjacent region */	    tmp_mask = region_mask << 1;	    if (OSD_suppressed_regions & tmp_mask) {                 OSD_suppressed_regions &= ~tmp_mask;		/* Check last region in line, if in first section */		if (region_mask & OSD_SECT_1) {		    tmp_mask = region_mask << 2;		    if (OSD_suppressed_regions & tmp_mask) { 			OSD_suppressed_regions &= ~tmp_mask;		    } 		} 	    }         }	                }    OSD_update_regions |= region_mask;    OSD_copy_data(0); /* Clear OSD region */    OSD_displayed_regions &= ~region_mask;}/* *  OSD_clear_all(): *  This function is used to clear all of the OSD regions at once.  *  Calling this function is much more efficient than clearing fifteen  *  regions with repeated calls to OSD_clear_region(). * *  NOTE: moved to osdcore.c.. used in time critical situation. *//* *  OSD_schedule_check(): *  This function is intended to be in a "slow" background task to check *  for osd messages that need to be cleared after time-out. */void OSD_schedule_check(void){#ifdef EQUALIZER    if (EQ_refresh()) return;#endif    if (OSD_scheduled_regions) {        int i;        unsigned short region_mask;         for (i = 0; i < OSD_MAX_REGIONS; i++) {            region_mask = ptrLshift[i];            if ( (OSD_scheduled_regions & region_mask) &&                 (OSD_schedule_time[i] < glbTimer) ) {                OSD_clear_region(i+1);                OSD_scheduled_regions &= ~region_mask;            }        }	#ifdef PLAYONLY	if (disableOsd) {	/* Delayed clearing of vcx_osd_on	*/	    vcx_osd_on = 0;	    disableOsd = 0;	}#endif    }}#ifdef ECHO/* * OSD for echo. We support up to 15 levels. */#define ECHO_LEVEL_POS	6unsigned char echo_msg[] = "ECHO +0 ";#ifdef BILINGUAL_OSD#ifdef USE_CN_HEADER#define CECHO_LEVEL_POS	6unsigned char c_echo_msg[] = {CN_HEADER,CN_HUI2, CN_HEADER,CN_SHENG1, 			      ' ', '+', '0', ' ', 0};#else#define CECHO_LEVEL_POS	4unsigned char c_echo_msg[] = {CN_HUI2, CN_SHENG1, ' ', '+', '0', ' ', 0};#endif /* USE_CN_HEADER */#endif /* BILINGUAL_OSD */void OSD_echo(){    int tmp, pos, cpos;    int region;    region = OSD_KARAOKE_REGION;#ifdef MP3    /* for MP3, don't want to conflict with NPOSD region */    if (STREAM_type) region = 7;#endif    if (vcx_echo == -1) {        OUTOSD(region, MSG_mic_off, MSG_c_mic_off, 5);    } else {	if (vcx_echo == 0){            OUTOSD(region, MSG_mic_on, MSG_c_mic_on, 5);	} else {	    tmp = vcx_echo;	    pos = ECHO_LEVEL_POS;#ifdef BILINGUAL_OSD	    cpos = CECHO_LEVEL_POS;#endif	    if (vcx_echo >= 10) {		echo_msg[ECHO_LEVEL_POS] = '1';#ifdef BILINGUAL_OSD		c_echo_msg[CECHO_LEVEL_POS] = '1';#endif		tmp -= 10;		pos++;		cpos++;	    }	    	    echo_msg[ECHO_LEVEL_POS+1] = ' ';	    echo_msg[pos] = '0' + tmp;#ifdef BILINGUAL_OSD	    c_echo_msg[CECHO_LEVEL_POS+1] = ' ';	    c_echo_msg[cpos] = '0' + tmp;#endif            OUTOSD(region, echo_msg, c_echo_msg, 5);	}    }}#endif /* #ifdef ECHO *//* * Display pitch/volume bar. 8 characters, one space, +/- level */static unsigned char pitchbarbuf[16];void OSD_pitch_bar(level)int level;{    int i;    int region;    region = OSD_KARAOKE_REGION;#ifdef MP3    /* for MP3, don't want to conflict with NPOSD region */    if (STREAM_type) region = 7;#endif    for (i = 0; i < 15; i++) {	asm("nop");	pitchbarbuf[i] = FONT_KEYSCALE;    }        pitchbarbuf[15]	 = '\0';    pitchbarbuf[0]       = FONT_KEYLOW;     pitchbarbuf[7]       = FONT_KEYMID;    pitchbarbuf[14]      = FONT_KEYHIGH;    pitchbarbuf[level+7] = FONT_KEYCURR;    OUTOSD(region, pitchbarbuf, pitchbarbuf, 5);}#ifdef PLAY20void OSD_digest_menu(int selection){    char * line_1, * line_2;#ifdef BILINGUAL_OSD    char * c_line_1, * c_line_2;#endif    if (selection == 2) {	assign_osd_msg(line_1, MSG_intro_1_disc_X, c_line_1, 		       MSG_c_intro_1_disc_X);	assign_osd_msg(line_2, MSG_track_X_exit_4, c_line_2,		       MSG_c_track_X_exit_4);    }    else {	assign_osd_msg(line_1, MSG_intro_1_disc_2, c_line_1, 		       MSG_c_intro_1_disc_2);	assign_osd_msg(line_2, MSG_track_3_exit_4, c_line_2,		       MSG_c_track_3_exit_4);    }            OUTOSD(OSD_DIGEST_REGION, MSG_digest_menu, MSG_c_digest_menu, 0);    OUTOSD(1, line_1, c_line_1, 0);    OUTOSD(4, line_2, c_line_2, 0);}#endif /* PLAY20 */#ifdef BILINGUAL_OSD/* * Toggling OSD language * Chinese -> English -> Chinese */void OSD_language_change(void){    extern int DiscMode;    int i, k = 1;    unsigned short displayed_region;        if (OSD_language == ENGLISH_OSD) {	OSD_language = CHINESE_OSD;	if (OSD_displayed_regions) {	    displayed_region = OSD_displayed_regions;	} else 	    displayed_region = 0;    } else {	displayed_region = OSD_displayed_regions;	OSD_language = ENGLISH_OSD;	OUTOSD(4, "ENGLISH", "", 3);    }     for (i = 0; i < OSD_MAX_REGIONS; i++) {	if (displayed_region & k)	    OUTOSD(i+1, english_ptr[i], chinese_ptr[i], 		   OSD_KEEP_TIMEOUT);	k = k << 1;    }	#ifdef PLAY20    if (DiscMode & DISC_OSD_ON)	OSD_time_track(OSD_TIME_REGION_MASK|OSD_TRACK_REGION_MASK, 0);#endif    OSD_update_info();}#endif /* BILINGUAL_OSD */#ifdef NON_PLAY_OSD/**************************************************************** ================================================================ ============ NON-PLAY OSD and related functions =============== ================================================================ **************************************************************** *//*============================================================== * Driver routines that sets up the extra 6 lines of OSD, These * six lines are used when the disk is stopped only.  Right now * all PSD & ABV memory are being used for the added * OSD display.  This 5 line configuration used to be called * Non-Play OSD.  So all of these driver routines start with * "NPOSD".  NPOSD is display only when the CD is stopped.  Rather * than the "regions" definition that's used by nomal OSD, NPOSD * uses a x-y grid.  Every character can be reference to a x-y * locations.  X can take on values between 0 and 19; Y can take * values between 0 and 5.   *=============================================================== *//* void NPOSD_output(int x, int y, unsigned char *osd_msg) * X:        colomn number * Y:        row number * osd_msg:  message array to be displayed */void NPOSD_output(int x, int y, unsigned char *osd_msg){    int i = 0;    int offset = 0;    int big, head, dest_even, dest_odd;    unsigned int ctmp;    head = (y * OSD_DRAM_DX * OSD_CHAR_HEIGHT/2) << 2;    /* question, why shift << 2 ?      * answer: dword address to byte address     */    head += (x << 2) + (x << 1); /* 6x */    while (osd_msg[i] != '\0' && i < OSD_MAX_CHAR) {        ctmp = osd_msg[i];#ifdef USE_CN_HEADER        big = (ctmp == CN_HEADER);        if(big) {	    ctmp = osd_msg[i+1];	}#else        big = (ctmp >= FONT_CSTART);#endif /* USE_CN_HEADER */        dest_even = (head + (NPOSD_DRAM_START<<2)) + 	    (offset << 2) + (offset << 1);        OSD_copy_one_char(ctmp, big, dest_even, OSD_DRAM_DX);        if(big) offset++; /* big occupies 2 char size */                    i++;        offset++;    }    OSD_displayed_regions |= NPOSD_MASK;    return;}/* void NPOSD_clear_all(void) * clears all NPOSD display */void NPOSD_clear_all(void){    if (OSD_displayed_regions & NPOSD_MASK)	dram_clear(NPOSD_DRAM_START, NPOSD_DRAM_SIZE);     /* Clearing status bits */    OSD_displayed_regions &= ~NPOSD_MASK;    return;}#endif /*NON_PLAY_OSD*/#ifdef DEBUG_OSDvoid debug_osd(char *string, unsigned int data, int region){    char *ptr;    int i = 0, j, digits=0, tmp;    char osdbuf[21];    char hex2ascii[] = {	'0', '1', '2', '3',	'4', '5', '6', '7',	'8', '9', 'A', 'B',	'C', 'D', 'E', 'F'    };    ptr = string;    while (*ptr) osdbuf[i++] = *ptr++;    osdbuf[i++] = '0';    osdbuf[i++] = 'X';    for (j = 0; j < 7; j++) {	tmp = data>>28;	if (tmp || digits) {	    osdbuf[i++] = hex2ascii[tmp];	    digits++;	}	if (i > 19) break;	data <<= 4;    }    tmp = data>>28;    osdbuf[i++] = hex2ascii[tmp];    osdbuf[i] = 0;    OUTOSD(region, osdbuf, osdbuf, 5);}#endif /* DEBUG_OSD */#ifdef NOT_USED/* void NPOSD_clear(int x, int y, int msg_length) * clears NPOSD starting at (x,y) for the length of msg_length. */void NPOSD_clear(int x, int y, int msg_length){    int i;    int head, dest_even, dest_odd;    head = (y * OSD_DRAM_DX * OSD_CHAR_HEIGHT/2) << 2;    head += (x << 2) + (x << 1);    for (i = 0; i < msg_length; i++) {        dest_even = (head + (NPOSD_DRAM_START<<2)) + (i << 2) + (i << 1);	/* duplicated fonts */        OSD_copy_one_char(FONT_SPACE, 0, dest_even, OSD_DRAM_DX);    }    return;}/* *  OSD_clear_line(): *  This function is used to clear a specified OSD line. * *  Inputs: *      line_index -   	index of OSD line to be cleared. *	line_mask -	mask values of the regions in the line. */void OSD_clear_line(int line_index, unsigned short line_mask){    int i, region_index;    unsigned int region_mask;        for (i = 0; i < OSD_MAX_CHAR; i++)    {            OSD_new[i] = ' ';    }    region_index = OSD_REGIONS_PER_LINE * line_index;     region_mask = ptrLshift[region_index];    OSD_update_regions |= (unsigned short)region_mask;    OSD_regions[region_index].end = OSD_MAX_CHAR;    OSD_copy_data(1);  /* clear DRAM */    /* Clearing status bits */    OSD_displayed_regions &= ~line_mask;    OSD_scheduled_regions &= ~line_mask;    OSD_suppressed_regions &= ~line_mask;}#endif /* NOT_USED */

⌨️ 快捷键说明

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