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

コントロール転送を同期実行

Syntax
C++
uhs_status_t Usbh_Api_SyncControlMsg(struct usb_control_block* ucb, const udi_ubit8_t bmRequestType, const udi_ubit8_t bRequest, const udi_ubit8_t wValue0, const udi_ubit8_t wValue1, const udi_ubit8_t wIndex0, const udi_ubit8_t wIndex1, void * buf, const uhs_ubit32_t size);
引数 
説明 
struct usb_control_block* ucb 
[in] USBコントロールブロック 
const udi_ubit8_t bmRequestType 
[in] 自由設定でbmRequestTypeを指定する 
const udi_ubit8_t bRequest 
[in] 自由設定でbRequestを指定する 
const udi_ubit8_t wValue0 
[in] 自由設定でwValueを指定する 
const udi_ubit8_t wValue1 
[in] 自由設定でwValueを指定する 
const udi_ubit8_t wIndex0 
[in] 自由設定でwIndexを指定する 
const udi_ubit8_t wIndex1 
[in] 自由設定でwIndexを指定する 
void * buf 
[in] バッファポインタを指定する 
const uhs_ubit32_t size 
[in] 転送サイズを指定する 

コントロール転送実行結果

返値の詳細 
説明 
正常終了 
状態異常 
パラメータ異常 
リソース不足 
USBリクエストの受付に失敗(キューフル等) 

コントロール転送を発行します。 

転送が完了した時点、もしくはエラーが発生するまで本関数からリターンしません。 

転送完了のCALLBACKポインタは設定しても呼び出しが行われないため、NULL指定とします。 

USBバス上の転送結果は、ucbに格納します。

CALLBACK関数内から本関数を呼び出すと、転送処理は行われますがタイムアウトによる エラーリターンします。 

SUSPEND/RESUME中に呼び出すとエラーリターンします。

1: uhs_status_t Usbh_Api_SyncControlMsg( 2: struct usb_control_block* ucb, 3: const udi_ubit8_t bmRequestType, 4: const udi_ubit8_t bRequest, 5: const udi_ubit8_t wValue0, 6: const udi_ubit8_t wValue1, 7: const udi_ubit8_t wIndex0, 8: const udi_ubit8_t wIndex1, 9: void *buf, 10: const uhs_ubit32_t size 11: ) 12: { 13: uhs_status_t retval = UDI_OK; 14: usb_device_request_t* devreq = NULL; 15: 16: 17: if( Usbh_susres_get_state() != USBH_SUSRES_STS_IDLE ){ 18: uhs_debug_print (DBG_ERR, ("ERROR : Don't Call Current State!!")); 19: CORE_REPORT_ERROR( USBC_ILLEGAL_ERROR ); 20: return UDI_STAT_INVALID_STATE; 21: } 22: 23: if ( ucb == NULL ) { 24: CORE_REPORT_ERROR( USBC_INVALID_PARAMETER ); 25: return UDI_STAT_DATA_ERROR; 26: } 27: 28: 29: devreq = Usbh_AllocDevReqInfo(); 30: if ( devreq == NULL ) { 31: CORE_REPORT_ERROR( USBC_INVALID_PARAMETER ); 32: return UDI_STAT_RESOURCE_UNAVAIL; 33: } else { 34: devreq->bmRequestType = bmRequestType; 35: devreq->bRequest = bRequest; 36: devreq->wValue0 = wValue0; 37: devreq->wValue1 = wValue1; 38: devreq->wIndex0 = wIndex0; 39: devreq->wIndex1 = wIndex1; 40: devreq->wLength0 = size & 0xffU; 41: devreq->wLength1 = (size >> 8) & 0xffU; 42: } 43: 44: 45: Usbh_Setup_Ucb( 46: ucb, 47: buf, 48: size, 49: devreq, 50: NULL, 51: ucb->time_out ); 52: 53: 54: retval = Usbh_ProcSyncRequest( ucb, USBWRAP_SUBMSG_CTLREQ ); 55: if ( retval != UDI_OK ) { 56: Usbh_FreeDevReqInfo( devreq ); 57: ucb->setup_data = NULL; 58: CORE_REPORT_WARNING(USBC_ILLEGAL_ERROR); 59: return retval; 60: } 61: 62: 63: Usbh_FreeDevReqInfo( devreq ); 64: ucb->setup_data = NULL; 65: 66: return UDI_OK; 67: }
Copyright (c) 2017-2025 Axell Corporation. All rights reserved.