1
0

usb_cdca.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /* This file is the part of the Lightweight USB device Stack for STM32 microcontrollers
  2. *
  3. * Copyright ©2016 Dmitry Filimonchuk <dmitrystu[at]gmail[dot]com>
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. /**\ingroup USB_CDC
  16. * \addtogroup USB_CDC_ATM USB CDC ATM subclass
  17. * \brief USB CDC ATM subclass definitions
  18. * \details This module based on "Universal Serial Bus Communications Class Subclass Specification
  19. * for Asynchronous Transfer Mode Devices" Revision 1.2
  20. * @{ */
  21. #ifndef _USB_CDC_ATM_H_
  22. #define _USB_CDC_ATM_H_
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. /**\name Communications Class Subclass Codes
  27. * @{ */
  28. #define USB_CDC_SUBCLASS_ATM 0x07 /**<\brief ATM Networking Control Model */
  29. /* @} */
  30. /**\name CDC ATM subclass specific Functional Descriptors codes
  31. * @{ */
  32. #define USB_DTYPE_CDC_ATM 0x10 /**<\brief ATM Networking Functional Descriptor */
  33. /** @} */
  34. /**\name CDC ATM subclass specific requests
  35. * @{ */
  36. #define USB_CDC_SET_ATM_DATA_FORMAT 0x50 /**<\brief Chooses which ATM data format will be
  37. * exchanged between the host and the ATM Networking
  38. * device.*/
  39. #define USB_CDC_GET_ATM_DEVICE_STATISTICS 0x51 /**<\brief Retrieves global statistics from the ATM
  40. * Networking device.*/
  41. #define USB_CDC_SET_ATM_DEFAULT_VC 0x52 /**<\brief Pre-selects the VPI/VCI value for subsequent
  42. * GET_ATM_DEVICE_STATISTICS requests.*/
  43. #define USB_CDC_GET_ATM_VC_STATISTICS 0x53 /**<\brief Retrieves statistics from the ATM Networking
  44. * device for a particular VPI/VCI.*/
  45. /** @} */
  46. /**\name ATM Device Statistics Feature Selector Codes
  47. * @{ */
  48. #define ATM_STAT_US_CELLS_SENT 0x01 /**<\brief The number of cells that have been sent
  49. * upstream to the WAN link by the ATM layer. */
  50. #define ATM_STAT_DS_CELLS_RECEIVED 0x02 /**<\brief The number of cells that have been received
  51. * downstream from the WAN link by the ATM layer */
  52. #define ATM_STAT_DS_CELLS_USB_CONGESTION 0x03 /**<\brief The number of cells that have been received
  53. * downstream from the WAN link by the ATM layer and
  54. * discarded due to congestion on the USB link.*/
  55. #define ATM_STAT_DS_CELLS_AAL5_CRC_ERROR 0x04 /**<\brief The number of cells that have been received
  56. * downstream from the WAN link by the ATM layer and
  57. * discarded due to AAL5 CRC errors.*/
  58. #define ATM_STAT_DS_CELLS_HEC_ERROR 0x05 /**<\brief The number of cells that have been received
  59. * downstream from the WAN link and discarded due to
  60. * HEC errors in the cell header.*/
  61. #define ATM_STAT_DS_CELLS_HEC_ERROR_CORRT 0x06 /**<\brief The number of cells that have been received
  62. * downstream from the WAN link and have been detected
  63. * with HEC errors in the cell header and successfully
  64. * corrected. */
  65. /** @} */
  66. /**\brief ATM Networking Functional Descriptor */
  67. struct usb_cdc_atm_desc {
  68. uint8_t bFunctionLength; /**<\brief Size of this functional descriptor, in bytes.*/
  69. uint8_t bDescriptorType; /**<\brief CS_INTERFACE descriptor type.*/
  70. uint8_t bDescriptorSubType; /**<\brief ATM Networking Functional Descriptor subtype.*/
  71. uint8_t iEndSystemIdentifier; /**<\brief The string descriptor holds the End System Identifier. */
  72. uint8_t bmDataCapabilities; /**<\brief The ATM data types the device supports.*/
  73. uint8_t bmATMDeviceStatistics; /**<\brief Indicates which optional statistics functions the
  74. * device collects. */
  75. uint16_t wType2MaxSegmentSize; /**<\brief The maximum segment size that the Type 2 device
  76. * is capable of supporting */
  77. uint16_t wType3MaxSegmentSize; /**<\brief The maximum segment size that the Type 3 device
  78. * is capable of supporting */
  79. uint16_t wMaxVC; /**<\brief The maximum number of simultaneous virtual circuits
  80. * the device is capable of supporting (Type 3 only) */
  81. } __attribute__((packed));
  82. /** @} */
  83. #ifdef __cplusplus
  84. }
  85. #endif
  86. #endif /* _USB_CDC_ATM_H_ */