1
0

usb_cdce.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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_ECM USB CDC ECM subclass
  17. * \brief USB CDC ECM subclass definitions
  18. * \details Includes following subclasses
  19. * + Ethernet Control Model
  20. * @{ */
  21. #ifndef _USB_CDC_ECM_H_
  22. #define _USB_CDC_ECM_H_
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. /**\name Communications Class Subclass Codes
  27. * @{ */
  28. #define USB_CDC_SUBCLASS_ETH 0x06 /**< Ethernet Networking Control Model */
  29. /* @} */
  30. /**\name CDC ECM subclass specific Functional Descriptors codes
  31. * @{ */
  32. #define USB_DTYPE_CDC_ETHERNET 0x0F /**< Ethernet Networking Functional Descriptor*/
  33. /** @} */
  34. /**\name CDC ECM subclass specific requests
  35. * @{ */
  36. #define USB_CDC_SET_ETH_MULTICAST_FILTERS 0x40 /**< */
  37. #define USB_CDC_SET_ETH_PM_PATTERN_FILTER 0x41 /**< */
  38. #define USB_CDC_GET_ETH_PM_PATTERN_FILTER 0x42 /**< */
  39. #define USB_CDC_SET_ETH_PACKET_FILTER 0x43 /**< Sets device filter for running a network analyzer application on the host machine */
  40. #define USB_CDC_GET_ETH_STATISTIC 0x44 /**< Retrieves Ethernet device statistics such as frames transmitted, frames received, and bad frames received. */
  41. /** @} */
  42. /**\brief Ethernet Networking Functional Descriptor
  43. * \details describes the operational modes supported by the
  44. * Communications Class interface, as defined in Section 3.4, with the SubClass code of Ethernet
  45. * Networking Control. It can only occur within the class-specific portion of an Interface descriptor.
  46. */
  47. struct usb_cdc_ether_desc {
  48. uint8_t bFunctionLength; /**< Size of this functional descriptor, in bytes. */
  49. uint8_t bDescriptorType; /**< CS_INTERFACE descriptor type. \see \ref USB_DTYPE_CS_INTERFACE */
  50. uint8_t bDescriptorSubType; /**< Ethernet Networking Functional Descriptor. \ref USB_DTYPE_CDC_ETHERNET */
  51. uint8_t iMACAddress; /**< Index of string descriptor that holds the 48bit Ethernet MAC address. */
  52. uint32_t bmEthernetStatistics; /**< Indicates which Ethernet statistics functions the device collects. */
  53. uint16_t wMaxSegmentSize; /**< The maximum segment size that the Ethernet device is capable of supporting. */
  54. uint16_t wNumberMCFilters; /**< Contains the number of multicast filters that can be configured by the host. */
  55. uint8_t bNumberPowerFilters; /**< Contains the number of pattern filters that are available for causing wake-up of the host. */
  56. } __attribute__ ((packed));
  57. /** @} */
  58. #ifdef __cplusplus
  59. }
  60. #endif
  61. #endif /* _USB_CDC_ECM_H_ */