Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Primary Author: Girish Verma Secondary Author(s): Navya Prabhakar Presenter: Navya Prabhakar Company/Organization: CircuitSutra USB Modeling Quick Start."— Presentation transcript:

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

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 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 Device Configuration 0... Interface 0Interface n Endpoint 0Endpoint n... Configuration n

5 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 o Encapsulate USB communication Contents of USB QSP Host Controller Device Controller Downstream Bus Upstream Bus Forward Interface Backward Interface USB Host Socket USB Device Socket

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

7 Payload: tlm_usb_host_payload AttributePossible Values Request typeDevice Reset, Device Suspend, Device Resume, Data Transfer, Sync Frame Device AddressAddress of USB device Endpoint AddressAddress of USB Endpoint Transfer DirectionSetup, In, Out Transfer TypeControl, Interrupt, Bulk, Isochronous Data pointerPointer to data buffer Data length requestedAllocated data length Used data lengthData length valid IntervalInterval between packets (required for Isochronous packets) Frame numberUSB frame number Response StatusOK, STALL, NAK, ERROR, INCOMPLETE 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) TLM USB Protocol Forward Interface

8 Payload: tlm_usb_device_payload AttributePossible Values Request typePort status, Remote wakeup, Initiate SRP, Initiate HNP Port StatusDevice Attached, Device removed Response StatusOK, ERROR,INCOMPLETE sc_interface: tlm_usb_bw_if Communication from USB Device Controller to USB Host Controller void nb_transport_usb_bw(tlm_usb_device_payload& payload) TLM USB Protocol Backward Interface

9 USB Host Socket sc_port templated 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_t port_status, int n); void usb_request_remote_wakeup(); bool usb_request_srp(); bool usb_request_hnp(); USB Host Socket sc_core::sc_port usb_host_socket sc_core::sc_export UsbHostState USB Host Controller Convenience APIs Callbacks

10 USB Host Socket Convenience APIs void reset(); void start(); void stop(); tlm_usb_transaction_status_t submit_transfer_request (tlm_usb_data_transfer_request_t* data_pkt); void set_port_state(int port_num, UsbPortState_t port_state); void get_port_status(uint8_t* buf);

11 USB Device Socket sc_port templated 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 int handle_ep_request (uint8_t EndPointAddr,int ep_dir,unsigned char* ep_data_ptr, unsigned int ep_data_len_requested); bool handle_ep0_request(usb_control_packet *setup_pkt, uint8_t* buf); USB Device Socket sc_core::sc_port usb_device_socket sc_core::sc_export UsbDeviceState 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 User space Kernel space Virtual Host Controller Emulation in kernel OS dependent API call for Virtual Host Controller emulation SC_THREAD Virtual Host Controller OS Adaptor USB Host Socket

14 USB Host PC Host Controller model 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 OS running on Host System Virtual Host Controller USB Core Layer SC_THREAD Virtual Host Controller Library USB Host Socket

15 USB Host PC Host Controller model USB Host PC Host Controller OS running on Host System Softehci Windows DSF Layer USB Core Layer 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 SC_THREAD Softusbdll USB Host Socket

16 USB Host PC Device Controller model 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 Port Host PC/System USB Host Controller on PC OS running on Host System Host Controller Driver USB HAL Layer USB Device Socket SC_THREAD LIBUSB API

17 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 Results Kernel space Virtual Platform Core Bus Memory USB Device Controller USB Device Socket USB Host PC Host Controller USB Host Socket Virtual Host Controller emulation in kernel User space

18 Virtual Platform Core Bus Memory USB Host Controller USB Host Socket USB Host PC Device Controller USB Device Socket USB Host Controller on Host PC User space Results USB Port 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 Kernel space

19 Thank You!!


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

Similar presentations


Ads by Google