Master Descriptor Table

As seen in the figure, the Device Master Descriptor Table (specified by the USB_DEVICE_MASTER_DESCRIPTOR data type) is a container for all descriptor related information that is needed by the Device Layer for its operation. This table contains the following information:

  • Pointer to the Full-Speed and High-Speed Device Descriptor
  • Number of Full-Speed and High-Speed Configurations
  • Pointers to Table of Full-Speed and High-Speed Configuration Descriptors
  • Number of String Descriptors
  • Pointer to a Table of String Descriptors
  • Pointers to Full-Speed and High-Speed Device Qualifier

In a case where a particular item in the Device Master Descriptor Table is not applicable, that entry can be either set to '0' or NULL as applicable. For example for a Full-Speed-only device, the number of High Speed Configuration should be set to '0' and the pointer to the table of High-Speed Configuration Descriptors should be set to NULL.

The following code shows an example of a USB Device Master Descriptor design for a Full-Speed USB HID Keyboard.

/**************************************************
 * USB Device Layer Master Descriptor Table
 **************************************************/
const USB_DEVICE_MASTER_DESCRIPTOR usbMasterDescriptor =
{
    &fullSpeedDeviceDescriptor,     /* Full-speed descriptor */
    1,                              /* Total number of full-speed configurations available */
    &fullSpeedConfigDescSet[0],     /* Pointer to array of full-speed configurations descriptors*/

    NULL,                           /* High-speed device descriptor is not supported*/
    0,                              /* Total number of high-speed configurations available */
    NULL,                           /* Pointer to array of high-speed configurations descriptors. Not supported*/

    3,                              /* Total number of string descriptors available */
    stringDescriptors,              /* Pointer to array of string descriptors */

    NULL,                           /* Pointer to full-speed device qualifier. Not supported */
    NULL,                           /* Pointer to high-speed device qualifier. Not supported */
};

The following code shows an example of a USB Device Master Descriptor design for a Full Speed/High Speed USB HID Keyboard.

/**************************************************
 * USB Device Layer Master Descriptor Table
 **************************************************/
const USB_DEVICE_MASTER_DESCRIPTOR usbMasterDescriptor =
{
    &fullSpeedDeviceDescriptor,     /* Full-speed descriptor */
    1,                              /* Total number of full-speed configurations available */
    &fullSpeedConfigDescSet[0],     /* Pointer to array of full-speed configurations descriptors*/

    &highSpeedDeviceDescriptor,     /* High-speed descriptor */
    1,                              /* Total number of high-speed configurations available */
    &highSpeedConfigDescSet[0],     /* Pointer to array of high-speed configurations descriptors*/

    3,                              /* Total number of string descriptors available */
    stringDescriptors,              /* Pointer to array of string descriptors */

    &deviceQualifierDescriptor1,    /* Pointer to full-speed device qualifier. */
    NULL,                           /* Pointer to high-speed device qualifier. Not supported */
};

The USB Device Layer Master Descriptor table can be placed in the data or program memory of the microcontroller. The contents of this table should not be modified while the application is running. Doing this will affect the operation of the Device Stack. A typical USB device application will not need to change the contents of this table while the application is running.