hwtLib.peripheral.usb.sim package¶
Subpackages¶
Submodules¶
hwtLib.peripheral.usb.sim.agent_base module¶
- class hwtLib.peripheral.usb.sim.agent_base.UsbAgent(rx: Deque[Union[UsbPacketToken, UsbPacketData, UsbPacketHandshake]], tx: Deque[Union[UsbPacketToken, UsbPacketData, UsbPacketHandshake]])[source]¶
Bases:
object
- __init__(rx: Deque[Union[UsbPacketToken, UsbPacketData, UsbPacketHandshake]], tx: Deque[Union[UsbPacketToken, UsbPacketData, UsbPacketHandshake]])[source]¶
- deparse_packet(p)[source]¶
Called to convert the packet from types supported by this class before putting into tx/rx queue
- class hwtLib.peripheral.usb.sim.agent_base.UsbPacketData(pid: int, data: List[int])[source]¶
Bases:
object
hwtLib.peripheral.usb.sim.usb_agent_device module¶
- class hwtLib.peripheral.usb.sim.usb_agent_device.UsbDevAgent(rx: Deque[Union[UsbPacketToken, UsbPacketData]], tx: Deque[Union[UsbPacketToken, UsbPacketData]], descriptors: UsbDescriptorBundle)[source]¶
Bases:
UsbAgent
This agent uses rx and tx queue to comunicate with a USB device. The agnet implements address assignment and descriptor upload and it is meant to be extended with a specific functionality of USB device.
- __init__(rx: Deque[Union[UsbPacketToken, UsbPacketData]], tx: Deque[Union[UsbPacketToken, UsbPacketData]], descriptors: UsbDescriptorBundle)[source]¶
hwtLib.peripheral.usb.sim.usb_agent_host module¶
- class hwtLib.peripheral.usb.sim.usb_agent_host.UsbHostAgent(rx: Deque[Union[UsbPacketToken, UsbPacketData, UsbPacketHandshake]], tx: Deque[Union[UsbPacketToken, UsbPacketData, UsbPacketHandshake]])[source]¶
Bases:
UsbAgent
This agent uses rx and tx queue to comunicate with a USB device. It performs bus enumerations, sets address to a device and downloads the descriptors. Note that the agent is written in a way which allows for easy extension to a driver which can parse the specific descriptors and comunicate with devices further.
- __init__(rx: Deque[Union[UsbPacketToken, UsbPacketData, UsbPacketHandshake]], tx: Deque[Union[UsbPacketToken, UsbPacketData, UsbPacketHandshake]])[source]¶
- control_read(addr, bmRequestType_type: USB_REQUEST_TYPE_TYPE, bRequest: int, wValue: int, wIndex: int, wLength: int, bmRequestType_recipient: USB_REQUEST_TYPE_RECIPIENT = 0, bmRequestType_data_transfer_direction: USB_REQUEST_TYPE_DIRECTION = 1)[source]¶
- control_write(addr: int, ep: int, bmRequestType_type: USB_REQUEST_TYPE_TYPE, bRequest: int, wValue: int, wIndex: int, buff: List[int], bmRequestType_recipient: USB_REQUEST_TYPE_RECIPIENT = 0, bmRequestType_data_transfer_direction: USB_REQUEST_TYPE_DIRECTION = 0)[source]¶
- download_descriptor(addr: int, descriptor_t: ~typing.Union[~hwt.hdl.types.struct.HStruct, str], index: int, wIndex: int = 0, wLength: ~typing.Optional[int] = <class 'hwt.synthesizer.rtlLevel.constants.NOT_SPECIFIED'>)[source]¶
- get_max_packet_size(addr: int, endp: int, direction: USB_ENDPOINT_DIR)[source]¶
- parse_interface_functional_descriptor(interface_descr: StructValBase, data: BitsVal)[source]¶