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

📄 test02.lst

📁 ps2 to ubs bridge sourc for 8051e code
💻 LST
📖 第 1 页 / 共 5 页
字号:
C51 COMPILER V7.07   TEST02                                                                01/26/2007 14:58:49 PAGE 1   


C51 COMPILER V7.07, COMPILATION OF MODULE TEST02
OBJECT MODULE PLACED IN TEST02.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE TEST02.C LARGE BROWSE DEBUG OBJECTEXTEND

stmt level    source

   1          //////////////////////////////////////////////////////////////////////
   2          //                                                              //////
   3          //      Author:         Tony Chen (July 22, 2005)               ////// 
   4          //                                                              //////
   5          //////////////////////////////////////////////////////////////////////
   6           
   7          #include        "REG515A.H"
   8          #include        "USB2PS2.h"
   9          
  10          #define         GET_STATUS                      0
  11          #define         CLEAR_FEATURE                   1
  12          #define         SET_FEATURE                     3
  13          #define         SET_ADDRESS                     5
  14          #define         GET_DESCRIPTOR                  6
  15          #define         SET_DESCRIPTOR                  7
  16          #define         GET_CONFIGURATION               8
  17          #define         SET_CONFIGURATION               9
  18          #define         GET_INTERFACE                   10
  19          #define         SET_INTERFACE                   11
  20          #define         SYNC_FRAME                      12
  21          
  22          #define         DEVICE_DESC                     1
  23          #define         CONFIGURATION_DESC              2
  24          #define         STRING_DESC                     3
  25          #define         INTERFACE_DESC                  4
  26          #define         ENDPOINT_DESC                   5
  27          #define         DEVICE_QUALIFIER                6
  28          #define         OTHER_SPEED_CONFIGURATION       7
  29          #define         INTERFACE_POWER                 8
  30          
  31          #define         CLASS_HID_DESC                  0x21
  32          #define         CLASS_REPORT_DESC               0x22
  33          #define         CLASS_PHY_DESC                  0x23    
  34          
  35          #define         GET_REPORT                      0x01
  36          #define         GET_IDLE                        0x02
  37          #define         GET_PROTOCAL                    0x03
  38          #define         SET_REPORT                      0x09
  39          #define         SET_IDLE                        0x0A
  40          #define         SET_PROTOCAL                    0x0B    
  41          
  42          #define         KB_BUF_MAX_LEN                  16
  43          
  44          #define         PS2_MS_RESET                    0xFF    //No ACK, *
  45          #define         PS2_MS_RESEND                   0xFE    // *
  46          #define         PS2_MS_SET_DEFAULT              0xF6    // *
  47          #define         PS2_MS_DISABLE                  0xF5    // *
  48          #define         PS2_MS_ENABLE                   0xF4    // *
  49          #define         PS2_MS_SET_SAMPLE_RATE          0xF3
  50          #define         PS2_MS_GET_DEVICE_TYPE          0xF2    // *
  51          #define         PS2_MS_SET_REMOTE               0xF0    // *
  52          #define         PS2_MS_SET_WRAP                 0xEE    // *
  53          #define         PS2_MS_RESET_WRAP               0xEC    //No ACK
  54          #define         PS2_MS_READ_DATA                0xEB
  55          #define         PS2_MS_SET_STREAM               0xEA    // *
C51 COMPILER V7.07   TEST02                                                                01/26/2007 14:58:49 PAGE 2   

  56          #define         PS2_MS_GET_STATUS               0xE9    // *
  57          #define         PS2_MS_SET_RESOLUTION           0xE8
  58          #define         PS2_MS_SCALING                  0xE7    // *
  59          #define         PS2_MS_RESET_SCALING            0xE6    // *
  60          
  61          #define         KB_LED_OOC                      0xED            //(b2,b1,b0)=(CapsLock,NumLock,ScrolLock)
  62          #define         KB_ECHO                         0xEE
  63          #define         KB_SET_SCAN_scan_code           0xF0
  64          #define         KB_SET_TYPEMATIC                0xF3
  65          #define         KB_ENABLE                       0xF4
  66          #define         KB_STD_DISABLE                  0xF5
  67          #define         KB_STD_ENABLE                   0xF6
  68          #define         KB_RESEND                       0xFE
  69          #define         KB_RESET                        0xFF
  70                  
  71          unsigned        char    rx_ms_bcnt;
  72          unsigned        char    len, len1;
  73          unsigned        char    i,j;
  74          unsigned        char    SETUPR0;
  75          unsigned        char    SETUPR1;
  76          unsigned        char    SETUPR2;
  77          unsigned        char    SETUPR3;
  78          unsigned        char    SETUPR4;
  79          unsigned        char    SETUPR5;
  80          unsigned        char    SETUPR6;
  81          unsigned        char    SETUPR7;
  82          unsigned        char    configuration;
  83          unsigned        char    KB_idle_rate;
  84          unsigned        char    KB_protocal;
  85          unsigned        char    NEW_KB_DATA;
  86          unsigned        char    KB_DATA[8];
  87          bit                     NEW_SYS_KB_DATA;
  88          unsigned        char    SYS_KB_DATA;
  89          bit                     NEW_MM_KB_DATA;
  90          unsigned        char    MM_KB_DATA[2];
  91          unsigned        char    MOUSE_DATA[3];
  92          unsigned        char    MOUSE_STATUS[3];
  93          unsigned        char    LED;
  94          unsigned        char    rd_kb_ptr;
  95          unsigned        char    rx_kb_ptr;
  96          unsigned        char    KB_BUF_DATA[KB_BUF_MAX_LEN];
  97          unsigned        char    mm_key0, mm_key1;
  98          unsigned        char    MS_idle_rate;
  99          unsigned        char    kb_idle_cnt;
 100          unsigned        char    ms_idle_cnt;
 101          unsigned        char    tmr_10ms_cnt;
 102          
 103          bit                     configured;
 104          bit                     toggle;
 105          bit                     ep1toggle;
 106          bit                     ep2toggle;
 107          bit                     remote_wku_enable;
 108          bit                     left_shift_make;
 109          bit                     right_shift_make;
 110          bit                     left_ctrl_make;
 111          bit                     right_ctrl_make;
 112          bit                     left_alt_make;
 113          bit                     right_alt_make;
 114          bit                     left_gui_make;
 115          bit                     right_gui_make;
 116          bit                     kb_check;
 117          bit                     caps_make;
C51 COMPILER V7.07   TEST02                                                                01/26/2007 14:58:49 PAGE 3   

 118          bit                     numlock_make;
 119          bit                     scroll_make;
 120          bit                     power_make;
 121          bit                     sleep_make;
 122          bit                     wakeup_make;
 123          bit                     key_make;
 124          
 125          
 126          void                    xreg_init(void);
 127          void                    SETUP_PROC(void);
 128          void                    in_status(void);
 129          void                    out_status(void);
 130          unsigned        char    PS2A_MS_NOACK(unsigned char);
 131          unsigned        char    PS2A_MS_ACK(unsigned char);
 132          unsigned        char    PS2A_MS_GET_DEVICE_TYPE(void);
 133          unsigned        char    PS2A_MS_GET_STATUS(void);
 134          
 135          unsigned        char    PS2B_MS_NOACK(unsigned char);
 136          unsigned        char    PS2B_MS_ACK(unsigned char);
 137          
 138          void                    wait100us(void);
 139          char                    PS2A_BAT(void);
 140          char                    PS2B_BAT(void);
 141          unsigned        char    get_next_scan_code(void);
 142          unsigned        char    KB_SET_ONE(unsigned char, unsigned char);
 143          unsigned        char    kb_scan(void);
 144          
 145          
 146          void main (void) {
 147   1      
 148   1      unsigned char usb_kb_ptr;
 149   1      unsigned char key;
 150   1      
 151   1        SP = 0x7f;  
 152   1        xreg_init(); 
 153   1        
 154   1        kb_idle_cnt=0;
 155   1        ms_idle_cnt=0;
 156   1        tmr_10ms_cnt=0;
 157   1        
 158   1        
 159   1        
 160   1        //
 161   1        // According to recommendation from HID 1.1 spec 
 162   1        // Keyboard idle rate could be initialized to 500ms,
 163   1        // Mouse idle rate is set to infinity (idle rate=0)
 164   1        KB_idle_rate=125; //500ms/4ms=125
 165   1        MS_idle_rate=0;   //infinity
 166   1        
 167   1        kb_check=0;
 168   1        KB_protocal=0;
 169   1        
 170   1        rd_kb_ptr = 0;
 171   1        rx_kb_ptr = 0;
 172   1       
 173   1        KB_DATA[1]=0; 
 174   1        usb_kb_ptr = 2; 
 175   1        key_make=0;
 176   1       
 177   1        NEW_SYS_KB_DATA=0;
 178   1        NEW_MM_KB_DATA=0;
 179   1        
C51 COMPILER V7.07   TEST02                                                                01/26/2007 14:58:49 PAGE 4   

 180   1        EAL= 1;
 181   1      
 182   1      
 183   1      //==== PS2A connected to KB 
 184   1        while(PS2A_MS_NOACK(PS2_MS_RESET));  
 185   1        PS2A_BAT();
 186   1        PS2A_MS_GET_DEVICE_TYPE();
 187   1        PS2A_MS_ACK(PS2_MS_SET_DEFAULT); 
 188   1        PS2A_MS_GET_STATUS(); 
 189   1        PS2A_MS_ACK(PS2_MS_ENABLE);
 190   1      
 191   1      
 192   1      //==== PS2B connected to Mouse  
 193   1        while(PS2B_MS_NOACK(PS2_MS_RESET));  
 194   1        PS2B_BAT();
 195   1        PS2B_MS_ACK(PS2_MS_SET_DEFAULT); 
 196   1        PS2B_MS_ACK(PS2_MS_ENABLE);

⌨️ 快捷键说明

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