Skip to content

Commit c63c5ce

Browse files
committed
USB added class specific endpoint descriptor
1 parent 431d239 commit c63c5ce

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

klib/usb/usb/descriptor.hpp

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,17 +444,36 @@ namespace klib::usb::descriptor {
444444
template <typename Base, uint8_t SubType>
445445
struct cs_interface {
446446
// size of the descriptor
447-
const uint8_t bFunctionLength = sizeof(Base);
447+
const uint8_t bLength = sizeof(Base);
448448

449449
// the device class specific descriptor type
450450
const descriptor_type bDescriptorType = descriptor_type::cs_interface;
451451

452452
// header functional descriptor subtype
453-
const uint8_t bDescriptorSubtype = static_cast<uint8_t>(SubType);
453+
const uint8_t bDescriptorSubType = SubType;
454454
};
455455

456456
// make sure the size is correct
457457
static_assert(sizeof(cs_interface<uint8_t, 0x00>) == 0x03, "Class specific base descriptor size is wrong");
458+
459+
/**
460+
* @brief Class specific endpoint descriptor
461+
*
462+
*/
463+
struct cs_endpoint {
464+
// size of the descriptor
465+
const uint8_t bLength = sizeof(cs_endpoint);
466+
467+
// the device class specific descriptor type
468+
const descriptor_type bDescriptorType = descriptor_type::cs_endpoint;
469+
470+
// header functional descriptor subtype
471+
uint8_t bDescriptorSubType;
472+
473+
// maximum transfer size this endpoint is capable of sending or
474+
// receiving
475+
uint16_t wMaxTransferSize;
476+
};
458477
}
459478

460479
// release the old pack so the rest of the structs are not

0 commit comments

Comments
 (0)