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

📄 si2c.lst

📁 MST720-DEMO程序
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.50   SI2C                                                                  03/18/2008 22:29:07 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE SI2C
OBJECT MODULE PLACED IN ..\1out\SI2C.obj
COMPILER INVOKED BY: D:\设计软件\Keil\C51\BIN\C51.EXE ..\KERNEL\SI2C.c BROWSE INCDIR(..\INC\;..\PANEL\;..\UI\;..\OPTION\
                    -;..\SCALER\DSP\) DEFINE(MCU_TYPE_SEL=0) DEBUG OBJECTEXTEND PRINT(..\1out\SI2C.lst) OBJECT(..\1out\SI2C.obj)

line level    source

   1          /******************************************************************************
   2           Copyright (c) 2005 MStar Semiconductor, Inc.
   3           All rights reserved.
   4          
   5           [Module Name]: SI2C.c
   6           [Date]:        13-Mar-2005
   7           [Comment]:
   8             For Slave I2C functions.
   9           [Reversion History]:
  10          
  11           Registers read and write command list:
  12           DATA WRITE : START + 0x6E + 0x10 + addrh + addrl + data + STOP
  13           DATA READ  : START + 0x6E + 0x10 + addrh + addrl + START + 0x6F + data +STOP
  14          
  15           Functions read and write command list:
  16           write contrast   : START + 0x6E + 0x20 +  01  +   xxh +   data  + STOP
  17           read  contrast   : START + 0x6E + 0x20 +  01  +   xxh +   START + 0x6F + (data) + STOP
  18           write Brightness : START + 0x6E + 0x20 +  02  +   xxh +   data  + STOP
  19           read  Brightness : START + 0x6E + 0x20 +  02  +   xxh +   START + 0x6F + (data) + STOP  
  20           ON/OFF Panel set : START + 0x6E + 0x20 +  10  +   xxh +   0:OFF 1:ON  + STOP
  21           ON/OFF Panel Rd  : START + 0x6E + 0x20 +  10  +   xxh +   START + 0x6F + (data) + STOP  
  22          
  23          *******************************************************************************/
  24          
  25          #define _SI2C_C_
  26          
  27          /********************
  28          * INCLUDE FILES     *
  29          *********************/
  30          #include "Project.h"
  31          #include "TypeDef.h"
  32          #include "Ms7X_reg.h"
  33          #include "Global.h"
  34          #include "Mcu.h"
  35          #include "Mcu_reg.h"
  36          #include "Ms_Rwreg.h"
  37          #include "Misc.h"
  38          #include "Sync.h"
  39          #include "OSDMenu.h"
  40          #include "Ms_Func.h"
  41          #include "msACE.h"
  42          #include "SI2C.h"
  43          #include "Debug.h"
  44          
  45          #if SI2C_ENABLE
  46          /**********************
  47          * FUNCTION PROTOTYPES *
  48          ***********************/
  49          void sysSlaveI2CInitial(void)
  50          {
  51   1              mstWriteByte(GEN_00_REGBK, REGBANKSCALER);      // Register bank switch to Scaler
  52   1              mstWriteByte(BK0_1B_INTENB, 0x00);              // Enable Scaler interrupt (datr & datw)
  53   1              mstWriteByte(BK0_1D_INTENC, 0x00);              // Enable Scaler interrupt (star & stop)
  54   1              mstWriteByte(BK0_1A_INTSTB, 0x00);
C51 COMPILER V7.50   SI2C                                                                  03/18/2008 22:29:07 PAGE 2   

  55   1              mstWriteByte(BK0_1C_INTSTC, 0x00);
  56   1      
  57   1              g_bSI2CCommandFlag = 0;
  58   1              g_bSI2CDebugModeFlag = 0;
  59   1              g_ucSI2CBuffIndex = 0;
  60   1              MCUXFR_19_DDC2BI_ID = 0x80 + (0x6E>>1);         // Set SI2C slave address 0x6E , bit7:Enable SI2C
  61   1              MCUXFR_18_DDC2BI_CTRL = 0x02;                                   // Enable SI2C no_ack 
  62   1              MCUXFR_11_DDC2BI_FLAG = 0x00;                                   // Clear all interrupt flag
  63   1              PX0 = 1;                                                                                        // Set to high priority interrupt
  64   1              IT0 = 1;                                                                                        // set INT0 level trigger
  65   1              EX0 = 1;                                                                        //enable MCU INT0
  66   1              MCUXFR_10_DDC2BI_INT_EN = 0x3E;                         // Enable SI2C interrupt
  67   1      }
  68          
  69          void sysSlaveI2CCommand(void)
  70          {
  71   1              WORD uwAddress;
  72   1              BYTE ucTemp;
  73   1              
  74   1              do
  75   1              {
  76   2                      if(g_bSI2CCommandFlag)
  77   2                      {
  78   3                              if(SI2C_CATEGORY == SI2C_CMD_BASIC)
  79   3                              {
  80   4                                      if(g_ucSI2CBuffIndex==SI2C_WRITE_CMD_LEN)
  81   4                                      {
  82   5                                              // enter debug mode
  83   5                                              if((SI2C_FUNCTION==SI2C_BAS_DEBUG)&&(SI2C_CONTROL==0x01))
  84   5                                                      g_bSI2CDebugModeFlag=1;
  85   5      
  86   5                                              // exit debug mode
  87   5                                              if((SI2C_FUNCTION==SI2C_BAS_DEBUG)&&(SI2C_CONTROL==0x00))
  88   5                                                      g_bSI2CDebugModeFlag=0;
  89   5                                      }
  90   4                                      else if(g_ucSI2CBuffIndex==SI2C_READ_CMD_LEN)
  91   4                                      {
  92   5                                              if((SI2C_FUNCTION==SI2C_BAS_VERSION)&&(SI2C_CONTROL==0x0F))//Feedback Bias version
  93   5                                                      SI2C_DATA=Display.ucVersion;
  94   5                                              MCUXFR_13_DDC2BI_R_BUF=SI2C_DATA;
  95   5                                      }
  96   4                              }
  97   3                              // Functions read and write
  98   3                              else if(SI2C_CATEGORY==SI2C_CMD_FUNC)
  99   3                              {
 100   4                                      if(g_ucSI2CBuffIndex==SI2C_READ_CMD_LEN)
 101   4                                      {
 102   5                                              if(SI2C_FUNCTION==SI2C_FUNC_BRIGHTNESS)
 103   5                                                      SI2C_DATA=Display.ucBrightness;
 104   5                                              else if(SI2C_FUNCTION==SI2C_FUNC_CONTRAST)
 105   5                                                      SI2C_DATA=Display.ucVedioContrast;
 106   5                                              else if(SI2C_FUNCTION==SI2C_FUNC_HUE)
 107   5                                                      SI2C_DATA=Display.ucHue;
 108   5                                              else if(SI2C_FUNCTION==SI2C_FUNC_SATURATION)
 109   5                                                      SI2C_DATA=Display.ucSaturation;
 110   5                                              else if(SI2C_FUNCTION==SI2C_FUNC_GAMMA)
 111   5                                                      SI2C_DATA=Display.ucGamma;
 112   5                                              else if(SI2C_FUNCTION==SI2C_FUNC_SCALING)
 113   5                                                      SI2C_DATA=Display.ucScalingMode;
 114   5                                              else if(SI2C_FUNCTION==SI2C_FUNC_SOURCE)
 115   5                                                      SI2C_DATA=tOSDSourcSELSequence[Display.ucSourceSEL];
 116   5                                              else if(SI2C_FUNCTION==SI2C_FUNC_VCOM_DC)
C51 COMPILER V7.50   SI2C                                                                  03/18/2008 22:29:07 PAGE 3   

 117   5                                                      SI2C_DATA=Display.ucVCOMdc;
 118   5                                              else if(SI2C_FUNCTION==SI2C_FUNC_VCOM_AC)
 119   5                                                      SI2C_DATA=Display.ucVCOMac;
 120   5                                              else if(SI2C_FUNCTION==SI2C_FUNC_GPIO)
 121   5                                              {
 122   6                                                      if(SI2C_CONTROL==SI2C_GPIO_0_7)
 123   6                                                              SI2C_DATA=P0;
 124   6                                                      else if(SI2C_CONTROL==SI2C_GPIO_8_15)
 125   6                                                              SI2C_DATA=P1;
 126   6                                                      else if(SI2C_CONTROL==SI2C_GPIO_16_23)
 127   6                                                              SI2C_DATA=P2;
 128   6                                                      else if(SI2C_CONTROL==SI2C_GPIO_24_29)
 129   6                                                              SI2C_DATA=P4;
 130   6                                              }
 131   5                                              MCUXFR_13_DDC2BI_R_BUF=SI2C_DATA;
 132   5                                      }
 133   4                                      else if(g_ucSI2CBuffIndex==SI2C_WRITE_CMD_LEN)
 134   4                                      {
 135   5                                              if(SI2C_FUNCTION==SI2C_FUNC_BRIGHTNESS)
 136   5                                              {       
 137   6                                                      if((SI2C_DATA<=100)&&(SI2C_DATA>=0))
 138   6                                                      {
 139   7                                                              Display.ucBrightness=SI2C_DATA;
 140   7                                                              mstSetBrightness(SI2C_DATA);
 141   7                                                      }
 142   6                                              }
 143   5                                              else if(SI2C_FUNCTION==SI2C_FUNC_CONTRAST)
 144   5                                              {       
 145   6                                                      if((SI2C_DATA<=MAX_CONTRAST)&&(SI2C_DATA>=MIN_CONTRAST))
 146   6                                                      {
 147   7                                                              Display.ucVedioContrast=SI2C_DATA;
 148   7                                                              mstSetContrast(SI2C_DATA);
 149   7                                                      }
 150   6                                                      
 151   6                                              }
 152   5                                              else if(SI2C_FUNCTION==SI2C_FUNC_HUE)

⌨️ 快捷键说明

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