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

📄 v46x_common.lst

📁 mtv512mg + mx88v462 液晶电视驱动C完整程序
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.50   V46X_COMMON                                                           12/14/2006 10:36:44 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE V46X_COMMON
OBJECT MODULE PLACED IN .\V46X_Common.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ..\Source\V46X_Common.c LARGE DEBUG OBJECTEXTEND PRINT(.\V46X_Common.lst) O
                    -BJECT(.\V46X_Common.obj)

line level    source

   1          /**--------------------------------------------------------------------------
   2          * Name          V46X_Common.c
   3          --------------------------------------------------------------------------**/
   4          #include        <string.h>
   5          #include        "..\inc\public2.h"
   6          #include        "Font12x18.C"
   7          
   8          unsigned        char    _Volume = 0xFF;
   9          unsigned        char    _Hue = 0xFF;
  10          
  11          extern  BYTE    Source_type;
  12          
  13          extern  code BYTE       OSD_Table_Title[20];
  14          
  15          code BYTE       OSDCtrlVal_Title[10] = 
  16          {                       //      Index
  17                                          0x00,   //H Start
  18                                          0x00,   //V Start
  19                                          0x00,   //H Width
  20                                          0x00,   //V Height
  21                                          0x00,   //H Space Start position & H Mirror
  22                                          0x00,   //V Space Start position & V Mirror
  23                                          0x00,   //H Space Width
  24                                          0x00,   //V Space Heigth
  25                                          0xA6,   //Ctrl. Reg
  26                                          0x98    //Misc. Ctrl
  27          };      
  28          
  29          code BYTE       OSDCtrlVal[10] = 
  30          {                       //      Index
  31                                          0x00,   //H Start
  32                                          0x00,   //V Start
  33                                          0x00,   //H Width
  34                                          0x00,   //V Height
  35                                          0x00,   //H Space Start position & H Mirror
  36                                          0x00,   //V Space Start position & V Mirror
  37                                          0x00,   //H Space Width
  38                                          0x00,   //V Space Heigth
  39                                          0x06,   //Ctrl. Reg
  40                                          0x98    //Misc. Ctrl
  41          };      
  42          /**--------------------------------------------------------------------------
  43          * Name          BYTE    CVD1_ReadWrite(BYTE wr_type, BYTE addr, BYTE value)
  44          *                               BYTE    wr_type;                //0x00: for read value from Reg.
  45          *                                                                               //0x01: for write value to Reg.
  46          *                               BYTE    addr;                   //which on Reg. will read/write
  47          *                               BYTE    value;                  //buffer for read/write
  48          *
  49          * Description   TV Decoder is indirect Reg. in V465.
  50          *                               There are 2Reg. one   for TV Decoder addr port  (0xF0)
  51          *                                                               other for TV Decoder data port  (0xF1)
  52          *                               This function usages by I2C
  53          * Flow Chart
  54          *
C51 COMPILER V7.50   V46X_COMMON                                                           12/14/2006 10:36:44 PAGE 2   

  55          * Return        None
  56          *
  57          * DATE          Author          Description
  58          * ===========================================================================
  59          **/
  60          BYTE    CVD1_ReadWrite(BYTE wr_type, BYTE addr, BYTE value)
  61          {
  62   1              I2C_WriteByte(V462_WRID, 0xF0, addr);   //Set Address
  63   1                                                                                              //Set/Get Data value
  64   1              if (wr_type)                    
  65   1                      I2C_WriteByte(V462_WRID, 0xF1, value);
  66   1              else                    
  67   1                      value = I2C_ReadByte(V462_WRID, 0xF1);
  68   1                      
  69   1              return(value);
  70   1      }
  71          
  72          
  73          void    Clr_OSDCode()
  74          {
  75   1              I2C_WriteByte(V462_WRID, ORWCTRL, 0x40);        //Clear OSD buffer
  76   1      }
  77          
  78          /**--------------------------------------------------------------------------
  79          * Name                  Read_OSDReg(BYTE *buf, BYTE rd_type, BYTE count, BYTE addr)
  80          *                               BYTE    *buf    store read data from registers.
  81          *                               BYTE    rd_type read type       0:OSD Control registers.
  82          *                                                                                       1:OSD RAM font <not support don't set>
  83          *                                                                                       2:OSD display code
  84          *                                                                                       3:OSD display attribute
  85          *                               BYTE    count   number of byte for read in this times
  86          *                               BYTE    addr    begin of address index
  87          * Description   Read data from Internal OSD
  88          *
  89          * Flow Chart
  90          *
  91          * Return        *str                    reading data buffer
  92          *
  93          * DATE          Author          Description
  94          * ===========================================================================
  95          * 2004-07-12    K.M. Ho         This is first time implement
  96          * 2004-10-12    KMHo                    Del the OSD enable 
  97          **/
  98          void    Read_OSDReg(BYTE *buf, BYTE rd_type, BYTE count, BYTE addr)
  99          {
 100   1              BYTE    i, offset;
 101   1              
 102   1              I2C_WriteByte(V462_WRID, ORWCTRL,       rd_type|0xA0);
 103   1              I2C_WriteByte(V462_WRID, OSDADDR_L,     addr);
 104   1              I2C_WriteByte(V462_WRID, OSDADDR_H,     0x00);
 105   1              
 106   1              if (rd_type)
 107   1              {                                                                               //        Support Display code and attribute Read
 108   2                      for(offset=0,i=0; i<count; i++, offset+=2)      
 109   2                      {                                                                       //not Support RAM font read
 110   3                              *(buf+offset)   = I2C_ReadByte(V462_WRID, OSDDATA_L);
 111   3                              *(buf+offset+1) = I2C_ReadByte(V462_WRID, OSDDATA_H);
 112   3                      }
 113   2              }
 114   1              else
 115   1                      for(i=0; i<count; i++)                          //OSD Control Reg. read
 116   1                              *(buf+i) = I2C_ReadByte(V462_WRID, OSDDATA_L);
C51 COMPILER V7.50   V46X_COMMON                                                           12/14/2006 10:36:44 PAGE 3   

 117   1                      
 118   1              I2C_WriteByte(V462_WRID, ORWCTRL,       0x04);  //Disable OSD Reg. Read/Write
 119   1      }
 120          
 121          /**--------------------------------------------------------------------------
 122          * Name          Write_OSDReg(BYTE *buf, BYTE wr_type, BYTE count, BYTE begin_addr)
 123          *                               BYTE    *buf    buffer for write.
 124          *                               BYTE    wr_type write type      0:OSD Control registers.
 125          *                                                                                       1:OSD RAM font
 126          *                                                                                       2:OSD display code
 127          *                                                                                       3:OSD display attribute
 128          *                               BYTE    count   number of byte for write in this times
 129          *                               BYTE    addr    begin of address index
 130          *
 131          * Description   Write data buffer to internal OSD Reg
 132          *
 133          * Flow Chart
 134          *
 135          * Return        None
 136          *
 137          * DATE          Author          Description
 138          * ===========================================================================
 139          * 2004-07-12    K.M. Ho         This is first time implement
 140          * 2004-10-12    KMHo                    Del the OSD enable 
 141          **/
 142          void    Write_OSDReg(BYTE buf[], BYTE wr_type, BYTE count, BYTE addr)
 143          {
 144   1              BYTE    i,j;
 145   1              int             offset;
 146   1      
 147   1              I2C_WriteByte(V462_WRID, ORWCTRL, wr_type|0x80);
 148   1              I2C_WriteByte(V462_WRID, OSDADDR_L,     addr);
 149   1              I2C_WriteByte(V462_WRID, OSDADDR_H,     0x00);
 150   1      
 151   1              switch(wr_type)
 152   1              {
 153   2                      case 0x00:                                              //0x00 OSD Control Reg.
 154   2                              for (i=0; i<count; i++)         //Write data to OSD Control Reg
 155   2                                      I2C_WriteByte(V462_WRID, OSDDATA_L, buf[i]);
 156   2                              break;
 157   2                      case 0x01:                                              //0x01 OSD Font table RAM
 158   2                              for (offset=0,i=0; i<count; i++)                //character count
 159   2                                      for (j=0; j<18; j++)    //Write a character to 15xx Font Table RAM
 160   2                                      {
 161   3                                              I2C_WriteByte(V462_WRID, OSDDATA_L, buf[offset]);
 162   3                                              I2C_WriteByte(V462_WRID, OSDDATA_H, buf[offset+1]);
 163   3                                              offset += 2;
 164   3                                      }
 165   2                              break;
 166   2                      case 0x02:                                              //0x02 OSD Display code buffer                          
 167   2                              for (offset=0,i=0; i<count; i++, offset+=2)
 168   2                              {
 169   3                                      I2C_WriteByte(V462_WRID, OSDDATA_L, buf[offset]);
 170   3                                      I2C_WriteByte(V462_WRID, OSDDATA_H, buf[offset+1]);
 171   3                              }
 172   2                              break;
 173   2                      case 0x03:                                              //0x03 OSD Display attribute buffer
 174   2                              for (offset=0,i=0; i<count; i++, offset+=2)
 175   2                              {                                                       //Write data to OSD Control Reg or Attribute
 176   3                                      I2C_WriteByte(V462_WRID, OSDDATA_L, buf[offset]);
 177   3                                      I2C_WriteByte(V462_WRID, OSDDATA_H, buf[offset+1]);
 178   3                              }
C51 COMPILER V7.50   V46X_COMMON                                                           12/14/2006 10:36:44 PAGE 4   

 179   2                              break;
 180   2              }
 181   1              I2C_WriteByte(V462_WRID, ORWCTRL,       0x04);  //Disable OSD Reg. Read/Write
 182   1      }
 183          
 184          /**--------------------------------------------------------------------------
 185          * Name                  OSD_Attribute(BYTE item, BYTE length, BYTE attr_color)
 186          *
 187          * Description   Write OSD Attribute Reg.
 188          *                               bit             7 6 5 4 3 2 1 0         //Low byte: background color select
 189          *                               bit             F E D C B A 9 8         //Hi  byte: foreground color select
 190          * Flow Chart
 191          *
 192          * Return
 193          *
 194          * DATE          Author          Description
 195          * ===========================================================================
 196          * 2004-07-12    K.M. Ho         This is first time implement
 197          * 2005-01-28    KMHo                    Modify to V465 Attribute 2bytes in each char
 198          * 2005-09-12    Microntrk               Modified
 199          **/
 200          void    OSD_Attribute(BYTE addr, BYTE length, BYTE FG_color, BYTE BG_color)
 201          {
 202   1              BYTE    i;
 203   1      
 204   1              I2C_WriteByte(V46X_WRID, ORWCTRL, 0x83);
 205   1              I2C_WriteByte(V46X_WRID, OSDADDR_L,     addr);
 206   1              I2C_WriteByte(V46X_WRID, OSDADDR_H,     0x00);
 207   1      
 208   1              for (i=0; i<length; i++)
 209   1              {                                                       //Write data to OSD Control Reg or Attribute
 210   2                      I2C_WriteByte(V46X_WRID, OSDDATA_L, BG_color);
 211   2                      I2C_WriteByte(V46X_WRID, OSDDATA_H, FG_color);
 212   2              }
 213   1              I2C_WriteByte(V46X_WRID, ORWCTRL, 0x04);        //Disable OSD Reg. Read/Write
 214   1      }
 215          
 216          
 217          void    Write_OSDCode(BYTE buf[], BYTE width, BYTE hight, BYTE addr)
 218          {
 219   1              BYTE i, offset;
 220   1      
 221   1              I2C_WriteByte(V462_WRID, ORWCTRL, 0x82);
 222   1              I2C_WriteByte(V462_WRID, OSDADDR_L,     addr);
 223   1              I2C_WriteByte(V462_WRID, OSDADDR_H,     0x00);
 224   1      
 225   1              for (i=0; i <width*hight; i++)
 226   1              {

⌨️ 快捷键说明

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