Access.lst
上传用户:xmyjxjd
上传日期:2013-05-04
资源大小:1517k
文件大小:130k
开发平台:

C/C++

  1. C51 COMPILER V7.06   ACCESS                                                                11/21/2005 13:47:43 PAGE 1   
  2. C51 COMPILER V7.06, COMPILATION OF MODULE ACCESS
  3. OBJECT MODULE PLACED IN .OutputAccess.obj
  4. COMPILER INVOKED BY: C:KeilC51BINC51.EXE CodeAccess.c OPTIMIZE(9,SPEED) BROWSE DEBUG OBJECTEXTEND CODE SYMBOLS PRIN
  5.                     -T(.OutputAccess.lst) PREPRINT(.OutputAccess.i) OBJECT(.OutputAccess.obj)
  6. stmt level    source
  7.    1          #define __ACCESS__
  8.    2          
  9.    3          #include "reg52.h"
  10.    4          #include "intrins.h"
  11.    5          
  12.    6          #include "HeaderMAIN_DEF.H"
  13.    7          #include "HeaderACCESS.h"
  14.    8          #include "HeaderCONFIG.H"
  15.    9          #include "HeaderMTV512.H"
  16.   10          #include "HeaderOSD.H"
  17.   11          #include "HeaderPower_Ctrl.h"
  18.   12          
  19.   13          #if(MCU_TYPE == MCU_MTV512)
  20.               ///////////////////////////////////////////////////////////////////////
  21.               // SCL Processor                                                                                          
  22.              -      //
  23.               ///////////////////////////////////////////////////////////////////////
  24.               void MCU_WriteI2cScl(bit Status)
  25.               {
  26.                      bIIC_SCL = Status;
  27.               }       
  28.               ///////////////////////////////////////////////////////////////////////
  29.               // SDA Processor                                                                                          
  30.              -     //
  31.               ///////////////////////////////////////////////////////////////////////
  32.               void MCU_WriteI2cSda(bit Status)
  33.               {
  34.                      bIIC_SDA = Status;
  35.               }       
  36.               
  37.               bit MCU_ReadI2cSda(void)
  38.               {
  39.                      return(bIIC_SDA);
  40.               }               
  41.               ///////////////////////////////////////////////////////////////////////
  42.               // RTD Reset Processor                                                                                    
  43.              -  //
  44.               ///////////////////////////////////////////////////////////////////////
  45.               #if(RESET_TYPE == RESET_IN)
  46.               void MCU_WriteRtdReset(bit Status)
  47.               {
  48.                      bRTD_RST = Status;
  49.               }
  50.               
  51.               bit MCU_ReadRtdReset(void)
  52.               {
  53.                      return(bRTD_RST);
  54.               }       
  55.               #endif
  56.               
  57.                       
  58.               ///////////////////////////////////////////////////////////////////////
  59.               // RTD SDIO Processor                                                                                     
  60.              -  //
  61. C51 COMPILER V7.06   ACCESS                                                                11/21/2005 13:47:43 PAGE 2   
  62.               ///////////////////////////////////////////////////////////////////////
  63.               /*
  64.               void MCU_WriteRtdSdio(bit Status)
  65.               {
  66.                      bRTD_SDIO_0 = Status;
  67.               }       
  68.               
  69.               bit MCU_ReadRtdSdio(void)
  70.               {
  71.                      return(bRTD_SDIO_0);
  72.               }       
  73.               */
  74.               ///////////////////////////////////////////////////////////////////////
  75.               // RTD Sclk Processor                                                                                     
  76.              -   //
  77.               ///////////////////////////////////////////////////////////////////////
  78.               void MCU_WriteRtdSclk(bit Status)
  79.               {
  80.                      bRTD_SCLK = Status;
  81.               }       
  82.               ///////////////////////////////////////////////////////////////////////
  83.               // RTD Scsb Processor                                                                                     
  84.              -  //
  85.               ///////////////////////////////////////////////////////////////////////
  86.               void MCU_WriteRtdScsb(bit Status)
  87.               {
  88.                      bRTD_SCSB = Status;
  89.               }       
  90.               ///////////////////////////////////////////////////////////////////////
  91.               // VIDEO POWER Processor                                                                                //
  92.               ///////////////////////////////////////////////////////////////////////
  93.               #if (VIDEO_CHIP != VDC_NONE)
  94.               void MCU_WriteVideoPower(bit Status)
  95.               {
  96.                      bVDC_PWR = Status;
  97.               }       
  98.               #endif
  99.               
  100.               ///////////////////////////////////////////////////////////////////////
  101.               // PANEL POWER Processor                                                                                 /
  102.              -/
  103.               ///////////////////////////////////////////////////////////////////////
  104.               void MCU_WritePanelPower(bit Status)
  105.               {
  106.                      bPANEL_PWR = Status;
  107.                      bPanel_Status = Status ? 1 : 0;
  108.               }       
  109.               /*
  110.               bit MCU_ReadPanelPower(void)
  111.               {
  112.                      return(bPANEL_PWR);
  113.               }
  114.               */      
  115.               ///////////////////////////////////////////////////////////////////////
  116.               // BACKLIGHT POWER Processor                                                                         //
  117.               ///////////////////////////////////////////////////////////////////////
  118.               void MCU_WriteBacklightPower(bit Status)
  119.               {       
  120.                      bLIGHT_PWR = (Status);
  121.               }
  122.               
  123.               
  124. C51 COMPILER V7.06   ACCESS                                                                11/21/2005 13:47:43 PAGE 3   
  125.               ///////////////////////////////////////////////////////////////////////
  126.               // VGA CONNECT Processor                                                                                //
  127.               ///////////////////////////////////////////////////////////////////////
  128.               bit MCU_ReadVgaConnect(void)
  129.               {
  130.                      return(bVGA_CONNECT);
  131.               }
  132.               
  133.               #endif
  134.  119          
  135.  120          void BitDly(void)
  136.  121          {
  137.  122   1          _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_();
  138.  123   1          _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_();
  139.  124   1          _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_();
  140.  125   1          _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_();
  141.  126   1      }
  142.  127          
  143.  128          void I2CRead(unsigned char addr, unsigned char index, unsigned char count)
  144.  129          {
  145.  130   1          unsigned char   n;
  146.  131   1      
  147.  132   1          if (count)
  148.  133   1          {
  149.  134   2              I2CSendAddr(addr, index, 0);
  150.  135   2              
  151.  136   2              I2CSendAddr(addr, 0, 1);
  152.  137   2      
  153.  138   2              count   = count - 1;
  154.  139   2      
  155.  140   2              for (n = 0; n < count; n++)     Data[n] = I2CGetByte(0);
  156.  141   2      
  157.  142   2              Data[count] = I2CGetByte(1);
  158.  143   2      
  159.  144   2              I2CSendStop();
  160.  145   2          }
  161.  146   1      }
  162.  147          
  163.  148          void I2CWrite(unsigned char *array)
  164.  149          {
  165.  150   1          unsigned char   n, len;
  166.  151   1      
  167.  152   1          if (3 <= array[0])
  168.  153   1          {
  169.  154   2              len     = array[0];
  170.  155   2              I2CSendAddr(array[1], array[2], 0);     
  171.  156   2      
  172.  157   2              for (n = 3; n < len; n++)   I2CSendByte(array[n]);
  173.  158   2      
  174.  159   2              I2CSendStop();
  175.  160   2          }
  176.  161   1      }
  177.  162          
  178.  163          
  179.  164          unsigned char I2CGetByte(unsigned char ack) 
  180.  165          {
  181.  166   1          unsigned char   r, m;
  182.  167   1      
  183.  168   1          r = 0;
  184.  169   1      #if(MCU_TYPE == MCU_WINBOND)
  185.  170   1          for (m = 0; m < 8; m++)         // Each bit at a time, MSB first
  186.  171   1          {
  187. C51 COMPILER V7.06   ACCESS                                                                11/21/2005 13:47:43 PAGE 4   
  188.  172   2              bIIC_SCL    = 1;
  189.  173   2              BitDly();                   // Delay
  190.  174   2      
  191.  175   2              r   = (r << 1) | bIIC_SDA;
  192.  176   2      
  193.  177   2              bIIC_SCL    = 0;
  194.  178   2              BitDly();                   // Delay
  195.  179   2          }  
  196.  180   1      
  197.  181   1          // Send ACK according to 'ack'
  198.  182   1          bIIC_SDA    = (bit)(ack & 0x01);
  199.  183   1          BitDly();                       // Delay
  200.  184   1          
  201.  185   1          bIIC_SCL    = 1; 
  202.  186   1          BitDly();                       // Delay
  203.  187   1          
  204.  188   1          bIIC_SCL    = 0; 
  205.  189   1          BitDly();                       // Delay
  206.  190   1          
  207.  191   1          bIIC_SDA    = 1;
  208.  192   1      #else
  209.                  
  210.                   for (m = 0; m < 8; m++)         // Each bit at a time, MSB first
  211.                   {
  212.                       MCU_WriteI2cScl(_HIGH);
  213.                       BitDly();                   // Delay
  214.                       r   = (r << 1) | MCU_ReadI2cSda();
  215.                       MCU_WriteI2cScl(_LOW);
  216.                       BitDly();                   // Delay
  217.                   }  
  218.                   // Send ACK according to 'ack'
  219.                   MCU_WriteI2cSda((bit)(ack & 0x01));
  220.                   BitDly();                       // Delay
  221.                   MCU_WriteI2cScl(_HIGH);
  222.                   BitDly();                       // Delay
  223.                   MCU_WriteI2cScl(_LOW);
  224.                   BitDly();                       // Delay
  225.                   MCU_WriteI2cSda(_HIGH);
  226.               
  227.               #endif
  228.  212   1      
  229.  213   1          return (r);
  230.  214   1      }
  231.  215          
  232.  216          void I2CSendByte(unsigned char send)
  233.  217          {
  234.  218   1          unsigned char   m;
  235.  219   1      #if(MCU_TYPE == MCU_WINBOND)    
  236.  220   1          for (m = 0; m < 8; m++)
  237.  221   1          {
  238.  222   2              bIIC_SDA    = (bit)(send & 0x80);   // Send each bit, MSB first
  239.  223   2              BitDly();
  240.  224   2      
  241.  225   2              bIIC_SCL    = 1;
  242.  226   2              BitDly();
  243.  227   2      
  244.  228   2              bIIC_SCL    = 0;
  245.  229   2      
  246.  230   2              send    = send << 1;
  247.  231   2          }
  248.  232   1      
  249.  233   1          bIIC_SDA    = 1;
  250. C51 COMPILER V7.06   ACCESS                                                                11/21/2005 13:47:43 PAGE 5   
  251.  234   1          bIIC_SCL    = 1;
  252.  235   1          BitDly();
  253.  236   1      
  254.  237   1          bIIC_SCL    = 0;
  255.  238   1          BitDly();
  256.  239   1      #else
  257.                   for (m = 0; m < 8; m++)
  258.                   {
  259.                       MCU_WriteI2cSda((bit)(send & 0x80));   // Send each bit, MSB first
  260.                       BitDly();
  261.                       MCU_WriteI2cScl(_HIGH);
  262.                       BitDly();
  263.                       MCU_WriteI2cScl(_LOW);;
  264.                       send    = send << 1;
  265.                   }
  266.                   MCU_WriteI2cSda(_HIGH);
  267.                   MCU_WriteI2cScl(_HIGH);
  268.                   BitDly();
  269.                   MCU_WriteI2cScl(_LOW);;
  270.                   BitDly();
  271.               
  272.               #endif
  273.  256   1      } 
  274.  257          
  275.  258          void I2CSendAddr(unsigned char addr, unsigned char index, unsigned char rd)
  276.  259          {         
  277.  260   1      #if(MCU_TYPE == MCU_WINBOND)         
  278.  261   1          bIIC_SCL    = 1;
  279.  262   1          bIIC_SDA    = 0;    // Start
  280.  263   1          BitDly();
  281.  264   1      
  282.  265   1          bIIC_SCL    = 0;
  283.  266   1          I2CSendByte(addr + rd);             // Send address byte
  284.  267   1      
  285.  268   1          if (0 == rd)    I2CSendByte(index); // Send index byte  
  286.  269   1      #else
  287.                   MCU_WriteI2cScl(_HIGH);
  288.                   MCU_WriteI2cSda(_LOW);    // Start
  289.                   BitDly();
  290.                   MCU_WriteI2cScl(_LOW);;
  291.                   I2CSendByte(addr + rd);             // Send address byte
  292.                   if (0 == rd)    I2CSendByte(index); // Send index byte 
  293.               #endif
  294.  277   1      }
  295.  278          
  296.  279          void I2CSendStop(void)
  297.  280          {
  298.  281   1      #if(MCU_TYPE == MCU_WINBOND)
  299.  282   1          bIIC_SDA    = 0; 
  300.  283   1          BitDly();
  301.  284   1      
  302.  285   1          bIIC_SCL    = 1;
  303.  286   1          BitDly();
  304.  287   1      
  305.  288   1          bIIC_SDA    = 1;
  306.  289   1          BitDly();
  307.  290   1      #else
  308.                   MCU_WriteI2cSda(_LOW); 
  309.                   BitDly();
  310.                   MCU_WriteI2cScl(_HIGH);
  311.                   BitDly();
  312.                   MCU_WriteI2cSda(_HIGH);
  313. C51 COMPILER V7.06   ACCESS                                                                11/21/2005 13:47:43 PAGE 6   
  314.                   BitDly();
  315.               #endif
  316.  298   1      }
  317.  299          
  318.  300          unsigned char RTDGetByte(void) 
  319.  301          {
  320.  302   1      
  321.  303   1      #if(PARALLEL_PORT)
  322.               
  323.               #if(1)
  324.                  bRTD_SCLK = 1;
  325.                  bRTD_SCLK = 0;
  326.                  r0        = bRTD_SDIO_0;
  327.                  r1        = bRTD_SDIO_1;
  328.                  r2        = bRTD_SDIO_2;
  329.                  r3        = bRTD_SDIO_3;
  330.               
  331.                  bRTD_SCLK = 1;
  332.                  bRTD_SCLK = 0;
  333.                  r4        = bRTD_SDIO_0;
  334.                  r5        = bRTD_SDIO_1;
  335.                  r6        = bRTD_SDIO_2;
  336.                  r7        = bRTD_SDIO_3;
  337.               
  338.                  bRTD_SCLK   = 1;
  339.               #else
  340.               
  341.                  bRTD_SCLK = 1;
  342.                  bRTD_SCLK = 0;
  343.               
  344.                  Reg = P0 & 0x0f;
  345.               
  346.                  bRTD_SCLK = 1;
  347.                  bRTD_SCLK = 0;
  348.               
  349.                  Reg = Reg | ((P0 & 0x0f) << 4);
  350.               
  351.                  bRTD_SCLK   = 1;
  352.               
  353.               #endif
  354.               
  355.               #else //serial port
  356.  338   1          bRTD_SCLK   = 1;
  357.  339   1          bRTD_SCLK   = 0;
  358.  340   1          r0          = bRTD_SDIO_0;
  359.  341   1      
  360.  342   1          bRTD_SCLK   = 1;
  361.  343   1          bRTD_SCLK   = 0;
  362.  344   1          r1          = bRTD_SDIO_0;
  363.  345   1      
  364.  346   1          bRTD_SCLK   = 1;
  365.  347   1          bRTD_SCLK   = 0;
  366.  348   1          r2          = bRTD_SDIO_0;
  367.  349   1      
  368.  350   1          bRTD_SCLK   = 1;
  369.  351   1          bRTD_SCLK   = 0;
  370.  352   1          r3          = bRTD_SDIO_0;
  371.  353   1      
  372.  354   1          bRTD_SCLK   = 1;
  373.  355   1          bRTD_SCLK   = 0;
  374.  356   1          r4          = bRTD_SDIO_0;
  375.  357   1      
  376. C51 COMPILER V7.06   ACCESS                                                                11/21/2005 13:47:43 PAGE 7   
  377.  358   1          bRTD_SCLK   = 1;
  378.  359   1          bRTD_SCLK   = 0;
  379.  360   1          r5          = bRTD_SDIO_0;
  380.  361   1      
  381.  362   1          bRTD_SCLK   = 1;
  382.  363   1          bRTD_SCLK   = 0;
  383.  364   1          r6          = bRTD_SDIO_0;
  384.  365   1      
  385.  366   1          bRTD_SCLK   = 1;
  386.  367   1          bRTD_SCLK   = 0;
  387.  368   1          r7          = bRTD_SDIO_0;
  388.  369   1      
  389.  370   1          bRTD_SCLK   = 1;
  390.  371   1      
  391.  372   1      #endif
  392.  373   1      
  393.  374   1      
  394.  375   1          return Reg;
  395.  376   1      }
  396.  377          
  397.  378          void RTDSendByte(unsigned char send)
  398.  379          {
  399.  380   1      
  400.  381   1      
  401.  382   1      #if(PARALLEL_PORT)
  402.               
  403.               #if(1)
  404.                   bRTD_SDIO_0 = (bit)(send & 0x01);
  405.                       bRTD_SDIO_1 = (bit)(send & 0x02);
  406.                       bRTD_SDIO_2 = (bit)(send & 0x04);
  407.                       bRTD_SDIO_3 = (bit)(send & 0x08);
  408.                       bRTD_SCLK   = 1;
  409.                   bRTD_SCLK   = 0;
  410.               
  411.                       bRTD_SDIO_0 = (bit)(send & 0x10);
  412.                       bRTD_SDIO_1 = (bit)(send & 0x20);
  413.                       bRTD_SDIO_2 = (bit)(send & 0x40);
  414.                       bRTD_SDIO_3 = (bit)(send & 0x80);
  415.                       bRTD_SCLK   = 1;
  416.                   bRTD_SCLK   = 0;
  417.               
  418.                       bRTD_SDIO_0 = 1;
  419.                       bRTD_SDIO_1 = 1;
  420.                       bRTD_SDIO_2 = 1;
  421.                       bRTD_SDIO_3 = 1;
  422.                       bRTD_SCLK   = 1;
  423.               #else
  424.                   unsigned char ucTemp;
  425.               
  426.                       ucTemp = P0 & 0xf0;
  427.               
  428.                   P0 = ucTemp | (send & 0x0f);
  429.                   bRTD_SCLK   = 1;
  430.                   bRTD_SCLK   = 0;
  431.               
  432.                   P0 = ucTemp | (send >> 4);
  433.               
  434.                       bRTD_SCLK   = 1;
  435.                   bRTD_SCLK   = 0;
  436.               
  437.                   P0 = ucTemp | 0x0f;
  438.                       bRTD_SCLK   = 1;
  439. C51 COMPILER V7.06   ACCESS                                                                11/21/2005 13:47:43 PAGE 8   
  440.               
  441.               #endif
  442.               
  443.               #else //serial port
  444.  424   1          bRTD_SDIO_0 = (bit)(send & 0x01);
  445.  425   1          bRTD_SCLK   = 1;
  446.  426   1          bRTD_SCLK   = 0;
  447.  427   1      
  448.  428   1          bRTD_SDIO_0 = (bit)(send & 0x02);
  449.  429   1          bRTD_SCLK   = 1;
  450.  430   1          bRTD_SCLK   = 0;
  451.  431   1      
  452.  432   1          bRTD_SDIO_0 = (bit)(send & 0x04);
  453.  433   1          bRTD_SCLK   = 1;
  454.  434   1          bRTD_SCLK   = 0;
  455.  435   1      
  456.  436   1          bRTD_SDIO_0 = (bit)(send & 0x08);
  457.  437   1          bRTD_SCLK   = 1;
  458.  438   1          bRTD_SCLK   = 0;
  459.  439   1      
  460.  440   1          bRTD_SDIO_0 = (bit)(send & 0x10);
  461.  441   1          bRTD_SCLK   = 1;
  462.  442   1          bRTD_SCLK   = 0;
  463.  443   1      
  464.  444   1          bRTD_SDIO_0 = (bit)(send & 0x20);
  465.  445   1          bRTD_SCLK   = 1;
  466.  446   1          bRTD_SCLK   = 0;
  467.  447   1      
  468.  448   1          bRTD_SDIO_0 = (bit)(send & 0x40);
  469.  449   1          bRTD_SCLK   = 1;
  470.  450   1          bRTD_SCLK   = 0;
  471.  451   1      
  472.  452   1          bRTD_SDIO_0 = (bit)(send & 0x80);
  473.  453   1          bRTD_SCLK   = 1;
  474.  454   1          bRTD_SCLK   = 0;
  475.  455   1      
  476.  456   1          bRTD_SDIO_0 = 1;
  477.  457   1          bRTD_SCLK   = 1;
  478.  458   1      
  479.  459   1      #endif
  480.  460   1      
  481.  461   1      
  482.  462   1      }
  483.  463          
  484.  464          void RTDSendAddr(unsigned char addr, unsigned char rd, unsigned char inc)   // rd   : 0 - Write, 1 - Read
  485.  465          {
  486.  466   1      
  487.  467   1      #if(PARALLEL_PORT)
  488.               
  489.                   RTDSendByte(addr);
  490.               
  491.                       bRTD_SDIO_0 = (bit)(rd & 0x01);
  492.                       bRTD_SDIO_1 = (bit)(inc & 0x01);
  493.                       
  494.                       bRTD_SCLK = 0;
  495.               
  496.                       bRTD_SDIO_0 = 1;
  497.                       bRTD_SDIO_1 = 1;
  498.                       bRTD_SCLK = 1;
  499.               #else // serial port
  500.  480   1          RTDSendByte(addr);
  501.  481   1      
  502. C51 COMPILER V7.06   ACCESS                                                                11/21/2005 13:47:43 PAGE 9   
  503.  482   1          bRTD_SDIO_0 = 1;
  504.  483   1          bRTD_SCLK   = 1;        
  505.  484   1          bRTD_SDIO_0 = (bit)(rd & 0x01); 
  506.  485   1          bRTD_SCLK   = 1;
  507.  486   1          bRTD_SCLK   = 0;
  508.  487   1          bRTD_SDIO_0 = (bit)(inc & 0x01); 
  509.  488   1          bRTD_SCLK   = 1;
  510.  489   1          bRTD_SCLK   = 0;
  511.  490   1          bRTD_SDIO_0 = 1;
  512.  491   1      #endif
  513.  492   1      
  514.  493   1      
  515.  494   1      }
  516.  495          
  517.  496          void RTDSendStop(void)
  518.  497          {
  519.  498   1      
  520.  499   1              bRTD_SCLK   = 0;
  521.  500   1              bRTD_SCLK   = 1; 
  522.  501   1              bRTD_SCSB   = 1;
  523.  502   1      
  524.  503   1      }
  525.  504          
  526.  505          void RTDRead(unsigned char index, unsigned char count, unsigned char inc)
  527.  506          {
  528.  507   1          if (count)
  529.  508   1          {
  530.  509   2              bRTD_SCSB   = 0;
  531.  510   2      
  532.  511   2              RTDSendAddr(index, 1, inc);
  533.  512   2      
  534.  513   2              index   = 0;
  535.  514   2              do
  536.  515   2              {
  537.  516   3                  Data[index++]   = RTDGetByte();
  538.  517   3              }
  539.  518   2              while (--count);
  540.  519   2      
  541.  520   2                      RTDSendStop();
  542.  521   2      
  543.  522   2          }
  544.  523   1      }
  545.  524          
  546.  525          void RTDWrite(unsigned char data *array)
  547.  526          {
  548.  527   1      
  549.  528   1          unsigned char   len, m;
  550.  529   1      
  551.  530   1          do
  552.  531   1          {
  553.  532   2              if (0 == (array[0] & 0xfc))     return;
  554.  533   2      
  555.  534   2              len     = array[0] - 3;
  556.  535   2              array   = array + 1;
  557.  536   2              bRTD_SCSB   = 0;
  558.  537   2      
  559.  538   2      
  560.  539   2              if (BURST == array[0])
  561.  540   2              {
  562.  541   3                  RTDSendAddr(array[1], 0, N_INC);
  563.  542   3      
  564.  543   3                  array   = array + 2;
  565. C51 COMPILER V7.06   ACCESS                                                                11/21/2005 13:47:43 PAGE 10  
  566.  544   3                  m       = array[0];
  567.  545   3      
  568.  546   3                  do
  569.  547   3                  {
  570.  548   4                      RTDSendByte(m);
  571.  549   4                  }
  572.  550   3                  while (--len);
  573.  551   3      
  574.  552   3                  array   = array + 1;
  575.  553   3              }
  576.  554   2              else
  577.  555   2              {
  578.  556   3                  RTDSendAddr(array[1], 0, array[0]);
  579.  557   3      
  580.  558   3                  array   = array + 2;
  581.  559   3                  do
  582.  560   3                  {
  583.  561   4                      RTDSendByte(*array++);
  584.  562   4                  }
  585.  563   3                  while (--len);
  586.  564   3              }
  587.  565   2                      RTDSendStop();
  588.  566   2          }
  589.  567   1          while (1);
  590.  568   1      }
  591.  569          
  592.  570          void RTDCodeW(unsigned char code *array)
  593.  571          {
  594.  572   1          unsigned char   len, m;
  595.  573   1      
  596.  574   1          do
  597.  575   1          {
  598.  576   2              if (0 == (array[0] & 0xfc))     return;
  599.  577   2      
  600.  578   2              len     = array[0] - 3;
  601.  579   2              array   = array + 1;
  602.  580   2              bRTD_SCSB   = 0;
  603.  581   2      
  604.  582   2              if (BURST == array[0])
  605.  583   2              {
  606.  584   3                  RTDSendAddr(array[1], 0, N_INC);
  607.  585   3      
  608.  586   3                  array   = array + 2;
  609.  587   3                  m       = array[0];
  610.  588   3                  
  611.  589   3                  do
  612.  590   3                  {
  613.  591   4                      RTDSendByte(m);
  614.  592   4                  }
  615.  593   3                  while (--len);
  616.  594   3      
  617.  595   3                  array   = array + 1;
  618.  596   3              }
  619.  597   2              else
  620.  598   2              {
  621.  599   3                  RTDSendAddr(array[1], 0, array[0]);
  622.  600   3      
  623.  601   3                  array   = array + 2;
  624.  602   3                  do
  625.  603   3                  {
  626.  604   4                      RTDSendByte(*array++);
  627.  605   4                  }
  628. C51 COMPILER V7.06   ACCESS                                                                11/21/2005 13:47:43 PAGE 11  
  629.  606   3                  while (--len);
  630.  607   3              }
  631.  608   2                      RTDSendStop();
  632.  609   2      
  633.  610   2          }
  634.  611   1          while (1);
  635.  612   1      }
  636.  613          
  637.  614          void RTDOSDW(unsigned char code *array)
  638.  615          {
  639.  616   1          unsigned char   len;
  640.  617   1          do
  641.  618   1          {
  642.  619   2              if (array[0] == _end_)     return;
  643.  620   2                          
  644.  621   2                      bRTD_SCSB   = 0;
  645.  622   2              RTDSendAddr(OSD_ROW_90,WRITE,Y_INC);
  646.  623   2              RTDSendByte(*array++);
  647.  624   2              RTDSendByte(*array++);
  648.  625   2      
  649.  626   2                      RTDSendStop();
  650.  627   2      
  651.  628   2                      bRTD_SCSB   = 0;
  652.  629   2              RTDSendAddr(OSD_DATA_92,WRITE,N_INC);
  653.  630   2              do
  654.  631   2                      {
  655.  632   3                 if(array[0] == _ext_)
  656.  633   3                 {
  657.  634   4                     if(array[2] == _bb_)
  658.  635   4                     {
  659.  636   5                        do
  660.  637   5                        {
  661.  638   6                           len = array[3] - 1;
  662.  639   6                           RTDSendByte(_ext_ + array[1]);
  663.  640   6                         }while(len--);
  664.  641   5      
  665.  642   5                         array += 4;
  666.  643   5                     }
  667.  644   4                     else
  668.  645   4                     {
  669.  646   5                         RTDSendByte(_ext_ + array[1]);
  670.  647   5                         array += 2;
  671.  648   5                     }
  672.  649   4                 }
  673.  650   3                 else if(array[1] == _bb_)
  674.  651   3                         {
  675.  652   4                             len = array[2] - 1;
  676.  653   4                                 do
  677.  654   4                                 {
  678.  655   5                                    RTDSendByte(*array);
  679.  656   5                                 }while(len--);
  680.  657   4                             
  681.  658   4                                 array += 3;
  682.  659   4                         }
  683.  660   3                         else
  684.  661   3                             RTDSendByte(*array++);
  685.  662   3      
  686.  663   3      
  687.  664   3                      }while(array[0] != _nn_);
  688.  665   2                      array +=1 ;
  689.  666   2                      RTDSendStop();
  690.  667   2      
  691. C51 COMPILER V7.06   ACCESS                                                                11/21/2005 13:47:43 PAGE 12  
  692.  668   2          }
  693.  669   1          while (1);
  694.  670   1      
  695.  671   1      }
  696.  672          
  697.  673          
  698.  674          void RTDSetByte(unsigned char addr, unsigned char val)
  699.  675          {
  700.  676   1          // Set Write Address
  701.  677   1          bRTD_SCSB   = 0;   
  702.  678   1      
  703.  679   1          RTDSendAddr(addr, 0, 1);
  704.  680   1      
  705.  681   1          // Write one Byte
  706.  682   1          RTDSendByte(val);
  707.  683   1      
  708.  684   1              RTDSendStop();
  709.  685   1      
  710.  686   1      }
  711.  687          
  712.  688          void RTDSetBit(unsigned char addr, unsigned char and, unsigned char or)
  713.  689          {
  714.  690   1          // Set Read Address
  715.  691   1          bRTD_SCSB   = 0;
  716.  692   1          RTDSendAddr(addr, 1, 1);
  717.  693   1      
  718.  694   1          // Read 1 Byte
  719.  695   1          or      = (RTDGetByte() & and) | or;
  720.  696   1      
  721.  697   1              RTDSendStop();
  722.  698   1      
  723.  699   1          // Set Write Address
  724.  700   1          bRTD_SCSB   = 0;   
  725.  701   1          RTDSendAddr(addr, 0, 1);
  726.  702   1      
  727.  703   1          // Write one Byte
  728.  704   1          RTDSendByte(or);
  729.  705   1      
  730.  706   1              RTDSendStop();
  731.  707   1      
  732.  708   1      
  733.  709   1      }
  734.  710          
  735.  711          #if(VLC_COMPRESS)
  736.  712          void Load_VLC_Font(unsigned char code *array, unsigned int start, unsigned int length)
  737.  713          {
  738.  714   1              unsigned char n,m;
  739.  715   1              unsigned char ucTemp[3];
  740.  716   1              unsigned char idata ucTemp_VLD[3];
  741.  717   1              
  742.  718   1      #if(PARALLEL_PORT)
  743.               //      unsigned char ucTemp1;
  744.               #endif
  745.  721   1      
  746.  722   1              start += FONT_BASE_ADDRESS;
  747.  723   1      
  748.  724   1              bRTD_SCSB   = 0;   
  749.  725   1              RTDSendAddr(OSD_ROW_90, WRITE, Y_INC);
  750.  726   1              ucTemp[0] = (unsigned char)((start >> 8) & 0x000f) | 0xd0;
  751.  727   1              RTDSendByte(ucTemp[0]);
  752.  728   1              ucTemp[0] = (unsigned char)(start & 0x00ff);
  753.  729   1              RTDSendByte(ucTemp[0]);
  754. C51 COMPILER V7.06   ACCESS                                                                11/21/2005 13:47:43 PAGE 13  
  755.  730   1      
  756.  731   1              RTDSendStop();
  757.  732   1      
  758.  733   1              bRTD_SCSB   = 0;   
  759.  734   1              RTDSendAddr(OSD_DATA_92, WRITE, N_INC);
  760.  735   1      
  761.  736   1              ucCnt = 0;
  762.  737   1              uiCount = 0;
  763.  738   1              bBit = 0;
  764.  739   1              ucByte_Temp = 0;
  765.  740   1      
  766.  741   1              do
  767.  742   1              {
  768.  743   2                      for(m=0; m<9; m++)
  769.  744   2                      {
  770.  745   3      
  771.  746   3                              ucTemp_VLD[0] = Get_VLD(array) << 4;
  772.  747   3                              ucTemp_VLD[0] |= Get_VLD(array);
  773.  748   3                              ucTemp_VLD[1] = Get_VLD(array) << 4;
  774.  749   3                              ucTemp_VLD[1] |= Get_VLD(array);
  775.  750   3                              ucTemp_VLD[2] = Get_VLD(array) << 4;
  776.  751   3                              ucTemp_VLD[2] |= Get_VLD(array);
  777.  752   3                              
  778.  753   3                              //Rearrange the byte order
  779.  754   3                              ucTemp[0] = (ucTemp_VLD[1] << 4) | (ucTemp_VLD[2] & 0x0f);
  780.  755   3                              ucTemp[1] = (ucTemp_VLD[2] & 0xf0) | (ucTemp_VLD[0] & 0x0f);
  781.  756   3                              ucTemp[2] = (ucTemp_VLD[0] & 0xf0) | (ucTemp_VLD[1] >> 4);
  782.  757   3      
  783.  758   3                              for(n=0;n<3;n++)
  784.  759   3                              {
  785.  760   4      #if(PARALLEL_PORT)
  786.                                               
  787.               #if(KINGMICE)
  788.                                               bRTD_SDIO_0 = (bit)(ucTemp[n] & 0x01);
  789.                                               bRTD_SDIO_1 = (bit)(ucTemp[n] & 0x02);
  790.                                               bRTD_SDIO_2 = (bit)(ucTemp[n] & 0x04);
  791.                                               bRTD_SDIO_3 = (bit)(ucTemp[n] & 0x08);
  792.                                               bRTD_SCLK   = 1;
  793.                                               bRTD_SCLK   = 0;
  794.                                               bRTD_SDIO_0 = (bit)(ucTemp[n] & 0x10);
  795.                                               bRTD_SDIO_1 = (bit)(ucTemp[n] & 0x20);
  796.                                               bRTD_SDIO_2 = (bit)(ucTemp[n] & 0x40);
  797.                                               bRTD_SDIO_3 = (bit)(ucTemp[n] & 0x80);
  798.                                               bRTD_SCLK   = 1;
  799.                                               bRTD_SCLK   = 0;
  800.                                               bRTD_SDIO_0 = 1;
  801.                                               bRTD_SDIO_1 = 1;
  802.                                               bRTD_SDIO_2 = 1;
  803.                                               bRTD_SDIO_3 = 1;
  804.                                               bRTD_SCLK   = 1;
  805.               #else
  806.                                               ucTemp1 = P0 & 0xf0;
  807.               
  808.                                               P0 = ucTemp1 | (ucTemp[n] & 0x0f);
  809.                                               bRTD_SCLK   = 1;
  810.                                               bRTD_SCLK   = 0;
  811.                                               P0 = ucTemp1 | (ucTemp[n] >> 4);
  812.                                               bRTD_SCLK   = 1;
  813.                                               bRTD_SCLK   = 0;
  814.                                               P0 = ucTemp1 | 0x0f;
  815.                                               bRTD_SCLK   = 1;
  816.               #endif
  817. C51 COMPILER V7.06   ACCESS                                                                11/21/2005 13:47:43 PAGE 14  
  818.               
  819.               #else
  820.  794   4                                      bRTD_SDIO_0 = (bit)(ucTemp[n] & 0x01);
  821.  795   4                                      bRTD_SCLK   = 1;
  822.  796   4                                      bRTD_SCLK   = 0;
  823.  797   4                                      bRTD_SDIO_0 = (bit)(ucTemp[n] & 0x02);
  824.  798   4                                      bRTD_SCLK   = 1;
  825.  799   4                                      bRTD_SCLK   = 0;
  826.  800   4                                      bRTD_SDIO_0 = (bit)(ucTemp[n] & 0x04);
  827.  801   4                                      bRTD_SCLK   = 1;
  828.  802   4                                      bRTD_SCLK   = 0;
  829.  803   4                                      bRTD_SDIO_0 = (bit)(ucTemp[n] & 0x08);
  830.  804   4                                      bRTD_SCLK   = 1;
  831.  805   4                                      bRTD_SCLK   = 0;
  832.  806   4                                      bRTD_SDIO_0 = (bit)(ucTemp[n] & 0x10);
  833.  807   4                                      bRTD_SCLK   = 1;
  834.  808   4                                      bRTD_SCLK   = 0;
  835.  809   4                                      bRTD_SDIO_0 = (bit)(ucTemp[n] & 0x20);
  836.  810   4                                      bRTD_SCLK   = 1;
  837.  811   4                                      bRTD_SCLK   = 0;
  838.  812   4                                      bRTD_SDIO_0 = (bit)(ucTemp[n] & 0x40);
  839.  813   4                                      bRTD_SCLK   = 1;
  840.  814   4                                      bRTD_SCLK   = 0;
  841.  815   4                                      bRTD_SDIO_0 = (bit)(ucTemp[n] & 0x80);
  842.  816   4                                      bRTD_SCLK   = 1;
  843.  817   4                                      bRTD_SCLK   = 0;
  844.  818   4                                      bRTD_SDIO_0 = 1;
  845.  819   4                                      bRTD_SCLK   = 1;
  846.  820   4      #endif
  847.  821   4                              }
  848.  822   3                      }
  849.  823   2              }
  850.  824   1              while (--length);
  851.  825   1      
  852.  826   1              RTDSendStop();
  853.  827   1              
  854.  828   1      }
  855.  829          
  856.  830          unsigned char Get_VLD(unsigned char code *array)
  857.  831          {
  858.  832   1              unsigned char data ucZero_Cnt = 0;
  859.  833   1              bit bSec_Part = 0;
  860.  834   1              
  861.  835   1              while(1)
  862.  836   1              {
  863.  837   2                      if( ucCnt == 0 )
  864.  838   2                      {
  865.  839   3                              ucByte_Temp = *(array + uiCount);
  866.  840   3                              ucCnt = 0x80;
  867.  841   3                              uiCount++;
  868.  842   3                      }
  869.  843   2      
  870.  844   2                      while( ucCnt > 0 )
  871.  845   2                      {
  872.  846   3                              bBit = (bit)(ucByte_Temp & ucCnt);
  873.  847   3                              ucCnt >>= 1;
  874.  848   3      
  875.  849   3                              if( (bBit) && (bSec_Part == 0) )
  876.  850   3                              {
  877.  851   4                                      bSec_Part = 1;
  878.  852   4                              }
  879.  853   3                              else    
  880. C51 COMPILER V7.06   ACCESS                                                                11/21/2005 13:47:43 PAGE 15  
  881.  854   3                              {
  882.  855   4                                      ucZero_Cnt++;
  883.  856   4                              }
  884.  857   3      
  885.  858   3                              if( bSec_Part == 1 )
  886.  859   3                              {
  887.  860   4                                      switch(ucZero_Cnt)
  888.  861   4                                      {
  889.  862   5                                              case 0:
  890.  863   5                                                      bSec_Part = 0;
  891.  864   5                                                      ucZero_Cnt = 0;
  892.  865   5                                                      return 0;
  893.  866   5              
  894.  867   5                                              case 1:
  895.  868   5                                                      Getbit(array);
  896.  869   5                                                      bSec_Part = 0;
  897.  870   5                                                      ucZero_Cnt = 0;
  898.  871   5      
  899.  872   5                                                      if(!bBit)
  900.  873   5                                                      {
  901.  874   6                                                              return 1;
  902.  875   6                                                      }
  903.  876   5                                                      else
  904.  877   5                                                      {
  905.  878   6                                                              return 15;
  906.  879   6                                                      }
  907.  880   5      
  908.  881   5                                              case 2:
  909.  882   5                                                      Getbit(array);
  910.  883   5                                                      bSec_Part = 0;
  911.  884   5                                                      ucZero_Cnt = 0;
  912.  885   5                                                      
  913.  886   5                                                      if(!bBit)
  914.  887   5                                                      {
  915.  888   6                                                              return 2;
  916.  889   6                                                      }
  917.  890   5                                                      else
  918.  891   5                                                      {
  919.  892   6                                                              return 8;
  920.  893   6                                                      }
  921.  894   5      
  922.  895   5                                              case 3:
  923.  896   5                                                      Getbit(array);
  924.  897   5                                                      bSec_Part = 0;
  925.  898   5                                                      ucZero_Cnt = 0;
  926.  899   5      
  927.  900   5                                                      if(!bBit)
  928.  901   5                                                      {
  929.  902   6                                                              return 12;
  930.  903   6                                                      }
  931.  904   5                                                      else
  932.  905   5                                                      {
  933.  906   6                                                              return 7;
  934.  907   6                                                      }
  935.  908   5      
  936.  909   5                                              case 4:
  937.  910   5                                                      Getbit(array);
  938.  911   5                                                      bSec_Part = 0;
  939.  912   5                                                      ucZero_Cnt = 0;
  940.  913   5      
  941.  914   5                                                      if(bBit)
  942.  915   5                                                      {
  943. C51 COMPILER V7.06   ACCESS                                                                11/21/2005 13:47:43 PAGE 16  
  944.  916   6                                                              Getbit(array);
  945.  917   6      
  946.  918   6                                                              if(!bBit)
  947.  919   6                                                              {
  948.  920   7                                                                      return 4;
  949.  921   7                                                              }
  950.  922   6                                                              else
  951.  923   6                                                              {
  952.  924   7                                                                      return 9;
  953.  925   7                                                              }
  954.  926   6                                                      }
  955.  927   5                                                      else
  956.  928   5                                                      {
  957.  929   6                                                              Getbit(array);
  958.  930   6              
  959.  931   6                                                              if(!bBit)
  960.  932   6                                                              {
  961.  933   7                                                                      Getbit(array);
  962.  934   7      
  963.  935   7                                                                      if(!bBit)
  964.  936   7                                                                      {
  965.  937   8                                                                              return 3;
  966.  938   8                                                                      }
  967.  939   7                                                                      else
  968.  940   7                                                                      {
  969.  941   8                                                                              return 11;
  970.  942   8                                                                      }
  971.  943   7      
  972.  944   7                                                              }
  973.  945   6                                                              else
  974.  946   6                                                              {
  975.  947   7                                                                      Getbit(array);
  976.  948   7                                                                      
  977.  949   7                                                                      if(!bBit)
  978.  950   7                                                                      {
  979.  951   8                                                                              return 10;
  980.  952   8                                                                      }
  981.  953   7                                                                      else
  982.  954   7                                                                      {
  983.  955   8                                                                              return 5;
  984.  956   8                                                                      }
  985.  957   7      
  986.  958   7                                                              }
  987.  959   6                                                      }
  988.  960   5      
  989.  961   5                                              case 5:
  990.  962   5                                                      Getbit(array);
  991.  963   5                                                      bSec_Part = 0;
  992.  964   5                                                      ucZero_Cnt = 0;
  993.  965   5      
  994.  966   5                                                      if(bBit)
  995.  967   5                                                      {
  996.  968   6                                                              Getbit(array);
  997.  969   6      
  998.  970   6                                                              if(!bBit)
  999.  971   6                                                              {
  1000.  972   7                                                                      return 14;
  1001.  973   7                                                              }
  1002.  974   6                                                              else
  1003.  975   6                                                              {
  1004.  976   7                                                                      return 13;
  1005.  977   7                                                              }
  1006. C51 COMPILER V7.06   ACCESS                                                                11/21/2005 13:47:43 PAGE 17  
  1007.  978   6                                                      }
  1008.  979   5                                                      else
  1009.  980   5                                                      {
  1010.  981   6                                                              Getbit(array);
  1011.  982   6                                                              if(bBit)
  1012.  983   6                                                              {
  1013.  984   7                                                                      return 6;
  1014.  985   7                                                              }
  1015.  986   6                                                      }
  1016.  987   5                                      }
  1017.  988   4                              }
  1018.  989   3                      }
  1019.  990   2              }
  1020.  991   1      }
  1021.  992          
  1022.  993          void Getbit(unsigned char code *array)
  1023.  994          {
  1024.  995   1              if( ucCnt == 0 )
  1025.  996   1              {
  1026.  997   2                      ucByte_Temp = *(array + uiCount);
  1027.  998   2                      ucCnt = 0x80;
  1028.  999   2                      uiCount++;
  1029. 1000   2              }
  1030. 1001   1                                                              
  1031. 1002   1              bBit = (bit)(ucByte_Temp & ucCnt);
  1032. 1003   1              ucCnt >>= 1;
  1033. 1004   1      
  1034. 1005   1      }
  1035. 1006          #else
  1036.               //length represent the number of character
  1037.               // character number of 1 bit font  = 1
  1038.               // character number of 2 bit font  = 2
  1039.               // character number of 4 bit font  = 4
  1040.               // length = (1 bit font amount) x 1 + (2 bit font amount) x 2 + (4 bit font amount) x 4
  1041.               void Load_Font(unsigned char code *array, unsigned int start, unsigned int length)
  1042.               {
  1043.                   unsigned char   n,m;
  1044.                   unsigned char   ucTemp[3];
  1045.               #if(PARALLEL_PORT)
  1046.               //      unsigned char ucTemp1;
  1047.               #endif
  1048.               
  1049.                   start = start * 9;
  1050.                   start += FONT_BASE_ADDRESS;
  1051.               
  1052.                       bRTD_SCSB   = 0;   
  1053.                       RTDSendAddr(OSD_ROW_90, WRITE, Y_INC);
  1054.                       ucTemp[0] = (unsigned char)((start >> 8) & 0x000f) | 0xd0;
  1055.                       RTDSendByte(ucTemp[0]);
  1056.                       ucTemp[0] = (unsigned char)(start & 0x00ff);
  1057.                       RTDSendByte(ucTemp[0]);
  1058.               
  1059.                       RTDSendStop();
  1060.               
  1061.                       bRTD_SCSB   = 0;   
  1062.                       RTDSendAddr(OSD_DATA_92, WRITE, N_INC);
  1063.               
  1064.                   do
  1065.                   {
  1066.                       for(m=0; m<9; m++)
  1067.                       {
  1068.                                       //Rearrange the byte order
  1069. C51 COMPILER V7.06   ACCESS                                                                11/21/2005 13:47:43 PAGE 18  
  1070.               
  1071.                           ucTemp[0] = (*(array + 1) << 4) | (*(array + 2) & 0x0f);
  1072.                                       ucTemp[1] = (*(array + 2) & 0xf0) | (*array & 0x0f);
  1073.                                       ucTemp[2] = (*array & 0xf0) | (*(array + 1) >> 4);
  1074.               
  1075.                                       for(n=0;n<3;n++)
  1076.                                       {
  1077.               #if(PARALLEL_PORT)
  1078.                                               
  1079.               #if(1)
  1080.                                               bRTD_SDIO_0 = (bit)(ucTemp[n] & 0x01);
  1081.                                               bRTD_SDIO_1 = (bit)(ucTemp[n] & 0x02);
  1082.                                               bRTD_SDIO_2 = (bit)(ucTemp[n] & 0x04);
  1083.                                               bRTD_SDIO_3 = (bit)(ucTemp[n] & 0x08);
  1084.                               bRTD_SCLK   = 1;
  1085.                                               bRTD_SCLK   = 0;
  1086.                                               bRTD_SDIO_0 = (bit)(ucTemp[n] & 0x10);
  1087.                                               bRTD_SDIO_1 = (bit)(ucTemp[n] & 0x20);
  1088.                                               bRTD_SDIO_2 = (bit)(ucTemp[n] & 0x40);
  1089.                                               bRTD_SDIO_3 = (bit)(ucTemp[n] & 0x80);
  1090.                                               bRTD_SCLK   = 1;
  1091.                                               bRTD_SCLK   = 0;
  1092.                                               bRTD_SDIO_0 = 1;
  1093.                                               bRTD_SDIO_1 = 1;
  1094.                                               bRTD_SDIO_2 = 1;
  1095.                                               bRTD_SDIO_3 = 1;
  1096.                                               bRTD_SCLK   = 1;
  1097.               #else
  1098.                                               ucTemp1 = P0 & 0xf0;
  1099.               
  1100.                                               P0 = ucTemp1 | (ucTemp[n] & 0x0f);
  1101.                                               bRTD_SCLK   = 1;
  1102.                                               bRTD_SCLK   = 0;
  1103.                                               P0 = ucTemp1 | (ucTemp[n] >> 4);
  1104.                                               bRTD_SCLK   = 1;
  1105.                                               bRTD_SCLK   = 0;
  1106.                                               P0 = ucTemp1 | 0x0f;
  1107.                                               bRTD_SCLK   = 1;
  1108.               #endif
  1109.               
  1110.               #else
  1111.                                               bRTD_SDIO_0 = (bit)(ucTemp[n] & 0x01);
  1112.                                               bRTD_SCLK   = 1;
  1113.                                               bRTD_SCLK   = 0;
  1114.                                               bRTD_SDIO_0 = (bit)(ucTemp[n] & 0x02);
  1115.                                               bRTD_SCLK   = 1;
  1116.                                               bRTD_SCLK   = 0;
  1117.                                               bRTD_SDIO_0 = (bit)(ucTemp[n] & 0x04);
  1118.                                               bRTD_SCLK   = 1;
  1119.                                               bRTD_SCLK   = 0;
  1120.                                               bRTD_SDIO_0 = (bit)(ucTemp[n] & 0x08);
  1121.                                               bRTD_SCLK   = 1;
  1122.                                               bRTD_SCLK   = 0;
  1123.                                               bRTD_SDIO_0 = (bit)(ucTemp[n] & 0x10);
  1124.                                               bRTD_SCLK   = 1;
  1125.                                               bRTD_SCLK   = 0;
  1126.                                               bRTD_SDIO_0 = (bit)(ucTemp[n] & 0x20);
  1127.                                               bRTD_SCLK   = 1;
  1128.                                               bRTD_SCLK   = 0;
  1129.                                               bRTD_SDIO_0 = (bit)(ucTemp[n] & 0x40);
  1130.                                               bRTD_SCLK   = 1;
  1131.                                               bRTD_SCLK   = 0;
  1132. C51 COMPILER V7.06   ACCESS                                                                11/21/2005 13:47:43 PAGE 19  
  1133.                                               bRTD_SDIO_0 = (bit)(ucTemp[n] & 0x80);
  1134.                                               bRTD_SCLK   = 1;
  1135.                                               bRTD_SCLK   = 0;
  1136.                                               bRTD_SDIO_0 = 1;
  1137.                                               bRTD_SCLK   = 1;
  1138.               #endif
  1139.                           }
  1140.                           array += 3;
  1141.                       }
  1142.                   }
  1143.                   while (--length);
  1144.               
  1145.                       RTDSendStop();
  1146.               }
  1147.               #endif
  1148. 1117          
  1149. 1118          
  1150. 1119          #if(HDCP_ENABLE)
  1151.               void KEYCodeW(unsigned char code *array)
  1152.               {
  1153.                   unsigned int m;  
  1154.               
  1155.                  RTDSetBit(DVI_CTRL1_AF, 0x7f,0x00);  //Reset the HDCP key download index
  1156.                  RTDSetBit(DVI_CTRL1_AF, 0x7f,0x80);
  1157.                       
  1158.                   for(m = 0; m < 320; m++)   //Key 0 ~ Key39   
  1159.                   {
  1160.                               RTDSetByte(0xb1,array[m]);
  1161.                   }   
  1162.               
  1163.                   RTDSetBit(DVI_CTRL1_AF, 0x7f,0x00);  //Disable the Key Access Download port
  1164.                   RTDSetBit(TMDS_INPUT_ENA_A1, 0x7f, 0x00);   // Turn on HDCP DDC channel  
  1165.               }
  1166.               #endif
  1167. C51 COMPILER V7.06   ACCESS                                                                11/21/2005 13:47:43 PAGE 20  
  1168. ASSEMBLY LISTING OF GENERATED OBJECT CODE
  1169.              ; FUNCTION Com008D (BEGIN)
  1170. 0000         L?0142:
  1171. 0000 A2E1              MOV     C,ACC.1
  1172. 0002 9290              MOV     bRTD_SDIO_0,C
  1173. 0004 D294              SETB    bRTD_SCLK
  1174. 0006 C294              CLR     bRTD_SCLK
  1175. 0008 A2E2              MOV     C,ACC.2
  1176. 000A 9290              MOV     bRTD_SDIO_0,C
  1177. 000C D294              SETB    bRTD_SCLK
  1178. 000E C294              CLR     bRTD_SCLK
  1179. 0010 A2E3              MOV     C,ACC.3
  1180. 0012 9290              MOV     bRTD_SDIO_0,C
  1181. 0014 D294              SETB    bRTD_SCLK
  1182. 0016 C294              CLR     bRTD_SCLK
  1183. 0018 A2E4              MOV     C,ACC.4
  1184. 001A 9290              MOV     bRTD_SDIO_0,C
  1185. 001C D294              SETB    bRTD_SCLK
  1186. 001E C294              CLR     bRTD_SCLK
  1187. 0020 A2E5              MOV     C,ACC.5
  1188. 0022 9290              MOV     bRTD_SDIO_0,C
  1189. 0024 D294              SETB    bRTD_SCLK
  1190. 0026 C294              CLR     bRTD_SCLK
  1191. 0028 A2E6              MOV     C,ACC.6
  1192. 002A 9290              MOV     bRTD_SDIO_0,C
  1193. 002C D294              SETB    bRTD_SCLK
  1194. 002E C294              CLR     bRTD_SCLK
  1195. 0030 33                RLC     A
  1196. 0031         L?0143:
  1197. 0031 9290              MOV     bRTD_SDIO_0,C
  1198. 0033 D294              SETB    bRTD_SCLK
  1199. 0035 C294              CLR     bRTD_SCLK
  1200. 0037 22                RET     
  1201. 0038         L?0150:
  1202. 0038         L?0151:
  1203. 0038 D294              SETB    bRTD_SCLK
  1204. 003A C294              CLR     bRTD_SCLK
  1205. 003C A290              MOV     C,bRTD_SDIO_0
  1206. 003E 22                RET     
  1207. 003F         L?0153:
  1208. 003F         L?0154:
  1209. 003F 850082      R     MOV     DPL,array+01H
  1210. 0042 850083      R     MOV     DPH,array
  1211. 0045 22                RET     
  1212. 0046         L?0157:
  1213. 0046 93                MOVC    A,@A+DPTR
  1214. 0047 FF                MOV     R7,A
  1215. 0048 E4                CLR     A
  1216. 0049 FD                MOV     R5,A
  1217. 004A 120000      R     LCALL   _RTDSendAddr
  1218. 004D 7402              MOV     A,#02H
  1219. 004F 2500        R     ADD     A,array+01H
  1220. 0051 F500        R     MOV     array+01H,A
  1221. 0053 E4                CLR     A
  1222. 0054 3500        R     ADDC    A,array
  1223. 0056 F500        R     MOV     array,A
  1224. 0058 22                RET     
  1225. 0059         L?0158:
  1226. 0059 9297              MOV     bIIC_SDA,C
  1227. 005B 120000      R     LCALL   BitDly
  1228. C51 COMPILER V7.06   ACCESS                                                                11/21/2005 13:47:43 PAGE 21  
  1229. 005E         L?0159:
  1230. 005E D296              SETB    bIIC_SCL
  1231. 0060 120000      R     LCALL   BitDly
  1232. 0063 C296              CLR     bIIC_SCL
  1233. 0065 22                RET     
  1234. 0066         L?0160:
  1235. 0066 3500        R     ADDC    A,uiCount
  1236. 0068 F583              MOV     DPH,A
  1237. 006A E4                CLR     A
  1238. 006B 93                MOVC    A,@A+DPTR
  1239. 006C F500        R     MOV     ucByte_Temp,A
  1240. 006E 750080      R     MOV     ucCnt,#080H
  1241. 0071 0500        R     INC     uiCount+01H
  1242. 0073 E500        R     MOV     A,uiCount+01H
  1243. 0075 22                RET     
  1244. 0076         L?0161:
  1245. 0076 E500        R     MOV     A,ucByte_Temp
  1246. 0078 5500        R     ANL     A,ucCnt
  1247. 007A 24FF              ADD     A,#0FFH
  1248. 007C 9200        R     MOV     bBit,C
  1249. 007E E500        R     MOV     A,ucCnt
  1250. 0080 C3                CLR     C
  1251. 0081 13                RRC     A
  1252. 0082 F500        R     MOV     ucCnt,A
  1253. 0084 22                RET     
  1254. 0085         L?0162:
  1255. 0085 120000      R     LCALL   RTDSendStop
  1256. 0088 C295              CLR     bRTD_SCSB
  1257. 008A 0B                INC     R3
  1258. 008B 7F92              MOV     R7,#092H
  1259. 008D 020000      R     LJMP    _RTDSendAddr
  1260. 0090         L?0164:
  1261. 0090 C295              CLR     bRTD_SCSB
  1262. 0092 E4                CLR     A
  1263. 0093 FB                MOV     R3,A
  1264. 0094 FD                MOV     R5,A
  1265. 0095 7F90              MOV     R7,#090H
  1266. 0097 020000      R     LJMP    _RTDSendAddr
  1267. 009A         L?0165:
  1268. 009A         L?0166:
  1269. 009A 0500        R     INC     array+01H
  1270. 009C E500        R     MOV     A,array+01H
  1271. 009E AE00        R     MOV     R6,array
  1272. 00A0 22                RET     
  1273. 00A1         L?0167:
  1274. 00A1 7401              MOV     A,#01H
  1275. 00A3 93                MOVC    A,@A+DPTR
  1276. 00A4 24FC              ADD     A,#0FCH
  1277. 00A6 FF                MOV     R7,A
  1278. 00A7 020000      R     LJMP    _RTDSendByte
  1279.              ; FUNCTION Com008D (END)
  1280.              ; FUNCTION BitDly (BEGIN)
  1281.                                            ; SOURCE LINE # 120
  1282.                                            ; SOURCE LINE # 121
  1283.                                            ; SOURCE LINE # 122
  1284. 0000 00                NOP     
  1285. 0001 00                NOP     
  1286. 0002 00                NOP     
  1287. 0003 00                NOP     
  1288. 0004 00                NOP     
  1289. 0005 00                NOP     
  1290. C51 COMPILER V7.06   ACCESS                                                                11/21/2005 13:47:43 PAGE 22  
  1291. 0006 00                NOP     
  1292. 0007 00                NOP     
  1293.                                            ; SOURCE LINE # 123
  1294. 0008 00                NOP     
  1295. 0009 00                NOP     
  1296. 000A 00                NOP     
  1297. 000B 00                NOP     
  1298. 000C 00                NOP     
  1299. 000D 00                NOP     
  1300. 000E 00                NOP     
  1301. 000F 00                NOP     
  1302.                                            ; SOURCE LINE # 124
  1303. 0010 00                NOP     
  1304. 0011 00                NOP     
  1305. 0012 00                NOP     
  1306. 0013 00                NOP     
  1307. 0014 00                NOP     
  1308. 0015 00                NOP     
  1309. 0016 00                NOP     
  1310. 0017 00                NOP     
  1311.                                            ; SOURCE LINE # 125
  1312. 0018 00                NOP     
  1313. 0019 00                NOP     
  1314. 001A 00                NOP     
  1315. 001B 00                NOP     
  1316. 001C 00                NOP     
  1317. 001D 00                NOP     
  1318. 001E 00                NOP     
  1319. 001F 00                NOP     
  1320.                                            ; SOURCE LINE # 126
  1321. 0020 22                RET     
  1322.              ; FUNCTION BitDly (END)
  1323.              ; FUNCTION _I2CRead (BEGIN)
  1324.                                            ; SOURCE LINE # 128
  1325. 0000 8F00        R     MOV     addr,R7
  1326. 0002 8B00        R     MOV     count,R3
  1327. ;---- Variable 'index' assigned to Register 'R5' ----
  1328.                                            ; SOURCE LINE # 129
  1329.                                            ; SOURCE LINE # 132
  1330. 0004 E500        R     MOV     A,count
  1331. 0006 6039              JZ      ?C0006
  1332.                                            ; SOURCE LINE # 133
  1333.                                            ; SOURCE LINE # 134
  1334. 0008 E4                CLR     A
  1335. 0009 FB                MOV     R3,A
  1336. 000A 120000      R     LCALL   _I2CSendAddr
  1337.                                            ; SOURCE LINE # 136
  1338. 000D 7B01              MOV     R3,#01H
  1339. 000F E4                CLR     A
  1340. 0010 FD                MOV     R5,A
  1341. 0011 AF00        R     MOV     R7,addr
  1342. 0013 120000      R     LCALL   _I2CSendAddr
  1343.                                            ; SOURCE LINE # 138
  1344. 0016 1500        R     DEC     count
  1345.                                            ; SOURCE LINE # 140
  1346. 0018 E4                CLR     A
  1347. 0019 F500        R     MOV     n,A
  1348. 001B         ?C0003:
  1349. 001B E500        R     MOV     A,n
  1350. 001D C3                CLR     C
  1351. 001E 9500        R     SUBB    A,count
  1352. C51 COMPILER V7.06   ACCESS                                                                11/21/2005 13:47:43 PAGE 23  
  1353. 0020 5010              JNC     ?C0004
  1354. 0022 E4                CLR     A
  1355. 0023 FF                MOV     R7,A
  1356. 0024 120000      R     LCALL   _I2CGetByte
  1357. 0027 7400        R     MOV     A,#LOW Data
  1358. 0029 2500        R     ADD     A,n
  1359. 002B F8                MOV     R0,A
  1360. 002C A607              MOV     @R0,AR7
  1361. 002E 0500        R     INC     n
  1362. 0030 80E9              SJMP    ?C0003
  1363. 0032         ?C0004:
  1364.                                            ; SOURCE LINE # 142
  1365. 0032 7F01              MOV     R7,#01H
  1366. 0034 120000      R     LCALL   _I2CGetByte
  1367. 0037 7400        R     MOV     A,#LOW Data
  1368. 0039 2500        R     ADD     A,count
  1369. 003B F8                MOV     R0,A
  1370. 003C A607              MOV     @R0,AR7
  1371.                                            ; SOURCE LINE # 144
  1372. 003E 120000      R     LCALL   I2CSendStop
  1373.                                            ; SOURCE LINE # 145
  1374.                                            ; SOURCE LINE # 146
  1375. 0041         ?C0006:
  1376. 0041 22                RET     
  1377.              ; FUNCTION _I2CRead (END)
  1378.              ; FUNCTION _I2CWrite (BEGIN)
  1379.                                            ; SOURCE LINE # 148
  1380. 0000 8B00        R     MOV     array,R3
  1381. 0002 8A00        R     MOV     array+01H,R2
  1382. 0004 8900        R     MOV     array+02H,R1
  1383.                                            ; SOURCE LINE # 149
  1384.                                            ; SOURCE LINE # 152
  1385. 0006 120000      E     LCALL   ?C?CLDPTR
  1386. 0009 FF                MOV     R7,A
  1387. 000A 7403              MOV     A,#03H
  1388. 000C D3                SETB    C
  1389. 000D 9F                SUBB    A,R7
  1390. 000E 5039              JNC     ?C0011
  1391.                                            ; SOURCE LINE # 153
  1392.                                            ; SOURCE LINE # 154
  1393. 0010 8F00        R     MOV     len,R7
  1394.                                            ; SOURCE LINE # 155
  1395. 0012 900001            MOV     DPTR,#01H
  1396. 0015 120000      E     LCALL   ?C?CLDOPTR
  1397. 0018 FF                MOV     R7,A
  1398. 0019 900002            MOV     DPTR,#02H
  1399. 001C 120000      E     LCALL   ?C?CLDOPTR
  1400. 001F FD                MOV     R5,A
  1401. 0020 E4                CLR     A
  1402. 0021 FB                MOV     R3,A
  1403. 0022 120000      R     LCALL   _I2CSendAddr