From 7bafce8df9aedba6e5c15bb40274545936c84e3c Mon Sep 17 00:00:00 2001 From: Chaoqiong Xiao Date: Wed, 18 Jan 2023 08:44:37 +0000 Subject: [PATCH] Update on 18 Jan 2023. Expand to see details. 4faab07a Remove internal deprecated files. d82f44a2 Upgrade to the latest Container Images. 04527692 Checked device removal while reading/writing storage. d7560786 Add a notice for not released file. --- README.md | 47 +++++++++++++++++++ .../src/ux_host_class_storage_check_run.c | 17 ++++++- .../src/ux_host_class_storage_lock.c | 17 ++++++- .../src/ux_host_class_storage_media_read.c | 7 ++- .../src/ux_host_class_storage_media_write.c | 7 ++- .../ux_host_class_storage_read_write_run.c | 18 ++++++- 6 files changed, 108 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index edf9d047..f8c3a982 100755 --- a/README.md +++ b/README.md @@ -33,6 +33,53 @@ See [Overview of Azure RTOS USBX](https://learn.microsoft.com/azure/rtos/usbx/ov The master branch has the most recent code with all new features and bug fixes. It does not represent the latest General Availability (GA) release of the library. Each official release (preview or GA) will be tagged to mark the commit and push it into the Github releases tab, e.g. `v6.2-rel`. +> When you see xx-xx-xxxx, 6.x or x.x in function header, this means the file is not officially released yet. They will be updated in the next release. See example below. +``` +/**************************************************************************/ +/* */ +/* FUNCTION RELEASE */ +/* */ +/* _tx_initialize_low_level Cortex-M23/GNU */ +/* 6.x */ +/* AUTHOR */ +/* */ +/* Scott Larson, Microsoft Corporation */ +/* */ +/* DESCRIPTION */ +/* */ +/* This function is responsible for any low-level processor */ +/* initialization, including setting up interrupt vectors, setting */ +/* up a periodic timer interrupt source, saving the system stack */ +/* pointer for use in ISR processing later, and finding the first */ +/* available RAM memory address for tx_application_define. */ +/* */ +/* INPUT */ +/* */ +/* None */ +/* */ +/* OUTPUT */ +/* */ +/* None */ +/* */ +/* CALLS */ +/* */ +/* None */ +/* */ +/* CALLED BY */ +/* */ +/* _tx_initialize_kernel_enter ThreadX entry function */ +/* */ +/* RELEASE HISTORY */ +/* */ +/* DATE NAME DESCRIPTION */ +/* */ +/* 09-30-2020 Scott Larson Initial Version 6.1 */ +/* xx-xx-xxxx Scott Larson Include tx_user.h, */ +/* resulting in version 6.x */ +/* */ +/**************************************************************************/ +``` + ## Component dependencies The main components of Azure RTOS are each provided in their own repository, but there are dependencies between them, as shown in the following graph. This is important to understand when setting up your builds. diff --git a/common/usbx_host_classes/src/ux_host_class_storage_check_run.c b/common/usbx_host_classes/src/ux_host_class_storage_check_run.c index be6d5403..6c8eb86c 100644 --- a/common/usbx_host_classes/src/ux_host_class_storage_check_run.c +++ b/common/usbx_host_classes/src/ux_host_class_storage_check_run.c @@ -36,7 +36,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_storage_check_run PORTABLE C */ -/* 6.1.10 */ +/* 6.x */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -79,10 +79,14 @@ /* DATE NAME DESCRIPTION */ /* */ /* 01-31-2022 Chaoqiong Xiao Initial Version 6.1.10 */ +/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* checked device state, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ UINT _ux_host_class_storage_check_run(UX_HOST_CLASS_STORAGE *storage) { +UX_DEVICE *device; #if defined UX_HOST_CLASS_STORAGE_STATE_CHECK_ENABLE UX_INTERRUPT_SAVE_AREA @@ -107,6 +111,9 @@ UX_INTERRUPT_SAVE_AREA UX_RESTORE #endif + /* Get device. */ + device = storage -> ux_host_class_storage_device; + switch(storage -> ux_host_class_storage_op_state) { case UX_STATE_IDLE: @@ -130,6 +137,14 @@ UX_INTERRUPT_SAVE_AREA /* Run tasks, including transport task. */ _ux_system_host_tasks_run(); + /* Check if device is still available. */ + if (device -> ux_device_state != UX_DEVICE_CONFIGURED) + { + + /* Instance should have been destroyed, just return. */ + return(UX_STATE_EXIT); + } + /* In case state is not idle, check if it changes back. */ if (storage -> ux_host_class_storage_state_state == UX_STATE_IDLE) { diff --git a/common/usbx_host_classes/src/ux_host_class_storage_lock.c b/common/usbx_host_classes/src/ux_host_class_storage_lock.c index 25ffd3c1..a2a0616d 100644 --- a/common/usbx_host_classes/src/ux_host_class_storage_lock.c +++ b/common/usbx_host_classes/src/ux_host_class_storage_lock.c @@ -36,7 +36,7 @@ /* FUNCTION RELEASE */ /* */ /* _ux_host_class_storage_lock PORTABLE C */ -/* 6.1.10 */ +/* 6.x */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -71,12 +71,19 @@ /* DATE NAME DESCRIPTION */ /* */ /* 01-31-2022 Chaoqiong Xiao Initial Version 6.1.10 */ +/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* checked device state, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ UINT _ux_host_class_storage_lock(UX_HOST_CLASS_STORAGE *storage, ULONG wait) { UX_INTERRUPT_SAVE_AREA ULONG t0, t1; +UX_DEVICE *device; + + /* Get device. */ + device = storage -> ux_host_class_storage_device; t0 = _ux_utility_time_get(); while(1) @@ -129,6 +136,14 @@ ULONG t0, t1; /* Run stack tasks. */ _ux_system_host_tasks_run(); + + /* Check if device is still available. */ + if (device -> ux_device_state != UX_DEVICE_CONFIGURED) + { + + /* Instance should have been destroyed, just return. */ + return(UX_STATE_EXIT); + } } /* Lock storage. */ diff --git a/common/usbx_host_classes/src/ux_host_class_storage_media_read.c b/common/usbx_host_classes/src/ux_host_class_storage_media_read.c index cdfd0660..61cdcf76 100644 --- a/common/usbx_host_classes/src/ux_host_class_storage_media_read.c +++ b/common/usbx_host_classes/src/ux_host_class_storage_media_read.c @@ -82,7 +82,7 @@ ULONG command_length; /* FUNCTION RELEASE */ /* */ /* _ux_host_class_storage_media_read PORTABLE C */ -/* 6.1.10 */ +/* 6.x */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -123,6 +123,9 @@ ULONG command_length; /* 01-31-2022 Chaoqiong Xiao Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.1.10 */ +/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* checked device removal, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ UINT _ux_host_class_storage_media_read(UX_HOST_CLASS_STORAGE *storage, ULONG sector_start, @@ -134,6 +137,8 @@ UINT status; status = _ux_host_class_storage_read_write_run(storage, UX_TRUE, sector_start, sector_count, data_pointer); } while(status == UX_STATE_WAIT); + if (status < UX_STATE_IDLE) + return(UX_HOST_CLASS_INSTANCE_UNKNOWN); return(storage -> ux_host_class_storage_status); #else UINT status; diff --git a/common/usbx_host_classes/src/ux_host_class_storage_media_write.c b/common/usbx_host_classes/src/ux_host_class_storage_media_write.c index d21d731d..4ad2d17d 100644 --- a/common/usbx_host_classes/src/ux_host_class_storage_media_write.c +++ b/common/usbx_host_classes/src/ux_host_class_storage_media_write.c @@ -81,7 +81,7 @@ ULONG command_length; /* FUNCTION RELEASE */ /* */ /* _ux_host_class_storage_media_write PORTABLE C */ -/* 6.1.10 */ +/* 6.x */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -122,6 +122,9 @@ ULONG command_length; /* 01-31-2022 Chaoqiong Xiao Modified comment(s), */ /* added standalone support, */ /* resulting in version 6.1.10 */ +/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* checked device removal, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ UINT _ux_host_class_storage_media_write(UX_HOST_CLASS_STORAGE *storage, ULONG sector_start, @@ -133,6 +136,8 @@ UINT status; status = _ux_host_class_storage_read_write_run(storage, UX_FALSE, sector_start, sector_count, data_pointer); } while(status == UX_STATE_WAIT); + if (status < UX_STATE_IDLE) + return(UX_HOST_CLASS_INSTANCE_UNKNOWN); return(storage -> ux_host_class_storage_status); #else UINT status; diff --git a/common/usbx_host_classes/src/ux_host_class_storage_read_write_run.c b/common/usbx_host_classes/src/ux_host_class_storage_read_write_run.c index ac7c5e86..6077eb9a 100644 --- a/common/usbx_host_classes/src/ux_host_class_storage_read_write_run.c +++ b/common/usbx_host_classes/src/ux_host_class_storage_read_write_run.c @@ -43,7 +43,7 @@ extern VOID _ux_host_class_storage_write_initialize(UX_HOST_CLASS_STORAGE *stora /* FUNCTION RELEASE */ /* */ /* _ux_host_class_storage_read_write_run PORTABLE C */ -/* 6.1.10 */ +/* 6.x */ /* AUTHOR */ /* */ /* Chaoqiong Xiao, Microsoft Corporation */ @@ -93,6 +93,9 @@ extern VOID _ux_host_class_storage_write_initialize(UX_HOST_CLASS_STORAGE *stora /* DATE NAME DESCRIPTION */ /* */ /* 01-31-2022 Chaoqiong Xiao Initial Version 6.1.10 */ +/* xx-xx-xxxx Chaoqiong Xiao Modified comment(s), */ +/* checked device state, */ +/* resulting in version 6.x */ /* */ /**************************************************************************/ UINT _ux_host_class_storage_read_write_run(UX_HOST_CLASS_STORAGE *storage, @@ -100,6 +103,8 @@ UINT _ux_host_class_storage_read_write_run(UX_HOST_CLASS_STORAGE *storage, ULONG sector_start, ULONG sector_count, UCHAR *data_pointer) { +UX_DEVICE *device; + #if defined UX_HOST_CLASS_STORAGE_STATE_CHECK_ENABLE UX_INTERRUPT_SAVE_AREA @@ -125,6 +130,9 @@ UX_INTERRUPT_SAVE_AREA /* If trace is enabled, insert this event into the trace buffer. */ UX_TRACE_IN_LINE_INSERT(UX_TRACE_HOST_CLASS_STORAGE_MEDIA_READ, storage, sector_start, sector_count, data_pointer, UX_TRACE_HOST_CLASS_EVENTS, 0, 0) + /* Get device. */ + device = storage -> ux_host_class_storage_device; + switch(storage -> ux_host_class_storage_op_state) { case UX_STATE_IDLE: /* Fall through. */ @@ -150,6 +158,14 @@ UX_INTERRUPT_SAVE_AREA /* Run tasks, including transport task. */ _ux_system_host_tasks_run(); + /* Check if device is still available. */ + if (device -> ux_device_state != UX_DEVICE_CONFIGURED) + { + + /* Instance should have been destroyed, just return. */ + return(UX_STATE_EXIT); + } + /* Fatal error. */ if (storage -> ux_host_class_storage_op_state < UX_STATE_IDLE) return(UX_STATE_EXIT);