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

📄 sl811s.lst

📁 keyword:usb host sl8
💻 LST
📖 第 1 页 / 共 5 页
字号:
C51 COMPILER V7.09   SL811S                                                                10/04/2004 17:01:23 PAGE 1   


C51 COMPILER V7.09, COMPILATION OF MODULE SL811S
OBJECT MODULE PLACED IN sl811s.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE sl811s.c OPTIMIZE(6,SPEED) DEBUG OBJECTEXTEND CODE

line level    source

   1          //*****************************************************************************************
   2          // Cypress Semiconductor - Customer Design Center 
   3          //*****************************************************************************************
   4          // Project              : (SL811S + Audio Control + Internet Control) Demo Code
   5          // File                 : sl811s.c
   6          // H/W Target   : SL811HST(Rev 1.5) + EZUSB DEV KIT
   7          // DCE/FAE              : Shawn Ng (cxn)
   8          // Last Update  : 03/01/02
   9          //
  10          //*****************************************************************************************
  11          // Code and Xdata Memory Space
  12          //*****************************************************************************************
  13          // IMPORTANT : 
  14          // 
  15          // 1) EZ811 Demo Board: JP1 - Select Slave Mode
  16          //                                              JP2 - Select Full Speed
  17          //                                              JP3 - Select Dev Kit power
  18          // 
  19          // 2) Currently code support on 3 buttons only, Mute(PC0), Vol Up(PC1) and Vol Down(PC2)
  20          //
  21          // 3) PROGRAM'S CODE/XDATA MEMORY ALLOCATION:
  22          //    Program Code Space        : 0x0080 ~ 0x1B3F -> size:0x1AC0, 6848 bytes available
  23          //    Program xdata Space       : 0x2000 ~ 0x2400 -> size:0x0400, 1024 bytes available
  24          //
  25          //*****************************************************************************************
  26          // SL811HST + EZUSB Hardware Interface:
  27          //*****************************************************************************************
  28          // SL811HST             <-->    AN2131QC        <-->    FUNCTIONS (looking from SL811H side)
  29          // A0                   <-->    A0                      <-->    (I) Address entry for SL811H, '0'-addr, '1'-data
  30          // D0 ~ D7              <-->    D0 ~ D7         <-->    (B) 8-bit Data Bus
  31          // nCS                  <-->    A15                     <-->    (I) Enable lower 32K memory(where SL811H is mapped)
  32          // nRD                  <-->    nRD (PC7)       <-->    (I) Read (active low)
  33          // nWR                  <-->    nWR (PC6)       <-->    (I) Write (active low)
  34          // nRST                 <-->    PB0                     <-->    (I) SL811HST's reset (active low)
  35          // MS_SEL               <-->    PB1                     <-->    (I) SL811HST's master/slave select, '0'-host
  36          // INTR                 <-->    INT4 (PB4)      <-->    (O) SL811HST's interrupt (active high) not used
  37          // ACTIVE_LED   <-->    PB6                     <-->    Blink - waiting for enum, On - enumerated
  38          //
  39          //*****************************************************************************************
  40          // LEDs + EZUSB Hardware Interface: (only for Host Mode)
  41          //*****************************************************************************************
  42          // PORT0_LED    <-->    PC0                     <-->    (O) Device attached to SL811H (in host mode)
  43          // PORT1_LED    <-->    PC1                     <-->    (O) Device attached to Port 1 of CY65100
  44          // PORT2_LED    <-->    PC2                     <-->    (O) Device attached to Port 2 of CY65100
  45          // PORT3_LED    <-->    PC3                     <-->    (O) Device attached to Port 3 of CY65100
  46          // PORT4_LED    <-->    PC4                     <-->    (O) Device attached to Port 4 of CY65100
  47          // PORT5_LED    <-->    PC4                     <-->    (O) Not Used
  48          //
  49          //*****************************************************************************************
  50          // Audio Buttons + EZUSB Hardware Interface: (only for Slave Mode)
  51          //*****************************************************************************************
  52          // MUTE_KEY             <-->    PC0                     <-->    (I) Mute Button (active low)
  53          // VOL_UP_KEY   <-->    PC1                     <-->    (I) Volume Up button
  54          // VOL_DN_KEY   <-->    PC2                     <-->    (I) Volume Down button
  55          //
C51 COMPILER V7.09   SL811S                                                                10/04/2004 17:01:23 PAGE 2   

  56          //*****************************************************************************************
  57          // History              :
  58          //*****************************************************************************************
  59          // cxn - 02/20/02       Set/Get Idle/Protocol - HIDview compliant
  60          // cxn - 02/21/02       Chapter9 Compliant
  61          // cxn - 02/28/02       Implemented HID Consumer Control (hardware is only 3 keys)
  62          //
  63          //*****************************************************************************************
  64          // Include files
  65          //*****************************************************************************************
  66          #include "sl811s.h"
  67          #include "descp.h"
  68          
  69          //*****************************************************************************************
  70          // Variables Define
  71          //*****************************************************************************************
  72          typedef struct                          
  73          {
  74              BYTE bmRequest;                                     // SETUP Token Protocol
  75              BYTE bRequest;
  76              WORD wValue;
  77              WORD wIndex;
  78              WORD wLength;
  79          }       SetupPKG, *pSetupPKG;
  80          
  81          //----------------------------------
  82          // SL811S Variables
  83          //----------------------------------
  84          xdata BYTE      SL811H_ADDR     _at_ 0x4000;// A0 = '0' - Addr (A15 = nCS of SL811HS)
  85          xdata BYTE      SL811H_DATA _at_ 0x4001;// A0 = '1' - Data
  86          
  87          xdata BYTE      Slave_USBaddr;                  // USB device address
  88          xdata BYTE      Slave_ConfigVal;                // Device configuration value
  89          xdata BYTE      Slave_Protocol;                 // HID device protocol status
  90          xdata BYTE      Slave_IdleRate;                 // HID device idle rate value
  91          xdata BYTE      Slave_RemoteWU;                 // Device remote wakeup stats
  92          xdata BYTE      Slave_inEPstall;                // EP0 ~ EP7's IN stall status
  93          xdata BYTE      Slave_outEPstall;               // EP0 ~ EP7's OUT stall status
  94          xdata BYTE      Slave_IfcAlt[MAXIFCNUM];// 8 interface(Ep0~7) contain alternate setting value
  95          
  96          xdata BYTE      Audio_Keys;                             // Audio Control BitMap
  97          xdata BYTE      Prev_Audio_Keys;
  98          xdata BYTE      Internet_Keys;                  // Internet Control BitMap
  99          xdata BYTE      Prev_Internet_Keys;
 100          
 101          SetupPKG        dReq;                                   // Setup token struct
 102          WORD            len_req;                                // length of data for EP0
 103          WORD            sof_cnt;                                // 1ms counter
 104          BYTE            ep1_toggle;                             // EP1 DATA toggle state
 105          BYTE            in_buffer_idx;                  // EP0 IN data buffer tracking
 106          
 107          BYTE bdata      flags;                                  // Flag Bitmap
 108          sbit dev_first  = flags ^ 0;            // status for 8-byte EP0 transfer
 109          sbit timeout    = flags ^ 1;            // time out for debounce
 110          sbit enum_done  = flags ^ 2;            // end of enum, (end of report descp)
 111          
 112          extern  BYTE    Toggle_SW;                      // Toggle switch
 113          
 114          BOOL            IN_NULL;                                // EP0's IN null packet transmission
 115          BOOL            IN_EXACT;                               // EP0's IN data length requested is extact of EP0_LEN
 116          BOOL            BUS_POWERED;                    // Bus powered device 
 117          
C51 COMPILER V7.09   SL811S                                                                10/04/2004 17:01:23 PAGE 3   

 118          //*****************************************************************************************
 119          // Byte Read from SL811H
 120          // a = register address
 121          // return = data in register
 122          //*****************************************************************************************
 123          BYTE SL811Read(BYTE a)
 124          {  
 125   1              SL811H_ADDR = a;                        
 126   1              return (SL811H_DATA);
 127   1      }
 128          
 129          //*****************************************************************************************
 130          // Byte Write to SL811H
 131          // a = register address
 132          // d = data to be written to this register address
 133          //*****************************************************************************************
 134          void SL811Write(BYTE a, BYTE d)
 135          {  
 136   1              SL811H_ADDR = a;        
 137   1              SL811H_DATA = d;
 138   1      }
 139          

⌨️ 快捷键说明

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