translator usb_device
API Reference Manual  /  4 Model-to-Model Interfaces  / 

usb

Description
The usb_interface_t interface is implemented by all USB hosts. USB devices use the interface to communicate with the USB host. The interface is Simics internal, and may be changed in future versions of Simics. It should not be used by user-defined classes.

The connect_device() function is called by the USB device to connect to the USB. The host returns the physical port to which the device is connected, or -1 on connection error (for example, if all ports are occupied). Parameter to connect_device() is the maximum data speed for the USB device.

The disconnect_device() function is called by the USB device when it wants to disconnect from the USB. The host returns 0 on success.

The complete_transfer() function is called by a USB device when it has completed a transfer. Refer to the usb_device_t interface documentation to know more about how a transfer is sent to the USB device.

SIM_INTERFACE(usb) {
        int (*connect_device)(conf_object_t *bus_obj,
                              conf_object_t *NOTNULL dev_obj,
                              usb_speed_t speed);
        int (*disconnect_device)(conf_object_t *bus_obj,
                                 conf_object_t *NOTNULL dev_obj);
        void (*complete_transfer)(conf_object_t *bus_obj,
                                  conf_object_t *NOTNULL dev_obj,
                                  usb_transfer_t *NOTNULL transfer);
};

#define USB_INTERFACE "usb"

Execution Context
connect_deviceGlobal Context
disconnect_device Global Context
complete_transferCell Context

translator usb_device