📄 usb.equ
字号:
MASS_XACT_STRUC STRUC
pCmdBuffer WORD ?
bCmdSize BYTE ?
bXferDir BYTE ?
fpBuffer DWORD ?
dwLength DWORD ?
wPreSkip WORD ?
wPostSkip WORD ?
wMiscFlag WORD ?
MASS_XACT_STRUC ENDS
USBM_XACT_FLAG_32BIT_DATA_BUFFER EQU BIT0
;<AMI_SHDR_START>
;----------------------------------------------------------------------------
; Name: DeviceInfo
;
; Description: This structure holds the information about each USB device
; configured by the BIOS
;
; Fields: Name Type Description
; ------------------------------------------------------------
; bFlag BYTE Device info flag (refer DEV_INFO_FLAGS)
; bDeviceType BYTE USB device type (refer BIOS_DEV_TYPE)
; wVendorId WORD USB device's vendor ID
; wDeviceId WORD USB device's product ID
; pHCStrucPtr HCStruc Pointer to host controller structure where this device is connected
; bHubDeviceNumber BYTE Device address of the hub that this device is connected. If BIT7 is set then it is a root hub
; bHubPortNumber BYTE Port number within the (root)hub that this device is connected
; bDeviceAddress BYTE Device address assigned to this device
; bEndPointNum BYTE Endpoint number of the device used to poll
; bEndpointSpeed BYTE Device's speed (01/10/11) for (low/full/hi)
; bLUN BYTE Maximum LUN supported
; wEndp0MaxPacket WORD Endpoint 0's max packet size
; bBulkInEndPoint BYTE Bulk IN endpoint number
; wBulkInMaxPkt WORD Bulk IN maximum packet size
; bBulkOutEndPoint BYTE Bulk OUT endpoint number
; wBulkOutMaxPkt WORD Bulk OUT maximum packet size
; bIntEndPoint BYTE Interrupt endpoint number
; wIntMaxPkt WORD Interrupt endpoint maximum packet size
; bDataSync BYTE Holds the data sync value for bulk IN, OUT and interrupt transactions
; bNumConfigs BYTE Num. of configurations supported by the dev.
; bConfigNum BYTE Configuration number used by the BIOS
; bInterfaceNum BYTE Interface number in use by BIOS
; bAltSettingNum BYTE Alternate interface setting number BIOS uses
; pDeviceCallback PTRFUNCPOLLCALLBK Routine to call when the polling TD completed
; pPollTDPtr NEAR Pointer to the polling TD or GTD
; pPollEDPtr NEAR Pointer to the polling ED
; bHubNumPorts BYTE Number of ports on this hub / root hub
; bHubPowerOnDelay BYTE Delay needed after power-on the hub port in 2ms granularity
; pMassInfoPtr MassDeviceInfo Pointer to the mass storage info struture
; pDevDriverPtr HCDHEADER Pointer to the device driver
;----------------------------------------------------------------------------
;<AMI_SHDR_END>
DeviceInfo STRUC
bFlag BYTE ? ; 0
bDeviceType BYTE ? ; 1
wVendorId WORD ? ; 2
wDeviceId WORD ? ; 4
pHCStrucPtr WORD ? ; 6
bHubDeviceNumber BYTE ? ; 8
bHubPortNumber BYTE ? ; 9
bDeviceAddress BYTE ? ; 10
bEndpointNum BYTE ? ; 11
bEndpointSpeed BYTE ? ; 12
bLUN BYTE ? ; 13
wEndp0MaxPacket WORD ? ; 14
bBulkInEndpoint BYTE ? ; 16
wBulkInMaxPkt WORD ? ; 17
bBulkOutEndpoint BYTE ? ; 19
wBulkOutMaxPkt WORD ? ; 20
bIntEndpoint BYTE ? ; 22
wIntMaxPkt WORD ? ; 23
bDataSync BYTE ? ; 25
bNumConfigs BYTE ? ; 26
bConfigNum BYTE ? ; 27
bInterfaceNum BYTE ? ; 28
bAltSettingNum BYTE ? ; 29
pDeviceCallback PTRFUNCPOLLCALLBK ? ; 30
pPollTDPtr WORD ? ; 32
pPollEDPtr WORD ? ; 34
bHubNumPorts BYTE ? ; 35
bHubPowerOnDelay BYTE ? ; 36
pMassInfoPtr WORD ? ; 38
pDevDriverPtr WORD ? ; 40
wIncompatFlags WORD ? ; 42
CntrlXfer CNTRL_XFER <> ; 44
DeviceInfo ENDS
;----------------------------------------------------------------------------
;<AMI_SHDR_START>
;----------------------------------------------------------------------------
; Name: MassDeviceInfo
;
; Description: This structure holds the information relevant to mass storage
; devices. The pointer to this structure is stored in
; DeviceInfo structure.
;
; Fields: Name Type Description
; ------------------------------------------------------------
; bPresent BYTE Indicates the validity of this structure TRUE = Valid and used, FALSE = Free
; bSubClass BYTE Identifies the sub class type of the mass storage device like UFI, SF8020i etc
; bProtocol BYTE Identifies the type of protocol used by the mass storage device like CBI, BOT etc
; wEmulationOption BYTE Setup option indicating the device emulation type
; bHiddenSectors BYTE Hidden sectors (used for forced FDD option)
; pLUN0DevInfoPtr WORD LUN 0's mass info pointer
; bDriveNumber BYTE Drive number assigned to this device
; bDevType BYTE Device type like CDROM, HDD, FLOPPY etc
; bEmuType BYTE Emulation type of this device like FDD, HDD
; bMediaType BYTE Media type like removable etc
; bHeads BYTE Number of maximum heads in this device
; bSectors BYTE Number of sectors in this device per cylinder
; wCylinders WORD Maximum number of cylinders in this device
; bNonLBAHeads BYTE Number of heads for INT13h func 8
; bNonLBASectors BYTE Number of sectors for INT13h func 8
; wNonLBACylinders BYTE Number of cylinders for INT13h func 8
; wBlockSize WORD Block size used by this device
; dMaxLBA DWORD Max LAB number
; bLastStatus BYTE Status of the last operation performed
;----------------------------------------------------------------------------
;<AMI_SHDR_END>
MassDeviceInfo STRUC
bPresent BYTE ?
bSubClass BYTE ?
bProtocol BYTE ?
wEmulationOption WORD ?
bHiddenSectors BYTE ?
pLUN0DevInfoPtr WORD ?
bDriveNumber BYTE ?
bDevType BYTE ?
bEmuType BYTE ?
bMediaType BYTE ?
bHeads BYTE ?
bSectors BYTE ?
wCylinders WORD ?
bNonLBAHeads BYTE ?
bNonLBASectors BYTE ?
wNonLBACylinders WORD ?
wBlockSize WORD ?
dMaxLBA DWORD ?
bLastStatus BYTE ?
MassDeviceInfo ENDS
; Mass storage data sync equates
USB_BULK_IN_DATA_SYNC EQU BIT0
USB_BULK_IN_DATA_SYNC_SHIFT EQU 0
USB_BULK_OUT_DATA_SYNC EQU BIT1
USB_BULK_OUT_DATA_SYNC_SHIFT EQU 1
USB_INT_DATA_SYNC EQU BIT2
USB_INT_DATA_SYNC_SHIFT EQU 2
;----------------------------------------------------------------------------
;<AMI_GHDR_START>
;----------------------------------------------------------------------------
; Name: DEV_INFO_FLAGS
;
; Type: Flag
;
; Description: This flag reflects the state of the device information
; structure and USB device's status. The following are the
; bits defined:
; DEV_INFO_VALID_STRUC BIT0 Indicates structure validity
; DEV_INFO_DEV_PRESENT BIT1 Reflect device presence status
; DEV_INFO_MASS_DEV_REGD BIT2 Indicates whether the mass
; device is registered with BBS
; and drive number is assigned
; for the device
; DEV_INFO_MULTI_IF BIT3 Indicates that the device
; is a part of multiple
; interface device
; Other bits are reserved
;
;----------------------------------------------------------------------------
;<AMI_GHDR_END>
DEV_INFO_VALID_STRUC EQU BIT0 ; Structure validity
DEV_INFO_DEV_PRESENT EQU BIT1 ; Device presence status
DEV_INFO_MASS_DEV_REGD EQU BIT2 ; Mass device registered(have
; drive number assigned)
DEV_INFO_MULTI_IF EQU BIT3 ; Indicates that the device
; is a part of multiple
; interface device
;<AMI_GHDR_START>
;----------------------------------------------------------------------------
; Name: BIOS_DEV_TYPE
;
; Type: Equates
;
; Description: These equates define the equates for each USB device type.
; BIOS_DEV_TYPE_KEYBOARD 01h USB HID Boot keyboard
; BIOS_DEV_TYPE_MOUSE 02h USB HID Boot mouse
; BIOS_DEV_TYPE_HUB 03h USB hub device
; BIOS_DEV_TYPE_STORAGE 04h USB mass storage device
;
;----------------------------------------------------------------------------
;<AMI_GHDR_END>
BIOS_DEV_TYPE_KEYBOARD EQU 01h
BIOS_DEV_TYPE_MOUSE EQU 02h
BIOS_DEV_TYPE_HUB EQU 03h
BIOS_DEV_TYPE_STORAGE EQU 04h
BIOS_DEV_TYPE_SECURITY EQU 05h
BIOS_DEV_TYPE_UNSUPPORTED EQU 06h
;----------------------------------------------------------------------------
; Physical Device Type Constants for BIOS internal use
;----------------------------------------------------------------------------
USB_MASS_DEV_TYPE_FLOPPY EQU 01h ; USB FD drive
USB_MASS_DEV_TYPE_CDROM EQU 02h ; USB CDROM drive
USB_MASS_DEV_TYPE_ZIP EQU 03h ; USB ZIP drive
USB_MASS_DEV_TYPE_ZIP_FLOPPY EQU 04h ; USB ZIP drive as floppy emulated
USB_MASS_DEV_TYPE_SUPER_DISK EQU 05h ; USB super disk (LS120/240)
USB_MASS_DEV_TYPE_HARD_DISK EQU 06h ; USB HD drive
USB_MASS_DEV_TYPE_DISKONKEY EQU 07h ; USB Disk On Key
;----------------------------------------------------------------------------
; Bulk transfer error status (bLastCommandStatus)
USB_BULK_STALLED EQU BIT0
USB_BULK_TIMEDOUT EQU BIT1
USB_CONTROL_STALLED EQU BIT2
; Mass storage miscellanous flags (16 bits)
; Flag that indicates that the bulk transfer
USBMASS_MISC_FLAG_32BIT_DATA_BUFFER EQU BIT0
;<AMI_SHDR_START>
;----------------------------------------------------------------------------
; Name: DeviceRequest
;
; Description: This structure describes the device request packet structure
;
; Fields: Name Type Description
; ------------------------------------------------------------
; RequestType BYTE USB request type (refer USB Spec)
; RequestCode BYTE USB request code (refer USB Spec)
; Value WORD Value depending on request type
; Index WORD Index depending on request type
; DataLength WORD Number of bytes of data to transfer
;
;----------------------------------------------------------------------------
;<AMI_SHDR_END>
DeviceRequest STRUC
RequestType BYTE ?
RequestCode BYTE ?
Value WORD ?
Index WORD ?
DataLength WORD ?
DeviceRequest ENDS
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
; Bit definitions for DeviceRequest.RequestType
;----------------------------------------------------------------------------
; Bit 7: Data direction
USB_REQ_TYPE_OUTPUT EQU 00h ; 0 = Host sending data to device
USB_REQ_TYPE_INPUT EQU 80h ; 1 = Device sending data to host
; Bit 6-5: Type
USB_REQ_TYPE_STANDARD EQU 00h ; 00 = Standard USB request
USB_REQ_TYPE_CLASS EQU 20h ; 01 = Class specific
USB_REQ_TYPE_VENDOR EQU 40h ; 10 = Vendor specific
; Bit 4-0: Recipient
USB_REQ_TYPE_DEVICE EQU 00h ; 00000 = Device
USB_REQ_TYPE_INTERFACE EQU 01h ; 00001 = Interface
USB_REQ_TYPE_ENDPOINT EQU 02h ; 00010 = Endpoint
USB_REQ_TYPE_OTHER EQU 03h ; 00011 = Other
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
; Values for DeviceRequest.RequestType and DeviceRequest.RequestCode fields
; combined as a word value.
;----------------------------------------------------------------------------
USB_RQ_SET_ADDRESS EQU (05d shl 8) or USB_REQ_TYPE_OUTPUT or USB_REQ_TYPE_STANDARD or USB_REQ_TYPE_DEVICE
USB_RQ_GET_DESCRIPTOR EQU (06d shl 8) or USB_REQ_TYPE_INPUT or USB_REQ_TYPE_STANDARD or USB_REQ_TYPE_DEVICE
USB_RQ_GET_CONFIGURATION EQU (08d shl 8) or USB_REQ_TYPE_INPUT or USB_REQ_TYPE_STANDARD or USB_REQ_TYPE_DEVICE
USB_RQ_SET_CONFIGURATION EQU (09d shl 8) or USB_REQ_TYPE_OUTPUT or USB_REQ_TYPE_STANDARD or USB_REQ_TYPE_DEVICE
USB_RQ_SET_INTERFACE EQU (11d shl 8) or USB_REQ_TYPE_OUTPUT or USB_REQ_TYPE_STANDARD or USB_REQ_TYPE_INTERFACE
USB_RQ_SET_FEATURE EQU (03d shl 8) or USB_REQ_TYPE_OUTPUT or USB_REQ_TYPE_STANDARD or USB_REQ_TYPE_DEVICE
USB_FSEL_DEV_REMOTE_WAKEUP EQU 01h
USB_RQ_GET_CLASS_DESCRIPTOR EQU (06d shl 8) or USB_REQ_TYPE_INPUT or USB_REQ_TYPE_CLASS or USB_REQ_TYPE_DEVICE
HID_RQ_SET_PROTOCOL EQU (11d shl 8) or USB_REQ_TYPE_OUTPUT or USB_REQ_TYPE_CLASS or USB_REQ_TYPE_INTERFACE
HID_RQ_SET_REPORT EQU (09d shl 8) or USB_REQ_TYPE_OUTPUT or USB_REQ_TYPE_CLASS or USB_REQ_TYPE_INTERFACE
HID_RQ_SET_IDLE EQU (0Ah shl 8) or USB_REQ_TYPE_OUTPUT or USB_REQ_TYPE_CLASS or USB_REQ_TYPE_INTERFACE
HUB_RQ_GET_PORT_STATUS EQU (00d shl 8) or USB_REQ_TYPE_INPUT or USB_REQ_TYPE_CLASS or USB_REQ_TYPE_OTHER
HUB_RQ_SET_PORT_FEATURE EQU (03d shl 8) or USB_REQ_TYPE_OUTPUT or USB_REQ_TYPE_CLASS or USB_REQ_TYPE_OTHER
HUB_RQ_CLEAR_PORT_FEATURE EQU (01d shl 8) or USB_REQ_TYPE_OUTPUT or USB_REQ_TYPE_CLASS or USB_REQ_TYPE_OTHER
ENDPOINT_CLEAR_PORT_FEATURE EQU (01d shl 8) or USB_REQ_TYPE_OUTPUT or USB_REQ_TYPE_STANDARD or USB_REQ_TYPE_ENDPOINT
ADSC_OUT_REQUEST_TYPE EQU (00h shl 8) or USB_REQ_TYPE_OUTPUT or USB_REQ_TYPE_CLASS or USB_REQ_TYPE_INTERFACE
ADSC_IN_REQUEST_TYPE EQU (00h shl 8) or USB_REQ_TYPE_INPUT or USB_REQ_TYPE_CLASS or USB_REQ_TYPE_INTERFACE
ENDPOINT_HALT EQU 00h
;----------------------------------------------------------------------------
;----------------------------------------------------------------------------
; Descriptor Type Values
;----------------------------------------------------------------------------
DESC_TYPE_DEVICE EQU 1 ; Device Descriptor (Type 1)
DESC_TYPE_CONFIG EQU 2 ; Configuration Descriptor (Type 2)
DESC_TYPE_STRING EQU 3 ; String Descriptor (Type 3)
DESC_TYPE_INTERFACE EQU 4 ; Interface Descriptor (Type 4)
DESC_TYPE_ENDPOINT EQU 5 ; Endpoint Descriptor (Type 5)
DESC_TYPE_HUB EQU 29h ; Hub Descriptor (Type 29h)
DESC_TYPE_CLASS_HUB EQU 0 ;Hub Class Descriptor (Type 0)
;----------------------------------------------------------------------------
;<AMI_SHDR_START>
;----------------------------------------------------------------------------
; Name: DeviceDescriptor
;
; Description: Device descriptor structure describes the USB device's
; characteristics (Refer USB specification for more
; detailed description)
;
; Fields: Name Type Description
; ------------------------------------------------------------
; bDescLength BYTE Descriptor l
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -