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

📄 lcd_osd.lst

📁 Realtek 公司的RTD2523A芯片原厂source code,没有被修改过的。
💻 LST
📖 第 1 页 / 共 5 页
字号:
C51 COMPILER V6.20c  LCD_OSD                                                               04/15/2004 12:59:12 PAGE 1   


C51 COMPILER V6.20c, COMPILATION OF MODULE LCD_OSD
OBJECT MODULE PLACED IN .\Output\Lcd_osd.obj
COMPILER INVOKED BY: C:\KEIL\C51\BIN\C51.EXE Code\Lcd_osd.c OPTIMIZE(9,SPEED) BROWSE DEBUG OBJECTEXTEND PRINT(.\Output\L
                    -cd_osd.lst) OBJECT(.\Output\Lcd_osd.obj) 

stmt level    source

   1          #define __OSD__
   2          
   3          #include "reg52.h" 
   4          
   5          #include "Header\MAIN_DEF.H"
   6          #include "Header\CONFIG.H"
   7          #include "Header\ACCESS.H"
   8          #include "Header\LCD_FUNC.H"
   9          #include "Header\LCD_AUTO.H"
  10          #include "Header\LCD_MSG.H"
  11          #include "Header\LCD_MAIN.H"
  12          #include "Header\LCD_OSD.H"
  13          #include "Header\FONT.H"
  14          #include "Header\OSD.H"
  15          #include "Header\SRC_CTRL.H"
  16          #include "Header\OSD_TREE.H"
  17          
  18          #if (TV_CHIP != TV_NONE)
              #include "TUNER.H"
              #endif
  21          
  22          //////////////////////////////////////////////////////////////////////////////////////////////////////////
             -////
  23          // OSD Process Dispatch Table
  24          // In this code, when input source is not VGA, AUTO CONFIG page will not be shown.
  25          //////////////////////////////////////////////////////////////////////////////////////////////////////////
             -////
  26          
  27          unsigned char GetNextPageIdx(unsigned char ucPageCurr)
  28          {
  29   1          switch (stGUD1.INPUT_SOURCE & 0x07)
  30   1          {
  31   2          case SOURCE_VGA :
  32   2              return (6 <= ucPageCurr) ? 1 : ucPageCurr + 1;
  33   2          case SOURCE_DVI :
  34   2              return (6 <= ucPageCurr) ? 1 : ucPageCurr + 1;
  35   2          case SOURCE_AV  :
  36   2              return (5 <= ucPageCurr) ? 1 : ucPageCurr + 1;
  37   2          case SOURCE_SV  :
  38   2              return (5 <= ucPageCurr) ? 1 : ucPageCurr + 1;
  39   2          case SOURCE_YUV :
  40   2              return (5 <= ucPageCurr) ? 1 : ucPageCurr + 1;
  41   2          default :
  42   2              return 1;
  43   2          }
  44   1          
  45   1      }
  46          
  47          unsigned char GetPrevPageIdx(unsigned char ucPageCurr)
  48          {
  49   1         switch (stGUD1.INPUT_SOURCE & 0x07)
  50   1          {
  51   2          case SOURCE_VGA :
  52   2              return (1 >= ucPageCurr) ? 6 : ucPageCurr - 1;
C51 COMPILER V6.20c  LCD_OSD                                                               04/15/2004 12:59:12 PAGE 2   

  53   2          case SOURCE_DVI :
  54   2              return (1 >= ucPageCurr) ? 6 : ucPageCurr - 1;
  55   2          case SOURCE_AV  :
  56   2              return (1 >= ucPageCurr) ? 5 : ucPageCurr - 1;
  57   2          case SOURCE_SV  :
  58   2              return (1 >= ucPageCurr) ? 5 : ucPageCurr - 1;
  59   2          case SOURCE_YUV :
  60   2              return (1 >= ucPageCurr) ? 5 : ucPageCurr - 1;
  61   2          default :
  62   2              return 1;
  63   2          }
  64   1      
  65   1      }
  66          
  67          //////////////////////////////////////////////////////////////////////////////////////////////////////////
             -////
  68          // OSD Process Public Function
  69          //////////////////////////////////////////////////////////////////////////////////////////////////////////
             -////
  70          
  71          //  OSD Window : Control OSD Windows
  72          //  win_no     : bit 2 ~ 0   Window Number 0 ~ 7
  73          //  row_start  : bit 10 ~ 0  Window Row Start Address
  74          //  row_end    : bit 10 ~ 0  Window Row End Address
  75          //  col_start  : bit 10 ~ 0  Window Column Start Address
  76          //  col_end    : bit 10 ~ 0  Window Column End Address
  77          //  width      : bit 2 ~ 0   shadow/border width or 3D button thickness in pixel unit 1~8 pixel
  78          //  height     : bit 2 ~ 0   shadow/border height in line unit , it must the same with width for 3D button
             - thickness
  79          //  color      : bit 3 ~ 0   window color index in 16-color LUT
  80          //  color_sb   : bit 7 ~ 4   shadow color or left-top/bottom border color for 3D window
  81          //             : bit 3 ~ 0   border color or right-bottom/top border color
  82          //  gradient   : bit 7       R Gradient Polarity 0 : Decrease  1 : Increase
  83          //             : bit 6       G Gradient Polarity 0 : Decrease  1 : Increase
  84          //             : bit 5       B Gradient Polarity 0 : Decrease  1 : Increase
  85          //             : bit 4 ~ 3   Gradient level      00~11 : 1 step ~ 4 setp per level
  86          //             : bit 2       Enable Red Color Gradient
  87          //             : bit 1       Enable Green Color Gradient
  88          //             : bit 0       Enable Blue Color Gradient
  89          //  gra_level  : bit 2~0     111 ~ 001 : 7 level ~ 1 level per gradient, 000 : 8 level per gradient
  90          //  attr       : bit 6       1 - Enable Gradient function      0 - Disable Gradient function
  91          //             : bit 5       1 - Vertical Gradient             0 - Horizontal Gradient
  92          //             : bit 4       1 - Enable Shadow/Border/3D button   0 - Disable
  93          //             : bit 3 ~ 1   000 : Shadow Type 1
  94          //                           001 : Shadow Type 2
  95          //                           010 : Shadow Type 3
  96          //                           011 : Shadow Type 4
  97          //                           100 : 3D Button Type 1
  98          //                           101 : 3D Button Type 2
  99          //                           110 : Reserved
 100          //                           111 : Border
 101          //             : bit 0       1 - Enable Window            0 - Disable Window
 102          void OSD_Window(unsigned char win_no, unsigned int row_start, unsigned int row_end, unsigned int col_start
             -, unsigned int col_end,
 103          					unsigned char width, unsigned char height, unsigned char color, unsigned char color_sb, unsigned char
             - gradient,
 104          					unsigned char gray_level,unsigned char attr)
 105          {
 106   1      	if(win_no > 7)  
 107   1      		return;
 108   1      
 109   1      	Data[0]     = 5;
C51 COMPILER V6.20c  LCD_OSD                                                               04/15/2004 12:59:12 PAGE 3   

 110   1      	Data[1]     = Y_INC;
 111   1      	Data[2]     = OSD_ADDR_MSB_90;
 112   1      	Data[3]     = 0xc1;
 113   1      	Data[4]     = (win_no << 2);
 114   1      	Data[5]     = 0;
 115   1      	RTDWrite(Data);
 116   1      	Data[0]     = 6;
 117   1      	Data[1]     = N_INC;
 118   1      	Data[2]     = OSD_DATA_92;
 119   1      	Data[3]     = ((width & 0x07) << 3) | (height & 0x07);
 120   1      	Data[4]     = color_sb;
 121   1      	Data[5]     = gradient;
 122   1      	Data[6]     = 0;
 123   1      	RTDWrite(Data);
 124   1      
 125   1      	Data[0]     = 5;
 126   1      	Data[1]     = Y_INC;
 127   1      	Data[2]     = OSD_ADDR_MSB_90;
 128   1      	Data[3]     = 0xe1;
 129   1      	Data[4]     = (win_no << 2) + 1;
 130   1      	Data[5]     = 0;
 131   1      	RTDWrite(Data);
 132   1      	Data[0]     = 9;
 133   1      	Data[1]     = N_INC;
 134   1      	Data[2]     = OSD_DATA_92;
 135   1      	Data[3]     = (unsigned char)((unsigned int)(row_start & 0x003f) << 2);
 136   1      	Data[4]     = (unsigned char)((unsigned int)(col_start & 0x0007) << 5) | 
 137   1      			      (unsigned char)((unsigned int)(row_start & 0x07c0) >> 6);
 138   1      	Data[5]     = (unsigned char)((unsigned int)(col_start & 0x07f8) >> 3);
 139   1      
 140   1      	Data[6]     = (unsigned char)((unsigned int)(row_end & 0x003f) << 2);
 141   1      	Data[7]    = (unsigned char)((unsigned int)(col_end & 0x0007) << 5) | 
 142   1      				  (unsigned char)((unsigned int)(row_end & 0x07c0) >> 6);
 143   1      	Data[8]    = (unsigned char)((unsigned int)(col_end & 0x07f8) >> 3);
 144   1      	Data[9]     = 0;
 145   1      	RTDWrite(Data);
 146   1      
 147   1      	Delay_Xms(25);
 148   1      	
 149   1      	/*
 150   1      	do
 151   1      	{
 152   1      		RTDRead(0x94, 0x01, Y_INC);
 153   1      	}
 154   1      	while( ((Data[0] >> 5) & 0x01) );
 155   1      	*/
 156   1      	
 157   1      	Data[0]     = 5;
 158   1      	Data[1]     = Y_INC;
 159   1      	Data[2]     = OSD_ADDR_MSB_90;
 160   1      	Data[3]     = 0xc1;
 161   1      	Data[4]     = (win_no << 2) + 3;
 162   1      	Data[5]     = 0;
 163   1      	RTDWrite(Data);
 164   1      	Data[0]     = 6;
 165   1      	Data[1]     = N_INC;
 166   1      	Data[2]     = OSD_DATA_92;
 167   1      	Data[3]    = 0x00;
 168   1      	Data[4]    = (unsigned char)((gray_level & 0x07) << 4) |( color & 0x0f);
 169   1      	Data[5]    = attr;
 170   1      	Data[6]    = 0;
 171   1      	RTDWrite(Data);
C51 COMPILER V6.20c  LCD_OSD                                                               04/15/2004 12:59:12 PAGE 4   

 172   1      
 173   1      }
 174          
 175          void Get_OSD_Margin(void)
 176          {
 177   1      	unsigned char ucH_Min, ucH_Max, ucV_Max;
 178   1      
 179   1      #if (DISP_ALIGN)
 180   1      	RTDRead(DH_ACT_STA_27, 0x02, Y_INC);
 181   1      	Data[2] = Data[1] & 0x07;
 182   1      	Data[3] = Data[0];
 183   1      
 184   1      	ucH_Min = (((unsigned int *)Data)[1] / 4) + 1;
 185   1      	ucH_Max = OSD_HMAX;
 186   1      #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) / 4) + 1;
              	ucH_Max = ((((unsigned int *)Data)[1] - 512) / 4) + 1; 
              	ucH_Min = OSD_HMIN;
              #endif
 195   1      
 196   1      	RTDRead(DV_ACT_END_34, 0x02, Y_INC);
 197   1      	Data[2] = Data[1] & 0x07;
 198   1      	Data[3] = Data[0];
 199   1      
 200   1      	ucV_Max = (((unsigned int *)Data)[1] - DV_ACT_STA_POS - 250 - 14) / 4;
 201   1      
 202   1      	Data[0] = ucH_Min;
 203   1      	Data[1] = ucH_Max;
 204   1      	Data[2] = OSD_VMIN;
 205   1      	Data[3] = ucV_Max;
 206   1      	
 207   1      }
 208          
 209          // OSD_Position : Restore OSD position according to global settings
 210          // para : OSD font parameter
 211          // OSD_GLOBAL_BLINK    : 0x10
 212          // OSD_DISP_ZONE_LEFT  : 0x04
 213          // OSD_DISP_ZONE_RIGHT : 0x08
 214          // OSD_ROTATE          : 0x02
 215          // OSD_ENABLE          : 0x01
 216          
 217          void OSD_Position(unsigned char para)
 218          {
 219   1      	Get_OSD_Margin();
 220   1      
 221   1      	if (Data[0] > stGUD1.OSD_POSH || Data[1] < stGUD1.OSD_POSH ||
 222   1      		Data[2] > stGUD1.OSD_POSV || Data[3] < stGUD1.OSD_POSV)
 223   1      	{
 224   2      		stGUD1.OSD_POSV = OSD_VMID;
 225   2      		stGUD1.OSD_POSH = OSD_HMID;
 226   2      		Save_GUD1();
 227   2      	}
 228   1      
 229   1      	Wait_For_Event(EVENT_DEN_STOP);
 230   1      /*
 231   1      	Data[0]     = 5;
 232   1      	Data[1]     = Y_INC;
 233   1      	Data[2]     = OSD_ADDR_MSB_90;
C51 COMPILER V6.20c  LCD_OSD                                                               04/15/2004 12:59:12 PAGE 5   

 234   1      	Data[3]     = 0xc0;
 235   1      	Data[4]     = 0x00;
 236   1      	Data[5]     = 6;
 237   1      	Data[6]     = N_INC;
 238   1      	Data[7]     = OSD_DATA_92;
 239   1      	Data[8]     = stGUD1.OSD_POSV >> 1;
 240   1      	Data[9]     = (unsigned char)(stGUD1.OSD_POSH >> 2);
 241   1      	Data[10]    = ((unsigned char)(stGUD1.OSD_POSH & 0x0003) << 6) | ((stGUD1.OSD_POSV & 0x01) << 5) | para;
 242   1      				//+ (unsigned char)(OSD_Enable[10] & 0x1e) + osd_en;
 243   1      	Data[11]    = 0;
 244   1      	RTDWrite(Data);
 245   1      */
 246   1          Data[0]     = 5;
 247   1          Data[1]     = Y_INC;
 248   1          Data[2]     = OSD_ADDR_MSB_90;
 249   1          Data[3]     = 0xef;
 250   1          Data[4]     = 0xff;
 251   1          Data[5]     = 9;
 252   1          Data[6]     = N_INC;
 253   1          Data[7]     = OSD_DATA_92;
 254   1          Data[8]     = 0x80;
 255   1          Data[9]     = 0x80 ;
 256   1          Data[10]    = 0x80 ;
 257   1          Data[11]    = stGUD1.OSD_POSV >> 1;
 258   1          Data[12]    = (unsigned char)(stGUD1.OSD_POSH >> 2);
 259   1          Data[13]    = ((unsigned char)(stGUD1.OSD_POSH & 0x0003) << 6) | ((stGUD1.OSD_POSV & 0x01) << 5) | par
             -a;
 260   1          Data[14]    = 0;
 261   1          RTDWrite(Data);
 262   1      
 263   1      }
 264          
 265          void OSD_Line(unsigned char row, unsigned char col, unsigned char length,
 266                        unsigned char value, unsigned char indicate)
 267          {
 268   1      	unsigned int idata usStart_Addr;
 269   1      	unsigned char idata ucTemp;
 270   1      
 271   1      	usStart_Addr = FONT_SELECT_ADDRESS;
 272   1      
 273   1      	//The address of the first character Cn1 in Row n = FONT_SELECT_ADDRESS + Row0_length + Row1_length +...+
             -Row(n-1)_length
 274   1      	for(ucTemp = 1; ucTemp < row+1; ucTemp ++)
 275   1      		usStart_Addr += Row_Info[0][ucTemp];
 276   1      
 277   1      	Data[0] = 5;
 278   1      	Data[1] = Y_INC;
 279   1      	Data[2] = OSD_ADDR_MSB_90;
 280   1      
 281   1      	if( (col+1) > Row_Info[0][row + 1])	// if column_start > row_length, then return
 282   1      		return;
 283   1      	else if((col + 1 + length) > Row_Info[0][row + 1])	// if column_start + length > row_length, then re-calc
             -ulate the length
 284   1      		length = Row_Info[0][row + 1] - col;
 285   1          	
 286   1      	// indicate : 0, 1, 2, 3 set byte 0, 1, 2 and all byte
 287   1      	Data[3] = (unsigned char)( ((usStart_Addr + col)  & 0x0fff) >> 8 ) | (((indicate << 2) + 1) << 4);
 288   1      	Data[4] = (unsigned char)((usStart_Addr + col) & 0x00ff);
 289   1      	Data[5] = 0;  
 290   1      	RTDWrite(Data);

⌨️ 快捷键说明

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