1
0

usb_cdcw.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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_WCM USB CDC WCM subclass
  17. * \brief USB CDC WCM subclass definitions
  18. * \details Wireless Mobile Communications Devices subclass
  19. * \details based on Universal Serial Bus CDC Subclass Specification for Wireless Mobile Communications Devices
  20. * Revision 1.1 (Errata 1)
  21. * + Wireless Handset Control Model
  22. * + Device Management Model
  23. * + Mobile Direct Line Model
  24. * + OBEX Model
  25. * @{ */
  26. #ifndef _USB_CDC_WCM_H_
  27. #define _USB_CDC_WCM_H_
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. /**\name Communications Class Subclass Codes
  32. * @{ */
  33. #define USB_CDC_SUBCLASS_WHCM 0x08 /**<\brief Wireless Handset Control Model.*/
  34. #define USB_CDC_SUBCLASS_DMM 0x09 /**<\brief Device Management Model.*/
  35. #define USB_CDC_SUBCLASS_MDLM 0x0A /**<\brief Mobile Direct Line Model.*/
  36. #define USB_CDC_SUBCLASS_OBEX 0x0B /**<\brief OBEX Model.*/
  37. /* @} */
  38. /**\name Communications Class Protocol Codes
  39. * @{ */
  40. #define USB_CDC_PROTO_PCCA101 0x02 /**<\brief AT Commands defined by PCCA-101.*/
  41. #define USB_CDC_PROTO_PCCA101O 0x03 /**<\brief AT Commands defined by PCCA-101 & Annex O.*/
  42. #define USB_CDC_PROTO_GSM 0x04 /**<\brief AT Commands defined by GSM 07.07.*/
  43. #define USB_CDC_PROTO_3G 0x05 /**<\brief AT Commands defined by 3GPP 27.007.*/
  44. #define USB_CDC_PROTO_CDMA 0x06 /**<\brief AT Commands defined by TIA for CDMA.*/
  45. /** @} */
  46. /**\name CDC WCM subclass specific Functional Descriptors codes
  47. * @{ */
  48. #define USB_DTYPE_CDC_WHCM 0x11 /**<\brief Wireless Handset Control Model Functional Descriptor.*/
  49. #define USB_DTYPE_CDC_MDLM 0x12 /**<\brief Mobile Direct Line Model Functional Descriptor.*/
  50. #define USB_DTYPE_CDC_MDLM_DETAIL 0x13 /**<\brief MDLM Detail Functional Descriptor.*/
  51. #define USB_DTYPE_CDC_DMM 0x14 /**<\brief Device Management Model Functional Descriptor.*/
  52. #define USB_DTYPE_CDC_OBEX 0x15 /**<\brief OBEX Functional Descriptor.*/
  53. #define USB_DTYPE_CDC_CMDSET 0x16 /**<\brief Command Set Functional Descriptor.*/
  54. #define USB_DTYPE_CDC_CMDSET_DETAIL 0x17 /**<\brief Command Set Detail Functional Descriptor.*/
  55. #define USB_DTYPE_CDC_TEL_CONRTOL 0x18 /**<\brief Telephone Control Model Functional Descriptor.*/
  56. #define USB_DTYPE_CDC_OBEX_SERVICE 0x19 /**<\brief OBEX Service Identifier Functional Descriptor.*/
  57. /** @} */
  58. /**\name CDC WCM subclass specific requests
  59. * @{ */
  60. /** @} */
  61. /**\brief Wireless Handset Control Model Functional Descriptor */
  62. struct usb_cdc_whcm_desc {
  63. uint8_t bFunctionLength; /**<\brief Size of this functional descriptor, in bytes.*/
  64. uint8_t bDescriptorType; /**<\brief CS_INTERFACE descriptor type.*/
  65. uint8_t bDescriptorSubType; /**<\brief Wireless Handset Control Model Functional Descriptor.*/
  66. uint16_t bcdVersion; /**<\brief BCD version number for this subclass specification.*/
  67. } __attribute__ ((packed));
  68. /**\brief Mobile Direct Line Model Functional Descriptor
  69. * \details This descriptor is mandatory. It conveys the GUID that uniquely identifies the kind of
  70. * MDLM interface that is being provided.
  71. */
  72. struct usb_cdc_mdlm_desc {
  73. uint8_t bFunctionLength; /**<\brief Size of this functional descriptor, in bytes.*/
  74. uint8_t bDescriptorType; /**<\brief CS_INTERFACE descriptor type.*/
  75. uint8_t bDescriptorSubType; /**<\brief Mobile Direct Line Model Functional Descriptor.*/
  76. uint16_t bcdVersion; /**<\brief Version number for this subclass specification.*/
  77. uint8_t bGUID[16]; /**<\brief Uniquely identifies the detailed transport protocol
  78. * provided by this MDLM interface. */
  79. } __attribute__ ((packed));
  80. /**\brief Mobile Direct Line Model Detail Functional Descriptor
  81. * \details This descriptor is optional, and may be repeated as necessary. It conveys any additional
  82. * information required by the MDLM transport specification identified by the MDLM Functional
  83. * Descriptor.*/
  84. struct usb_cdc_mdlm_detail_desc {
  85. uint8_t bFunctionLength; /**<\brief Size of this functional descriptor, in bytes.*/
  86. uint8_t bDescriptorType; /**<\brief CS_INTERFACE descriptor type.*/
  87. uint8_t bDescriptorSubType; /**<\brief Mobile Direct Line Model Details Functional Descriptor.*/
  88. uint8_t bGuidDescriptorType; /**<\brief Discriminator, interpreted according to the semantic
  89. * model specified by the GUID in the MDLM Functional Descriptor.*/
  90. uint8_t bDetailData[0]; /**< Information associated with this GUID and discriminator,
  91. * according to the semantic model specified by the GUID in
  92. * the MDLM Functional Descriptor */
  93. } __attribute__ ((packed));
  94. /**\brief Device Management Functional Descriptor */
  95. struct usb_cdc_dmm_desc {
  96. uint8_t bFunctionLength; /**<\brief Size of this functional descriptor, in bytes.*/
  97. uint8_t bDescriptorType; /**<\brief CS_INTERFACE descriptor type.*/
  98. uint8_t bDescriptorSubType; /**<\brief Wireless Handset Control Model Functional Descriptor.*/
  99. uint16_t bcdVersion; /**<\brief Version number for this subclass specification.*/
  100. uint16_t wMaxCommand; /**<\brief The buffer size allocated in the device for data
  101. * sent from the host using SEND_ENCAPSULATED_CMD. */
  102. } __attribute__ ((packed));
  103. /**\brief OBEX Service Identification Functional Descriptor
  104. * \details This optional functional descriptor indicates the mode supported by this OBEX function.
  105. * This corresponds to an OBEX role (client or server), a particular OBEX service, and an OBEX
  106. * service version.*/
  107. struct usb_cdc_obex_serv_desc {
  108. uint8_t bFunctionLength; /**<\brief Size of this functional descriptor, in bytes.*/
  109. uint8_t bDescriptorType; /**<\brief CS_INTERFACE descriptor type.*/
  110. uint8_t bDescriptorSubType; /**<\brief OBEX Service Identifier Functional Descriptor.*/
  111. uint8_t bmOBEXRole; /**<\brief Represents the OBEX role to be played by the function.*/
  112. uint8_t bOBEXServiceUUID[16]; /**<\brief A 16 byte UUID value used to indicate the particular
  113. * OBEX service associated with this function. */
  114. uint16_t wOBEXServiceVersion; /**<\brief A 16 bit value indicating the version of the OBEX
  115. * service associated with this function. */
  116. } __attribute__ ((packed));
  117. /** @} */
  118. #ifdef __cplusplus
  119. }
  120. #endif
  121. #endif /* _USB_CDC_WCM_H_ */