replace USB_MSC_MAX_PACKET_SIZE with USB_HIGHSPEED in descriptor gen tool

This commit is contained in:
hathach 2020-07-29 15:38:55 +07:00
parent debbf1028a
commit 6063828279
4 changed files with 18 additions and 11 deletions

View File

@ -1,5 +1,5 @@
USB_SERIAL_NUMBER_LENGTH = 10
USB_MSC_MAX_PACKET_SIZE = 512
USB_HIGHSPEED = 1
USB_RENUMBER_ENDPOINTS = 0
USB_CDC_EP_NUM_NOTIFICATION = 3
USB_CDC_EP_NUM_DATA_OUT = 2

View File

@ -15,7 +15,7 @@ endif
INTERNAL_LIBM = 1
USB_SERIAL_NUMBER_LENGTH = 32
USB_MSC_MAX_PACKET_SIZE = 512
USB_HIGHSPEED = 1
INTERNAL_FLASH_FILESYSTEM = 1

View File

@ -129,8 +129,8 @@ ifndef USB_HID_DEVICES
USB_HID_DEVICES = "KEYBOARD,MOUSE,CONSUMER,GAMEPAD"
endif
ifndef USB_MSC_MAX_PACKET_SIZE
USB_MSC_MAX_PACKET_SIZE = 64
ifndef USB_HIGHSPEED
USB_HIGHSPEED = 0
endif
ifndef USB_CDC_EP_NUM_NOTIFICATION
@ -178,7 +178,6 @@ USB_DESCRIPTOR_ARGS = \
--interface_name $(USB_INTERFACE_NAME)\
--devices $(USB_DEVICES)\
--hid_devices $(USB_HID_DEVICES)\
--msc_max_packet_size $(USB_MSC_MAX_PACKET_SIZE)\
--cdc_ep_num_notification $(USB_CDC_EP_NUM_NOTIFICATION)\
--cdc_ep_num_data_out $(USB_CDC_EP_NUM_DATA_OUT)\
--cdc_ep_num_data_in $(USB_CDC_EP_NUM_DATA_IN)\
@ -195,6 +194,10 @@ ifeq ($(USB_RENUMBER_ENDPOINTS), 0)
USB_DESCRIPTOR_ARGS += --no-renumber_endpoints
endif
ifeq ($(USB_HIGHSPEED), 1)
USB_DESCRIPTOR_ARGS += --highspeed
endif
$(BUILD)/supervisor/shared/translate.o: $(HEADER_BUILD)/qstrdefs.generated.h
$(BUILD)/autogen_usb_descriptor.c $(BUILD)/genhdr/autogen_usb_descriptor.h: autogen_usb_descriptor.intermediate

View File

@ -23,6 +23,8 @@ ALL_HID_DEVICES_SET=frozenset(ALL_HID_DEVICES.split(','))
DEFAULT_HID_DEVICES='KEYBOARD,MOUSE,CONSUMER,GAMEPAD'
parser = argparse.ArgumentParser(description='Generate USB descriptors.')
parser.add_argument('--highspeed', default=False, action='store_true',
help='descriptor for highspeed device')
parser.add_argument('--manufacturer', type=str,
help='manufacturer of the device')
parser.add_argument('--product', type=str,
@ -40,8 +42,6 @@ parser.add_argument('--hid_devices', type=lambda l: tuple(l.split(',')), default
parser.add_argument('--interface_name', type=str,
help='The name/prefix to use in the interface descriptions',
default=DEFAULT_INTERFACE_NAME)
parser.add_argument('--msc_max_packet_size', type=int, default=64,
help='Max packet size for MSC')
parser.add_argument('--no-renumber_endpoints', dest='renumber_endpoints', action='store_false',
help='use to not renumber endpoint')
parser.add_argument('--cdc_ep_num_notification', type=int, default=0,
@ -185,11 +185,15 @@ cdc_data_interface = standard.InterfaceDescriptor(
standard.EndpointDescriptor(
description="CDC data out",
bEndpointAddress=args.cdc_ep_num_data_out | standard.EndpointDescriptor.DIRECTION_OUT,
bmAttributes=standard.EndpointDescriptor.TYPE_BULK),
bmAttributes=standard.EndpointDescriptor.TYPE_BULK,
bInterval=0,
wMaxPacketSize=512 if args.highspeed else 64),
standard.EndpointDescriptor(
description="CDC data in",
bEndpointAddress=args.cdc_ep_num_data_in | standard.EndpointDescriptor.DIRECTION_IN,
bmAttributes=standard.EndpointDescriptor.TYPE_BULK),
bmAttributes=standard.EndpointDescriptor.TYPE_BULK,
bInterval=0,
wMaxPacketSize=512 if args.highspeed else 64),
])
cdc_interfaces = [cdc_comm_interface, cdc_data_interface]
@ -207,13 +211,13 @@ msc_interfaces = [
bEndpointAddress=args.msc_ep_num_in | standard.EndpointDescriptor.DIRECTION_IN,
bmAttributes=standard.EndpointDescriptor.TYPE_BULK,
bInterval=0,
wMaxPacketSize=args.msc_max_packet_size),
wMaxPacketSize=512 if args.highspeed else 64),
standard.EndpointDescriptor(
description="MSC out",
bEndpointAddress=(args.msc_ep_num_out | standard.EndpointDescriptor.DIRECTION_OUT),
bmAttributes=standard.EndpointDescriptor.TYPE_BULK,
bInterval=0,
wMaxPacketSize=args.msc_max_packet_size)
wMaxPacketSize=512 if args.highspeed else 64),
]
)
]