AG903ライブラリリファレンス
内容インデックスホーム
Body Source
本文ソース
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.