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

📄 sbc.lst

📁 atmel at89c51snd1c mp3芯片方案源码
💻 LST
字号:
C51 COMPILER V7.50   SBC                                                                   02/16/2009 09:59:54 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE SBC
OBJECT MODULE PLACED IN sbc.obj
COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE lib_storage\sbc.c LARGE BROWSE DEBUG OBJECTEXTEND PRINT(.\sbc.lst) OBJECT(s
                    -bc.obj)

line level    source

   1          //sbc_operation
   2          
   3          
   4          #include "config.h"                         /* system configuration */
   5          #include "lib_mcu\usb\usb_drv.h"            /* usb driver definition */
   6          #include "lib_mcu\mmc\mmc_drv.h"                        /* mmc driver definition */
   7          #include "modules\mem\media.h"               /* low level function definition */
   8          #include "lib_storage\sbc.h"                /* SBC commands definition */
   9          #include "lib_mcu\ide\ide_drv.h"
  10          
  11          //#define Usb_clear_RXOUTB0()  {if(UEPSTAX & 0x42)  UEPSTAX &= 0xbd;}
  12          
  13          bdata   bit     no_data_phase;
  14          Uint32 data     media_sector;
  15          Uint16 data     media_data_length;
  16          extern data     Uint32 dCBWDataTransferLength;
  17          extern xdata    Uint32 total_capacity;
  18          
  19          INT8U code sbc_vendor[8]   = SBC_VENDOR_ID;
  20          INT8U code sbc_product[16] = SBC_PRODUCT_ID;
  21          INT8U code sbc_revision[4] = SBC_REVISION_ID;
  22          
  23          
  24          
  25          ////////////////////////////////////////////////////////////////////////////////////////
  26          void Sbc_chip_init (void) 
  27          { 
  28   1      //  Hard_install();
  29   1      }
  30          
  31          
  32          
  33          ////////////////////////////////////////////////////////////////////////////////////////
  34          void scsi_command_iquiry(void)
  35          {
  36   1         uchar inquiry_allocation_length;
  37   1         uchar i;
  38   1         INT8U *p;
  39   1      
  40   1         ACC = Usb_read_byte(); //read LUN
  41   1         ACC = Usb_read_byte(); //read pagecode
  42   1         ACC = Usb_read_byte(); //read Reserved
  43   1         inquiry_allocation_length = Usb_read_byte(); //read inquiry_allocation_length
  44   1         ACC = Usb_read_byte(); //read control code
  45   1      
  46   1         Usb_clear_RXOUT_PP();
  47   1      
  48   1         Usb_clear_no_data_phase();
  49   1         Usb_clear_status_ready();
  50   1         Usb_select_ep(EP_IN);
  51   1      
  52   1         Usb_write_byte(0x00); //外设属性
  53   1         Usb_write_byte(0x80); //设备可移动
  54   1         Usb_write_byte(0x00); 
C51 COMPILER V7.50   SBC                                                                   02/16/2009 09:59:54 PAGE 2   

  55   1         Usb_write_byte(0x01); 
  56   1         Usb_write_byte(inquiry_allocation_length-5); //以下还有相应的字节数传输
  57   1         Usb_write_byte(0x00);
  58   1         Usb_write_byte(0x00);
  59   1         Usb_write_byte(0x00);
  60   1      
  61   1         p = sbc_vendor;
  62   1         for (i=0; i<8; i++)
  63   1         {
  64   2           Usb_write_byte(*p ++);
  65   2         }
  66   1      
  67   1         p = sbc_product;
  68   1         for (i=0; i<16; i++)
  69   1         {
  70   2               Usb_write_byte(*p ++);
  71   2         }
  72   1      
  73   1         p = sbc_revision;
  74   1         for (i=0; i<4; i++)
  75   1         {
  76   2               Usb_write_byte(*p ++); 
  77   2         }
  78   1      
  79   1         Usb_set_TXRDY();
  80   1         Usb_select_ep(EP_IN);
  81   1         while (!Usb_tx_complete());
  82   1         Usb_clear_TXCMPL();
  83   1         dCBWDataTransferLength = 0;
  84   1         status = 0; 
  85   1      }
  86          
  87          
  88          ////////////////////////////////////////////////////////////////////////////////////////
  89          void scsi_command_read_long(void)
  90          { 
  91   1         Usb_clear_RXOUT_PP(); 
  92   1      
  93   1         Usb_clear_no_data_phase();
  94   1         Usb_clear_status_ready();
  95   1         Usb_select_ep(EP_IN);
  96   1      
  97   1         Usb_write_byte(0x00);
  98   1         Usb_write_byte(0x00);
  99   1         Usb_write_byte(0x00);
 100   1         Usb_write_byte(0x08);
 101   1         Usb_write_byte(0x00);
 102   1         Usb_write_byte(0x00);
 103   1         Usb_write_byte(0x00);
 104   1         Usb_write_byte(0x00);
 105   1         Usb_write_byte(0x0c);
 106   1         Usb_write_byte(0x00);
 107   1         Usb_write_byte(0x02);
 108   1         Usb_write_byte(0x00);
 109   1      
 110   1         Usb_set_TXRDY();
 111   1         Usb_select_ep(EP_IN);
 112   1         while (!Usb_tx_complete());
 113   1         Usb_clear_TXCMPL();
 114   1         dCBWDataTransferLength = 0;
 115   1         status = 0;
 116   1      }
C51 COMPILER V7.50   SBC                                                                   02/16/2009 09:59:54 PAGE 3   

 117          
 118          
 119          
 120          ////////////////////////////////////////////////////////////////////////////////////////
 121          void scsi_command_read_capacity(void)
 122          { 
 123   1         Usb_clear_RXOUT_PP();
 124   1          
 125   1         Usb_clear_no_data_phase();
 126   1         Usb_clear_status_ready();
 127   1         Usb_select_ep(EP_IN);
 128   1      
 129   1         Usb_write_byte(((Byte*)&total_capacity)[3]);
 130   1         Usb_write_byte(((Byte*)&total_capacity)[2]);
 131   1         Usb_write_byte(((Byte*)&total_capacity)[1]);
 132   1         Usb_write_byte(((Byte*)&total_capacity)[0]);
 133   1         Usb_write_byte(0x00);
 134   1         Usb_write_byte(0x00);
 135   1         Usb_write_byte(0x02);
 136   1         Usb_write_byte(0x00);
 137   1      
 138   1         Usb_set_TXRDY();
 139   1         Usb_select_ep(EP_IN);
 140   1         while (!Usb_tx_complete());
 141   1         Usb_clear_TXCMPL();
 142   1         dCBWDataTransferLength = 0;
 143   1         status = 0;
 144   1      }
 145          
 146          
 147          
 148          ////////////////////////////////////////////////////////////////////////////////////////
 149          void scsi_command_mode_sence(void)
 150          { 
 151   1          Usb_clear_RXOUT_PP();
 152   1          
 153   1          Usb_clear_no_data_phase();
 154   1          Usb_clear_status_ready();
 155   1          Usb_select_ep(EP_IN);
 156   1      
 157   1          Usb_write_byte(0x03);
 158   1          Usb_write_byte(0x00);
 159   1          Usb_write_byte(0x00);
 160   1          Usb_write_byte(0x00);
 161   1      
 162   1          Usb_set_TXRDY();
 163   1          Usb_select_ep(EP_IN);
 164   1          while (!Usb_tx_complete());
 165   1          Usb_clear_TXCMPL();
 166   1          dCBWDataTransferLength = 0;
 167   1          status = 0;
 168   1      }
 169          
 170          
 171          
 172          ////////////////////////////////////////////////////////////////////////////////////////
 173          void scsi_command_test_uint_ready(void)
 174          {
 175   1          Usb_clear_RXOUT_PP();
 176   1          dCBWDataTransferLength = 0;
 177   1          status = 0;
 178   1      }
C51 COMPILER V7.50   SBC                                                                   02/16/2009 09:59:54 PAGE 4   

 179          
 180          
 181          
 182          
 183          ////////////////////////////////////////////////////////////////////////////////////////
 184          void scsi_command_read(void)
 185          {
 186   1         INT8U i, u8Sectors;
 187   1      
 188   1         ACC = Usb_read_byte();
 189   1         ((Byte*)&media_sector)[0] = Usb_read_byte();
 190   1         ((Byte*)&media_sector)[1] = Usb_read_byte();
 191   1         ((Byte*)&media_sector)[2] = Usb_read_byte();
 192   1         ((Byte*)&media_sector)[3] = Usb_read_byte();
 193   1         ACC = Usb_read_byte();
 194   1         ((Byte*)&media_data_length)[0] = Usb_read_byte();
 195   1         ((Byte*)&media_data_length)[1] = Usb_read_byte();
 196   1       
 197   1         u8Sectors = media_data_length; 
 198   1         Usb_clear_RXOUT_PP();
 199   1      
 200   1         for(i=0; i<u8Sectors; i++)
 201   1         {
 202   2            if(Hard_read_one_sector(media_sector + i))
 203   2            {
 204   3              dCBWDataTransferLength = 0;
 205   3              status = 0;
 206   3            }
 207   2            else 
 208   2            {
 209   3              status = 1;
 210   3              break;
 211   3                }
 212   2         } 
 213   1      }
 214          
 215          
 216          /////////////////////////////////////////////////////////////////////////
 217          void scsi_command_write(void)
 218          {
 219   1          INT8U i, u8Sectors;
 220   1      
 221   1          ACC = Usb_read_byte();
 222   1          ((Byte*)&media_sector)[0] = Usb_read_byte();
 223   1              ((Byte*)&media_sector)[1] = Usb_read_byte();
 224   1              ((Byte*)&media_sector)[2] = Usb_read_byte();
 225   1              ((Byte*)&media_sector)[3] = Usb_read_byte();
 226   1          ACC = Usb_read_byte();
 227   1          ((Byte*)&media_data_length)[0] = Usb_read_byte();
 228   1          ((Byte*)&media_data_length)[1] = Usb_read_byte();
 229   1      
 230   1          u8Sectors = media_data_length; 
 231   1          Usb_clear_RXOUT_PP();
 232   1      
 233   1          for(i=0; i<u8Sectors; i++)
 234   1          { 
 235   2                 if (Hard_write_one_sector(media_sector + i))
 236   2                 {
 237   3                    dCBWDataTransferLength = 0;
 238   3                status = 0;
 239   3                 }
 240   2             else 
C51 COMPILER V7.50   SBC                                                                   02/16/2009 09:59:54 PAGE 5   

 241   2             {
 242   3               status = 1;
 243   3               break;
 244   3                 }
 245   2              }            
 246   1      }
 247          
 248          
 249          /////////////////////////////////////////////////////////////////////////
 250          void Sbc_command_chip(void)
 251          {
 252   1         switch(Usb_read_byte()) //read operate code 
 253   1         {  
 254   2            case SCSI_IQUIRY: 
 255   2                         scsi_command_iquiry();
 256   2                 break;
 257   2      
 258   2            case SCSI_READ_LONG:
 259   2                         scsi_command_read_long(); 
 260   2                 break; 
 261   2      
 262   2            case SCSI_READ_CAPACITY:
 263   2                         scsi_command_read_capacity();
 264   2                 break; 
 265   2      
 266   2            case SCSI_MODE_SENCE:
 267   2                 scsi_command_mode_sence();
 268   2                     break; 
 269   2      
 270   2                case SCSI_TEST_UNIT_READY:
 271   2                     scsi_command_test_uint_ready();
 272   2                     break;
 273   2      
 274   2                case SCSI_READ:
 275   2                 scsi_command_read();
 276   2                 break;
 277   2      
 278   2            case SCSI_WRITE:      
 279   2                 scsi_command_write();
 280   2                 break;
 281   2      
 282   2                default:  
 283   2                     Usb_clear_RXOUT_PP();    
 284   2                 dCBWDataTransferLength = 0;
 285   2                 status = 0;
 286   2                     break;
 287   2          }
 288   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    730    ----
   CONSTANT SIZE    =     28    ----
   XDATA SIZE       =   ----       7
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      6    ----
   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 + -