/* * VAS_EBOOT -- GRand Unified Bootloader * Copyright (C) 2008 Free Software Foundation, Inc. * * VAS_EBOOT is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * VAS_EBOOT is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with VAS_EBOOT. If not, see . */ #ifndef VAS_EBOOT_USBTRANS_H #define VAS_EBOOT_USBTRANS_H 1 #define MAX_USB_TRANSFER_LEN 0x0800 typedef enum { VAS_EBOOT_USB_TRANSFER_TYPE_IN, VAS_EBOOT_USB_TRANSFER_TYPE_OUT, VAS_EBOOT_USB_TRANSFER_TYPE_SETUP } VasEBoot_transfer_type_t; typedef enum { VAS_EBOOT_USB_TRANSACTION_TYPE_CONTROL, VAS_EBOOT_USB_TRANSACTION_TYPE_BULK } VasEBoot_transaction_type_t; struct VasEBoot_usb_transaction { int size; int toggle; VasEBoot_transfer_type_t pid; VasEBoot_uint32_t data; VasEBoot_size_t preceding; }; typedef struct VasEBoot_usb_transaction *VasEBoot_usb_transaction_t; struct VasEBoot_usb_transfer { int devaddr; int endpoint; int size; int transcnt; int max; VasEBoot_transaction_type_t type; VasEBoot_transfer_type_t dir; struct VasEBoot_usb_device *dev; struct VasEBoot_usb_transaction *transactions; int last_trans; /* Index of last processed transaction in OHCI/UHCI driver. */ void *controller_data; /* Used when finishing transfer to copy data back. */ struct VasEBoot_pci_dma_chunk *data_chunk; void *data; }; typedef struct VasEBoot_usb_transfer *VasEBoot_usb_transfer_t; enum { VAS_EBOOT_USB_REQTYPE_TARGET_DEV = (0 << 0), VAS_EBOOT_USB_REQTYPE_TARGET_INTERF = (1 << 0), VAS_EBOOT_USB_REQTYPE_TARGET_ENDP = (2 << 0), VAS_EBOOT_USB_REQTYPE_TARGET_OTHER = (3 << 0), VAS_EBOOT_USB_REQTYPE_STANDARD = (0 << 5), VAS_EBOOT_USB_REQTYPE_CLASS = (1 << 5), VAS_EBOOT_USB_REQTYPE_VENDOR = (2 << 5), VAS_EBOOT_USB_REQTYPE_OUT = (0 << 7), VAS_EBOOT_USB_REQTYPE_IN = (1 << 7), VAS_EBOOT_USB_REQTYPE_CLASS_INTERFACE_OUT = VAS_EBOOT_USB_REQTYPE_TARGET_INTERF | VAS_EBOOT_USB_REQTYPE_CLASS | VAS_EBOOT_USB_REQTYPE_OUT, VAS_EBOOT_USB_REQTYPE_VENDOR_OUT = VAS_EBOOT_USB_REQTYPE_VENDOR | VAS_EBOOT_USB_REQTYPE_OUT, VAS_EBOOT_USB_REQTYPE_CLASS_INTERFACE_IN = VAS_EBOOT_USB_REQTYPE_TARGET_INTERF | VAS_EBOOT_USB_REQTYPE_CLASS | VAS_EBOOT_USB_REQTYPE_IN, VAS_EBOOT_USB_REQTYPE_VENDOR_IN = VAS_EBOOT_USB_REQTYPE_VENDOR | VAS_EBOOT_USB_REQTYPE_IN }; enum { VAS_EBOOT_USB_REQ_GET_STATUS = 0x00, VAS_EBOOT_USB_REQ_CLEAR_FEATURE = 0x01, VAS_EBOOT_USB_REQ_SET_FEATURE = 0x03, VAS_EBOOT_USB_REQ_SET_ADDRESS = 0x05, VAS_EBOOT_USB_REQ_GET_DESCRIPTOR = 0x06, VAS_EBOOT_USB_REQ_SET_DESCRIPTOR = 0x07, VAS_EBOOT_USB_REQ_GET_CONFIGURATION = 0x08, VAS_EBOOT_USB_REQ_SET_CONFIGURATION = 0x09, VAS_EBOOT_USB_REQ_GET_INTERFACE = 0x0A, VAS_EBOOT_USB_REQ_SET_INTERFACE = 0x0B, VAS_EBOOT_USB_REQ_SYNC_FRAME = 0x0C }; #define VAS_EBOOT_USB_FEATURE_ENDP_HALT 0x00 #define VAS_EBOOT_USB_FEATURE_DEV_REMOTE_WU 0x01 #define VAS_EBOOT_USB_FEATURE_TEST_MODE 0x02 enum { VAS_EBOOT_USB_HUB_FEATURE_PORT_RESET = 0x04, VAS_EBOOT_USB_HUB_FEATURE_PORT_POWER = 0x08, VAS_EBOOT_USB_HUB_FEATURE_C_PORT_CONNECTED = 0x10, VAS_EBOOT_USB_HUB_FEATURE_C_PORT_ENABLED = 0x11, VAS_EBOOT_USB_HUB_FEATURE_C_PORT_SUSPEND = 0x12, VAS_EBOOT_USB_HUB_FEATURE_C_PORT_OVERCURRENT = 0x13, VAS_EBOOT_USB_HUB_FEATURE_C_PORT_RESET = 0x14 }; enum { VAS_EBOOT_USB_HUB_STATUS_PORT_CONNECTED = (1 << 0), VAS_EBOOT_USB_HUB_STATUS_PORT_ENABLED = (1 << 1), VAS_EBOOT_USB_HUB_STATUS_PORT_SUSPEND = (1 << 2), VAS_EBOOT_USB_HUB_STATUS_PORT_OVERCURRENT = (1 << 3), VAS_EBOOT_USB_HUB_STATUS_PORT_POWERED = (1 << 8), VAS_EBOOT_USB_HUB_STATUS_PORT_LOWSPEED = (1 << 9), VAS_EBOOT_USB_HUB_STATUS_PORT_HIGHSPEED = (1 << 10), VAS_EBOOT_USB_HUB_STATUS_C_PORT_CONNECTED = (1 << 16), VAS_EBOOT_USB_HUB_STATUS_C_PORT_ENABLED = (1 << 17), VAS_EBOOT_USB_HUB_STATUS_C_PORT_SUSPEND = (1 << 18), VAS_EBOOT_USB_HUB_STATUS_C_PORT_OVERCURRENT = (1 << 19), VAS_EBOOT_USB_HUB_STATUS_C_PORT_RESET = (1 << 20) }; struct VasEBoot_usb_packet_setup { VasEBoot_uint8_t reqtype; VasEBoot_uint8_t request; VasEBoot_uint16_t value; VasEBoot_uint16_t index; VasEBoot_uint16_t length; } VAS_EBOOT_PACKED; #endif /* VAS_EBOOT_USBTRANS_H */