?? lcd_osd_rel.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_REL.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_Proc4, 0, 0, 0, 0 },
{ OSD_Proc4, OSD_Proc5, 0, 0, 0, 0 },
{ OSD_Proc5, OSD_Proc6, 0, 0, 0, 0 },
{ OSD_Proc6, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0 },
{ OSD_ProcADC, OSD_ProcADC, 0, 0, 0, 0 }
};
unsigned char GetNextPageIdx(unsigned char ucPageCurr)
{
switch (stGUD1.INPUT_SOURCE & 0x07)
{
case SOURCE_VGA :
return (6 <= ucPageCurr) ? 1 : ucPageCurr + 1;
case SOURCE_DVI :
return (5 <= ucPageCurr) ? 1 : ucPageCurr + 1;
case SOURCE_AV :
return (5 <= ucPageCurr) ? 1 : ucPageCurr + 1;
case SOURCE_SV :
return (5 <= ucPageCurr) ? 1 : ucPageCurr + 1;
case SOURCE_YUV :
return (5 <= ucPageCurr) ? 1 : ucPageCurr + 1;
default :
return 1;
}
}
unsigned char GetPrevPageIdx(unsigned char ucPageCurr)
{
switch (stGUD1.INPUT_SOURCE & 0x07)
{
case SOURCE_VGA :
return (1 >= ucPageCurr) ? 6 : ucPageCurr - 1;
case SOURCE_DVI :
return (1 >= ucPageCurr) ? 5 : ucPageCurr - 1;
case SOURCE_AV :
return (1 >= ucPageCurr) ? 5 : ucPageCurr - 1;
case SOURCE_SV :
return (1 >= ucPageCurr) ? 5 : ucPageCurr - 1;
case SOURCE_YUV :
return (1 >= ucPageCurr) ? 5 : ucPageCurr - 1;
default :
return 1;
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
// OSD Process Public Function
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
// OSD_Window : Control OSD Windows
// win_no bit 1 ~ 0 Window Number 0 ~ 3
// row_start bit 3 ~ 0 Window Row Start Address
// row_end bit 3 ~ 0 Window Row End Address
// col_start bit 4 ~ 0 Window Column Start Address
// col_end bit 4 ~ 0 Window Column End Address
// color bit 2 ~ 0 RGB color for window
// attrib bit 2 0 - Disable window 1 - Enable window
// bit 1 0 - Normal intensity 1 - High color intensity
// bit 0 0 - Disable shadowing 1 - Enable shadowing
void OSD_Window(unsigned char win_no, unsigned char row_start, unsigned char row_end,
unsigned char col_start, unsigned char col_end, unsigned char attrib, unsigned char color)
{
if (3 < win_no) return;
Data[0] = 5;
Data[1] = Y_INC;
Data[2] = OSD_ROW_90;
Data[3] = 0xaf;
Data[4] = (win_no << 2) - win_no;
Data[5] = 6;
Data[6] = N_INC;
Data[7] = OSD_DATA_92;
Data[8] = (row_start << 4) | row_end;
Data[9] = (col_start << 3) | color;
Data[10] = (col_end << 3) | attrib;
Data[11] = 0;
RTDWrite(Data);
}
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
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -