1:
void Usbh_Api_SetPortPower(
struct usbd_usb_deviceinfo *usbhub,
const uhs_ubit8_t port_num,
const uhs_ubit8_t stat )
2: {
3: uhs_ubit8_t port_power = 0;
4:
5:
6:
if( Usbh_susres_get_state() != USBH_SUSRES_STS_IDLE ){
7: uhs_debug_print (DBG_ERR, ("ERROR : Don't Call Current State!!"));
8: CORE_REPORT_ERROR(
USBC_ILLEGAL_ERROR );
9:
return;
10: }
11:
12:
if (( usbhub == NULL ) || ( port_num > USB_HW_PORT_NUM )) {
13: CORE_REPORT_ERROR(
USBC_INVALID_PARAMETER );
14:
return;
15: }
16:
17: port_power =
Usbh_Api_GetPortPower( usbhub, port_num );
18:
19:
if ( port_power == stat ) {
20: 21:
return;
22: }
23:
24:
switch ( stat ) {
25:
case USBH_RH_PORT_POWER_ON:
26: Usbh_Rh_Set_PortPower( port_num );
27:
break;
28:
case USBH_RH_PORT_POWER_OFF:
29: Usbh_Rh_Clear_PortPower( port_num );
30:
break;
31:
default:
32:
break;
33: }
34:
35: }