luna_soc.gateware.core.usb2.device module
Contains the organizing gateware used to add USB Device functionality
to your own designs; including the core USBDevice class.
- class luna_soc.gateware.core.usb2.device.Peripheral(*args, src_loc_at=0, **kwargs)[source]
Bases:
ComponentSoC controller for a USBDevice.
Breaks our USBDevice control and status signals out into registers so a CPU / Wishbone master can control our USB device.
The attributes below are intended to connect to a USBDevice. Typically, they’d be created by using the .controller() method on a USBDevice object, which will automatically connect all relevant signals.
Attributes
- connect: Signal(), output
High when the USBDevice should be allowed to connect to a host.
- class Control(*args, src_loc_at=0, **kwargs)[source]
Bases:
RegisterA CSR register.
Parameters
- fields
dictorlistorField Collection of register fields. If
None(default), a dict is populated from Python variable annotations.fieldsis used to create aFieldActionMap,FieldActionArray, orFieldAction, depending on its type (dict, list, or Field).
Interface attributes
- element
Element Interface between this register and a CSR bus primitive.
Attributes
- field
FieldActionMaporFieldActionArrayorFieldAction Collection of field instances.
- f
FieldActionMaporFieldActionArrayorFieldAction Shorthand for
Register.field.
Raises
TypeErrorIf
fieldsis neitherNone, adict, alist, or aField.ValueErrorIf
fieldsis notNoneand at least one variable annotation is aField.ValueErrorIf
element.accessis not readable and at least one field is readable.ValueErrorIf
element.accessis not writable and at least one field is writable.
- connect: <amaranth_soc.csr.reg.Field object at 0x751452d97200>
- full_speed_only: <amaranth_soc.csr.reg.Field object at 0x751452c9b7d0>
- low_speed_only: <amaranth_soc.csr.reg.Field object at 0x751452c9a2a0>
- fields
- class Status(*args, src_loc_at=0, **kwargs)[source]
Bases:
RegisterA CSR register.
Parameters
- fields
dictorlistorField Collection of register fields. If
None(default), a dict is populated from Python variable annotations.fieldsis used to create aFieldActionMap,FieldActionArray, orFieldAction, depending on its type (dict, list, or Field).
Interface attributes
- element
Element Interface between this register and a CSR bus primitive.
Attributes
- field
FieldActionMaporFieldActionArrayorFieldAction Collection of field instances.
- f
FieldActionMaporFieldActionArrayorFieldAction Shorthand for
Register.field.
Raises
TypeErrorIf
fieldsis neitherNone, adict, alist, or aField.ValueErrorIf
fieldsis notNoneand at least one variable annotation is aField.ValueErrorIf
element.accessis not readable and at least one field is readable.ValueErrorIf
element.accessis not writable and at least one field is writable.
- speed: <amaranth_soc.csr.reg.Field object at 0x751452cdc140>
- fields
- attach(device: USBDevice)[source]
Returns a list of statements necessary to connect this to a USB controller.
The returned values makes all of the connections necessary to provide control and fetch status from the relevant USB device. These can be made either combinationally or synchronously, but combinational is recommended; as these signals are typically fed from a register anyway.
Parameters
- device: USBDevice
The
USBDeviceobject to be controlled.