/*************************************************************************** * Copyright (c) 2024 Microsoft Corporation * Copyright (c) 2026-present Eclipse ThreadX contributors * * This program and the accompanying materials are made available under the * terms of the MIT License which is available at * https://opensource.org/licenses/MIT. * * SPDX-License-Identifier: MIT **************************************************************************/ /**************************************************************************/ /**************************************************************************/ /** */ /** USBX Component */ /** */ /** Storage Class */ /** */ /**************************************************************************/ /**************************************************************************/ /* Include necessary system files. */ #define UX_SOURCE_CODE #include "ux_api.h" #include "ux_host_class_storage.h" #include "ux_host_stack.h" #if defined(UX_HOST_STANDALONE) /**************************************************************************/ /* */ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_storage_media_check PORTABLE C */ /* 6.1.10 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ /* */ /* DESCRIPTION */ /* */ /* This function runs state machine to check and mount/unmount storage */ /* media for current selected logic unit number (LUN). */ /* */ /* It's valid only in standalone mode. */ /* It's blocking. */ /* */ /* INPUT */ /* */ /* storage Pointer to storage class */ /* sector_start Starting sector */ /* sector_count Number of sectors to read */ /* data_pointer Pointer to data to read */ /* */ /* OUTPUT */ /* */ /* Completion Status */ /* */ /* CALLS */ /* */ /* _ux_host_class_storage_check_run Runs check state machine */ /* */ /* CALLED BY */ /* */ /* Storage Class */ /* */ /**************************************************************************/ UINT _ux_host_class_storage_media_check(UX_HOST_CLASS_STORAGE *storage) { UINT status; do { status = _ux_host_class_storage_check_run(storage); } while(status == UX_STATE_WAIT); return(storage -> ux_host_class_storage_status); } /**************************************************************************/ /* */ /* FUNCTION RELEASE */ /* */ /* _uxe_host_class_storage_media_check PORTABLE C */ /* 6.3.0 */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ /* */ /* DESCRIPTION */ /* */ /* This function checks errors in storage media check function call. */ /* */ /* INPUT */ /* */ /* storage Pointer to storage class */ /* */ /* OUTPUT */ /* */ /* Status */ /* */ /* CALLS */ /* */ /* _ux_host_class_storage_media_check Check storage media */ /* */ /* CALLED BY */ /* */ /* Application */ /* */ /**************************************************************************/ UINT _uxe_host_class_storage_media_check(UX_HOST_CLASS_STORAGE *storage) { /* Sanity check. */ if (storage == UX_NULL) return(UX_INVALID_PARAMETER); /* Invoke storage media check function. */ return(_ux_host_class_storage_media_check(storage)); } #endif