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

📄 hal_usb_hid.lst

📁 非常全的nrf2401设计资料
💻 LST
字号:
C51 COMPILER V7.50   HAL_USB_HID                                                           04/09/2009 10:12:51 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE HAL_USB_HID
OBJECT MODULE PLACED IN .\build\hal_usb_hid.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ..\..\..\..\arch\hal\nrf24lu1\hal_usb_hid.c LARGE OMF2 OPTIMIZE(9,SPEED) BR
                    -OWSE INCDIR(..\common;..\..\..\..\comp\protocol\wdp\common\;..\..\..\..\comp\protocol\wdp\host\;..\..\..\..\arch\hal\inc
                    -lude;..\..\..\..\arch\hal\nrf24lu1;..\..\..\..\arch\nrf24lu1;..\common;..\..\..\..\comp\protocol\fap) DEBUG PRINT(.\lst\
                    -hal_usb_hid.lst) OBJECT(.\build\hal_usb_hid.obj)

line level    source

   1          /* Copyright (c) 2007 Nordic Semiconductor. All Rights Reserved.
   2           *
   3           * The information contained herein is property of Nordic Semiconductor ASA.
   4           * Terms and conditions of usage are described in detail in NORDIC
   5           * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 
   6           *
   7           * Licensees are granted free, non-transferable use of the information. NO
   8           * WARRENTY of ANY KIND is provided. This heading must NOT be removed from
   9           * the file.
  10           *
  11           * $LastChangedRevision: 2290 $
  12           */ 
  13          
  14          /** @file
  15           * Hardware Abstraction Layer for USB Human Interface Descriptors.
  16           * 
  17           * @author Ken A. Redergaard
  18           */
  19          
  20          #include "hal_usb_hid.h"
  21          #include "nordic_common.h"
  22          
  23          static xdata uint8_t tmp_usb_buf[8];
  24          static uint8_t tmp_usb_hid_protocol;
  25          
  26          bool hal_usb_hid_device_req_proc(hal_usb_device_req* req, uint8_t** data_ptr, uint16_t* size, hal_usb_dev_
             -req_resp_t* resp)
  27          {
  28   1          bool retval = false;
  29   1          *resp = STALL;
  30   1      
  31   1          if(req->bRequest == USB_REQ_GET_DESCRIPTOR )
  32   1          {
  33   2              switch( MSB(req->wValue) )
  34   2              {
  35   3                  case  USB_CLASS_DESCRIPTOR_REPORT:
  36   3                      retval = true;
  37   3      
  38   3                      *data_ptr = g_usb_hid_hids[LSB(req->wIndex)].hid_report_desc;
  39   3                      *size = MIN(g_usb_hid_hids[LSB(req->wIndex)].hid_report_desc_size, LSB(req->wLength));
  40   3                      *resp = DATA;
  41   3                      break;
  42   3                  case USB_CLASS_DESCRIPTOR_HID:
  43   3                      retval = true;
  44   3      
  45   3                      *data_ptr = (uint8_t*)g_usb_hid_hids[LSB(req->wIndex)].hid_desc;
  46   3                      *size = MIN(sizeof(hal_usb_hid_desc_t), LSB(req->wLength));
  47   3                      *resp = DATA;
  48   3                      break;
  49   3                  default:
  50   3                      break;
  51   3              }
C51 COMPILER V7.50   HAL_USB_HID                                                           04/09/2009 10:12:51 PAGE 2   

  52   2          } 
  53   1          else if( ( req->bmRequestType & 0x20 ) == 0x20 ) // This is a class specific request D5..6: Type Class
             -(value 1)
  54   1          { 
  55   2              switch( req->bRequest )
  56   2              {
  57   3                  case 0x01: // Get_Report
  58   3                      retval = true;
  59   3                      // For now we just send an "empty" report. No mousemoves, no mouse-key pressed.
  60   3                      // TODO: This breaks the generic nature of usb.c. 
  61   3                      // Have to create some global "default" reports in the template later.
  62   3                      tmp_usb_buf[0] = tmp_usb_buf[1] = 0x00;
  63   3                      *data_ptr = &tmp_usb_buf[0];
  64   3                      *size = 0x03;
  65   3                      *resp = DATA;
  66   3                      break;
  67   3                  case 0x02: // Get_Idle
  68   3                      retval = true;
  69   3                      *resp = STALL;
  70   3                      break;
  71   3                  case 0x0a: // Set_Idle
  72   3                      retval = true;
  73   3                      *resp = STALL;
  74   3                      break;
  75   3                  case 0x03: // Get_Protocol
  76   3                      retval = true;
  77   3                      tmp_usb_buf[0] = ( tmp_usb_hid_protocol & (1 << LSB(req->wIndex)) ) ? 0x01 : 0x00;
  78   3                      *data_ptr = &tmp_usb_buf[0];
  79   3                      *size = 0x01;
  80   3                      *resp = DATA;
  81   3                      break;
  82   3                  case 0x0b: // Set_Protocol
  83   3                      retval = true;
  84   3      #if 1 // Right now we do not support setting of protocol in a intelligent way
  85   3                      if( LSB(req->wValue) == 0x01 )
  86   3                      {
  87   4                          tmp_usb_hid_protocol |= 1 << LSB(req->wIndex);
  88   4                      }
  89   3                      else
  90   3                      {
  91   4                          tmp_usb_hid_protocol &= ~(1 << LSB(req->wIndex));
  92   4                      }
  93   3      
  94   3                      *resp = NAK;
  95   3      #else
                              *resp = EMPTY_RESPONSE;
              #endif
  98   3                      break;
  99   3                  case 0x09: // Set_Report
 100   3                      if( MSB(req->wValue) == 0x03 ) // Feature report
 101   3                      {
 102   4                          retval = false;
 103   4                      }
 104   3                      else if ( MSB(req->wValue) == 0x02 ) // Output report
 105   3                      {
 106   4                          // For now we just assume that the OUT packet is a keyboard report.
 107   4                          *resp =NAK;
 108   4                          retval = true;
 109   4                      }
 110   3                      break;
 111   3                  default:
 112   3                      break;
C51 COMPILER V7.50   HAL_USB_HID                                                           04/09/2009 10:12:51 PAGE 3   

 113   3                  }
 114   2          }
 115   1      
 116   1          return retval;
 117   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    568    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =      9      13
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
   EDATA SIZE       =   ----    ----
   HDATA SIZE       =   ----    ----
   XDATA CONST SIZE =   ----    ----
   FAR CONST SIZE   =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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