AG903ライブラリリファレンス
内容インデックスホーム
Body Source
本文ソース
1: uhs_sbit32_t Usbh_Stor_ReadSector(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_READSECTOR ); 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: API_REPORT_SUMMARY( USBSTOR_LOG_API_PARAM_ERROR ); 20: return Usbh_Stor_SetLastError( NULL, USBSTOR_API_PARAM_ERROR ); 21: } 22: if( ((pStorUnit = Usbh_Stor_Api_GetAssignStorUnit(pDrv)) == NULL) || 23: (u16BlockCount == 0) || 24: (pDataBuffer == NULL) ) { 25: API_REPORT_SUMMARY( USBSTOR_LOG_API_PARAM_ERROR ); 26: return Usbh_Stor_SetLastError( NULL, USBSTOR_API_PARAM_ERROR ); 27: } 28: if( pStorUnit->u32LastBlockAddress < u32LBA ) { 29: API_REPORT_SUMMARY( USBSTOR_LOG_API_PARAM_ERROR ); 30: return Usbh_Stor_SetLastError( NULL, USBSTOR_API_PARAM_ERROR ); 31: } 32: 33: 34: nScsiStat = Usbh_Stor_ScsiCtrl_ReadSector( pStorUnit, u32LBA, u16BlockCount, pDataBuffer ); 35: s16Status = Usbh_Stor_Api_ConvertUsbScsiStatToUsbStorStat( nScsiStat ); 36: if( s16Status != USBSTOR_SUCCESS ) { 37: API_REPORT_SUMMARY( Usbh_Stor_ApiLog_ConvertUsbScsiStatToUsbStorStat( nScsiStat ) ); 38: Usbh_Stor_SetLastError( pStorUnit, s16Status ); 39: } 40: return s16Status; 41: }
Copyright (c) 2017-2025 Axell Corporation. All rights reserved.