AG903ライブラリリファレンス
内容インデックスホーム
Body Source
本文ソース
1: uhs_status_t Usb_HubApi_SetFeature( struct usb_hub_info* hub_info, uhs_ubit8_t feature, uhs_ubit16_t port_num ){ 2: 3: uhs_status_t retval = UDI_OK; 4: uhs_status_t result = UDI_OK; 5: 6: 7: 8: 9: if( ( g_usb_hub_stat != USB_HUB_IDLE ) && ( g_usb_hub_stat != USB_HUB_RUN ) ){ 10: uhs_debug_print( DBG_ERR, ( "Usb_HubApi_SetFeature: status error" ) ); 11: HUB_REPORT_ERROR( USBCLS_HUB_INVALID_STATUS, 0 ); 12: return UDI_STAT_INVALID_STATE; 13: } 14: 15: 16: 17: 18: if( hub_info == NULL ){ 19: uhs_debug_print( DBG_ERR, ( "Usb_HubApi_SetFeature: parameter error" ) ); 20: HUB_REPORT_ERROR( USBCLS_HUB_INVALID_PARAMETER, 0 ); 21: return UDI_STAT_DATA_ERROR; 22: } 23: if( hub_info->port_num == 0 ){ 24: uhs_debug_print( DBG_ERR, ( "Usb_HubApi_SetFeature: parameter error" ) ); 25: HUB_REPORT_ERROR( USBCLS_HUB_INVALID_PARAMETER, 0 ); 26: return UDI_STAT_DATA_ERROR; 27: } 28: if( hub_info->port_num < port_num ){ 29: uhs_debug_print( DBG_ERR, ( "Usb_HubApi_SetFeature: parameter error" ) ); 30: HUB_REPORT_ERROR( USBCLS_HUB_INVALID_PARAMETER, 0 ); 31: return UDI_STAT_DATA_ERROR; 32: } 33: if( port_num != 0 ){ 34: switch( feature ){ 35: 36: 37: case PORT_SUSPEND: 38: 39: case PORT_RESET: 40: case PORT_POWER: 41: 42: case C_PORT_CONNECTION: 43: case C_PORT_ENABLE: 44: case C_PORT_SUSPEND: 45: case C_PORT_OVERCURRENT: 46: case C_PORT_RESET: 47: case PORT_TEST: 48: case PORT_INDICATOR: 49: break; 50: default: 51: uhs_debug_print( DBG_ERR, ( "Usb_HubApi_SetFeature: parameter error" ) ); 52: HUB_REPORT_ERROR( USBCLS_HUB_INVALID_PARAMETER, 0 ); 53: return UDI_STAT_DATA_ERROR; 54: } 55: }else{ 56: switch( feature ){ 57: case C_HUB_LOCAL_POWER: 58: case C_HUB_OVER_CURRENT: 59: break; 60: default: 61: uhs_debug_print( DBG_ERR, ( "Usb_HubApi_SetFeature: parameter error" ) ); 62: HUB_REPORT_ERROR( USBCLS_HUB_INVALID_PARAMETER, 0 ); 63: return UDI_STAT_DATA_ERROR; 64: } 65: } 66: 67: 68: 69: 70: retval = kernel_acquisition_semaphore( &(hub_info->hub_info_sem), USB_HOST_SEMTIMEOUT, in_interrupt() ); 71: if( retval != UDI_OK ){ 72: uhs_debug_print( DBG_ERR, ( "Usb_HubApi_SetFeature: semaphore error" ) ); 73: HUB_REPORT_WARNING( USBCLS_HUB_RESOURCE_UNAVAIL, 0 ); 74: return retval; 75: } 76: 77: 78: 79: 80: uhs_debug_print( DBG_ERR, ( "Set Feature called by external module( Usb_HubApi_SetFeature() )" ) ); 81: result = Usb_Hub_SetFeature( hub_info, feature, port_num ); 82: if( result != UDI_OK ){ 83: uhs_debug_print( DBG_ERR, ( "Usb_HubApi_PortDevDttached: PortDevDetach error" ) ); 84: HUB_REPORT_WARNING( USBCLS_HUB_ILLEGAL_ERROR, 0 ); 85: } 86: 87: 88: 89: 90: retval = kernel_release_semaphore( &(hub_info->hub_info_sem), in_interrupt() ); 91: if( retval != UDI_OK ){ 92: uhs_debug_print( DBG_ERR, ( "Usb_HubApi_SetFeature: semaphore error" ) ); 93: HUB_REPORT_ERROR( USBCLS_HUB_RESOURCE_UNAVAIL, 0 ); 94: 95: if( result == UDI_OK ){ 96: return retval; 97: } 98: } 99: 100: return result; 101: }
Copyright (c) 2017-2025 Axell Corporation. All rights reserved.