1 / 19

Primary Author: Girish Verma Secondary Author(s): Navya Prabhakar Presenter: Navya Prabhakar

USB Modeling Quick Start Package. Primary Author: Girish Verma Secondary Author(s): Navya Prabhakar Presenter: Navya Prabhakar Company/Organization: CircuitSutra. Presentation Topics. Need for USB Modeling QSP USB Concepts Overview of USB QSP contents Contents of USB QSP

orpah
Download Presentation

Primary Author: Girish Verma Secondary Author(s): Navya Prabhakar Presenter: Navya Prabhakar

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. USB Modeling Quick Start Package Primary Author: Girish Verma Secondary Author(s): Navya Prabhakar Presenter: Navya Prabhakar Company/Organization: CircuitSutra

  2. Presentation Topics • Need for USB Modeling QSP • USB Concepts • Overview of USB QSP contents • Contents of USB QSP • TLM USB Protocol • USB Host Socket • USB Device Socket • USB Host PC Host Controller • USB Host PC Device Controller • Results

  3. Need for USB Modeling QSP • Issues with USB Modeling • USB protocol is standardized but no available standard on TLM USB • Developing a model which addresses USB protocol without re-usable components is time consuming • Testing USB models requires complete protocol stack • Solution • Provide basic infrastructure to quick start SystemC model development of USB Device controller, USB Host Controller • Facilitates development and testing of device driver/application stack • Generic USB Device/Host requirements are modeled in convenience sockets so model developer needs to focus only on device-related modeling

  4. USB Concepts Device Configuration 0 Configuration n ... Interface 0 Interface n ... Endpoint 0 Endpoint n ... • USB Bus • Supports data exchange between a USB host and • USB peripherals • USB Host Controller • Manages data transfer between USB Host and USB devices • USB Device • Device specification • General information about device • Configuration • Groups interfaces • Interface • Represent basic functionality • Endpoint • Source or sink of data • Unique for a device

  5. Contents of USB QSP • USB Communication Interface • Takes place at electrical/link level and • protocol level • Abstracted as transaction level interface call • Contains APIs to model communication • at high level of abstraction • USB Host and Slave sockets • Encapsulate USB • communication USB Host Socket USB Device Socket Forward Interface Host Controller Device Controller Downstream Bus Upstream Bus Backward Interface

  6. Contents of USB QSP USB Host Socket USB Host PC Host Controller USB Device Controller USB Host Controller USB Host PC Device Controller USB Host Socket USB Device Socket USB Device Socket

  7. TLM USB Protocol • Forward Interface sc_interface: tlm_usb_fw_if Communication from USB Host Controller to USB Device Controller void nb_transport_usb_fw(tlm_usb_host_payload& payload)

  8. TLM USB Protocol • Backward Interface void nb_transport_usb_bw(tlm_usb_device_payload& payload) sc_interface: tlm_usb_bw_if Communication from USB Device Controller to USB Host Controller

  9. USB Host Socket • sc_porttemplated with forward interface • Implements the backward interface • Inherits from USB Host State • Implements generic USB Device handling • Provides convenience APIs for USB device model developer • Callbacks • void usb_port_status • (UsbPortState_tport_status, int n); • void usb_request_remote_wakeup(); • bool usb_request_srp(); • bool usb_request_hnp(); USB Host Socket sc_core::sc_port<usb_fw_transport_if> usb_host_socket UsbHostState sc_core::sc_export<usb_bw_transport_if> Convenience APIs Callbacks USB Host Controller

  10. USB Host Socket • Convenience APIs • void reset(); • void start(); • void stop(); • tlm_usb_transaction_status_tsubmit_transfer_request • (tlm_usb_data_transfer_request_t* data_pkt); • void set_port_state(intport_num, UsbPortState_tport_state); • void get_port_status(uint8_t* buf);

  11. USB Device Socket • sc_porttemplated with backward interface • Implements the forward interface • Inherits from USB Device State • Implements generic USB Device handling • Provides convenience APIs for USB device model developer • Callbacks • void device_state_change • (device_state_change_t reason); • unsigned inthandle_ep_request • (uint8_t EndPointAddr,intep_dir,unsigned • char* ep_data_ptr, • unsigned intep_data_len_requested); • bool handle_ep0_request(usb_control_packet • *setup_pkt, uint8_t* buf); USB Device Socket sc_core::sc_port<usb_bw_transport_if> usb_device_socket UsbDeviceState sc_core::sc_export<usb_fw_transport_if> Convenience APIs Callbacks USB Device Controller

  12. USB Device Socket • Convenience APIs • void enable_endpoint(uint8_t _EndPointAddr, tlm_usb_transfer_type_t _EndPointType, tlm_usb_endpoint_dir_t _EndPointDir, uint16_t _MaxPacketSize, • uint8_t _bInterval); • void halt_endpoint(uint8_t _EndPointAddr); • void set_device_state(UsbDeviceState_t _DevState); • void set_device_address(tlm_usb_device_address _dev_addr); • void handle_ep0_standard_req(bool _handle_standard_req = true); • void set_device_descriptor(usb_device_descriptor* _p_device_descriptor); • void set_config_descriptor(usb_config_descriptor* _p_config_descriptor, int num); • void set_string_descriptor(usb_string_descriptor* _p_string_descriptor, • int num);

  13. USB Host PC Host Controller • SystemC model USB host controller that • encapsulate USB system of host PC • Can connect with USB Device • Controller model • Adds a new virtual Host Controller • in the Host PC OS • Connects the USB Device Controller • to the new virtual Host through set • of OS-dependent APIs • Supports Control, Bulk, Interrupt and Isochronous transfers USB Host PC Host Controller model SC_THREAD USB Host Socket Virtual Host Controller OS Adaptor OS dependent API call for Virtual Host Controller emulation User space Kernel space Virtual Host Controller Emulation in kernel

  14. USB Host PC Host Controller Linux Version • USB Host PC Host Controller connects with • USB Device model through USB Host • Socket • Virtual Host Controller Library • provides convenience APIs to interact • with virtual Host Controller driver • Virtual Host Controller • Linux kernel Virtual Host Controller driver • Registers itself to the core layer • Forwards URB requests from USB Core layer to the application USB Host PC Host Controller model SC_THREAD USB Host Socket Virtual Host Controller Library OS running on Host System Virtual Host Controller USB Core Layer

  15. USB Host PC Host Controller Windows Version • USB Host Controller connects with USB • Device model through USB Host Socket • Soft USB • Interfaces with the application to communicate as a USB Device • Receives URB requests from USB DSF layer and sends it to the application • Soft ehci • DSF [Device Simulation Framework] • Emulates virtual Host Controller USB Host PC Host Controller model SC_THREAD USB Host Socket Softusbdll OS running on Host System Softehci Windows DSF Layer USB Core Layer

  16. USB Host PC Device Controller • SystemC model of USB device controller • that encapsulate the USB system of host PC • Can connect with USB Host Controller • model • Controls the USB Devices connected to • Host PC through LIBUSB API • LIBUSB is a C library that provides • applications easy access to USB devices • Contains configurable parameters – • Product ID and Vendor ID to make the • USB device accessible in the Virtual • Platform • Supports Control, Bulk, Interrupt transfers USB Host PC Device Controller model OS running on Host System SC_THREAD LIBUSB API USB HAL Layer USB Device Socket Host Controller Driver Host PC/System USB Host Controller on PC USB Port

  17. Results • Created virtual platform • having USB device controller • booting Linux with USB • file storage gadget driver • Able to emulate virtual • platform as a USB mass • storage device in Host PC • Mounted this USB device • on Host PC & successfully • performed read, write on • virtual platform • Provides support to develop • and test device driver/ • application stalk on Host PC Virtual Platform Core Bus Memory USB Host PC Host Controller USB Device Controller USB Host Socket USB Device Socket User space Kernel space Virtual Host Controller emulation in kernel

  18. Results • Created virtual platform • having a USB3.0 XHCI • Host Controller booting Linux • Host PC is able to connect • real USB device to the • virtual platform • Successfully able to mount, • read, write on USB thumb • drive connected to Host PC • Provides support to develop • device driver for USB Host • Controller on virtual platform Virtual Platform Core Bus Memory USB Host PC Device Controller USB Host Controller USB Device Socket USB Host Socket User space Kernel space USB Host Controller on Host PC USB Port

  19. Thank You!!

More Related