../src/lowrisc_ip_usb_fs_nb_pe_0.1/rtl/usb_consts_pkg.sv Cov: 100%

   1: // Copyright lowRISC contributors.
   2: // Licensed under the Apache License, Version 2.0, see LICENSE for details.
   3: // SPDX-License-Identifier: Apache-2.0
   4: 
   5: package usb_consts_pkg;
   6: 
   7:   // Definitions for USB Packet Identifier (called PID in the spec)
   8: 
   9:   // Bottom two bits of the PID are type
  10:   typedef enum logic [1:0] {
  11:     UsbPidTypeSpecial    = 2'b00,
  12:     UsbPidTypeToken      = 2'b01,
  13:     UsbPidTypeHandshake  = 2'b10,
  14:     UsbPidTypeData       = 2'b11
  15:   } usb_pid_type_e;
  16: 
  17:   // Direct from USB 2.0 Spec Table 8-1
  18:   typedef enum logic [3:0] {
  19:     // TOKEN
  20:     UsbPidOut   = 4'b0001,
  21:     UsbPidIn    = 4'b1001,
  22:     UsbPidSof   = 4'b0101,
  23:     UsbPidSetup = 4'b1101,
  24:     // DATA
  25:     UsbPidData0 = 4'b0011,
  26:     UsbPidData1 = 4'b1011,
  27:     UsbPidData2 = 4'b0111, // Only valid for High Speed
  28:     UsbPidMData = 4'b1111, // Only valid for High Speed
  29:     // HANDSHAKE
  30:     UsbPidAck   = 4'b0010,
  31:     UsbPidNak   = 4'b1010,
  32:     UsbPidStall = 4'b1110,
  33:     UsbPidNyet  = 4'b0110
  34:   } usb_pid_e;
  35: 
  36: 
  37:   // USB SETUP packet commands (USB2.0 Table 9-4)
  38:   typedef enum logic [7:0] {
  39:     SetupGetStatus        = 8'd0,
  40:     SetupClearFeature     = 8'd1,
  41:     SetupSetFeature       = 8'd3,
  42:     SetupSetAddress       = 8'd5,
  43:     SetupGetDescriptor    = 8'd6,
  44:     SetupSetDescriptor    = 8'd7,
  45:     SetupGetConfiguration = 8'd8,
  46:     SetupSetConfiguration = 8'd9,
  47:     SetupGetInterface     = 8'd10,
  48:     SetupSetInterface     = 8'd11,
  49:     SetupSynchFrame       = 8'd12
  50:   } usb_setup_request_e;
  51: 
  52:   // USB Desctiptor Types (USB2.0 Table 9-5)
  53:   typedef enum logic [7:0] {
  54:     DscrTypeDevice        = 8'd1,
  55:     DscrTypeConfiguration = 8'd2,
  56:     DscrTypeString        = 8'd3,
  57:     DscrTypeInterface     = 8'd4,
  58:     DscrTypeEndpoint      = 8'd5,
  59:     DscrTypeDevQual       = 8'd6,
  60:     DscrTypeOthrSpd       = 8'd7,
  61:     DscrTypeIntPwr        = 8'd8
  62:   } usb_dscr_type_e;
  63: 
  64: endpackage
  65: