usb vectored_interrupt
API Reference Manual  /  4 Model-to-Model Interfaces  / 

usb_device

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

The submit_transfer() function is used by the USB host controller to send a new transfer to a USB device. Transfers are the basic means of communication between the USB host controller and the USB devices. A transfer contains all information needed to handle control, bulk, interrupt, and isochronous transfers. A transfer to a USB device simply moves the control from the USB host to the USB device. The USB device can then decide when to send back any useful data to the USB host. The USB device receives a pointer to the transfer to handle. It can either handle the transfer immediately or send the transfer back later using the complete_transfer() function in the usb_interface_t interface, which is implemented by the USB host.

The USB device must return USB_Transfer_Completed when it handles the transfer immediately, i.e., it has filled the required fields in the transfer structure. The USB device must return USB_Transfer_Not_Ready for unfinished transfers, i.e., the USB device does not have any interesting data to deliver at this point. The isochronous and interrupt transfers contain a field indicating how long time the USB host expects the USB device to wait before returning the transfer. Note that it is just an indication on how often this transfer is scheduled in the periodic list and USB devices can complete the transfers at any time. A value of 0 means that the USB host does have any expectations about the return time.

The abort_transfer() function tells the USB device to abort a transfer previously issued by the USB host. The USB device should not call the complete_transfer() function for a request that has been aborted.

The reset() function is used by the USB host to reset the USB device.

The USB host expects the device to return the same transfer pointer it received when completing, i.e., the transfer pointer is used to identify uniquely a transfer.

SIM_INTERFACE(usb_device) {
        usb_transfer_completion_t (*submit_transfer)(conf_object_t *dev_obj,
                                                     usb_transfer_t *transfer);
        void (*abort_transfer)(conf_object_t *dev_obj,
                               usb_transfer_t *transfer);
        void (*reset)(conf_object_t *dev_obj);
};

#define USB_DEVICE_INTERFACE "usb_device"

Execution Context
Cell Context for all methods.

usb vectored_interrupt