?? lcd_osd_ktc.c
字號:
#define __OSD__
#include "reg52.h"
#include "MAIN_DEF.H"
#include "CONFIG.H"
#include "ACCESS.H"
#include "LCD_FUNC.H"
#include "LCD_AUTO.H"
#include "LCD_MSG.H"
#include "LCD_MAIN.H"
#include "LCD_OSD.H"
#include "FONT.H"
#include "OSD_KTC.H"
#include "MTV512.H"
#if (TV_CHIP != TV_NONE)
#include "TUNER.H"
#endif
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
// OSD Process Dispatch Table
// In this code, when input source is not VGA, AUTO CONFIG page will not be shown.
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
code void (*OSD_Proc[][SOURCE_MAX + 1])(unsigned char action) =
{
// VGA Pages DVI Pages AV Pages SV Pages YUV Pages TV Pages
{ OSD_Proc0, OSD_Proc0, OSD_AV_Proc0, OSD_AV_Proc0, OSD_AV_Proc0, OSD_TV_Proc0 },
{ OSD_Proc1, OSD_Proc1, OSD_AV_Proc1, OSD_AV_Proc1, OSD_AV_Proc1, OSD_AV_Proc1 },
{ OSD_Proc2, OSD_Proc2, 0, 0, 0, OSD_TV_Proc2 },
{ OSD_Proc3, OSD_Proc3, 0, 0, 0, 0 },
{ OSD_Proc4, OSD_Proc4, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0 },
{ OSD_Proc8, OSD_Proc8, 0, 0, 0, 0 }
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
// OSD Process Public Function
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Get_OSD_Margin(void)
{
unsigned char ucH_Min, ucH_Max, ucV_Max;
#if (DISP_ALIGN)
RTDRead(DH_ACT_STA_27, 0x02, Y_INC);
Data[2] = Data[1] & 0x07;
Data[3] = Data[0];
ucH_Min = ((((unsigned int *)Data)[1] - 16) / 6) + 1;
ucH_Max = OSD_HMAX;
#else
RTDRead(DH_ACT_END_29, 0x02, Y_INC);
Data[2] = Data[1] & 0x07;
Data[3] = Data[0];
ucH_Max = ((((unsigned int *)Data)[1] - 312 - 8 - 16) / 6) + 1;
ucH_Min = OSD_HMIN;
#endif
RTDRead(DV_ACT_END_34, 0x02, Y_INC);
Data[2] = Data[1] & 0x07;
Data[3] = Data[0];
ucV_Max = (((unsigned int *)Data)[1] - DV_ACT_STA_POS - 270 - 14) / 4;
Data[0] = ucH_Min;
Data[1] = ucH_Max;
Data[2] = OSD_VMIN;
Data[3] = ucV_Max;
}
// OSD_Position : Restore OSD position according to global settings
void OSD_Position(void)
{
Get_OSD_Margin();
if (Data[0] > stGUD1.OSD_POSH || Data[1] < stGUD1.OSD_POSH ||
Data[2] > stGUD1.OSD_POSV || Data[3] < stGUD1.OSD_POSV)
{
stGUD1.OSD_POSV = OSD_VMID;
stGUD1.OSD_POSH = OSD_HMID;
Save_GUD1();
}
Wait_For_Event(EVENT_DEN_STOP);
Data[0] = 5;
Data[1] = Y_INC;
Data[2] = OSD_ROW_90;
Data[3] = 0xaf;
Data[4] = 0x0c;
Data[5] = 5;
Data[6] = N_INC;
Data[7] = OSD_DATA_92;
Data[8] = stGUD1.OSD_POSV;
Data[9] = stGUD1.OSD_POSH;
Data[10] = 0;
RTDWrite(Data);
}
void OSD_Line(unsigned char row, unsigned char col, unsigned char length,
unsigned char value, unsigned char indicate)
{
Data[0] = 5;
Data[1] = Y_INC;
Data[2] = OSD_ROW_90;
Data[3] = indicate ? (0x80 | row) : (0xa0 | row); // indicate : 0 - Attribute, otherwise - Display
Data[4] = col;
Data[5] = 0;
RTDWrite(Data);
Data[0] = 15;
Data[1] = N_INC;
Data[2] = OSD_DATA_92;
Data[3] = value;
Data[4] = value;
Data[5] = value;
Data[6] = value;
Data[7] = value;
Data[8] = value;
Data[9] = value;
Data[10] = value;
Data[11] = value;
Data[12] = value;
Data[13] = value;
Data[14] = value;
Data[15] = 0;
while (12 <= length)
{
RTDWrite(Data);
length -= 12;
}
if (length)
{
length = length + 3;
Data[0] = length;
Data[length] = 0;
RTDWrite(Data);
}
}
void OSD_Clear(unsigned char row_start, unsigned char height, unsigned char col_start, unsigned char width)
{
if (height && width)
{
do
{
OSD_Line(row_start, col_start, width, 0x00, 1); // Display
OSD_Line(row_start, col_start, width, 0x00, 0); // Attribute
row_start++;
}
while (--height);
}
}
// BE CAREFUL !!
// length must be larger than 2 (left and right border of slider)
// value must be small than or equal to range
void OSD_Slider(unsigned char row, unsigned char col, unsigned char length, unsigned char value, unsigned char range,
unsigned char color)
{
unsigned int bound;
OSD_Line(row, col, length + 4, color, 0x00); // Set Slider Attribute. 4 extra columns for space/numbers/space
length = length - 2;
bound = length * value;
// Left Border
Data[0] = 6;
Data[1] = Y_INC;
Data[2] = OSD_ROW_90;
Data[3] = 0x80 | row;
Data[4] = col;
Data[5] = 0x30;
Data[6] = 0;
RTDWrite(Data);
for (row = 1; row <= length; row++)
{
Data[4] = col + row;
if (bound)
{
if (bound >= range)
{
Data[5] = 0x37;
bound = bound - range;
}
else
{
color = (bound << 4) / range;
bound = 0;
if (4 > color)
Data[5] = 0x32;
else if (7 > color)
Data[5] = 0x33;
else if (10 > color)
Data[5] = 0x34;
else if (13 > color)
Data[5] = 0x35;
else
Data[5] = 0x36;
}
}
else
{
Data[5] = 0x31;
}
RTDWrite(Data);
}
range = value / 10;
row = value - (range * 10); // x1
color = range / 10; // x100
range = range - (color * 10); // x10
row = row + _0_;
range = (range || color) ? range + _0_ : 0x00;
color = color ? color + _0_ : 0x00;
// Right Border, Space and Number
Data[0] = 8;
Data[1] = N_INC;
Data[2] = OSD_DATA_92;
Data[3] = 0x38; // Right Border
Data[4] = color; // Number x100
Data[5] = range; // Number x10
Data[6] = row; // Number x1
Data[7] = 0x00; // Space
Data[8] = 0;
RTDWrite(Data);
}
void OSD_Opening(void)
{
#if (1)
RTDCodeW(OSD_Enable);
#else
// For OSD animetion
RTDCodeW(Palette_Open);
RTDCodeW(Palette_1);
RTDCodeW(OSD_Enable);
Delay_Xms(16);
Wait_For_Event(EVENT_DEN_STOP); // Wait for Frame End
RTDCodeW(Palette_2);
Delay_Xms(16);
Wait_For_Event(EVENT_DEN_STOP); // Wait for Frame End
RTDCodeW(Palette_3);
Delay_Xms(28);
Wait_For_Event(EVENT_DEN_STOP); // Wait for Frame End
RTDCodeW(Palette_4);
Delay_Xms(28);
Wait_For_Event(EVENT_DEN_STOP); // Wait for Frame End
RTDCodeW(Palette_5);
Delay_Xms(28);
Wait_For_Event(EVENT_DEN_STOP); // Wait for Frame End
RTDCodeW(Palette_6);
Delay_Xms(28);
Wait_For_Event(EVENT_DEN_STOP); // Wait for Frame End
RTDCodeW(Palette_7);
RTDCodeW(Palette_Close);
#endif
}
void OSD_Ending(void)
{
#if (0)
// For OSD animetion
unsigned char ucTemp;
// First, clear debug information drawn by OSD_Show_Check()
OSD_Line(13, 2, 24, 0x00, 0);
OSD_Line(13, 2, 24, 0x00, 1);
// Close unused window
OSD_Window(0, 0, 0, 0, 0, 0, 0);
OSD_Window(1, 0, 0, 0, 0, 0, 0);
OSD_Window(2, 0, 0, 0, 0, 0, 0);
OSD_Line(11, 2, 24, 0x00, 0);
OSD_Line(11, 2, 24, 0x00, 1);
for (ucTemp = 0; ucTemp < 5; ucTemp ++)
{
OSD_Line(ucTemp, 2, 24, 0x00, 0); // Attribute
OSD_Line(ucTemp, 2, 24, 0x00, 1); // Display
OSD_Line(10 - ucTemp, 2, 24, 0x00, 0); // Attribute
OSD_Line(10 - ucTemp, 2, 24, 0x00, 1); // Display
OSD_Window(3, ucTemp + 1, 9 - ucTemp, 2, 25,
OSD_WINDOW_ENABLE | OSD_WINDOW_SHADOWING, COLOR_CYAN); // Main OSD window
Wait_For_Event(EVENT_DEN_STOP); // Wait for Frame End
}
OSD_Line(5, 2, 24, 0x00, 0); // Attribute
OSD_Line(5, 2, 24, 0x00, 1); // Display
for (ucTemp = 0; ucTemp < 12; ucTemp += 2)
{
OSD_Window(3, 5, 5, ucTemp + 3, 23 - ucTemp,
OSD_WINDOW_ENABLE | OSD_WINDOW_SHADOWING, COLOR_CYAN);
Wait_For_Event(EVENT_DEN_STOP); // Wait for Frame End
}
#endif
}
void Show_Note(void)
{
RTDSetByte(HOSTCTRL_02, 0x40); // Wake RTD up
RTDCodeW(OSD_Reset);
Get_OSD_Margin();
Data[8] = Data[2];
Data[9] = Data[0] + 2;
Data[0] = 5;
Data[1] = Y_INC;
Data[2] = OSD_ROW_90;
Data[3] = 0xaf;
Data[4] = 0x0c;
Data[5] = 5;
Data[6] = N_INC;
Data[7] = OSD_DATA_92;
Data[10] = 0;
RTDWrite(Data);
// When input format changed, OSD will be cleared by Detect_VGA_Mode() and Detect_AV_Mode()
#if (VIDEO_CHIP != VDC_NONE)
switch (stGUD1.INPUT_SOURCE & 0x07)
{
case SOURCE_VGA:
RTDCodeW(OSD_RGB); // OSD RGB note
break;
case SOURCE_AV:
RTDCodeW(OSD_AV); // OSD AV note
break;
case SOURCE_SV:
RTDCodeW(OSD_SV); // OSD S-Video note
break;
case SOURCE_YUV:
RTDCodeW(OSD_YUV); // OSD YUV note
break;
case SOURCE_TV:
RTDCodeW(OSD_TV);
break;
}
#endif
RTDCodeW(OSD_Enable);
#if(IRPOLLING)
usOSD_Timer = (unsigned int)stGUD1.OSD_TIMEOUT * 34;
#else
usOSD_Timer = (unsigned int)stGUD1.OSD_TIMEOUT * 51;
#endif
}
void Show_Hint(void)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -