📄 mu_hcore.h
字号:
/** * @doc This function initializes control IRP and prepare setup packet * for SET CONFIG request and start control transfer. * @param pUsbHubDevice: Pointer to Hub device. * @param pUsbDevice : USB representation of Hub. * @param bBusAddress : Address given by UCD to hub device. * @param pPort : Given by UCD. * @return MUSB_SUCCESS or MUSB_FAILURE. */extern uint32_t MGC_HubConnectHandler (MUSB_Hub *pHubDevice, MUSB_Device *pUsbDevice, uint8_t bBusAddress, MUSB_Port *pPort);/** * @doc This function contains state machine which is used during * initialization of hub. * @param pContext: Context given conrol IRP initialization. * @param pControlIrp : Pointer to control IRP. * @return None. */extern void MGC_HubInitializeCallback (void *pContext, MUSB_ControlIrp *pControlIrp);extern uint32_t MGC_HubFillAndSubmitIntrIrp (MUSB_Hub *pHubDevice, uint8_t bBusAddress);extern void MGC_HubIntrIrpHandler(MUSB_Hub *pHubDevice, MUSB_Irp *pIntrIrp);extern void MGC_HubIntrIrpCallback ( void *pCtxt, MUSB_Irp *pCtrlIrp);extern void MGC_HubDisconnectHandler(MUSB_Hub *pHubDevice, uint32_t dwHubType, MUSB_HubDriverContext *pDriverContext);/** * @doc This function find hub device for Given USB device information. * This function will tell that given usb device pointer represent * hub or not. * * @param pUsbDevice Pointer to usb device * * @param pHubDevice Pointer to Hub device will be store here. * * @return MUSB_SUCCESS when pUsbDevice belongs to HUB otherwiseMUSB_FAILURE */extern uint32_t MGC_HubFindHubDevice (MUSB_Device *pUsbDevice, MUSB_Hub **pHubDevice);/** * @doc This function finds index at which free hub device structure is available. * * @param pDriverContext Pointer to driver context at which information about * all hub device is available. * @param pIndex Index at which free hub device is present will be store here. * * @return MUSB_SUCCESS when free index is found or MUSB_FAILURE when free device * is not available. */extern uint32_t MGC_HubFindFreeHubDeviceIndex(MUSB_HubDriverContext *pDriverContext, uint8_t *pIndex); /** * @doc This function will be registered by HUB driver as timer expiry callback. * This function will be called by UCD whenever timer is expired. * * @param pDriverPrivateData Pointer to driver's private data. * * @param hBus Bus Handle * * @return None */extern void MUSB_HubDriverTimerExpired(void *pDriverPrivateData, MUSB_BusHandle hBus);/** * This needs to be called by the Hub class driver after set configuration * * This interprets the Operating speed of the Hub and validates the * descriptors fields accordingly. It also Finds whether it supports * multiple TT or Single TT or Invalid device and stores the * TT information at HUB device information * * @param pHubDevice Pointer to the HUB device information * * @return MUSB_SUCCESS on success * @return MUSB_FAILURE on failure */ extern uint32_t MGC_HubValidateUpdateTtInfo(MUSB_Hub *pHubDevice);/** * Hub driver has to call this after getting the Hub status * (through Get status Request) * * It does the verification against the power requirements(usb2.0 spec, 11.13) * and initialize the parameters related to power management * * This validates/compares the power requirements given in the * "bmAttributes" field of the configuration descriptor and "Hub device status" * * @param pHubDevice Pointer to the Hub device information * * @return MUSB_SUCCESS on success * @return MUSB_FAILURE On failure */extern uint32_t MGC_HubPowerValidateInit(MUSB_Hub *pHubDevice); /** * Assumption: Hub always gets 5 units of load from upstream port * and Bus Powered hub cannot be connected to a Bus powered hub. * * This needs to be called by the hub class driver whenever any of * the following events occur on any port of the hub. * 1.New connection, 2.Disconnection, 3.Port Suspend, 4.Port Resume * Note: This function should not be called whenever a hub is connected * to this * * Power scheduling is required for Bus-Powered hubs only since * there are some limits on the available power from upstream and number * of devices to be connected. * Self-Powered hubs can drive any number of ports, so no need to * schedule the power. * * It updates the available power and checks the newly connected device * working feasibility * * @param pHubDevice Pointer to Hub device information * * @param bPowerUpdateType This is any one of type MUSB_HubPowerUpdateTypes * * @return MUSB_SUCCESS on Success * @return MUSB_FALIURE on Failure (This is valid incase of connect event only ) */extern uint32_t MGC_HubUpdatePower(MUSB_Hub *pHubDevice, uint8_t bPowerUpdateType);/** * This Initializes the TT information of the hub and * Reset the TT of the Hub to keep the TT in known state * * @param pUsbDevice USB device information. * * @param ControlIrpComplete Callback function for control IRP * * @param pHubDevice Pointer to Hub Device information * * @return MUSB_SUCCESS on Success * @return MUSB_FALIURE on Failure */extern uint32_t MGC_HubInitAndResetTt(MUSB_Device *pUsbDevice, MUSB_pfControlIrpComplete ControlIrpComplete, MUSB_Hub *pHubDevice);/* * This checks the remote wakeup feature in the total USB_Tree * * @param pUsbDevice Pointer to the USB device of a HUB * * @retunr TRUE if all the devices connected to the given hub are supporting * Remote wakeup. * @return FALSE In other cases it */extern uint8_t MGC_HubIsAnyPortNotSupportsRemoteWakeup(MUSB_Device *pUsbDevice);extern const MUSB_EndpointDescriptor* MGC_GetIntrInEndpointDescriptor( MUSB_ConfigurationDescriptor* pConfig, const MUSB_InterfaceDescriptor* pInterfaceDescriptor, uint8_t bEndpointType, uint8_t bEndpointDirection);extern void MGC_HubDisplayHubDescriptor(MUSB_HubDescriptor *pHubDscr);extern void MGC_HubDisplayDeviceDescriptors(MUSB_DeviceDescriptor *pDeviceDescriptor);extern void MGC_HubDisplayConfigurationDescriptors(MUSB_ConfigurationDescriptor* pConfiguration);extern void MGC_HubDisplayInterfaceDescriptor(MUSB_InterfaceDescriptor *pInterface);/*********************Function Related to Hub Status *******************/extern void MUSB_HubStatusChange (MUSB_Hub *pHubDevice);extern void MGC_HubGetHubStatusCallback (void *pCtxt, MUSB_ControlIrp *pCtrlIrp);extern void MGC_HubOverCurrentTimerCallback (void *pParam, MUSB_BusHandle hBus);extern void MGC_HubHandleHubOverCurrentTimer (MUSB_Hub *pHubDevice, uint32_t dwWaitingTime);extern void MGC_HubPowerOnGoodTimerCallback (void *pParam, MUSB_BusHandle hBus);extern void MGC_HubPowerOnGoodTimer (MUSB_Hub *pHubDevice, uint32_t dwWaitingTime);extern void MGC_HubHandleOverCurrent (MUSB_Hub *pHubDevice, uint8_t *pHubNextState);/**************Function Used for Hub as well as Port***********************/extern void MGC_HubStoreStatus (uint8_t *pStatusData, MUSB_HubPortStatus *pHubStatus);extern void MGC_HubHandlePowerOnPorts(MUSB_Hub *pHubDevice, uint8_t *pHubNextState);extern void MUSB_HubPrepareSetupPkt (MUSB_DeviceRequest *pSetup, uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex, uint16_t wLength);extern uint32_t MGC_HubGetChildIndexForGivenPort (MUSB_Hub *pHubDevice, uint8_t bPortNum, uint8_t *pChildIndex);extern void MGC_DeEnumerateHub (MUSB_Hub *pHubDevice, uint32_t dwHubType);extern void MUSB_HubDeviceEnumerateCallback (MUSB_Device *pHubUsbDevice, MUSB_Device *pChildUsbDevice);/*****************Funtion Related to ports status Change ***************/extern void MGC_HubPortStatusChange(MUSB_Hub *pHubDevice);extern void MGC_HubGetPortStatusCallback (void *pCtxt, MUSB_ControlIrp *pCtrlIrp);extern void MGC_HubHandleOverCurrentPortContinue (MUSB_Hub *pHubDevice, uint8_t *pPortNextState, uint8_t bPortNum);extern void MGC_HubHandleEnablePort (MUSB_Hub *pHubDevice, uint8_t *pPortNextState, uint8_t bPortNum);extern void MGC_HubHandleSuspendPort (MUSB_Hub *pHubDevice, uint8_t *pPortNextState, uint8_t bPortNum);extern void MGC_HubOverCurrentPortTimer (MUSB_Hub *pHubDevice, uint32_t dwWaitingTime);extern void MGC_HubOverCurrentPortTimerCallback (void *pParam, MUSB_BusHandle hBus);extern void MGC_HubHandlePortConnect (MUSB_Hub *pHubDevice, uint8_t *pPortNextState, uint8_t bPortNum);extern void MGC_HubHandlePortDisconnect (MUSB_Hub *pHubDev, uint8_t bPortNum);extern void MGC_HubHandleOverCurrentPortComplete (MUSB_Hub *pHubDevice, uint8_t *pPortNextState, uint8_t bPortNum);extern void MGC_HubPortConnectCallback (void *pCtxt, MUSB_ControlIrp *pCtrlIrp);/**********************Function related to DEBOUCE ***********/extern void MGC_HubHandlePortDebounceTimer (MUSB_Hub *pHubDevice, uint32_t dwWaitingTime);extern void MGC_HubPortDebounceTimerCallback (void *pParam, MUSB_BusHandle hBus);extern void MGC_HubPortDebounceCallback (void *pCtxt, MUSB_ControlIrp *pCtrlIrp);/**********************Function Used for RESET ***********/extern void MGC_HubPortResetCallback (void *pCtxt, MUSB_ControlIrp *pCtrlIrp);extern void MGC_HubPortResetTimerCallback (void *pParam, MUSB_BusHandle hBus); extern void MGC_HubHandlePortResetTimer (MUSB_Hub *pHubDevice, uint32_t dwWaitingTime);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -