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

📄 t101_util.lst

📁 宏芯T102芯片驱动(51单片机作主控)
💻 LST
📖 第 1 页 / 共 3 页
字号:
C51 COMPILER V7.06   T101_UTIL                                                             12/28/2004 10:14:03 PAGE 1   


C51 COMPILER V7.06, COMPILATION OF MODULE T101_UTIL
OBJECT MODULE PLACED IN .\obj\T101_Util.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE source\T101\T101_Util.c BROWSE INCDIR(.\include\;.\source\) DEBUG OBJECTEXT
                    -END PRINT(.\T101_Util.lst) OBJECT(.\obj\T101_Util.obj)

stmt level    source

   1          #include <reg51.h>
   2          #include "math.h"
   3          #include "common.h"
   4          #include "system.h"
   5          #include "struct.h"
   6          #include "T101_Util.h"
   7          #include "TW101Reg.h"
   8          #include "twowire.h"
   9          #include "display.h"
  10          #include "keypad.h"
  11          
  12          extern uCHAR idata m_cStandard;
  13          extern uCHAR idata m_cScaleratio;
  14          extern uWORD m_wHRes;
  15          extern uWORD m_wVRes;
  16          extern uWORD idata m_wBuff[3];
  17          extern uCHAR IDATA m_cBuff[4];
  18          extern uWORD m_wDWHSZ;
  19          extern uWORD idata m_wVTotal;
  20          extern uCHAR cSVideo;
  21          extern uCHAR idata m_cSource;//Kuo
  22          
  23          static bit NoSignal=0;
  24          
  25          //Ruby add 2004-06-21
  26          #ifdef ROTATE
  27              #ifndef T100
  28              uCHAR Dis_Mode=BOTTOM_RIGHT;
  29              #else
                  uCHAR Dis_Mode=TOP_LEFT;
                  #endif
  32          #endif
  33          
  34          void InitTW101(void)
  35          {
  36   1      #ifndef T100
  37   1              I2CWriteByte(TW101,0x3F, 0x03);
  38   1      #endif
  39   1      #ifdef T100
                      I2CWriteByte(TW101,ADC_ROFF, 0x60);
                      I2CWriteByte(TW101,ADC_GOFF, 0x60);
                      I2CWriteByte(TW101,ADC_BOFF, 0x60);
              #else
  44   1              I2CWriteByte(TW101,0x00, 0x00);
  45   1              I2CWriteByte(TW101,0x01, 0x00);
  46   1              I2CWriteByte(TW101,0x02, 0x00);
  47   1              I2CWriteByte(TW101,0x07, 0x80);
  48   1              I2CWriteByte(TW101,0x08, 0x80);
  49   1              I2CWriteByte(TW101,0x09, 0x80);
  50   1      #endif
  51   1              I2CWriteByte(TW101,0x97, 0x95);
  52   1          I2CWriteByte(TW101,0x98, 0xCC);//930813 Ruby
  53   1      
  54   1          I2CWriteByte(TW101+4,0x24, 0xe9);
C51 COMPILER V7.06   T101_UTIL                                                             12/28/2004 10:14:03 PAGE 2   

  55   1              I2CWriteByte(TW101+4,0x25, 0x0F);
  56   1      ///////////////////////
  57   1              I2CWriteByte(TW101,0xd, 0x20);
  58   1      ////
  59   1      
  60   1              I2CWriteByte(TW101,0xe0, 0x92);
  61   1              I2CWriteByte(TW101,0x11, 0x05);//
  62   1      //Source Select--S Video
  63   1              I2CWriteByte(TW101,0x18, 0x00);
  64   1              I2CWriteByte(TW101,0x19, 0x07);
  65   1      #ifdef T100
                  I2CWriteByte(TW101,0x1a, 0x87);
              #else
  68   1              I2CWriteByte(TW101,0x1a, 0xc7);
  69   1      #endif
  70   1      //Video Register Page Setted
  71   1              I2CWriteByte(TW101+4,0x02, 0x4b);
  72   1              I2CWriteByte(TW101+4,0x2e, 0x82);
  73   1          I2CWriteByte(TW101+4,0x2f, 0x30);
  74   1              I2CWriteByte(TW101+4,0x3f, 0x00);
  75   1              I2CWriteByte(TW101+4,0xc0, 0x14);
  76   1              I2CWriteByte(TW101+4,0xc1, 0x01);
  77   1              I2CWriteByte(TW101+4,0xe0, 0x10);
  78   1      
  79   1              I2CWriteByte(TW101+4,0x00, 0x01);
  80   1      
  81   1              I2CWriteByte(TW101+4,0x03, 0x03);
  82   1      
  83   1      //      I2CWriteByte(TW101+4,0x01, 0x01);
  84   1              I2CWriteByte(TW101+4,0x0c, 0x8a);
  85   1              I2CWriteByte(TW101+4,0x18, 0x21);
  86   1              I2CWriteByte(TW101+4,0x19, 0xf0);
  87   1              I2CWriteByte(TW101+4,0x1a, 0x7c);
  88   1              I2CWriteByte(TW101+4,0x1b, 0x1f);
  89   1      
  90   1              I2CWriteByte(TW101+4,0x30,0x24);// 0x22);
  91   1              I2CWriteByte(TW101+4,0x31, 0x61);
  92   1              I2CWriteByte(TW101+4,0x82, 0x42);
  93   1      //Enable CSC
  94   1              I2CWriteByte(TW101,0x90, 0x04);
  95   1              I2CWriteByte(TW101,0x91, 0x00);
  96   1      //DSP Clock
  97   1              I2CWriteByte(TW101, PLLDIV_F,DFDIV_40);
  98   1              I2CWriteByte(TW101, PLLDIV_I,DIDIV);
  99   1      #ifdef T100
                  I2CWriteByte(TW101, PLLDIV_O,DODIV);
                      I2CWriteByte(TW101,0xc2, 0x12);
              #else
 103   1              I2CWriteByte(TW101, PLLDIV_O,0x10|DODIV);
 104   1              I2CWriteByte(TW101,0xc2, 0x00);
 105   1      #endif
 106   1      //DSP Colck Polarity
 107   1              I2CWriteByte(TW101,0xc1, 0xc8);
 108   1      
 109   1      //H&V Main Display Pixel Clock Setted
 110   1      
 111   1              I2CWriteByte(TW101,0xdc, (uCHAR)(H_Size&0xFF));//H Size
 112   1              I2CWriteByte(TW101,0xdd, (uCHAR)(H_Size>>8));
 113   1      
 114   1              I2CWriteByte(TW101,0xde, (uCHAR)(V_Size&0xFF));//V Size
 115   1              I2CWriteByte(TW101,0xdf, (uCHAR)(V_Size>>8));
 116   1      
C51 COMPILER V7.06   T101_UTIL                                                             12/28/2004 10:14:03 PAGE 3   

 117   1      
 118   1      //H&V Display Pixel Clock Setted
 119   1              I2CWriteByte(TW101,0xb0, 0x20);//H Start
 120   1              I2CWriteByte(TW101,0xb1, 0x00);
 121   1              I2CWriteByte(TW101,0xb2, 0x20);//V Start
 122   1              I2CWriteByte(TW101,0xb3, 0x00);
 123   1              I2CWriteByte(TW101,0xb4, (uCHAR)(H_Size&0xFF));//H Width
 124   1              I2CWriteByte(TW101,0xb5, (uCHAR)(H_Size>>8));
 125   1          I2CWriteByte(TW101,0xb6, (uCHAR)(V_Size&0xFF));
 126   1          I2CWriteByte(TW101,0xb7, (uCHAR)(V_Size>>8));
 127   1              I2CWriteByte(TW101,0xb8, 0x10);//H Total
 128   1              I2CWriteByte(TW101,0xb9, 0x05);
 129   1              I2CWriteByte(TW101,0xba, 0x2f);//V Total
 130   1              I2CWriteByte(TW101,0xbb, 0x02);
 131   1              I2CWriteByte(TW101,0xbc, 0x20);//HSYNC Width
 132   1              I2CWriteByte(TW101,0xbd, 0x00);
 133   1              I2CWriteByte(TW101,0xbe, 0x04);//VSYNC Width
 134   1              I2CWriteByte(TW101,0xbf, 0x00);
 135   1      
 136   1      
 137   1      //Scaling
 138   1              I2CWriteByte(TW101,0x72, 0x33);//H Scale
 139   1              I2CWriteByte(TW101,0x73, 0x73);
 140   1              I2CWriteByte(TW101,0x74, 0x00);//V Scale
 141   1              I2CWriteByte(TW101,0x75, 0x40);
 142   1      
 143   1      
 144   1      //LineBuffer Prefill
 145   1              I2CWriteByte(TW101,0x84, 0x00);
 146   1              I2CWriteByte(TW101,0x85, 0x01);
 147   1      
 148   1              I2CWriteByte(TW101,0xe1, 0xa0);
 149   1              I2CWriteByte(TW101,0x50, 0x10);
 150   1              I2CWriteByte(TW101,0x38, 0x50);
 151   1              I2CWriteByte(TW101,0x39, 0x00);
 152   1              I2CWriteByte(TW101,0x3a, 0x20);
 153   1              I2CWriteByte(TW101,0x3b, 0x03);
 154   1      #ifdef TCON 
 155   1          #ifdef T100
                          I2CWriteByte(TW101,0xe0, 0x9d);
                          I2CWriteByte(TW101,0xe1, 0xf4);
                      #else
 159   1              I2CWriteByte(TW101,0xe0, 0x9d);
 160   1                  I2CWriteByte(TW101,0xe1, 0xe0);
 161   1              #endif
 162   1      #else
                      I2CWriteByte(TW101,0xe0, 0x9c);
                      I2CWriteByte(TW101,0xe1, 0x00);
              #endif
 166   1      #ifdef KVGA
                 SET_Dismod();
              #endif
 169   1      #ifdef WVGA
 170   1         SET_Dismod();
 171   1      #endif
 172   1      
 173   1          
 174   1          I2CWriteByte(TW101, 0x9c, 0x02);
 175   1      #ifdef T100
                  I2CWriteByte(TW101, 0x90, 0x04);
                  I2CWriteByte(TW101+4, 0x04, 0xDD);   
                      I2CWriteByte(TW101+4, 0x10, 0x27);
C51 COMPILER V7.06   T101_UTIL                                                             12/28/2004 10:14:03 PAGE 4   

                      I2CWriteByte(TW101+4, 0x00, 0x00);
                      I2CWriteByte(TW101+4, 0x03, 0x00);
                      I2CWriteByte(TW101+4, 0x02, 0x4B);
                      I2CWriteByte(TW101+4, 0x39, 0x8A);  // even or odd field polarity
                      I2CWriteByte(TW101+4, 0x11, 0xb9);
              #else
 185   1          I2CWriteByte(TW101+4, 0x04, 0xDD);  
 186   1              I2CWriteByte(TW101+4, 0x10, 0x27);
 187   1          I2CWriteByte(TW101, 0x90, 0x05);
 188   1          I2CWriteByte(TW101+4, 0x02, 0x4B);
 189   1              I2CWriteByte(TW101+4, 0x11, 0xFF);
 190   1      #endif
 191   1      //    I2CWriteByte(TW101+4, 0x07, 0x01);
 192   1          
 193   1      
 194   1      
 195   1      //    I2CWriteByte(TW101, 0x65, 0x88);    //Ruby 2004-08-30
 196   1      //   I2CWriteByte(TW101, 0x66, 0xff);    //Keep in default 2004-10-06 //Ruby 2004-08-30
 197   1      
 198   1          I2CWriteByte(TW101,0x30,(I2CReadByte(TW101, 0x30)|0x01));    //De-Interlace enable
 199   1              I2CWriteByte(TW101+4,0x01,(I2CReadByte(TW101+4, 0x01)|0x01));//Color
 200   1      
 201   1      #ifdef T100
              /////////////for image quality
                  I2CWriteByte(TW101+4,0x80,0x05);  //04); 2004-10-16//  0x05);     //For char clear    2004-10-07
                  I2CWriteByte(TW101,0x6C,0x80);// 2004-10-16 0x40);
                  I2CWriteByte(TW101+4,0x07,0x02|0x20);   // for color bar clear    2004-10-07
                  I2CWriteByte(TW101, 0x60, 0x01);
                  I2CWriteByte(TW101,0x61,0x8F);    //For char clear    2004-10-08
                  I2CWriteByte(TW101,0x62,0x0F);     //For char clear    2004-10-08
                  I2CWriteByte(TW101,0x63,0x0F);     //For char clear    2004-10-08
                  I2CWriteByte(TW101,0x64,0x04);     //For char clear    2004-10-08
                      I2CWriteByte(TW101,0x66,0x88);     //For color clear    2004-11-25 enable DCTI
                      I2CWriteByte(TW101,0x1C,0xF0);// 2004-10-16 0xF0);     //For image quality    2004-10-08
                      I2CWriteByte(TW101+4,0x08,0x50);//0x80);//2004-10-16 0x6A);     //For image quality    2004-10-09
                      I2CWriteByte(TW101+4,0x0a,0x50);//0x80);//2004-10-16 0x6A); 
                      I2CWriteByte(TW101+4,0x09,0x20);//0x20);//2004-10-16 0x18);     //For image quality    2004-10-09
                      #ifdef AT_VGA
                              I2CWriteByte(TW101+4,0x09,0x18);
                      #endif
              //      page2 0x24 need to fine tune in assamble time, because different decoder will nedd different value
              //  working with 0x24   I2CWriteByte(TW101, 0x66, 0xff);    //Keep in default 2004-10-06 //Ruby 2004-08-30
              #else
 222   1              I2CWriteByte(TW101+4,0x08,0x58);
 223   1              I2CWriteByte(TW101+4,0x09,0x18);
 224   1              I2CWriteByte(TW101+4,0x80,0x05);
 225   1          I2CWriteByte(TW101, 0x60, 0x00);
 226   1          I2CWriteByte(TW101, 0x1c, 0xF0);
 227   1              I2CWriteByte(TW101, 0x66, 0x8A);  
 228   1      #endif
 229   1      //////////////////////////////////////////////
 230   1      #ifdef T515 // For T515 test
                      I2CWriteByte(TW101+4,0x01,0x05);
                      I2CWriteByte(TW101+4,0x02,0x4B);
                      I2CWriteByte(TW101+4,0x08,0x80);
                      I2CWriteByte(TW101+4,0x09,0x20);
                      I2CWriteByte(TW101+4,0x10,0x27);
                      I2CWriteByte(TW101,0x60,0x02);
                      I2CWriteByte(TW101,0x62,0x04);
              #endif
 239   1      
 240   1      }
C51 COMPILER V7.06   T101_UTIL                                                             12/28/2004 10:14:03 PAGE 5   

 241          
 242          #ifdef TCON     // for TCON only
 243          void TconInit(void)
 244          {
 245   1      #ifdef T100
              #ifdef AT_VGA
              /////////////////////////// Toby test
              /*
                  I2CWriteByte(TW101+2,0x20,0x21);
                  I2CWriteByte(TW101+2, 0x21, TIME_PROTOCOL);
                  I2CWriteByte(TW101+2,0x22,0xc4);
                  I2CWriteByte(TW101+2,0x23,0x02);
                  I2CWriteByte(TW101+2,0x24,0x0e);
                  I2CWriteByte(TW101+2,0x25,0xc3);
                  I2CWriteByte(TW101+2,0x26,0x02);
                  I2CWriteByte(TW101+2,0x27,0xe9);
                  I2CWriteByte(TW101+2,0x28,0x02);
                  I2CWriteByte(TW101+2,0x29,0x93);
                  I2CWriteByte(TW101+2,0x2a,0x01);
                  I2CWriteByte(TW101+2,0x2b,0x04);
                  I2CWriteByte(TW101+2,0x2d,0x03);
                  I2CWriteByte(TW101+2,0x30,0x00);
                  I2CWriteByte(TW101+2,0x31,0x8E);
                  I2CWriteByte(TW101+2,0x32,0x02);
                  I2CWriteByte(TW101+2,0x33,0x36);
                  I2CWriteByte(TW101+2,0x34,0x00);
                  I2CWriteByte(TW101+2,0x35,0x01);
                  I2CWriteByte(TW101,0xc7,0x04);
                      */
              ///////////////////////////
                  I2CWriteByte(TW101+2,0x20,0x21);
                  I2CWriteByte(TW101+2, 0x21, TIME_PROTOCOL);
                  I2CWriteByte(TW101+2,0x22,0xc3);
                  I2CWriteByte(TW101+2,0x23,0x02);
                  I2CWriteByte(TW101+2,0x24,0x1B);
                  I2CWriteByte(TW101+2,0x25,0xc3);
                  I2CWriteByte(TW101+2,0x26,0x02);
                  I2CWriteByte(TW101+2,0x27,0x5e);
                  I2CWriteByte(TW101+2,0x28,0x02);
                  I2CWriteByte(TW101+2,0x29,0x93);
                  I2CWriteByte(TW101+2,0x2a,0x01);
                  I2CWriteByte(TW101+2,0x2b,0x04);
                  I2CWriteByte(TW101+2,0x2d,0x03);
                  I2CWriteByte(TW101+2,0x30,0x00);
                  I2CWriteByte(TW101+2,0x31,0xf9);

⌨️ 快捷键说明

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