Improve coding style in MdeModulePkg.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9793 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
Usb Bus Driver Binding and Bus IO Protocol.
|
||||
|
||||
Copyright (c) 2004 - 2007, Intel Corporation
|
||||
Copyright (c) 2004 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -47,81 +47,83 @@ typedef struct _USB_HUB_API USB_HUB_API;
|
||||
#include "UsbHub.h"
|
||||
#include "UsbEnumer.h"
|
||||
|
||||
typedef enum {
|
||||
USB_MAX_LANG_ID = 16,
|
||||
USB_MAX_INTERFACE = 16,
|
||||
USB_MAX_DEVICES = 128,
|
||||
//
|
||||
// USB bus timeout experience values
|
||||
//
|
||||
|
||||
USB_BUS_1_MILLISECOND = 1000,
|
||||
#define USB_MAX_LANG_ID 16
|
||||
#define USB_MAX_INTERFACE 16
|
||||
#define USB_MAX_DEVICES 128
|
||||
|
||||
//
|
||||
// Roothub and hub's polling interval, set by experience,
|
||||
// The unit of roothub is 100us, means 1s as interval, and
|
||||
// the unit of hub is 1ms, means 64ms as interval.
|
||||
//
|
||||
USB_ROOTHUB_POLL_INTERVAL = 1000 * 10000U,
|
||||
USB_HUB_POLL_INTERVAL = 64,
|
||||
#define USB_BUS_1_MILLISECOND 1000
|
||||
|
||||
//
|
||||
// Wait for port stable to work, refers to specification
|
||||
// [USB20-9.1.2]
|
||||
//
|
||||
USB_WAIT_PORT_STABLE_STALL = 100 * USB_BUS_1_MILLISECOND,
|
||||
//
|
||||
// Roothub and hub's polling interval, set by experience,
|
||||
// The unit of roothub is 100us, means 1s as interval, and
|
||||
// the unit of hub is 1ms, means 64ms as interval.
|
||||
//
|
||||
#define USB_ROOTHUB_POLL_INTERVAL (1000 * 10000U)
|
||||
#define USB_HUB_POLL_INTERVAL 64
|
||||
|
||||
//
|
||||
// Wait for port statue reg change, set by experience
|
||||
//
|
||||
USB_WAIT_PORT_STS_CHANGE_STALL = 5 * USB_BUS_1_MILLISECOND,
|
||||
//
|
||||
// Wait for port stable to work, refers to specification
|
||||
// [USB20-9.1.2]
|
||||
//
|
||||
#define USB_WAIT_PORT_STABLE_STALL (100 * USB_BUS_1_MILLISECOND)
|
||||
|
||||
//
|
||||
// Wait for set device address, refers to specification
|
||||
// [USB20-9.2.6.3, it says 2ms]
|
||||
//
|
||||
USB_SET_DEVICE_ADDRESS_STALL = 20 * USB_BUS_1_MILLISECOND,
|
||||
//
|
||||
// Wait for port statue reg change, set by experience
|
||||
//
|
||||
#define USB_WAIT_PORT_STS_CHANGE_STALL (5 * USB_BUS_1_MILLISECOND)
|
||||
|
||||
//
|
||||
// Wait for retry max packet size, set by experience
|
||||
//
|
||||
USB_RETRY_MAX_PACK_SIZE_STALL = 100 * USB_BUS_1_MILLISECOND,
|
||||
//
|
||||
// Wait for set device address, refers to specification
|
||||
// [USB20-9.2.6.3, it says 2ms]
|
||||
//
|
||||
#define USB_SET_DEVICE_ADDRESS_STALL (20 * USB_BUS_1_MILLISECOND)
|
||||
|
||||
//
|
||||
// Wait for hub port power-on, refers to specification
|
||||
// [USB20-11.23.2]
|
||||
//
|
||||
USB_SET_PORT_POWER_STALL = 2 * USB_BUS_1_MILLISECOND,
|
||||
//
|
||||
// Wait for retry max packet size, set by experience
|
||||
//
|
||||
#define USB_RETRY_MAX_PACK_SIZE_STALL (100 * USB_BUS_1_MILLISECOND)
|
||||
|
||||
//
|
||||
// Wait for port reset, refers to specification
|
||||
// [USB20-7.1.7.5, it says 10ms for hub and 50ms for
|
||||
// root hub]
|
||||
//
|
||||
USB_SET_PORT_RESET_STALL = 20 * USB_BUS_1_MILLISECOND,
|
||||
USB_SET_ROOT_PORT_RESET_STALL = 50 * USB_BUS_1_MILLISECOND,
|
||||
//
|
||||
// Wait for hub port power-on, refers to specification
|
||||
// [USB20-11.23.2]
|
||||
//
|
||||
#define USB_SET_PORT_POWER_STALL (2 * USB_BUS_1_MILLISECOND)
|
||||
|
||||
//
|
||||
// Wait for clear roothub port reset, set by experience
|
||||
//
|
||||
USB_CLR_ROOT_PORT_RESET_STALL = 20 * USB_BUS_1_MILLISECOND,
|
||||
//
|
||||
// Wait for port reset, refers to specification
|
||||
// [USB20-7.1.7.5, it says 10ms for hub and 50ms for
|
||||
// root hub]
|
||||
//
|
||||
#define USB_SET_PORT_RESET_STALL (20 * USB_BUS_1_MILLISECOND)
|
||||
#define USB_SET_ROOT_PORT_RESET_STALL (50 * USB_BUS_1_MILLISECOND)
|
||||
|
||||
//
|
||||
// Wait for set roothub port enable, set by experience
|
||||
//
|
||||
USB_SET_ROOT_PORT_ENABLE_STALL = 20 * USB_BUS_1_MILLISECOND,
|
||||
//
|
||||
// Wait for clear roothub port reset, set by experience
|
||||
//
|
||||
#define USB_CLR_ROOT_PORT_RESET_STALL (20 * USB_BUS_1_MILLISECOND)
|
||||
|
||||
//
|
||||
// Send general device request timeout.
|
||||
//
|
||||
// The USB Specification 2.0, section 11.24.1 recommends a value of
|
||||
// 50 milliseconds. We use a value of 100 milliseconds to work
|
||||
// around slower hubs and devices.
|
||||
//
|
||||
USB_GENERAL_DEVICE_REQUEST_TIMEOUT = 100,
|
||||
//
|
||||
// Wait for set roothub port enable, set by experience
|
||||
//
|
||||
#define USB_SET_ROOT_PORT_ENABLE_STALL (20 * USB_BUS_1_MILLISECOND)
|
||||
|
||||
//
|
||||
// Send clear feature request timeout, set by experience
|
||||
//
|
||||
USB_CLEAR_FEATURE_REQUEST_TIMEOUT = 10
|
||||
}USB_BUS_TIMEOUT_EXPERIENCE_VALUE;
|
||||
//
|
||||
// Send general device request timeout.
|
||||
//
|
||||
// The USB Specification 2.0, section 11.24.1 recommends a value of
|
||||
// 50 milliseconds. We use a value of 100 milliseconds to work
|
||||
// around slower hubs and devices.
|
||||
//
|
||||
#define USB_GENERAL_DEVICE_REQUEST_TIMEOUT 100
|
||||
|
||||
//
|
||||
// Send clear feature request timeout, set by experience
|
||||
//
|
||||
#define USB_CLEAR_FEATURE_REQUEST_TIMEOUT 10
|
||||
|
||||
//
|
||||
// Bus raises TPL to TPL_NOTIFY to serialize all its operations
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
Manage Usb Descriptor List
|
||||
|
||||
Copyright (c) 2007, Intel Corporation
|
||||
Copyright (c) 2007 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -16,9 +16,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#ifndef _USB_DESCRIPTOR_H_
|
||||
#define _USB_DESCRIPTOR_H_
|
||||
|
||||
typedef enum {
|
||||
USB_MAX_INTERFACE_SETTING = 8
|
||||
}USB_INTERFACE_SETTING_MAX;
|
||||
#define USB_MAX_INTERFACE_SETTING 8
|
||||
|
||||
//
|
||||
// The RequestType in EFI_USB_DEVICE_REQUEST is composed of
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
The definition for USB hub.
|
||||
|
||||
Copyright (c) 2007, Intel Corporation
|
||||
Copyright (c) 2007 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -21,72 +21,65 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#define USB_ENDPOINT_ADDR(EpAddr) ((EpAddr) & 0x7F)
|
||||
#define USB_ENDPOINT_TYPE(Desc) ((Desc)->Attributes & USB_ENDPOINT_TYPE_MASK)
|
||||
|
||||
typedef enum {
|
||||
USB_DESC_TYPE_HUB = 0x29,
|
||||
|
||||
//
|
||||
// Hub class control transfer target
|
||||
//
|
||||
USB_HUB_TARGET_HUB = 0,
|
||||
USB_HUB_TARGET_PORT = 3,
|
||||
#define USB_DESC_TYPE_HUB 0x29
|
||||
//
|
||||
// Hub class control transfer target
|
||||
//
|
||||
#define USB_HUB_TARGET_HUB 0
|
||||
#define USB_HUB_TARGET_PORT 3
|
||||
//
|
||||
// HUB class specific contrl transfer request type
|
||||
//
|
||||
#define USB_HUB_REQ_GET_STATUS 0
|
||||
#define USB_HUB_REQ_CLEAR_FEATURE 1
|
||||
#define USB_HUB_REQ_SET_FEATURE 3
|
||||
#define USB_HUB_REQ_GET_DESC 6
|
||||
#define USB_HUB_REQ_SET_DESC 7
|
||||
#define USB_HUB_REQ_CLEAR_TT 8
|
||||
#define USB_HUB_REQ_RESET_TT 9
|
||||
#define USB_HUB_REQ_GET_TT_STATE 10
|
||||
#define USB_HUB_REQ_STOP_TT 11
|
||||
//
|
||||
// USB hub class feature selector
|
||||
//
|
||||
#define USB_HUB_C_HUB_LOCAL_POWER 0
|
||||
#define USB_HUB_C_HUB_OVER_CURRENT 1
|
||||
#define USB_HUB_PORT_CONNECTION 0
|
||||
#define USB_HUB_PORT_ENABLE 1
|
||||
#define USB_HUB_PORT_SUSPEND 2
|
||||
#define USB_HUB_PORT_OVER_CURRENT 3
|
||||
#define USB_HUB_PORT_RESET 4
|
||||
#define USB_HUB_PORT_POWER 8
|
||||
#define USB_HUB_PORT_LOW_SPEED 9
|
||||
#define USB_HUB_C_PORT_CONNECT 16
|
||||
#define USB_HUB_C_PORT_ENABLE 17
|
||||
#define USB_HUB_C_PORT_SUSPEND 18
|
||||
#define USB_HUB_C_PORT_OVER_CURRENT 19
|
||||
#define USB_HUB_C_PORT_RESET 20
|
||||
#define USB_HUB_PORT_TEST 21
|
||||
#define USB_HUB_PORT_INDICATOR 22
|
||||
//
|
||||
// USB hub power control method. In gang power control
|
||||
//
|
||||
#define USB_HUB_GANG_POWER_CTRL 0
|
||||
#define USB_HUB_PORT_POWER_CTRL 0x01
|
||||
//
|
||||
// USB hub status bits
|
||||
//
|
||||
#define USB_HUB_STAT_LOCAL_POWER 0x01
|
||||
#define USB_HUB_STAT_OVER_CURRENT 0x02
|
||||
#define USB_HUB_STAT_C_LOCAL_POWER 0x01
|
||||
#define USB_HUB_STAT_C_OVER_CURRENT 0x02
|
||||
|
||||
//
|
||||
// HUB class specific contrl transfer request type
|
||||
//
|
||||
USB_HUB_REQ_GET_STATUS = 0,
|
||||
USB_HUB_REQ_CLEAR_FEATURE = 1,
|
||||
USB_HUB_REQ_SET_FEATURE = 3,
|
||||
USB_HUB_REQ_GET_DESC = 6,
|
||||
USB_HUB_REQ_SET_DESC = 7,
|
||||
USB_HUB_REQ_CLEAR_TT = 8,
|
||||
USB_HUB_REQ_RESET_TT = 9,
|
||||
USB_HUB_REQ_GET_TT_STATE = 10,
|
||||
USB_HUB_REQ_STOP_TT = 11,
|
||||
#define USB_HUB_CLASS_CODE 0x09
|
||||
#define USB_HUB_SUBCLASS_CODE 0x00
|
||||
|
||||
|
||||
//
|
||||
// USB hub class feature selector
|
||||
//
|
||||
USB_HUB_C_HUB_LOCAL_POWER = 0,
|
||||
USB_HUB_C_HUB_OVER_CURRENT = 1,
|
||||
USB_HUB_PORT_CONNECTION = 0,
|
||||
USB_HUB_PORT_ENABLE = 1,
|
||||
USB_HUB_PORT_SUSPEND = 2,
|
||||
USB_HUB_PORT_OVER_CURRENT = 3,
|
||||
USB_HUB_PORT_RESET = 4,
|
||||
USB_HUB_PORT_POWER = 8,
|
||||
USB_HUB_PORT_LOW_SPEED = 9,
|
||||
USB_HUB_C_PORT_CONNECT = 16,
|
||||
USB_HUB_C_PORT_ENABLE = 17,
|
||||
USB_HUB_C_PORT_SUSPEND = 18,
|
||||
USB_HUB_C_PORT_OVER_CURRENT = 19,
|
||||
USB_HUB_C_PORT_RESET = 20,
|
||||
USB_HUB_PORT_TEST = 21,
|
||||
USB_HUB_PORT_INDICATOR = 22,
|
||||
|
||||
//
|
||||
// USB hub power control method. In gang power control
|
||||
//
|
||||
USB_HUB_GANG_POWER_CTRL = 0,
|
||||
USB_HUB_PORT_POWER_CTRL = 0x01,
|
||||
|
||||
//
|
||||
// USB hub status bits
|
||||
//
|
||||
USB_HUB_STAT_LOCAL_POWER = 0x01,
|
||||
USB_HUB_STAT_OVER_CURRENT = 0x02,
|
||||
USB_HUB_STAT_C_LOCAL_POWER = 0x01,
|
||||
USB_HUB_STAT_C_OVER_CURRENT = 0x02,
|
||||
|
||||
USB_HUB_CLASS_CODE = 0x09,
|
||||
USB_HUB_SUBCLASS_CODE = 0x00,
|
||||
|
||||
//
|
||||
// Host software return timeout if port status doesn't change
|
||||
// after 500ms(LOOP * STALL = 100 * 5ms), set by experience
|
||||
//
|
||||
USB_WAIT_PORT_STS_CHANGE_LOOP = 100
|
||||
}USB_HUB_FLAGS_VALUE;
|
||||
//
|
||||
// Host software return timeout if port status doesn't change
|
||||
// after 500ms(LOOP * STALL = 100 * 5ms), set by experience
|
||||
//
|
||||
#define USB_WAIT_PORT_STS_CHANGE_LOOP 100
|
||||
|
||||
#pragma pack(1)
|
||||
//
|
||||
|
@@ -2,7 +2,7 @@
|
||||
Definition of USB Mass Storage Class and its value, USB Mass Transport Protocol,
|
||||
and other common definitions.
|
||||
|
||||
Copyright (c) 2007 - 2008, Intel Corporation
|
||||
Copyright (c) 2007 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -38,36 +38,34 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#define USB_IS_INTERRUPT_ENDPOINT(Attribute) (((Attribute) & (BIT0 | BIT1)) == USB_ENDPOINT_INTERRUPT)
|
||||
#define USB_IS_ERROR(Result, Error) (((Result) & (Error)) != 0)
|
||||
|
||||
typedef enum {
|
||||
//
|
||||
// Usb mass storage class code
|
||||
//
|
||||
USB_MASS_STORE_CLASS = 0x08,
|
||||
//
|
||||
// Usb mass storage class code
|
||||
//
|
||||
#define USB_MASS_STORE_CLASS 0x08
|
||||
|
||||
//
|
||||
// Usb mass storage subclass code, specify the command set used.
|
||||
//
|
||||
USB_MASS_STORE_RBC = 0x01, ///< Reduced Block Commands
|
||||
USB_MASS_STORE_8020I = 0x02, ///< SFF-8020i, typically a CD/DVD device
|
||||
USB_MASS_STORE_QIC = 0x03, ///< Typically a tape device
|
||||
USB_MASS_STORE_UFI = 0x04, ///< Typically a floppy disk driver device
|
||||
USB_MASS_STORE_8070I = 0x05, ///< SFF-8070i, typically a floppy disk driver device.
|
||||
USB_MASS_STORE_SCSI = 0x06, ///< SCSI transparent command set
|
||||
//
|
||||
// Usb mass storage subclass code, specify the command set used.
|
||||
//
|
||||
#define USB_MASS_STORE_RBC 0x01 ///< Reduced Block Commands
|
||||
#define USB_MASS_STORE_8020I 0x02 ///< SFF-8020i, typically a CD/DVD device
|
||||
#define USB_MASS_STORE_QIC 0x03 ///< Typically a tape device
|
||||
#define USB_MASS_STORE_UFI 0x04 ///< Typically a floppy disk driver device
|
||||
#define USB_MASS_STORE_8070I 0x05 ///< SFF-8070i, typically a floppy disk driver device.
|
||||
#define USB_MASS_STORE_SCSI 0x06 ///< SCSI transparent command set
|
||||
|
||||
//
|
||||
// Usb mass storage protocol code, specify the transport protocol
|
||||
//
|
||||
USB_MASS_STORE_CBI0 = 0x00, ///< CBI protocol with command completion interrupt
|
||||
USB_MASS_STORE_CBI1 = 0x01, ///< CBI protocol without command completion interrupt
|
||||
USB_MASS_STORE_BOT = 0x50, ///< Bulk-Only Transport
|
||||
//
|
||||
// Usb mass storage protocol code, specify the transport protocol
|
||||
//
|
||||
#define USB_MASS_STORE_CBI0 0x00 ///< CBI protocol with command completion interrupt
|
||||
#define USB_MASS_STORE_CBI1 0x01 ///< CBI protocol without command completion interrupt
|
||||
#define USB_MASS_STORE_BOT 0x50 ///< Bulk-Only Transport
|
||||
|
||||
USB_MASS_1_MILLISECOND = 1000,
|
||||
USB_MASS_1_SECOND = 1000 * USB_MASS_1_MILLISECOND,
|
||||
#define USB_MASS_1_MILLISECOND 1000
|
||||
#define USB_MASS_1_SECOND (1000 * USB_MASS_1_MILLISECOND)
|
||||
|
||||
USB_MASS_CMD_SUCCESS = 0,
|
||||
USB_MASS_CMD_FAIL,
|
||||
USB_MASS_CMD_PERSISTENT
|
||||
} USB_MASS_DEV_CLASS_AND_VALUE;
|
||||
#define USB_MASS_CMD_SUCCESS 0
|
||||
#define USB_MASS_CMD_FAIL 1
|
||||
#define USB_MASS_CMD_PERSISTENT 2
|
||||
|
||||
/**
|
||||
Initializes USB transport protocol.
|
||||
|
@@ -2,7 +2,7 @@
|
||||
Implementation of the command set of USB Mass Storage Specification
|
||||
for Bootability, Revision 1.0.
|
||||
|
||||
Copyright (c) 2007 - 2008, Intel Corporation
|
||||
Copyright (c) 2007 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -92,10 +92,10 @@ UsbBootRequestSense (
|
||||
|
||||
case USB_BOOT_SENSE_NOT_READY:
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
if (SenseData.ASC == USB_BOOT_ASC_NO_MEDIA) {
|
||||
if (SenseData.Asc == USB_BOOT_ASC_NO_MEDIA) {
|
||||
Media->MediaPresent = FALSE;
|
||||
Status = EFI_NO_MEDIA;
|
||||
} else if (SenseData.ASC == USB_BOOT_ASC_NOT_READY) {
|
||||
} else if (SenseData.Asc == USB_BOOT_ASC_NOT_READY) {
|
||||
Status = EFI_NOT_READY;
|
||||
}
|
||||
break;
|
||||
@@ -106,7 +106,7 @@ UsbBootRequestSense (
|
||||
|
||||
case USB_BOOT_SENSE_UNIT_ATTENTION:
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
if (SenseData.ASC == USB_BOOT_ASC_MEDIA_CHANGE) {
|
||||
if (SenseData.Asc == USB_BOOT_ASC_MEDIA_CHANGE) {
|
||||
//
|
||||
// If MediaChange, reset ReadOnly and new MediaId
|
||||
//
|
||||
@@ -129,8 +129,8 @@ UsbBootRequestSense (
|
||||
DEBUG ((EFI_D_INFO, "UsbBootRequestSense: (%r) with sense key %x/%x/%x\n",
|
||||
Status,
|
||||
USB_BOOT_SENSE_KEY (SenseData.SenseKey),
|
||||
SenseData.ASC,
|
||||
SenseData.ASCQ
|
||||
SenseData.Asc,
|
||||
SenseData.Ascq
|
||||
));
|
||||
|
||||
return Status;
|
||||
|
@@ -2,7 +2,7 @@
|
||||
Definition of the command set of USB Mass Storage Specification
|
||||
for Bootability, Revision 1.0.
|
||||
|
||||
Copyright (c) 2007 - 2008, Intel Corporation
|
||||
Copyright (c) 2007 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -18,79 +18,77 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
#include "UsbMass.h"
|
||||
|
||||
typedef enum {
|
||||
//
|
||||
// The opcodes of various USB boot commands:
|
||||
// INQUIRY/REQUEST_SENSE are "No Timeout Commands" as specified
|
||||
// by Multi-Media Commands (MMC) set.
|
||||
// Others are "Group 1 Timeout Commands". That is,
|
||||
// they should be retried if driver is ready.
|
||||
//
|
||||
USB_BOOT_INQUIRY_OPCODE = 0x12,
|
||||
USB_BOOT_REQUEST_SENSE_OPCODE = 0x03,
|
||||
USB_BOOT_MODE_SENSE10_OPCODE = 0x5A,
|
||||
USB_BOOT_READ_CAPACITY_OPCODE = 0x25,
|
||||
USB_BOOT_TEST_UNIT_READY_OPCODE = 0x00,
|
||||
USB_BOOT_READ10_OPCODE = 0x28,
|
||||
USB_BOOT_WRITE10_OPCODE = 0x2A,
|
||||
//
|
||||
// The opcodes of various USB boot commands:
|
||||
// INQUIRY/REQUEST_SENSE are "No Timeout Commands" as specified
|
||||
// by Multi-Media Commands (MMC) set.
|
||||
// Others are "Group 1 Timeout Commands". That is,
|
||||
// they should be retried if driver is ready.
|
||||
//
|
||||
#define USB_BOOT_INQUIRY_OPCODE 0x12
|
||||
#define USB_BOOT_REQUEST_SENSE_OPCODE 0x03
|
||||
#define USB_BOOT_MODE_SENSE10_OPCODE 0x5A
|
||||
#define USB_BOOT_READ_CAPACITY_OPCODE 0x25
|
||||
#define USB_BOOT_TEST_UNIT_READY_OPCODE 0x00
|
||||
#define USB_BOOT_READ10_OPCODE 0x28
|
||||
#define USB_BOOT_WRITE10_OPCODE 0x2A
|
||||
|
||||
USB_SCSI_MODE_SENSE6_OPCODE = 0x1A,
|
||||
|
||||
//
|
||||
// The Sense Key part of the sense data. Sense data has three levels:
|
||||
// Sense key, Additional Sense Code and Additional Sense Code Qualifier
|
||||
//
|
||||
USB_BOOT_SENSE_NO_SENSE = 0x00, ///< No sense key
|
||||
USB_BOOT_SENSE_RECOVERED = 0x01, ///< Last command succeed with recovery actions
|
||||
USB_BOOT_SENSE_NOT_READY = 0x02, ///< Device not ready
|
||||
USB_BOOT_SNESE_MEDIUM_ERROR = 0X03, ///< Failed probably because flaw in the media
|
||||
USB_BOOT_SENSE_HARDWARE_ERROR = 0X04, ///< Non-recoverable hardware failure
|
||||
USB_BOOT_SENSE_ILLEGAL_REQUEST = 0X05, ///< Illegal parameters in the request
|
||||
USB_BOOT_SENSE_UNIT_ATTENTION = 0X06, ///< Removable medium may have been changed
|
||||
USB_BOOT_SENSE_DATA_PROTECT = 0X07, ///< Write protected
|
||||
USB_BOOT_SENSE_BLANK_CHECK = 0X08, ///< Blank/non-blank medium while reading/writing
|
||||
USB_BOOT_SENSE_VENDOR = 0X09, ///< Vendor specific sense key
|
||||
USB_BOOT_SENSE_ABORTED = 0X0B, ///< Command aborted by the device
|
||||
USB_BOOT_SENSE_VOLUME_OVERFLOW = 0x0D, ///< Partition overflow
|
||||
USB_BOOT_SENSE_MISCOMPARE = 0x0E, ///< Source data mis-match while verfying.
|
||||
#define USB_SCSI_MODE_SENSE6_OPCODE 0x1A
|
||||
|
||||
USB_BOOT_ASC_NOT_READY = 0x04,
|
||||
USB_BOOT_ASC_NO_MEDIA = 0x3A,
|
||||
USB_BOOT_ASC_MEDIA_CHANGE = 0x28,
|
||||
//
|
||||
// The Sense Key part of the sense data. Sense data has three levels:
|
||||
// Sense key, Additional Sense Code and Additional Sense Code Qualifier
|
||||
//
|
||||
#define USB_BOOT_SENSE_NO_SENSE 0x00 ///< No sense key
|
||||
#define USB_BOOT_SENSE_RECOVERED 0x01 ///< Last command succeed with recovery actions
|
||||
#define USB_BOOT_SENSE_NOT_READY 0x02 ///< Device not ready
|
||||
#define USB_BOOT_SNESE_MEDIUM_ERROR 0X03 ///< Failed probably because flaw in the media
|
||||
#define USB_BOOT_SENSE_HARDWARE_ERROR 0X04 ///< Non-recoverable hardware failure
|
||||
#define USB_BOOT_SENSE_ILLEGAL_REQUEST 0X05 ///< Illegal parameters in the request
|
||||
#define USB_BOOT_SENSE_UNIT_ATTENTION 0X06 ///< Removable medium may have been changed
|
||||
#define USB_BOOT_SENSE_DATA_PROTECT 0X07 ///< Write protected
|
||||
#define USB_BOOT_SENSE_BLANK_CHECK 0X08 ///< Blank/non-blank medium while reading/writing
|
||||
#define USB_BOOT_SENSE_VENDOR 0X09 ///< Vendor specific sense key
|
||||
#define USB_BOOT_SENSE_ABORTED 0X0B ///< Command aborted by the device
|
||||
#define USB_BOOT_SENSE_VOLUME_OVERFLOW 0x0D ///< Partition overflow
|
||||
#define USB_BOOT_SENSE_MISCOMPARE 0x0E ///< Source data mis-match while verfying.
|
||||
|
||||
//
|
||||
// Supported PDT codes, or Peripheral Device Type
|
||||
//
|
||||
USB_PDT_DIRECT_ACCESS = 0x00, ///< Direct access device
|
||||
USB_PDT_CDROM = 0x05, ///< CDROM
|
||||
USB_PDT_OPTICAL = 0x07, ///< Non-CD optical disks
|
||||
USB_PDT_SIMPLE_DIRECT = 0x0E, ///< Simplified direct access device
|
||||
|
||||
//
|
||||
// Other parameters, Max carried size is 512B * 128 = 64KB
|
||||
//
|
||||
USB_BOOT_IO_BLOCKS = 128,
|
||||
#define USB_BOOT_ASC_NOT_READY 0x04
|
||||
#define USB_BOOT_ASC_NO_MEDIA 0x3A
|
||||
#define USB_BOOT_ASC_MEDIA_CHANGE 0x28
|
||||
|
||||
//
|
||||
// Retry mass command times, set by experience
|
||||
//
|
||||
USB_BOOT_COMMAND_RETRY = 5,
|
||||
USB_BOOT_INIT_MEDIA_RETRY = 5,
|
||||
//
|
||||
// Supported PDT codes, or Peripheral Device Type
|
||||
//
|
||||
#define USB_PDT_DIRECT_ACCESS 0x00 ///< Direct access device
|
||||
#define USB_PDT_CDROM 0x05 ///< CDROM
|
||||
#define USB_PDT_OPTICAL 0x07 ///< Non-CD optical disks
|
||||
#define USB_PDT_SIMPLE_DIRECT 0x0E ///< Simplified direct access device
|
||||
|
||||
//
|
||||
// Wait for unit ready command, set by experience
|
||||
//
|
||||
USB_BOOT_RETRY_UNIT_READY_STALL = 500 * USB_MASS_1_MILLISECOND,
|
||||
//
|
||||
// Other parameters, Max carried size is 512B * 128 = 64KB
|
||||
//
|
||||
#define USB_BOOT_IO_BLOCKS 128
|
||||
|
||||
//
|
||||
// Mass command timeout, refers to specification[USB20-9.2.6.1]
|
||||
//
|
||||
// USB2.0 Spec define the up-limit timeout 5s for all command. USB floppy,
|
||||
// USB CD-Rom and iPod devices are much slower than USB key when reponse
|
||||
// most of commands, So we set 5s as timeout here.
|
||||
//
|
||||
USB_BOOT_GENERAL_CMD_TIMEOUT = 5 * USB_MASS_1_SECOND
|
||||
}USB_BOOT_OPTCODE;
|
||||
//
|
||||
// Retry mass command times, set by experience
|
||||
//
|
||||
#define USB_BOOT_COMMAND_RETRY 5
|
||||
#define USB_BOOT_INIT_MEDIA_RETRY 5
|
||||
|
||||
//
|
||||
// Wait for unit ready command, set by experience
|
||||
//
|
||||
#define USB_BOOT_RETRY_UNIT_READY_STALL (500 * USB_MASS_1_MILLISECOND)
|
||||
|
||||
//
|
||||
// Mass command timeout, refers to specification[USB20-9.2.6.1]
|
||||
//
|
||||
// USB2.0 Spec define the up-limit timeout 5s for all command. USB floppy,
|
||||
// USB CD-Rom and iPod devices are much slower than USB key when reponse
|
||||
// most of commands, So we set 5s as timeout here.
|
||||
//
|
||||
#define USB_BOOT_GENERAL_CMD_TIMEOUT (5 * USB_MASS_1_SECOND)
|
||||
|
||||
//
|
||||
// The required commands are INQUIRY, READ CAPACITY, TEST UNIT READY,
|
||||
@@ -193,8 +191,8 @@ typedef struct {
|
||||
UINT8 Infor[4];
|
||||
UINT8 AddLen; ///< Additional Sense length, 10
|
||||
UINT8 Reserved1[4];
|
||||
UINT8 ASC; ///< Additional Sense Code
|
||||
UINT8 ASCQ; ///< Additional Sense Code Qualifier
|
||||
UINT8 Asc; ///< Additional Sense Code
|
||||
UINT8 Ascq; ///< Additional Sense Code Qualifier
|
||||
UINT8 Reserverd2[4];
|
||||
} USB_BOOT_REQUEST_SENSE_DATA;
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
based on the "Universal Serial Bus Mass Storage Class Bulk-Only
|
||||
Transport" Revision 1.0, September 31, 1999.
|
||||
|
||||
Copyright (c) 2007 - 2008, Intel Corporation
|
||||
Copyright (c) 2007 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -21,41 +21,39 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
extern USB_MASS_TRANSPORT mUsbBotTransport;
|
||||
|
||||
typedef enum {
|
||||
//
|
||||
// Usb Bulk-Only class specfic request
|
||||
//
|
||||
USB_BOT_RESET_REQUEST = 0xFF, ///< Bulk-Only Mass Storage Reset
|
||||
USB_BOT_GETLUN_REQUEST = 0xFE, ///< Get Max Lun
|
||||
USB_BOT_CBW_SIGNATURE = 0x43425355, ///< dCBWSignature, tag the packet as CBW
|
||||
USB_BOT_CSW_SIGNATURE = 0x53425355, ///< dCSWSignature, tag the packet as CSW
|
||||
USB_BOT_MAX_LUN = 0x0F, ///< Lun number is from 0 to 15
|
||||
USB_BOT_MAX_CMDLEN = 16, ///< Maxium number of command from command set
|
||||
//
|
||||
// Usb Bulk-Only class specfic request
|
||||
//
|
||||
#define USB_BOT_RESET_REQUEST 0xFF ///< Bulk-Only Mass Storage Reset
|
||||
#define USB_BOT_GETLUN_REQUEST 0xFE ///< Get Max Lun
|
||||
#define USB_BOT_CBW_SIGNATURE 0x43425355 ///< dCBWSignature, tag the packet as CBW
|
||||
#define USB_BOT_CSW_SIGNATURE 0x53425355 ///< dCSWSignature, tag the packet as CSW
|
||||
#define USB_BOT_MAX_LUN 0x0F ///< Lun number is from 0 to 15
|
||||
#define USB_BOT_MAX_CMDLEN 16 ///< Maxium number of command from command set
|
||||
|
||||
//
|
||||
// Usb BOT command block status values
|
||||
//
|
||||
USB_BOT_COMMAND_OK = 0x00, ///< Command passed, good status
|
||||
USB_BOT_COMMAND_FAILED = 0x01, ///< Command failed
|
||||
USB_BOT_COMMAND_ERROR = 0x02, ///< Phase error, need to reset the device
|
||||
//
|
||||
// Usb BOT command block status values
|
||||
//
|
||||
#define USB_BOT_COMMAND_OK 0x00 ///< Command passed, good status
|
||||
#define USB_BOT_COMMAND_FAILED 0x01 ///< Command failed
|
||||
#define USB_BOT_COMMAND_ERROR 0x02 ///< Phase error, need to reset the device
|
||||
|
||||
//
|
||||
// Usb Bot retry to get CSW, refers to specification[BOT10-5.3, it says 2 times]
|
||||
//
|
||||
USB_BOT_RECV_CSW_RETRY = 3,
|
||||
//
|
||||
// Usb Bot retry to get CSW, refers to specification[BOT10-5.3, it says 2 times]
|
||||
//
|
||||
#define USB_BOT_RECV_CSW_RETRY 3
|
||||
|
||||
//
|
||||
// Usb Bot wait device reset complete, set by experience
|
||||
//
|
||||
USB_BOT_RESET_DEVICE_STALL = 100 * USB_MASS_1_MILLISECOND,
|
||||
|
||||
//
|
||||
// Usb Bot transport timeout, set by experience
|
||||
//
|
||||
USB_BOT_SEND_CBW_TIMEOUT = 3 * USB_MASS_1_SECOND,
|
||||
USB_BOT_RECV_CSW_TIMEOUT = 3 * USB_MASS_1_SECOND,
|
||||
USB_BOT_RESET_DEVICE_TIMEOUT = 3 * USB_MASS_1_SECOND
|
||||
} USB_BOT_SUBCLASS;
|
||||
//
|
||||
// Usb Bot wait device reset complete, set by experience
|
||||
//
|
||||
#define USB_BOT_RESET_DEVICE_STALL (100 * USB_MASS_1_MILLISECOND)
|
||||
|
||||
//
|
||||
// Usb Bot transport timeout, set by experience
|
||||
//
|
||||
#define USB_BOT_SEND_CBW_TIMEOUT (3 * USB_MASS_1_SECOND)
|
||||
#define USB_BOT_RECV_CSW_TIMEOUT (3 * USB_MASS_1_SECOND)
|
||||
#define USB_BOT_RESET_DEVICE_TIMEOUT (3 * USB_MASS_1_SECOND)
|
||||
|
||||
#pragma pack(1)
|
||||
///
|
||||
|
@@ -2,7 +2,7 @@
|
||||
Defination for the USB mass storage Control/Bulk/Interrupt (CBI) transport,
|
||||
according to USB Mass Storage Class Control/Bulk/Interrupt (CBI) Transport, Revision 1.1.
|
||||
|
||||
Copyright (c) 2007 - 2008, Intel Corporation
|
||||
Copyright (c) 2007 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -21,25 +21,20 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
extern USB_MASS_TRANSPORT mUsbCbi0Transport;
|
||||
extern USB_MASS_TRANSPORT mUsbCbi1Transport;
|
||||
|
||||
typedef enum {
|
||||
USB_CBI_MAX_PACKET_NUM = 16,
|
||||
USB_CBI_RESET_CMD_LEN = 12,
|
||||
|
||||
//
|
||||
// USB CBI retry C/B/I transport times, set by experience
|
||||
//
|
||||
USB_CBI_MAX_RETRY = 3,
|
||||
|
||||
//
|
||||
// Time to wait for USB CBI reset to complete, set by experience
|
||||
//
|
||||
USB_CBI_RESET_DEVICE_STALL = 50 * USB_MASS_1_MILLISECOND,
|
||||
|
||||
//
|
||||
// USB CBI transport timeout, set by experience
|
||||
//
|
||||
USB_CBI_RESET_DEVICE_TIMEOUT = 1 * USB_MASS_1_SECOND
|
||||
} USB_CBI_DATA;
|
||||
#define USB_CBI_MAX_PACKET_NUM 16
|
||||
#define USB_CBI_RESET_CMD_LEN 12
|
||||
//
|
||||
// USB CBI retry C/B/I transport times, set by experience
|
||||
//
|
||||
#define USB_CBI_MAX_RETRY 3
|
||||
//
|
||||
// Time to wait for USB CBI reset to complete, set by experience
|
||||
//
|
||||
#define USB_CBI_RESET_DEVICE_STALL (50 * USB_MASS_1_MILLISECOND)
|
||||
//
|
||||
// USB CBI transport timeout, set by experience
|
||||
//
|
||||
#define USB_CBI_RESET_DEVICE_TIMEOUT (1 * USB_MASS_1_SECOND)
|
||||
|
||||
typedef struct {
|
||||
//
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Helper routine and corresponding data struct used by USB Mouse Absolute Pointer Driver.
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
Copyright (c) 2004 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -79,20 +79,23 @@ typedef struct {
|
||||
///
|
||||
/// General HID Item structure
|
||||
///
|
||||
|
||||
typedef union {
|
||||
UINT8 U8;
|
||||
UINT16 U16;
|
||||
UINT32 U32;
|
||||
INT8 I8;
|
||||
INT16 I16;
|
||||
INT32 I32;
|
||||
UINT8 *LongData;
|
||||
} HID_DATA;
|
||||
|
||||
typedef struct {
|
||||
UINT16 Format;
|
||||
UINT8 Size;
|
||||
UINT8 Type;
|
||||
UINT8 Tag;
|
||||
union {
|
||||
UINT8 U8;
|
||||
UINT16 U16;
|
||||
UINT32 U32;
|
||||
INT8 I8;
|
||||
INT16 I16;
|
||||
INT32 I32;
|
||||
UINT8 *LongData;
|
||||
} Data;
|
||||
UINT16 Format;
|
||||
UINT8 Size;
|
||||
UINT8 Type;
|
||||
UINT8 Tag;
|
||||
HID_DATA Data;
|
||||
} HID_ITEM;
|
||||
|
||||
#define USB_MOUSE_ABSOLUTE_POINTER_DEV_FROM_MOUSE_PROTOCOL(a) \
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
Helper routine and corresponding data struct used by USB Mouse Driver.
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation
|
||||
Copyright (c) 2004 - 2010, Intel Corporation
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -79,20 +79,23 @@ typedef struct {
|
||||
///
|
||||
/// General HID Item structure
|
||||
///
|
||||
|
||||
typedef union {
|
||||
UINT8 U8;
|
||||
UINT16 U16;
|
||||
UINT32 U32;
|
||||
INT8 I8;
|
||||
INT16 I16;
|
||||
INT32 I32;
|
||||
UINT8 *LongData;
|
||||
} HID_DATA;
|
||||
|
||||
typedef struct {
|
||||
UINT16 Format;
|
||||
UINT8 Size;
|
||||
UINT8 Type;
|
||||
UINT8 Tag;
|
||||
union {
|
||||
UINT8 U8;
|
||||
UINT16 U16;
|
||||
UINT32 U32;
|
||||
INT8 I8;
|
||||
INT16 I16;
|
||||
INT32 I32;
|
||||
UINT8 *LongData;
|
||||
} Data;
|
||||
UINT16 Format;
|
||||
UINT8 Size;
|
||||
UINT8 Type;
|
||||
UINT8 Tag;
|
||||
HID_DATA Data;
|
||||
} HID_ITEM;
|
||||
|
||||
#define USB_MOUSE_DEV_FROM_MOUSE_PROTOCOL(a) \
|
||||
|
Reference in New Issue
Block a user