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

📄 lcd_osd_rel.lst

📁 keil c51平台,此代码可用于学习TFT LCD 之TCON,SCALER,OSD,(本人自己修改)
💻 LST
📖 第 1 页 / 共 5 页
字号:
C51 COMPILER V7.50   LCD_OSD_REL                                                           07/28/2008 16:10:58 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE LCD_OSD_REL
OBJECT MODULE PLACED IN .\REL_OUT\Lcd_osd_rel.obj
COMPILER INVOKED BY: D:\keil-701\C51\BIN\C51.EXE Lcd_osd_rel.c OPTIMIZE(9,SPEED) BROWSE DEBUG OBJECTEXTEND PRINT(.\REL_O
                    -UT\Lcd_osd_rel.lst) OBJECT(.\REL_OUT\Lcd_osd_rel.obj)

line level    source

   1          #define __OSD__
   2          
   3          #include "reg52.h"
   4          
   5          #include "MAIN_DEF.H"
   6          #include "CONFIG.H"
   7          #include "ACCESS.H"
   8          #include "LCD_FUNC.H"
   9          #include "LCD_AUTO.H"
  10          #include "LCD_MSG.H"
  11          #include "LCD_MAIN.H"
  12          #include "LCD_OSD.H"
  13          #include "FONT.H"
  14          #include "OSD_REL.H"
  15          #include "MTV512.H"
  16          
  17          #if (TV_CHIP != TV_NONE)
              #include "TUNER.H"
              #endif
  20          
  21          //////////////////////////////////////////////////////////////////////////////////////////////////////////
             -////
  22          // OSD Process Dispatch Table
  23          // In this code, when input source is not VGA, AUTO CONFIG page will not be shown.
  24          //////////////////////////////////////////////////////////////////////////////////////////////////////////
             -////
  25          code void (*OSD_Proc[][SOURCE_MAX + 1])(unsigned char action)   =
  26          {
  27              //  VGA Pages       DVI Pages       AV Pages        SV Pages        YUV Pages       TV Pages
  28              {   OSD_Proc0,      OSD_Proc0,      OSD_AV_Proc0,   OSD_AV_Proc0,   OSD_AV_Proc0,   OSD_TV_Proc0 },
  29              {   OSD_Proc1,      OSD_Proc1,      OSD_AV_Proc1,   OSD_AV_Proc1,   OSD_AV_Proc1,   OSD_AV_Proc1 },
  30              {   OSD_Proc2,      OSD_Proc2,      0,              0,              0,              OSD_TV_Proc2 },
  31              {   OSD_Proc3,      OSD_Proc4,      0,              0,              0,              0            },
  32              {   OSD_Proc4,      OSD_Proc5,      0,              0,              0,              0            },
  33              {   OSD_Proc5,      OSD_Proc6,      0,              0,              0,              0            },
  34              {   OSD_Proc6,      0,              0,              0,              0,              0            },
  35              {   0,              0,              0,              0,              0,              0            },
  36              {   OSD_ProcADC,    OSD_ProcADC,    0,              0,              0,              0            }
  37          };
  38          
  39          unsigned char GetNextPageIdx(unsigned char ucPageCurr)
  40          {
  41   1          switch (stGUD1.INPUT_SOURCE & 0x07)
  42   1          {
  43   2          case SOURCE_VGA :
  44   2              return (6 <= ucPageCurr) ? 1 : ucPageCurr + 1;
  45   2          case SOURCE_DVI :
  46   2              return (5 <= ucPageCurr) ? 1 : ucPageCurr + 1;
  47   2          case SOURCE_AV  :
  48   2              return (5 <= ucPageCurr) ? 1 : ucPageCurr + 1;
  49   2          case SOURCE_SV  :
  50   2              return (5 <= ucPageCurr) ? 1 : ucPageCurr + 1;
  51   2          case SOURCE_YUV :
  52   2              return (5 <= ucPageCurr) ? 1 : ucPageCurr + 1;
C51 COMPILER V7.50   LCD_OSD_REL                                                           07/28/2008 16:10:58 PAGE 2   

  53   2          default :
  54   2              return 1;
  55   2          }
  56   1          
  57   1      }
  58          
  59          unsigned char GetPrevPageIdx(unsigned char ucPageCurr)
  60          {
  61   1          switch (stGUD1.INPUT_SOURCE & 0x07)
  62   1          {
  63   2          case SOURCE_VGA :
  64   2              return (1 >= ucPageCurr) ? 6 : ucPageCurr - 1;
  65   2          case SOURCE_DVI :
  66   2              return (1 >= ucPageCurr) ? 5 : ucPageCurr - 1;
  67   2          case SOURCE_AV  :
  68   2              return (1 >= ucPageCurr) ? 5 : ucPageCurr - 1;
  69   2          case SOURCE_SV  :
  70   2              return (1 >= ucPageCurr) ? 5 : ucPageCurr - 1;
  71   2          case SOURCE_YUV :
  72   2              return (1 >= ucPageCurr) ? 5 : ucPageCurr - 1;
  73   2          default :
  74   2              return 1;
  75   2          }
  76   1      
  77   1      }
  78          
  79          //////////////////////////////////////////////////////////////////////////////////////////////////////////
             -////
  80          // OSD Process Public Function
  81          //////////////////////////////////////////////////////////////////////////////////////////////////////////
             -////
  82          
  83          // OSD_Window : Control OSD Windows
  84          // win_no       bit 1 ~ 0   Window Number 0 ~ 3
  85          // row_start    bit 3 ~ 0   Window Row Start Address
  86          // row_end      bit 3 ~ 0   Window Row End Address
  87          // col_start    bit 4 ~ 0   Window Column Start Address
  88          // col_end      bit 4 ~ 0   Window Column End Address
  89          // color        bit 2 ~ 0   RGB color for window
  90          // attrib       bit 2       0 - Disable window      1 - Enable window
  91          //              bit 1       0 - Normal intensity    1 - High color intensity
  92          //              bit 0       0 - Disable shadowing   1 - Enable shadowing
  93          void OSD_Window(unsigned char win_no, unsigned char row_start, unsigned char row_end,
  94                          unsigned char col_start, unsigned char col_end, unsigned char attrib, unsigned char color)
  95          {
  96   1          if (3 < win_no) return;
  97   1          
  98   1          Data[0]     = 5;
  99   1          Data[1]     = Y_INC;
 100   1          Data[2]     = OSD_ROW_90;
 101   1          Data[3]     = 0xaf;
 102   1          Data[4]     = (win_no << 2) - win_no;
 103   1          Data[5]     = 6;
 104   1          Data[6]     = N_INC;
 105   1          Data[7]     = OSD_DATA_92;
 106   1          Data[8]     = (row_start << 4)  | row_end;
 107   1              Data[9]     = (col_start << 3)  | color;
 108   1          Data[10]    = (col_end << 3)    | attrib;
 109   1      
 110   1          
 111   1          Data[11]    = 0;
 112   1          RTDWrite(Data);
C51 COMPILER V7.50   LCD_OSD_REL                                                           07/28/2008 16:10:58 PAGE 3   

 113   1      }
 114          
 115          void Get_OSD_Margin(void)
 116          {
 117   1          unsigned char ucH_Min, ucH_Max, ucV_Max;
 118   1      
 119   1      #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
 127   1          RTDRead(DH_ACT_END_29, 0x02, Y_INC);
 128   1          Data[2] = Data[1] & 0x07;
 129   1          Data[3] = Data[0];
 130   1      
 131   1          ucH_Max = ((((unsigned int *)Data)[1] - 312 - 8 - 16) / 6) + 1;
 132   1          ucH_Min = OSD_HMIN;
 133   1      #endif
 134   1      
 135   1          RTDRead(DV_ACT_END_34, 0x02, Y_INC);
 136   1          Data[2] = Data[1] & 0x07;
 137   1          Data[3] = Data[0];
 138   1      
 139   1          ucV_Max = (((unsigned int *)Data)[1] - DV_ACT_STA_POS - 270 - 14) / 4;
 140   1      
 141   1          Data[0] = ucH_Min;
 142   1          Data[1] = ucH_Max;
 143   1          Data[2] = OSD_VMIN;
 144   1          Data[3] = ucV_Max;
 145   1      }
 146          
 147          // OSD_Position : Restore OSD position according to global settings
 148          void OSD_Position(void)
 149          {
 150   1          Get_OSD_Margin();
 151   1      
 152   1          if (Data[0] > stGUD1.OSD_POSH || Data[1] < stGUD1.OSD_POSH ||
 153   1              Data[2] > stGUD1.OSD_POSV || Data[3] < stGUD1.OSD_POSV)
 154   1          {
 155   2              stGUD1.OSD_POSV = OSD_VMID;
 156   2              stGUD1.OSD_POSH = OSD_HMID;
 157   2              Save_GUD1();
 158   2          }
 159   1          
 160   1          Wait_For_Event(EVENT_DEN_STOP);
 161   1      
 162   1          Data[0]     = 5;
 163   1          Data[1]     = Y_INC;
 164   1          Data[2]     = OSD_ROW_90;
 165   1          Data[3]     = 0xaf;
 166   1          Data[4]     = 0x0c;
 167   1          Data[5]     = 5;
 168   1          Data[6]     = N_INC;
 169   1          Data[7]     = OSD_DATA_92;
 170   1          Data[8]     = stGUD1.OSD_POSV;
 171   1          Data[9]     = stGUD1.OSD_POSH;
 172   1          Data[10]    = 0;
 173   1          RTDWrite(Data);  
 174   1      }
C51 COMPILER V7.50   LCD_OSD_REL                                                           07/28/2008 16:10:58 PAGE 4   

 175          
 176          void OSD_Line(unsigned char row, unsigned char col, unsigned char length,
 177                        unsigned char value, unsigned char indicate)
 178          {
 179   1          Data[0] = 5;
 180   1          Data[1] = Y_INC;
 181   1          Data[2] = OSD_ROW_90;
 182   1          Data[3] = indicate ? (0x80 | row) : (0xa0 | row);   // indicate : 0 - Attribute, otherwise - Display
 183   1          Data[4] = col;
 184   1          Data[5] = 0;  
 185   1          RTDWrite(Data);
 186   1      
 187   1          Data[0]     = 15;
 188   1          Data[1]     = N_INC; 
 189   1          Data[2]     = OSD_DATA_92;
 190   1          Data[3]     = value;
 191   1          Data[4]     = value;
 192   1          Data[5]     = value;
 193   1          Data[6]     = value;
 194   1          Data[7]     = value;
 195   1          Data[8]     = value;
 196   1          Data[9]     = value;
 197   1          Data[10]    = value;
 198   1          Data[11]    = value;
 199   1          Data[12]    = value;
 200   1          Data[13]    = value;
 201   1          Data[14]    = value;    
 202   1          Data[15]    = 0;
 203   1      
 204   1          while (12 <= length)
 205   1          {
 206   2              RTDWrite(Data);
 207   2              length  -= 12;
 208   2          }
 209   1      
 210   1          if (length)
 211   1          {
 212   2              length          = length + 3;
 213   2              Data[0]         = length;
 214   2              Data[length]    = 0;
 215   2              RTDWrite(Data);
 216   2          }
 217   1      }     
 218          
 219          void OSD_Clear(unsigned char row_start, unsigned char height, unsigned char col_start, unsigned char width
             -)
 220          {
 221   1          if (height && width)
 222   1          {
 223   2              do
 224   2              {
 225   3                  OSD_Line(row_start, col_start, width, 0x00, 1);     // Display
 226   3                  OSD_Line(row_start, col_start, width, 0x00, 0);     // Attribute
 227   3                  row_start++;
 228   3              }
 229   2              while (--height);
 230   2          }
 231   1      }
 232          
 233          // BE CAREFUL !!
 234          // length must be larger than 2 (left and right border of slider)
 235          // value must be small than or equal to range
C51 COMPILER V7.50   LCD_OSD_REL                                                           07/28/2008 16:10:58 PAGE 5   

 236          void OSD_Slider(unsigned char row, unsigned char col, unsigned char length, unsigned char value, unsigned 
             -char range,
 237                          unsigned char color)
 238          {
 239   1          unsigned int    bound;
 240   1      
 241   1          OSD_Line(row, col, length + 4, color, 0x00);   // Set Slider Attribute. 4 extra columns for space/numb
             -ers/space
 242   1      
 243   1          length  = length - 2;
 244   1          bound   = length * value;
 245   1      
 246   1          // Left Border
 247   1          Data[0] = 6;
 248   1          Data[1] = Y_INC;
 249   1          Data[2] = OSD_ROW_90;
 250   1          Data[3] = 0x80 | row;
 251   1          Data[4] = col;

⌨️ 快捷键说明

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