📄 mu_hcore.h
字号:
/***************************************************************************** * * * Copyright Mentor Graphics Corporation 2003-2004 * * * * All Rights Reserved. * * * * THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY INFORMATION * * WHICH IS THE PROPERTY OF MENTOR GRAPHICS CORPORATION OR ITS * * LICENSORS AND IS SUBJECT TO LICENSE TERMS. * * * ****************************************************************************//* * Header related to hub or port status change handling * $Revision: 1.3 $ */#ifndef _MU_HCORE_H_#define _MU_HCORE_H_#include "mu_arch.h"/** * This data structure is used to get information that which device is connected * to which port. Since 255 port can be active but only 4 device are allowed to * connect to the system (Its configurable option and more devices can be * connected if MUSB_HUB_MAX_PORTS value will be increased). * * @field bPortNum Port number at which device is connected. * * @field bStatus It tells that child device present or not. */typedef struct _MUSB_HubChildPortMap_{ uint8_t bPortNum; uint8_t bStatus;} MUSB_HubChildPortMap;/** * MUSB_PortDebounceParam * * @field dwWaitingTime: waiting time of Hub driver before checking connection * has settle down or not. * * @field dwIntermediateDelay: Increment waiting time by this amount. * * @field bErrorCount Number of times disconnect allowed dring debounce processing. * */typedef struct { uint32_t dwWaitingTime; uint32_t dwIntermediateDelay; uint8_t bErrorCount; MUSB_HubPortStatus debouncePortStatus;} MUSB_PortDebounceParam;/** * MUSB_PortResetParam: * * @field dwNumOfTry: Maximum number of time hub driver will try to reset the device. * If driver able to reset device in first then try return success * from there itself. * * @field dwWaitingTime: Hub driver waits before checking that reset has completed or not. * */typedef struct { uint32_t dwNumOfTry; uint32_t dwWaitingTime; MUSB_HubPortStatus resetPortStatus;} MUSB_PortResetParam;/** * MUSB_Hub (Hub specific data structure). When Hub device is connected then * Hub connect function is called. This function allocates as well as * initializes few fields of this data structure. * * @field pUcdPrivateData : Data given by STACK/UCD. * * @field busHandle : session "handle" used for different pipe operation. * * @field pUsbDev : Pointer to USB device i.e. USB device representation of HUB. * * @field pInfDscr : Interface for which HUB driver is selected. This information * will be given by UCD and hub driver will store just reference * pointer. There will not be any allocation. * * @field pEndpDscr : Interrupt endpoint for which IRP is going to submit. * This pointer is pointing to location where Endpoint * descriptor is stored by UCD. * For this field there will not be any pointer allocation. * * @aHubRawDscr : This will act as buffer for hub descriptor in raw format. * Later data will be taken from here and stored in proper * format of hub descriptor. * * @field hubDscr : HUB descriptor in proper format will be store here. * * @field ctrlIrp : IRP used by Hub for all control transaction. * * @field setupPacket : Setup packet as per USB 2.0 specification. * * @field aHubPortStatus : This field is used in control IRP as IN buffer to store * either hub or port status. * * @field hubStatus : Status of the hub will be stored here. * * @field portStatus : Status of a port will be store here. * * @field intrInIrp : IntrIrp which gives information about Hub and Port status change. * * @field intrInPipe: Interrupt pipe handler. * * @field aStatusBitMap : Contain status change information of all the ports as well as * hub. * * @field pChild : pointer of Connected USB devices at different ports of the HUB. * Hub Class driver will update this information when enumeration is * completed by UCD. * * @field bState : State of the HUB. * * @field bNextState : Next state of hub if the given request executed properly. * When IRP is executed properly then first statement of any * callback would be bState = bNextState; * * @field bPortState : State of the active port i.e. port for which currently requests are * sent or received. * * @field bPortNextState : Next state of port if the given request executed properly. * When IRP is executed properly then first statement of any * callback would be bPortState = bPortNextState; * * @field bActivePortNum : Port number used for current request or presently all the request * will go to this port. * * @field bSpeed : Speed of newly connected device to the hub's port. * * @field debounceParam : Parameter used during debounce period. * * @field resetParam : Parameter used during Reseting a port. * * @field bAlternateSelling Current alternate setting value * * @field bTtType This field represents the TT type. * Lower Nible first Bit(0-Bit) inidcates the presently Configured TT type * ( It can have MUSB_HUB_SINGLE_TT(0) or MUSB_HUB_MULTIPLE_TT(1) ) * Upper Nible first Bit(4-Bit) indicates the TT type * ( It can have MUSB_HUB_SINGLE_TT or MUSB_HUB_MULTIPLE_TT ) * If it doesn't have TT, then its value is MUSB_HUB_INVALID_TT * * @field bSelfPower This tells the power status of a hub * It can have MUSB_HUB_SELF_AND_BUS_POWERED(2), * MUSB_HUB_SELF_POWERED(1) or MUSB_HUB_BUS_POWERED(0). * * @field bLocalPower This indicates the present power status of the hub * This values is MUSB_HUB_LOCAL_POWERED(1) if local power supply is good; * MUSB_HUB_NO_LOCAL_POWERED(0) If local power supply is not good. * * @field bAllocatedPower In terms of units (unit = 100mA), This field is * valid only incase of bus powered hub, because bus powered hub * has to take care about the number of devices connected to the hub. */typedef struct _MUSB_Hub_{ void *pUcdPrivateData; MUSB_BusHandle busHandle; MUSB_Device *pUsbDevice; MUSB_DeviceDriver* pDriver; const MUSB_InterfaceDescriptor *pInfDscr; const MUSB_EndpointDescriptor *pEndpDscr; uint8_t aHubRawDscr[MUSB_HUB_MAX_HUB_DSCR_SIZE]; MUSB_HubDescriptor hubDscr; MUSB_ControlIrp ctrlIrp; MUSB_DeviceRequest setupPacket; uint8_t aHubPortStatus[MUSB_HUB_PORT_STATUS_LENGTH]; MUSB_HubPortStatus hubStatus; MUSB_HubPortStatus portStatus; MUSB_Irp intrInIrp; MUSB_Pipe intrInPipe; uint8_t aHubPortStatusChangeBuffer[(MUSB_HUB_MAX_PORTS / 8) + 1]; uint32_t dwHubPortStatusChange; MUSB_Device *pChild[MUSB_HUB_MAX_PORTS]; MUSB_HubChildPortMap aHubChildPortMap[MUSB_HUB_MAX_PORTS]; MUSB_PortDebounceParam debounceParam; MUSB_PortResetParam resetParam; uint8_t bNumOfChildActive; uint8_t bState; uint8_t bNextState; uint8_t bPortState; uint8_t bPortNextState; uint8_t bActivePortNum; uint8_t bSpeed; uint8_t bIndexAtHubDeviceList; uint8_t bAlternateSetting; int8_t bTtType; uint8_t bSelfPower; uint8_t bLocalPower; uint8_t bAllocatedPower; uint8_t bDepthInHubChain; uint8_t bIntrIrpExecutionErrorCount; uint8_t bCurrentChildIndex;} MUSB_Hub;/* Random value has taken */#define MUSB_HUB_MAX_ERROR_COUNT_FOR_INTR_IRP_EXECUTION 0x05#define MUSB_HUB_MAX_HUB_SUPPORTED 0x01 //[LL] 0x06typedef struct { uint8_t bRootHub; MUSB_Hub hubDeviceList[MUSB_HUB_MAX_HUB_SUPPORTED]; uint8_t bNumOfHubActive; MUSB_DeviceDriver* pDriver;} MUSB_HubDriverContext;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -