use only one endpoint pair for MSC except on SAMD21
This commit is contained in:
parent
95a5a57f94
commit
195de97c67
|
@ -19,6 +19,9 @@ ifeq ($(CHIP_FAMILY),samd21)
|
||||||
# frequencyio not yet verified as working on SAMD21.
|
# frequencyio not yet verified as working on SAMD21.
|
||||||
CIRCUITPY_FREQUENCYIO = 0
|
CIRCUITPY_FREQUENCYIO = 0
|
||||||
CIRCUITPY_TOUCHIO_USE_NATIVE = 1
|
CIRCUITPY_TOUCHIO_USE_NATIVE = 1
|
||||||
|
|
||||||
|
# SAMD21 needs separate endpoint pairs for MSC BULK IN and BULK OUT, otherwise it's erratic.
|
||||||
|
USB_MSC_NUM_ENDPOINT_PAIRS = 2
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Put samd51-only choices here.
|
# Put samd51-only choices here.
|
||||||
|
|
|
@ -89,6 +89,11 @@ ifndef USB_HID_DEVICES
|
||||||
USB_HID_DEVICES = "KEYBOARD,MOUSE,CONSUMER,GAMEPAD"
|
USB_HID_DEVICES = "KEYBOARD,MOUSE,CONSUMER,GAMEPAD"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# SAMD21 needs separate endpoint pairs for MSC BULK IN and BULK OUT, otherwise it's erratic.
|
||||||
|
ifndef USB_MSC_NUM_ENDPOINT_PAIRS
|
||||||
|
USB_MSC_NUM_ENDPOINT_PAIRS = 1
|
||||||
|
endif
|
||||||
|
|
||||||
SUPERVISOR_O = $(addprefix $(BUILD)/, $(SRC_SUPERVISOR:.c=.o)) $(BUILD)/autogen_display_resources.o
|
SUPERVISOR_O = $(addprefix $(BUILD)/, $(SRC_SUPERVISOR:.c=.o)) $(BUILD)/autogen_display_resources.o
|
||||||
|
|
||||||
$(BUILD)/supervisor/shared/translate.o: $(HEADER_BUILD)/qstrdefs.generated.h
|
$(BUILD)/supervisor/shared/translate.o: $(HEADER_BUILD)/qstrdefs.generated.h
|
||||||
|
@ -106,8 +111,9 @@ autogen_usb_descriptor.intermediate: ../../tools/gen_usb_descriptor.py Makefile
|
||||||
--vid $(USB_VID)\
|
--vid $(USB_VID)\
|
||||||
--pid $(USB_PID)\
|
--pid $(USB_PID)\
|
||||||
--serial_number_length $(USB_SERIAL_NUMBER_LENGTH)\
|
--serial_number_length $(USB_SERIAL_NUMBER_LENGTH)\
|
||||||
--devices $(USB_DEVICES) \
|
--devices $(USB_DEVICES)\
|
||||||
--hid_devices $(USB_HID_DEVICES) \
|
--hid_devices $(USB_HID_DEVICES)\
|
||||||
|
--msc_num_endpoint_pairs $(USB_MSC_NUM_ENDPOINT_PAIRS)\
|
||||||
--output_c_file $(BUILD)/autogen_usb_descriptor.c\
|
--output_c_file $(BUILD)/autogen_usb_descriptor.c\
|
||||||
--output_h_file $(BUILD)/genhdr/autogen_usb_descriptor.h
|
--output_h_file $(BUILD)/genhdr/autogen_usb_descriptor.h
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,8 @@ parser.add_argument('--devices', type=lambda l: tuple(l.split(',')), default=DEF
|
||||||
help='devices to include in descriptor (AUDIO includes MIDI support)')
|
help='devices to include in descriptor (AUDIO includes MIDI support)')
|
||||||
parser.add_argument('--hid_devices', type=lambda l: tuple(l.split(',')), default=DEFAULT_HID_DEVICES,
|
parser.add_argument('--hid_devices', type=lambda l: tuple(l.split(',')), default=DEFAULT_HID_DEVICES,
|
||||||
help='HID devices to include in HID report descriptor')
|
help='HID devices to include in HID report descriptor')
|
||||||
|
parser.add_argument('--msc_num_endpoint_pairs', type=int, default=1,
|
||||||
|
help='Use 1 or 2 endpoint pairs for MSC (1 bidirectional, or 1 input + 1 output (required by SAMD21))')
|
||||||
parser.add_argument('--output_c_file', type=argparse.FileType('w'), required=True)
|
parser.add_argument('--output_c_file', type=argparse.FileType('w'), required=True)
|
||||||
parser.add_argument('--output_h_file', type=argparse.FileType('w'), required=True)
|
parser.add_argument('--output_h_file', type=argparse.FileType('w'), required=True)
|
||||||
|
|
||||||
|
@ -45,6 +47,9 @@ unknown_hid_devices = list(frozenset(args.hid_devices) - ALL_HID_DEVICES_SET)
|
||||||
if unknown_hid_devices:
|
if unknown_hid_devices:
|
||||||
raise ValueError("Unknown HID devices(s)", unknown_hid_devices)
|
raise ValueError("Unknown HID devices(s)", unknown_hid_devices)
|
||||||
|
|
||||||
|
if args.msc_num_endpoint_pairs not in (1, 2):
|
||||||
|
raise ValueError("--msc_num_endpoint_pairs must be 1 or 2")
|
||||||
|
|
||||||
|
|
||||||
class StringIndex:
|
class StringIndex:
|
||||||
"""Assign a monotonically increasing index to each unique string. Start with 0."""
|
"""Assign a monotonically increasing index to each unique string. Start with 0."""
|
||||||
|
@ -153,7 +158,9 @@ msc_interfaces = [
|
||||||
bInterval=0),
|
bInterval=0),
|
||||||
standard.EndpointDescriptor(
|
standard.EndpointDescriptor(
|
||||||
description="MSC out",
|
description="MSC out",
|
||||||
bEndpointAddress=0x1 | standard.EndpointDescriptor.DIRECTION_OUT,
|
# SAMD21 needs to use a separate pair of endpoints for MSC.
|
||||||
|
bEndpointAddress=((0x1 if args.msc_num_endpoint_pairs == 2 else 0x0) |
|
||||||
|
standard.EndpointDescriptor.DIRECTION_OUT),
|
||||||
bmAttributes=standard.EndpointDescriptor.TYPE_BULK,
|
bmAttributes=standard.EndpointDescriptor.TYPE_BULK,
|
||||||
bInterval=0)
|
bInterval=0)
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue