1
0

usb_cdcw.h 7.2 KB

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