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

📄 key.lst

📁 CS8955控制TV软件。用MCU做模拟电视的控制。
💻 LST
字号:
C51 COMPILER V8.05a   KEY                                                                  07/03/2008 18:27:37 PAGE 1   


C51 COMPILER V8.05a, COMPILATION OF MODULE KEY
OBJECT MODULE PLACED IN .\OBJ\Key.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE key\Key.C LARGE BROWSE INCDIR(.\include) DEBUG OBJECTEXTEND PRINT(.\Key.lst
                    -) OBJECT(.\OBJ\Key.obj)

line level    source

   1          /******************************************************************************\
   2               Project Version:   MTKCARDVD()
   3          ********************************************************************************
   4               Filename:          Key.c
   5          
   6               Author:            Alan chan
   7          
   8               Company:           CoreTek/ACT Company
   9          
  10          ********************************************************************************
  11               File Version:      1.01
  12               File Created:      July 2007
  13          
  14               Compiled Using:    keil uVision2 Version 2.23 
  15          
  16          ********************************************************************************
  17               Files Required:
  18          
  19          ********************************************************************************
  20               File Description:
  21          
  22          ********************************************************************************
  23               File History:
  24          
  25          --------------------------------------------------------------------------------
  26            Date         Name           Description
  27          --------------------------------------------------------------------------------
  28            Mar. 2007    Alan chan    File Created
  29            
  30          \******************************************************************************/
  31          #include "stdio.h"
  32          
  33          #include "global.h"
  34          #include "irkey.h"
  35          
  36          #include "tv.h"
  37          
  38          #include "key.h"
  39          
  40          extern void vInitCPU(BIT OnOff);
  41          
  42          // Determine is long push key
  43          BIT IsLongPushKey(BYTE key)
  44          {
  45   1          return ((key==IR_VOLUME_UP)||(key==IR_VOLUME_DOWN));
  46   1      }
  47          
  48          // Determine is long push key or short push key
  49          BIT IsLongPushOrShortKey(BYTE key)
  50          {
  51   1          return ((key==IR_MODE)||(key==IR_NUM1)||(key==IR_NUM2)      
  52   1          ||(key==IR_NUM3)||(key==IR_NUM4)||(key==IR_NUM5)||(key==IR_NUM6));
  53   1      }
  54          
C51 COMPILER V8.05a   KEY                                                                  07/03/2008 18:27:37 PAGE 2   

  55          // convert key to IR key
  56          BYTE Key2IR(BIT long_push, BYTE prev_key)
  57          {
  58   1          BYTE ret_key = prev_key;
  59   1              
  60   1          if (long_push)
  61   1          {
  62   2              switch (prev_key)
  63   2              {
  64   3                      case IR_MODE: 
  65   3                                      ret_key = IR_POWER;
  66   3                                      break;
  67   3                      case IR_PLAY_PAUSE:      
  68   3                                      ret_key = IR_MEM1;
  69   3                                      break;               
  70   3                      case IR_NEXT:    
  71   3                                      ret_key = IR_MEM2;
  72   3                                      break;               
  73   3                      case IR_FF:      
  74   3                                      ret_key = IR_MEM3;
  75   3                                      break;               
  76   3                      case IR_PREV:    
  77   3                                      ret_key = IR_MEM4;
  78   3                                      break;               
  79   3                      case IR_FR:      
  80   3                                      ret_key = IR_MEM5;
  81   3                                      break;               
  82   3                      case IR_STOP:    
  83   3                                      ret_key = IR_MEM6;
  84   3                                      break;
  85   3      
  86   3                      // seek-
  87   3                      case IR_LEFT:    
  88   3                                      ret_key = IR_PREV;
  89   3                                      break;               
  90   3                      // seek+
  91   3                      case IR_RIGHT:   
  92   3                                      ret_key = IR_NEXT;
  93   3                                      break;
  94   3                                      
  95   3                      case IR_MUTE: 
  96   3                                      ret_key = IR_LOUD;                      
  97   3                                      break;                                                                                                                                     
  98   3              }
  99   2          }
 100   1      
 101   1          return ret_key;
 102   1      }
 103          
 104          void KeyProcess()
 105          {
 106   1      #ifndef MARTIN_MODIFY_UPDATE_DATA   //06Jun08
                  BYTE  i, chksum;
              #endif
 109   1      
 110   1              //02Jun08 if (_bIRKey0!=IR_NONE) 
 111   1              if ((_bIRKey0!=IR_NONE)||(bTempIrKey!=IR_NONE)) 
 112   1          {
 113   2      
 114   2                #if 0
                              // power up
                              if((_bIRKey0 == IR_POWER)&&(_fgIRKeyValid == TRUE)&&(SysMode==PWR_DOWN_MODE))
C51 COMPILER V8.05a   KEY                                                                  07/03/2008 18:27:37 PAGE 3   

                              {       
                                 #ifndef MARTIN_SYSTEM_ONLY_TVMODE
                                      vInitSysPwr(ON);                
                                 #endif
                                      TR0=1;   // start timer0                                                
                                      EX0 = 1;  // IR         
                                      EX1 = 1;  // DVD com
              #ifdef ENABLE_UART
                                      ES = 1;   // enable serial interrupt
                                      TI = RI = 0;
              #endif
                                      vInitialE2prom();
                               #ifndef MARTIN_SYSTEM_ONLY_TVMODE  //martin 12May08 
                                      vSysModeSwitch(SysMode);
                               #endif
                                      _fgIRKeyValid = FALSE;                          
                                      _bIRKey0 = IR_NONE;                                                                                                     
                              }                                                
                         #endif
 136   2               
 137   2               // com=>dvd data
 138   2               #ifndef MARTIN_MCU_NO_IR  //martin 09May08
                       if (_fgIRKeyValid  && (_bRemoteTimer<=5))
                      #endif
 141   2               {
 142   3               #ifndef MARTIN_SYSTEM_ONLY_TVMODE //martin 08May08
                              if (SysMode!=PWR_DOWN_MODE)
                      #endif                  
 145   3                      {
 146   4                      #ifndef MARTIN_MODIFY_UPDATE_DATA  //06Jun08
                                   for (i=0;i<COMDVD_BYTE;i++)
                                       DataOut[i] = 0;
                                                       #endif
 150   4                          //  DataOut[1] =  _bIRKey0;
 151   4                  #if 0 //    #ifndef MARTIN_SYSTEM_ONLY_TVMODE  //martin 08May08
                                   // IR_MODE, mode switch
                                    if (_bIRKey0==IR_MODE)
                                     {
                                              DataOut[2] = ((SysMode+1)>TV_MODE) ? DVD_MODE : (SysMode+1);
                                              NextSysMode = DataOut[2];
                                              switch (DataOut[2])
                                              {
                                                      case TV_MODE:
                                                          DataOut[3] = 0;
                                                              // bit 5
                                                          if (_fgSearchDir == UP_SEARCH)
                                                      DataOut[3] |= 0x08;
                                                   // bit 0-2
                                                              DataOut[4] = bTvCurrChIndex;
                                                              DataOut[5] = bTvCurrSound;
                                                              DataOut[6] = (BYTE)((sTvCurrChannel.wFreq>>8) & 0xff);
                                                              DataOut[7] = (BYTE)(sTvCurrChannel.wFreq & 0xff);       
                                                              _bSearchPercent = _bSearchCnt = 0;
                                                     _bSearchMode = SEARCH_IDLE;
                                                              _bSearchState = S_STATE_IDLE;   
                                                              break;
                                              }
                                      }
                                      else // other ir keys
                                 #endif
 177   4                              {
 178   5                      #if 0// #ifndef MARTIN_SYSTEM_ONLY_TVMODE
C51 COMPILER V8.05a   KEY                                                                  07/03/2008 18:27:37 PAGE 4   

                                           DataOut[2] = SysMode;               
                                            if (SysMode==TV_MODE)
                                      #endif          
 182   5                                    {
 183   6                                              vTVKeyPreProc(_bIRKey0);
 184   6                              #if 0 //#ifndef MARTIN_MODIFY_UPDATE_DATA  //06Jun08
                                                     DataOut[3] = 0;
                                                      // bit 5
                                                     if (_fgSearchDir == UP_SEARCH)
                                                      DataOut[3] |= 0x08;
                                              // bit 0-2
                                              if (_bIRKey0!=IR_STOP || !_bSearchMode)
                                              {
                                                              if (_bSearchMode == SEARCH_SCAN)
                                                                      DataOut[3] |= 0x01;                     
                                                              else if (_bSearchMode == SEARCH_SEEK)
                                                              DataOut[3] |= 0x02;             
                                                              else if (_bSearchMode == SEARCH_STEP)
                                                                      DataOut[3] |= 0x03;     
                                                              else if (_bSearchMode == SEARCH_SEEK_STEP_WAIT)
                                                                      DataOut[3] |= 0x04;                     
                                              }               
                                                      // memory, for seek+/- and step +/- only
                                                      if (bTvChMemory)                
                                                              DataOut[3] |= 0x10;     
              
                                                      DataOut[4] = bTvCurrChIndex;
                                                      DataOut[5] = bTvCurrSound;
                                                      DataOut[6] = (BYTE)((sTvCurrChannel.wFreq>>8) & 0xff);
                                                      DataOut[7] = (BYTE)(sTvCurrChannel.wFreq & 0xff);       
                                                      DataOut[8] = _bSearchPercent & 0xff;    
                                               #ifdef MARTIN_MCU_AND_DVD_PROTOCOL
                                                  //  DataOut[9] = _bSearchCnt;       
                                               DataOut[2] = bTvTotalCh;       
                                                #endif
                                              DataOut[9] = bVideoCheck;       
                                    DataOut[10] = sTvCurrChannel.bSystem;             
                                        DataOut[1] = bDisplaMode;     
                                      #endif
 218   6                                    }                           
 219   5                              }       
 220   4              #if 0 //17Jun08 #ifndef MARTIN_MODIFY_UPDATE_DATA  //06Jun08
                                   chksum = 0;
                                      for (i=1;i<COMDVD_BYTE;i++)
                                              chksum += DataOut[i];
                                    DataOut[0] = chksum;
                                    DataOutValid = 3;
                                  #endif
 227   4                      }
 228   3                   _bPlaypostKey = _bIRKey0;
 229   3                       //02Jun08  _bPlaypostKey = bTempIrKey;
 230   3                   _bIRKey0 = IR_NONE;
 231   3               }
 232   2          }           
 233   1      
 234   1          // mcu task for different keys
 235   1          if (_bPlaypostKey!=IR_NONE)
 236   1          {   
 237   2          #ifndef MARTIN_SYSTEM_ONLY_TVMODE
                      if (SysMode==TV_MODE)
                 #endif                       
 240   2                      _bPlaypostKey = vTVKeyState(_bPlaypostKey);
C51 COMPILER V8.05a   KEY                                                                  07/03/2008 18:27:37 PAGE 5   

 241   2              _bPlaypostKey = IR_NONE;
 242   2          }            
 243   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    235    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----       2
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----       1
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

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