usb_cdca.h 4.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* This file is the part of the LUS32 project
  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 for Asynchronous Transfer Mode Devices" Revision 1.2
  19. * @{ */
  20. #ifndef _USB_CDC_ATM_H_
  21. #define _USB_CDC_ATM_H_
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /**\name Communications Class Subclass Codes
  26. * @{ */
  27. #define USB_CDC_SUBCLASS_ATM 0x07 /**< ATM Networking Control Model */
  28. /* @} */
  29. /**\name CDC ATM subclass specific Functional Descriptors codes
  30. * @{ */
  31. #define USB_DTYPE_CDC_ATM 0x10 /**< ATM Networking Functional Descriptor */
  32. /** @} */
  33. /**\name CDC ATM subclass specific requests
  34. * @{ */
  35. #define USB_CDC_SET_ATM_DATA_FORMAT 0x50 /**< Chooses which ATM data format will be exchanged between the host and the ATM Networking device. */
  36. #define USB_CDC_GET_ATM_DEVICE_STATISTICS 0x51 /**< Retrieves global statistics from the ATM Networking device. */
  37. #define USB_CDC_SET_ATM_DEFAULT_VC 0x52 /**< Pre-selects the VPI/VCI value for subsequent GET_ATM_DEVICE_STATISTICS requests */
  38. #define USB_CDC_GET_ATM_VC_STATISTICS 0x53 /**< Retrieves statistics from the ATM Networking device for a particular VPI/VCI. */
  39. /** @} */
  40. /**\name ATM Device Statistics Feature Selector Codes
  41. * @{ */
  42. #define ATM_STAT_US_CELLS_SENT 0x01 /**< The number of cells that have been sent upstream to the WAN link by the ATM layer. */
  43. #define ATM_STAT_DS_CELLS_RECEIVED 0x02 /**< The number of cells that have been received downstream from the WAN link by the ATM layer */
  44. #define ATM_STAT_DS_CELLS_USB_CONGESTION 0x03 /**< The number of cells that have been received downstream from the WAN link by the ATM
  45. * layer and discarded due to congestion on the USB link. */
  46. #define ATM_STAT_DS_CELLS_AAL5_CRC_ERROR 0x04 /**< The number of cells that have been received downstream from the WAN link by the ATM
  47. * layer and discarded due to AAL5 CRC errors. */
  48. #define ATM_STAT_DS_CELLS_HEC_ERROR 0x05 /**< The number of cells that have been received downstream from the WAN link and discarded
  49. * due to HEC errors in the cell header. */
  50. #define ATM_STAT_DS_CELLS_HEC_ERROR_CORRT 0x06 /**< The number of cells that have been received downstream from the WAN link and have
  51. * been detected with HEC errors in the cell header and successfully corrected. */
  52. /** @} */
  53. /**\brief ATM Networking Functional Descriptor */
  54. struct usb_cdc_atm_desc {
  55. uint8_t bFunctionLength; /**< Size of this functional descriptor, in bytes. */
  56. uint8_t bDescriptorType; /**< CS_INTERFACE descriptor type. \see \ref USB_DTYPE_CS_INTERFACE */
  57. uint8_t bDescriptorSubType; /**< ATM Networking Functional Descriptor subtype \ref USB_DTYPE_CDC_ATM */
  58. uint8_t iEndSystemIdentifier; /**< The string descriptor holds the End System Identifier. */
  59. uint8_t bmDataCapabilities; /**< The ATM data types the device supports */
  60. uint8_t bmATMDeviceStatistics; /**< Indicates which optional statistics functions the device collects. */
  61. uint16_t wType2MaxSegmentSize; /**< The maximum segment size that the Type 2 device is capable of supporting */
  62. uint16_t wType3MaxSegmentSize; /**< The maximum segment size that the Type 3 device is capable of supporting */
  63. uint16_t wMaxVC; /**< The maximum number of simultaneous virtual circuits the device is capable
  64. * of supporting (Type 3 only) */
  65. } __attribute__((packed));
  66. /** @} */
  67. #ifdef __cplusplus
  68. }
  69. #endif
  70. #endif /* _USB_CDC_ATM_H_ */