AG903ライブラリリファレンス
内容インデックスホーム
前へ上へ次へ
Usb_HubApi_PortDevDetach 関数

ポートデタッチ処理

Syntax
C++
uhs_status_t Usb_HubApi_PortDevDetach(struct usbd_usb_deviceinfo* usbdev);
引数 
説明 
struct usbd_usb_deviceinfo* usbdev 
[in] USBデバイス情報構造体用ポインタ 

ポートデタッチ処理結果

返値の詳細 
説明 
正常終了 
ステートエラー 
パラメータエラー 

対象デバイスのデタッチ処理をHUBクラスドライバに要求します。

1: uhs_status_t Usb_HubApi_PortDevDetach( struct usbd_usb_deviceinfo* usbdev ){ 2: 3: struct usbd_usb_deviceinfo* hubdev = NULL; 4: struct usb_hub_info* hub_info = NULL; 5: uhs_status_t retval = UDI_OK; 6: uhs_ubit16_t sarch_port = 0; 7: 8: 9: 10: 11: if( ( g_usb_hub_stat != USB_HUB_IDLE ) && ( g_usb_hub_stat != USB_HUB_RUN ) ){ 12: uhs_debug_print( DBG_ERR, ( "Usb_HubApi_PortDevDetach: status error" ) ); 13: HUB_REPORT_ERROR( USBCLS_HUB_INVALID_STATUS, 0 ); 14: return UDI_STAT_INVALID_STATE; 15: } 16: 17: 18: 19: 20: if( usbdev == NULL ){ 21: uhs_debug_print( DBG_ERR, ( "Usb_HubApi_PortDevDetach: parameter error" ) ); 22: HUB_REPORT_ERROR( USBCLS_HUB_INVALID_PARAMETER, 0 ); 23: return UDI_STAT_DATA_ERROR; 24: } 25: 26: if( usbdev->usbdev_DevNum == 0 ){ 27: 28: return UDI_OK; 29: } 30: 31: hubdev = usbdev->usbdev_UpperHub; 32: if( hubdev != NULL ){ 33: 34: hub_info = (struct usb_hub_info *)hubdev->context; 35: sarch_port = 1; 36: while( hubdev->usbdev_LowerHub[sarch_port] != usbdev ){ 37: 38: if( sarch_port >= hub_info->port_num ){ 39: uhs_debug_print( DBG_ERR, ( "Usb_HubApi_PortDevDetach: parameter error" ) ); 40: HUB_REPORT_WARNING( USBCLS_HUB_INVALID_PARAMETER, 0 ); 41: return UDI_STAT_DATA_ERROR; 42: } 43: sarch_port++; 44: } 45: }else{ 46: sarch_port = 1; 47: 48: } 49: 50: 51: 52: 53: 54: 55: 56: 57: uhs_debug_print( DBG_INFO, ( "PortDevDetach called by external module ( Usb_HubApi_PortDevDetach() )" ) ); 58: 59: retval = Usb_Hub_PortDevDetach( usbdev, sarch_port ); 60: if( retval != UDI_OK ){ 61: uhs_debug_print( DBG_ERR, ( "Usb_HubApi_PortDevDttached: PortDevDetach error" ) ); 62: HUB_REPORT_ERROR( USBCLS_HUB_ILLEGAL_ERROR, 0 ); 63: } 64: 65: return retval; 66: }
Copyright (c) 2017-2025 Axell Corporation. All rights reserved.