summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Bus/Usb/UsbBusDxe
diff options
context:
space:
mode:
authorrsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524>2010-01-19 06:42:21 +0000
committerrsun3 <rsun3@6f19259b-4bc3-4df7-8a09-765794883524>2010-01-19 06:42:21 +0000
commit1ccdbf2a3e61fe9494fcd39432107ba0eb74f584 (patch)
treef8f2bcf407258369b67023955eb4374ff1a8f901 /MdeModulePkg/Bus/Usb/UsbBusDxe
parentcd730ec08d8fc5afc557ae7f39c948998cd96bbb (diff)
downloadedk2-platforms-1ccdbf2a3e61fe9494fcd39432107ba0eb74f584.tar.xz
Improve coding style in MdeModulePkg.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9793 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Bus/Usb/UsbBusDxe')
-rw-r--r--MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.h130
-rw-r--r--MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.h6
-rw-r--r--MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.h127
3 files changed, 128 insertions, 135 deletions
diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.h b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.h
index 638be9988b..9bc5cf6561 100644
--- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.h
+++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBus.h
@@ -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
diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.h b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.h
index dd7868bc1d..ae189f761d 100644
--- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.h
+++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.h
@@ -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
diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.h b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.h
index af4897a74b..f63eb5005f 100644
--- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.h
+++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.h
@@ -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,
-
- //
- // 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,
-
-
- //
- // 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;
+
+#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
+
+#define USB_HUB_CLASS_CODE 0x09
+#define USB_HUB_SUBCLASS_CODE 0x00
+
+//
+// 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)
//