AG903ライブラリリファレンス
内容インデックスホーム
Body Source
本文ソース
1: uhs_sbit32_t Usbh_Stor_WriteSector(PUSER_DRV pDrv, uhs_ubit32_t u32LBA, uhs_ubit16_t u16BlockCount, uhs_ubit8_t *pDataBuffer) 2: { 3: STOR_UNIT *pStorUnit; 4: USB_SCSI_STATUS nScsiStat; 5: uhs_sbit16_t s16Status; 6: 7: #if STOR_RW_MILESTONE_ERA == TRUE 8: API_REPORT_MILESTONE( USBSTOR_CHKPOINTS_API_WRITESECTOR ); 9: #endif 10: 11: 12: if( pStorClassDriver == NULL ) { 13: API_REPORT_SUMMARY( USBSTOR_LOG_SYS_SYSTEM_ERROR ); 14: return USBSTOR_SYS_SYSTEM_ERROR; 15: } 16: 17: 18: if( pDrv == NULL ) { 19: return Usbh_Stor_SetLastError( NULL, USBSTOR_API_PARAM_ERROR ); 20: } 21: if( ((pStorUnit = Usbh_Stor_Api_GetAssignStorUnit(pDrv)) == NULL) || 22: (u16BlockCount == 0) || 23: (pDataBuffer == NULL) ) { 24: return Usbh_Stor_SetLastError( NULL, USBSTOR_API_PARAM_ERROR ); 25: } 26: if( pStorUnit->u32LastBlockAddress < u32LBA ) { 27: API_REPORT_SUMMARY( USBSTOR_LOG_API_PARAM_ERROR ); 28: return Usbh_Stor_SetLastError( NULL, USBSTOR_API_PARAM_ERROR ); 29: } 30: 31: 32: nScsiStat = Usbh_Stor_ScsiCtrl_WriteSector( pStorUnit, u32LBA, u16BlockCount, pDataBuffer ); 33: s16Status = Usbh_Stor_Api_ConvertUsbScsiStatToUsbStorStat( nScsiStat ); 34: if( s16Status != USBSTOR_SUCCESS ) { 35: API_REPORT_SUMMARY( Usbh_Stor_ApiLog_ConvertUsbScsiStatToUsbStorStat( nScsiStat ) ); 36: Usbh_Stor_SetLastError( pStorUnit, s16Status ); 37: } 38: return s16Status; 39: }
Copyright (c) 2017-2025 Axell Corporation. All rights reserved.