diff --git a/CMakeLists.txt b/CMakeLists.txt index f515e38..4729274 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,9 @@ project(filex LANGUAGES C ASM ) + +option(FX_STANDALONE_ENABLE "Enable Filex in standalone mode" OFF) + if(NOT DEFINED THREADX_ARCH) message(FATAL_ERROR "Error: THREADX_ARCH not defined") endif() @@ -18,9 +21,11 @@ add_library(${PROJECT_NAME}) add_library("azrtos::${PROJECT_NAME}" ALIAS ${PROJECT_NAME}) # Define any required dependencies between this library and others -target_link_libraries(${PROJECT_NAME} PUBLIC - "azrtos::threadx" -) +if(NOT FX_STANDALONE_ENABLE) + target_link_libraries(${PROJECT_NAME} PUBLIC + "azrtos::threadx" + ) +endif() # A place for generated/copied include files (no need to change) set(CUSTOM_INC_DIR ${CMAKE_CURRENT_BINARY_DIR}/custom_inc) @@ -46,7 +51,12 @@ target_include_directories(${PROJECT_NAME} PUBLIC ${CUSTOM_INC_DIR} ) -target_compile_definitions(${PROJECT_NAME} PUBLIC "FX_INCLUDE_USER_DEFINE_FILE" ) + +if(NOT FX_STANDALONE_ENABLE) + target_compile_definitions(${PROJECT_NAME} PUBLIC "FX_INCLUDE_USER_DEFINE_FILE" ) +else() + target_compile_definitions(${PROJECT_NAME} PUBLIC "FX_INCLUDE_USER_DEFINE_FILE" -DFX_STANDALONE_ENABLE) +endif() # Enable a build target that produces a ZIP file of all sources set(CPACK_SOURCE_GENERATOR "ZIP") @@ -60,4 +70,5 @@ set(CPACK_SOURCE_IGNORE_FILES ".*~$" ) set(CPACK_VERBATIM_VARIABLES YES) -include(CPack) \ No newline at end of file +include(CPack) + diff --git a/common/inc/fx_api.h b/common/inc/fx_api.h index 24fd735..adbb022 100644 --- a/common/inc/fx_api.h +++ b/common/inc/fx_api.h @@ -26,7 +26,7 @@ /* APPLICATION INTERFACE DEFINITION RELEASE */ /* */ /* fx_api.h PORTABLE C */ -/* 6.1.3 */ +/* 6.1.5 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -54,6 +54,9 @@ /* 12-31-2020 William E. Lamie Modified comment(s), and */ /* updated product constants, */ /* resulting in version 6.1.3 */ +/* 03-02-2021 William E. Lamie Modified comment(s), and */ +/* added standalone support, */ +/* resulting in version 6.1.5 */ /* */ /**************************************************************************/ @@ -91,6 +94,11 @@ extern "C" { #include "fx_port.h" +/* Define compiler library include files */ + +#ifdef FX_STANDALONE_ENABLE +#include "string.h" +#endif /* Define the major/minor version information that can be used by the application and the FileX source as well. */ @@ -98,11 +106,36 @@ extern "C" { #define AZURE_RTOS_FILEX #define FILEX_MAJOR_VERSION 6 #define FILEX_MINOR_VERSION 1 -#define FILEX_PATCH_VERSION 3 +#define FILEX_PATCH_VERSION 5 /* Define the following symbols for backward compatibility */ #define EL_PRODUCT_FILEX +#ifdef FX_STANDALONE_ENABLE + +/* FileX will be used without Azure RTOS ThreadX */ + +#ifndef FX_SINGLE_THREAD +#define FX_SINGLE_THREAD +#endif /* !FX_SINGLE_THREAD */ + + +/* FileX will be used with local path logic disabled */ + +#ifndef FX_NO_LOCAL_PATH +#define FX_NO_LOCAL_PATH +#endif /* !FX_NO_LOCAL_PATH */ + + +/* FileX is built without update to the time parameters. */ + +#ifndef FX_NO_TIMER +#define FX_NO_TIMER +#endif /* !FX_NO_TIMER */ + +#endif + + /* Override the interrupt protection provided in FileX port files to simply use ThreadX protection, which is often in-line assembly. */ @@ -148,14 +181,17 @@ extern "C" { #ifndef FX_NO_LOCAL_PATH #ifndef FX_LOCAL_PATH_SETUP +#ifndef FX_SINGLE_THREAD #define FX_LOCAL_PATH_SETUP extern TX_THREAD *_tx_thread_current_ptr; +#else +#define FX_NO_LOCAL_PATH +#endif #endif #endif - /* Determine if tracing is enabled. */ -#ifdef TX_ENABLE_EVENT_TRACE +#if defined(TX_ENABLE_EVENT_TRACE) && !defined(FX_STANDALONE_ENABLE) /* Trace is enabled. Remap calls so that interrupts can be disabled around the actual event logging. */ diff --git a/common/inc/fx_user_sample.h b/common/inc/fx_user_sample.h index 5335076..2c5bb69 100644 --- a/common/inc/fx_user_sample.h +++ b/common/inc/fx_user_sample.h @@ -26,7 +26,7 @@ /* PORT SPECIFIC C INFORMATION RELEASE */ /* */ /* fx_user.h PORTABLE C */ -/* 6.1 */ +/* 6.1.5 */ /* */ /* AUTHOR */ /* */ @@ -50,6 +50,9 @@ /* to enable code */ /* size optimization, */ /* resulting in version 6.1 */ +/* 03-02-2021 William E. Lamie Modified comment(s), and */ +/* added standalone support, */ +/* resulting in version 6.1.5 */ /* */ /**************************************************************************/ @@ -162,6 +165,11 @@ /* #define FX_SINGLE_THREAD */ +/* Defined, Filex will be used in standalone mode (without ThreadX) */ + +/* #define FX_STANDALONE_ENABLE */ + + /* Defined, data sector write requests are flushed immediately to the driver. */ /*#define FX_FAULT_TOLERANT_DATA */ diff --git a/common/src/fx_directory_entry_write.c b/common/src/fx_directory_entry_write.c index 0c3fe4c..54776ce 100644 --- a/common/src/fx_directory_entry_write.c +++ b/common/src/fx_directory_entry_write.c @@ -39,7 +39,7 @@ /* FUNCTION RELEASE */ /* */ /* _fx_directory_entry_write PORTABLE C */ -/* 6.1 */ +/* 6.1.5 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -78,6 +78,8 @@ /* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 09-30-2020 William E. Lamie Modified comment(s), */ /* resulting in version 6.1 */ +/* 03-02-2021 William E. Lamie Modified comment(s), */ +/* resulting in version 6.1.5 */ /* */ /**************************************************************************/ UINT _fx_directory_entry_write(FX_MEDIA *media_ptr, FX_DIR_ENTRY *entry_ptr) @@ -261,7 +263,7 @@ ULONG changed_offset; } /* Default the name match to true. */ - match = TX_TRUE; + match = FX_TRUE; /* Loop through the newly derived short name and the original name and look for a non-matching character. */ diff --git a/common/src/fx_directory_local_path_get.c b/common/src/fx_directory_local_path_get.c index 3be3921..31b0973 100644 --- a/common/src/fx_directory_local_path_get.c +++ b/common/src/fx_directory_local_path_get.c @@ -40,7 +40,7 @@ FX_LOCAL_PATH_SETUP /* FUNCTION RELEASE */ /* */ /* _fx_directory_local_path_get PORTABLE C */ -/* 6.1 */ +/* 6.1.5 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -74,6 +74,8 @@ FX_LOCAL_PATH_SETUP /* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 09-30-2020 William E. Lamie Modified comment(s), */ /* resulting in version 6.1 */ +/* 03-02-2021 William E. Lamie Modified comment(s), */ +/* resulting in version 6.1.5 */ /* */ /**************************************************************************/ UINT _fx_directory_local_path_get(FX_MEDIA *media_ptr, CHAR **return_path_name) @@ -96,6 +98,8 @@ UINT _fx_directory_local_path_get(FX_MEDIA *media_ptr, CHAR **return_path_name) #ifdef FX_NO_LOCAL_PATH + FX_PARAMETER_NOT_USED(return_path_name); + /* Error, return to caller. */ return(FX_NOT_IMPLEMENTED); #else diff --git a/common/src/fx_directory_local_path_restore.c b/common/src/fx_directory_local_path_restore.c index 1c21176..66bcff6 100644 --- a/common/src/fx_directory_local_path_restore.c +++ b/common/src/fx_directory_local_path_restore.c @@ -40,7 +40,7 @@ FX_LOCAL_PATH_SETUP /* FUNCTION RELEASE */ /* */ /* _fx_directory_local_path_restore PORTABLE C */ -/* 6.1 */ +/* 6.1.5 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -74,6 +74,8 @@ FX_LOCAL_PATH_SETUP /* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 09-30-2020 William E. Lamie Modified comment(s), */ /* resulting in version 6.1 */ +/* 03-02-2021 William E. Lamie Modified comment(s), */ +/* resulting in version 6.1.5 */ /* */ /**************************************************************************/ UINT _fx_directory_local_path_restore(FX_MEDIA *media_ptr, FX_LOCAL_PATH *local_path_ptr) @@ -96,6 +98,8 @@ UINT _fx_directory_local_path_restore(FX_MEDIA *media_ptr, FX_LOCAL_PATH *local #ifdef FX_NO_LOCAL_PATH + FX_PARAMETER_NOT_USED(local_path_ptr); + /* Error, return to caller. */ return(FX_NOT_IMPLEMENTED); #else diff --git a/common/src/fx_directory_local_path_set.c b/common/src/fx_directory_local_path_set.c index 9a54d64..01def03 100644 --- a/common/src/fx_directory_local_path_set.c +++ b/common/src/fx_directory_local_path_set.c @@ -40,7 +40,7 @@ FX_LOCAL_PATH_SETUP /* FUNCTION RELEASE */ /* */ /* _fx_directory_local_path_set PORTABLE C */ -/* 6.1 */ +/* 6.1.5 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -78,6 +78,8 @@ FX_LOCAL_PATH_SETUP /* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 09-30-2020 William E. Lamie Modified comment(s), */ /* resulting in version 6.1 */ +/* 03-02-2021 William E. Lamie Modified comment(s), */ +/* resulting in version 6.1.5 */ /* */ /**************************************************************************/ UINT _fx_directory_local_path_set(FX_MEDIA *media_ptr, FX_LOCAL_PATH *local_path_ptr, CHAR *new_path_name) @@ -121,6 +123,8 @@ FX_DIR_ENTRY dir_entry; #ifdef FX_NO_LOCAL_PATH + FX_PARAMETER_NOT_USED(new_path_name); + /* Error, return to caller. */ return(FX_NOT_IMPLEMENTED); #else diff --git a/common/src/fx_media_format.c b/common/src/fx_media_format.c index 050597a..ab0ff44 100644 --- a/common/src/fx_media_format.c +++ b/common/src/fx_media_format.c @@ -25,7 +25,6 @@ /* Include necessary system files. */ -#include "tx_api.h" #include "fx_api.h" #include "fx_media.h" #include "fx_utility.h" @@ -59,7 +58,7 @@ ULONG _fx_media_format_volume_id = 1; /* FUNCTION RELEASE */ /* */ /* _fx_media_format PORTABLE C */ -/* 6.1 */ +/* 6.1.5 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -116,6 +115,8 @@ ULONG _fx_media_format_volume_id = 1; /* added conditional to */ /* disable force memset, */ /* resulting in version 6.1 */ +/* 03-02-2021 William E. Lamie Modified comment(s), */ +/* resulting in version 6.1.5 */ /* */ /**************************************************************************/ UINT _fx_media_format(FX_MEDIA *media_ptr, VOID (*driver)(FX_MEDIA *media), VOID *driver_info_ptr, UCHAR *memory_ptr, UINT memory_size, diff --git a/common/src/fx_media_format_oem_name_set.c b/common/src/fx_media_format_oem_name_set.c index fea43a4..0dacf3f 100644 --- a/common/src/fx_media_format_oem_name_set.c +++ b/common/src/fx_media_format_oem_name_set.c @@ -25,7 +25,6 @@ /* Include necessary system files. */ -#include "tx_api.h" #include "fx_api.h" #include "fx_media.h" @@ -40,7 +39,7 @@ UINT fx_media_format_oem_name_set(UCHAR new_oem_name[8]); /* FUNCTION RELEASE */ /* */ /* _fx_media_format_oem_name_set PORTABLE C */ -/* 6.1 */ +/* 6.1.5 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -74,6 +73,8 @@ UINT fx_media_format_oem_name_set(UCHAR new_oem_name[8]); /* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 09-30-2020 William E. Lamie Modified comment(s), */ /* resulting in version 6.1 */ +/* 03-02-2021 William E. Lamie Modified comment(s), */ +/* resulting in version 6.1.5 */ /* */ /**************************************************************************/ UINT fx_media_format_oem_name_set(UCHAR new_oem_name[8]) diff --git a/common/src/fx_media_format_type_set.c b/common/src/fx_media_format_type_set.c index 69b8f59..a8e32aa 100644 --- a/common/src/fx_media_format_type_set.c +++ b/common/src/fx_media_format_type_set.c @@ -25,7 +25,6 @@ /* Include necessary system files. */ -#include "tx_api.h" #include "fx_api.h" #include "fx_media.h" @@ -40,7 +39,7 @@ UINT fx_media_format_type_set(UCHAR new_media_type); /* FUNCTION RELEASE */ /* */ /* _fx_media_format_type_set PORTABLE C */ -/* 6.1 */ +/* 6.1.5 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -73,6 +72,8 @@ UINT fx_media_format_type_set(UCHAR new_media_type); /* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 09-30-2020 William E. Lamie Modified comment(s), */ /* resulting in version 6.1 */ +/* 03-02-2021 William E. Lamie Modified comment(s), */ +/* resulting in version 6.1.5 */ /* */ /**************************************************************************/ UINT fx_media_format_type_set(UCHAR new_media_type) diff --git a/common/src/fx_media_format_volume_id_set.c b/common/src/fx_media_format_volume_id_set.c index 2728df4..72b8f28 100644 --- a/common/src/fx_media_format_volume_id_set.c +++ b/common/src/fx_media_format_volume_id_set.c @@ -25,7 +25,6 @@ /* Include necessary system files. */ -#include "tx_api.h" #include "fx_api.h" #include "fx_media.h" @@ -40,7 +39,7 @@ UINT fx_media_format_volume_id_set(ULONG new_volume_id); /* FUNCTION RELEASE */ /* */ /* _fx_media_format_media_volume_id_set PORTABLE C */ -/* 6.1 */ +/* 6.1.5 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -74,6 +73,8 @@ UINT fx_media_format_volume_id_set(ULONG new_volume_id); /* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 09-30-2020 William E. Lamie Modified comment(s), */ /* resulting in version 6.1 */ +/* 03-02-2021 William E. Lamie Modified comment(s), */ +/* resulting in version 6.1.5 */ /* */ /**************************************************************************/ UINT fx_media_format_volume_id_set(ULONG new_volume_id) diff --git a/common/src/fx_ram_driver.c b/common/src/fx_ram_driver.c index 1ed73d7..10d8de0 100644 --- a/common/src/fx_ram_driver.c +++ b/common/src/fx_ram_driver.c @@ -23,7 +23,6 @@ /* Include necessary system files. */ -#include "tx_api.h" #include "fx_api.h" @@ -57,7 +56,7 @@ VOID _fx_ram_driver(FX_MEDIA *media_ptr); /* FUNCTION RELEASE */ /* */ /* _fx_ram_driver PORTABLE C */ -/* 6.1 */ +/* 6.1.5 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -107,6 +106,8 @@ VOID _fx_ram_driver(FX_MEDIA *media_ptr); /* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 09-30-2020 William E. Lamie Modified comment(s), */ /* resulting in version 6.1 */ +/* 03-02-2021 William E. Lamie Modified comment(s), */ +/* resulting in version 6.1.5 */ /* */ /**************************************************************************/ VOID _fx_ram_driver(FX_MEDIA *media_ptr) diff --git a/common/src/fx_utility_exFAT_size_calculate.c b/common/src/fx_utility_exFAT_size_calculate.c index 58678cd..2996123 100644 --- a/common/src/fx_utility_exFAT_size_calculate.c +++ b/common/src/fx_utility_exFAT_size_calculate.c @@ -39,7 +39,7 @@ /* FUNCTION RELEASE */ /* */ /* _fx_utility_exFAT_size_calculate PORTABLE C */ -/* 6.1 */ +/* 6.1.5 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -77,6 +77,9 @@ /* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 09-30-2020 William E. Lamie Modified comment(s), */ /* resulting in version 6.1 */ +/* 03-02-2021 William E. Lamie Modified comment(s), fixed */ +/* FAT size calculation issue, */ +/* resulting in version 6.1.5 */ /* */ /**************************************************************************/ VOID _fx_utility_exFAT_size_calculate(ULONG boundary_unit, ULONG64 size_in_sectors, ULONG sectors_per_cluster, @@ -123,21 +126,26 @@ ULONG64 total_cluster_heap_sectors; } else /* Recalculate FAT size since System Area will be increased on FAT size. */ { + do + { - /* Increase System Area size on number of FAT sectors aligned according BU. */ - system_area_sectors += *sectors_per_fat_ptr; + /* Increase System Area size on number of FAT sectors aligned according BU. */ + system_area_sectors = *fat_offset_ptr + *sectors_per_fat_ptr; - /* Decrease sectors available for clusters heap. */ - total_cluster_heap_sectors = size_in_sectors - system_area_sectors; + /* Decrease sectors available for clusters heap. */ + total_cluster_heap_sectors = size_in_sectors - system_area_sectors; - /* Re-calculate number of sectors per FAT. */ - *sectors_per_fat_ptr = (ULONG)DIVIDE_TO_CEILING(((total_cluster_heap_sectors / sectors_per_cluster) * EXFAT_FAT_BITS), - (FX_BOOT_SECTOR_SIZE * BITS_PER_BYTE)); + /* Re-calculate number of sectors per FAT. */ + *sectors_per_fat_ptr = (ULONG)DIVIDE_TO_CEILING(((total_cluster_heap_sectors / sectors_per_cluster) * EXFAT_FAT_BITS), + (FX_BOOT_SECTOR_SIZE * BITS_PER_BYTE)); - *sectors_per_fat_ptr = ALIGN_UP(*sectors_per_fat_ptr, boundary_unit >> 1); + *sectors_per_fat_ptr = ALIGN_UP(*sectors_per_fat_ptr, boundary_unit >> 1); - /* Increase Cluster Heap offset according new FAT size. */ - *cluster_heap_offset_ptr += *sectors_per_fat_ptr; + /* Increase Cluster Heap offset according new FAT size. */ + *cluster_heap_offset_ptr = *fat_offset_ptr + *sectors_per_fat_ptr; + + /* Loop until we find a FAT size that can hold all the clusters. */ + }while (*sectors_per_fat_ptr * FX_BOOT_SECTOR_SIZE * BITS_PER_BYTE / EXFAT_FAT_BITS < ((size_in_sectors - *cluster_heap_offset_ptr) / sectors_per_cluster)); } } diff --git a/common/src/fxe_media_exFAT_format.c b/common/src/fxe_media_exFAT_format.c index 49ebb2f..09fefc4 100644 --- a/common/src/fxe_media_exFAT_format.c +++ b/common/src/fxe_media_exFAT_format.c @@ -24,7 +24,6 @@ /* Include necessary system files. */ -#include "tx_api.h" #include "fx_api.h" @@ -40,7 +39,7 @@ FX_CALLER_CHECKING_EXTERNS /* FUNCTION RELEASE */ /* */ /* _fxe_media_exFAT_format PORTABLE C */ -/* 6.1 */ +/* 6.1.5 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -90,6 +89,8 @@ FX_CALLER_CHECKING_EXTERNS /* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 09-30-2020 William E. Lamie Modified comment(s), */ /* resulting in version 6.1 */ +/* 03-02-2021 William E. Lamie Modified comment(s), */ +/* resulting in version 6.1.5 */ /* */ /**************************************************************************/ UINT _fxe_media_exFAT_format(FX_MEDIA *media_ptr, VOID (*driver)(FX_MEDIA *media), VOID *driver_info_ptr, diff --git a/common/src/fxe_media_format.c b/common/src/fxe_media_format.c index af72fff..196852b 100644 --- a/common/src/fxe_media_format.c +++ b/common/src/fxe_media_format.c @@ -25,7 +25,6 @@ /* Include necessary system files. */ -#include "tx_api.h" #include "fx_api.h" #include "fx_media.h" @@ -38,7 +37,7 @@ FX_CALLER_CHECKING_EXTERNS /* FUNCTION RELEASE */ /* */ /* _fxe_media_format PORTABLE C */ -/* 6.1 */ +/* 6.1.5 */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ @@ -89,6 +88,8 @@ FX_CALLER_CHECKING_EXTERNS /* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 09-30-2020 William E. Lamie Modified comment(s), */ /* resulting in version 6.1 */ +/* 03-02-2021 William E. Lamie Modified comment(s), */ +/* resulting in version 6.1.5 */ /* */ /**************************************************************************/ UINT _fxe_media_format(FX_MEDIA *media_ptr, VOID (*driver)(FX_MEDIA *media), VOID *driver_info_ptr, UCHAR *memory_ptr, UINT memory_size, diff --git a/ports/cortex_m0/gnu/inc/fx_port.h b/ports/cortex_m0/gnu/inc/fx_port.h index 0edf665..6d98724 100644 --- a/ports/cortex_m0/gnu/inc/fx_port.h +++ b/ports/cortex_m0/gnu/inc/fx_port.h @@ -26,7 +26,7 @@ /* PORT SPECIFIC C INFORMATION RELEASE */ /* */ /* fx_port.h Cortex-M0/GNU */ -/* 6.1 */ +/* 6.1.5 */ /* */ /* AUTHOR */ /* */ @@ -47,6 +47,8 @@ /* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 09-30-2020 William E. Lamie Modified comment(s), */ /* resulting in version 6.1 */ +/* 03-02-2021 William E. Lamie Modified comment(s), */ +/* resulting in version 6.1.5 */ /* */ /**************************************************************************/ @@ -68,6 +70,7 @@ /* Include the ThreadX api file. */ +#ifndef FX_STANDALONE_ENABLE #include "tx_api.h" @@ -78,13 +81,45 @@ typedef unsigned long long ULONG64; #endif +#else + +/* Define compiler library include files. */ + +#include +#include + +#define VOID void +typedef char CHAR; +typedef char BOOL; +typedef unsigned char UCHAR; +typedef int INT; +typedef unsigned int UINT; +typedef long LONG; +typedef unsigned long ULONG; +typedef short SHORT; +typedef unsigned short USHORT; + +#ifndef ULONG64_DEFINED +#define ULONG64_DEFINED +typedef unsigned long long ULONG64; +#endif + +/* Define basic alignment type used in block and byte pool operations. This data type must + be at least 32-bits in size and also be large enough to hold a pointer type. */ + +#ifndef ALIGN_TYPE_DEFINED +#define ALIGN_TYPE_DEFINED +#define ALIGN_TYPE ULONG +#endif + +#endif /* Define FileX internal protection macros. If FX_SINGLE_THREAD is defined, these protection macros are effectively disabled. However, for multi-thread uses, the macros are setup to utilize a ThreadX mutex for multiple thread access control into an open media. */ -#ifdef FX_SINGLE_THREAD +#if defined(FX_SINGLE_THREAD) || defined(FX_STANDALONE_ENABLE) #define FX_PROTECT #define FX_UNPROTECT #else @@ -96,16 +131,33 @@ typedef unsigned long long ULONG64; /* Define interrupt lockout constructs to protect the system date/time from being updated while they are being read. */ - +#ifndef FX_STANDALONE_ENABLE +#ifndef FX_INT_SAVE_AREA #define FX_INT_SAVE_AREA unsigned int old_interrupt_posture; -#define FX_DISABLE_INTS old_interrupt_posture = tx_interrupt_control(TX_INT_DISABLE); -#define FX_RESTORE_INTS tx_interrupt_control(old_interrupt_posture); +#endif +#ifndef FX_DISABLE_INTS +#define FX_DISABLE_INTS old_interrupt_posture = tx_interrupt_control(TX_INT_DISABLE); +#endif + +#ifndef FX_RESTORE_INTS +#define FX_RESTORE_INTS tx_interrupt_control(old_interrupt_posture); +#endif +#else +/* Disable use of ThreadX protection in standalone mode for FileX */ +#ifndef FX_LEGACY_INTERRUPT_PROTECTION +#define FX_LEGACY_INTERRUPT_PROTECTION +#endif +#define FX_INT_SAVE_AREA +#define FX_DISABLE_INTS +#define FX_RESTORE_INTS +#endif /* Define the error checking logic to determine if there is a caller error in the FileX API. The default definitions assume ThreadX is being used. This code can be completely turned off by just defining these macros to white space. */ +#ifndef FX_STANDALONE_ENABLE #ifndef TX_TIMER_PROCESS_IN_ISR #define FX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \ @@ -125,6 +177,10 @@ typedef unsigned long long ULONG64; (_tx_thread_current_ptr == TX_NULL)) \ return(FX_CALLER_ERROR); #endif +#else +#define FX_CALLER_CHECKING_EXTERNS +#define FX_CALLER_CHECKING_CODE +#endif /* Define the update rate of the system timer. These values may also be defined at the command @@ -146,7 +202,7 @@ typedef unsigned long long ULONG64; this value is derived from TX_TIMER_TICKS_PER_SECOND. */ #ifndef FX_UPDATE_RATE_IN_TICKS -#ifdef TX_TIMER_TICKS_PER_SECOND +#if (defined(TX_TIMER_TICKS_PER_SECOND) && (!defined(FX_STANDALONE_ENABLE))) #define FX_UPDATE_RATE_IN_TICKS (TX_TIMER_TICKS_PER_SECOND * FX_UPDATE_RATE_IN_SECONDS) #else #define FX_UPDATE_RATE_IN_TICKS 1000 @@ -158,7 +214,7 @@ typedef unsigned long long ULONG64; #ifdef FX_SYSTEM_INIT CHAR _fx_version_id[] = - "Copyright (c) Microsoft Corporation. All rights reserved. * FileX Cortex-M0/GNU Version 6.1 *"; + "Copyright (c) Microsoft Corporation. All rights reserved. * FileX Cortex-M0/GNU Version 6.1.5 *"; #else extern CHAR _fx_version_id[]; #endif diff --git a/ports/cortex_m3/gnu/inc/fx_port.h b/ports/cortex_m3/gnu/inc/fx_port.h index 2581390..14c8a2d 100644 --- a/ports/cortex_m3/gnu/inc/fx_port.h +++ b/ports/cortex_m3/gnu/inc/fx_port.h @@ -26,7 +26,7 @@ /* PORT SPECIFIC C INFORMATION RELEASE */ /* */ /* fx_port.h Cortex-M3/GNU */ -/* 6.1 */ +/* 6.1.5 */ /* */ /* AUTHOR */ /* */ @@ -47,6 +47,8 @@ /* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 09-30-2020 William E. Lamie Modified comment(s), */ /* resulting in version 6.1 */ +/* 03-02-2021 William E. Lamie Modified comment(s), */ +/* resulting in version 6.1.5 */ /* */ /**************************************************************************/ @@ -68,6 +70,7 @@ /* Include the ThreadX api file. */ +#ifndef FX_STANDALONE_ENABLE #include "tx_api.h" @@ -78,13 +81,45 @@ typedef unsigned long long ULONG64; #endif +#else + +/* Define compiler library include files. */ + +#include +#include + +#define VOID void +typedef char CHAR; +typedef char BOOL; +typedef unsigned char UCHAR; +typedef int INT; +typedef unsigned int UINT; +typedef long LONG; +typedef unsigned long ULONG; +typedef short SHORT; +typedef unsigned short USHORT; + +#ifndef ULONG64_DEFINED +#define ULONG64_DEFINED +typedef unsigned long long ULONG64; +#endif + +/* Define basic alignment type used in block and byte pool operations. This data type must + be at least 32-bits in size and also be large enough to hold a pointer type. */ + +#ifndef ALIGN_TYPE_DEFINED +#define ALIGN_TYPE_DEFINED +#define ALIGN_TYPE ULONG +#endif + +#endif /* Define FileX internal protection macros. If FX_SINGLE_THREAD is defined, these protection macros are effectively disabled. However, for multi-thread uses, the macros are setup to utilize a ThreadX mutex for multiple thread access control into an open media. */ -#ifdef FX_SINGLE_THREAD +#if defined(FX_SINGLE_THREAD) || defined(FX_STANDALONE_ENABLE) #define FX_PROTECT #define FX_UNPROTECT #else @@ -96,16 +131,33 @@ typedef unsigned long long ULONG64; /* Define interrupt lockout constructs to protect the system date/time from being updated while they are being read. */ - +#ifndef FX_STANDALONE_ENABLE +#ifndef FX_INT_SAVE_AREA #define FX_INT_SAVE_AREA unsigned int old_interrupt_posture; -#define FX_DISABLE_INTS old_interrupt_posture = tx_interrupt_control(TX_INT_DISABLE); -#define FX_RESTORE_INTS tx_interrupt_control(old_interrupt_posture); +#endif +#ifndef FX_DISABLE_INTS +#define FX_DISABLE_INTS old_interrupt_posture = tx_interrupt_control(TX_INT_DISABLE); +#endif + +#ifndef FX_RESTORE_INTS +#define FX_RESTORE_INTS tx_interrupt_control(old_interrupt_posture); +#endif +#else +/* Disable use of ThreadX protection in standalone mode for FileX */ +#ifndef FX_LEGACY_INTERRUPT_PROTECTION +#define FX_LEGACY_INTERRUPT_PROTECTION +#endif +#define FX_INT_SAVE_AREA +#define FX_DISABLE_INTS +#define FX_RESTORE_INTS +#endif /* Define the error checking logic to determine if there is a caller error in the FileX API. The default definitions assume ThreadX is being used. This code can be completely turned off by just defining these macros to white space. */ +#ifndef FX_STANDALONE_ENABLE #ifndef TX_TIMER_PROCESS_IN_ISR #define FX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \ @@ -125,6 +177,10 @@ typedef unsigned long long ULONG64; (_tx_thread_current_ptr == TX_NULL)) \ return(FX_CALLER_ERROR); #endif +#else +#define FX_CALLER_CHECKING_EXTERNS +#define FX_CALLER_CHECKING_CODE +#endif /* Define the update rate of the system timer. These values may also be defined at the command @@ -146,7 +202,7 @@ typedef unsigned long long ULONG64; this value is derived from TX_TIMER_TICKS_PER_SECOND. */ #ifndef FX_UPDATE_RATE_IN_TICKS -#ifdef TX_TIMER_TICKS_PER_SECOND +#if (defined(TX_TIMER_TICKS_PER_SECOND) && (!defined(FX_STANDALONE_ENABLE))) #define FX_UPDATE_RATE_IN_TICKS (TX_TIMER_TICKS_PER_SECOND * FX_UPDATE_RATE_IN_SECONDS) #else #define FX_UPDATE_RATE_IN_TICKS 1000 @@ -158,7 +214,7 @@ typedef unsigned long long ULONG64; #ifdef FX_SYSTEM_INIT CHAR _fx_version_id[] = - "Copyright (c) Microsoft Corporation. All rights reserved. * FileX Cortex-M3/GNU Version 6.1 *"; + "Copyright (c) Microsoft Corporation. All rights reserved. * FileX Cortex-M3/GNU Version 6.1.5 *"; #else extern CHAR _fx_version_id[]; #endif diff --git a/ports/cortex_m4/gnu/inc/fx_port.h b/ports/cortex_m4/gnu/inc/fx_port.h index 43d9f72..471e5bc 100644 --- a/ports/cortex_m4/gnu/inc/fx_port.h +++ b/ports/cortex_m4/gnu/inc/fx_port.h @@ -26,7 +26,7 @@ /* PORT SPECIFIC C INFORMATION RELEASE */ /* */ /* fx_port.h Cortex-M4/GNU */ -/* 6.1 */ +/* 6.1.5 */ /* */ /* AUTHOR */ /* */ @@ -47,6 +47,8 @@ /* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 09-30-2020 William E. Lamie Modified comment(s), */ /* resulting in version 6.1 */ +/* 03-02-2021 William E. Lamie Modified comment(s), */ +/* resulting in version 6.1.5 */ /* */ /**************************************************************************/ @@ -68,6 +70,7 @@ /* Include the ThreadX api file. */ +#ifndef FX_STANDALONE_ENABLE #include "tx_api.h" @@ -78,13 +81,45 @@ typedef unsigned long long ULONG64; #endif +#else + +/* Define compiler library include files. */ + +#include +#include + +#define VOID void +typedef char CHAR; +typedef char BOOL; +typedef unsigned char UCHAR; +typedef int INT; +typedef unsigned int UINT; +typedef long LONG; +typedef unsigned long ULONG; +typedef short SHORT; +typedef unsigned short USHORT; + +#ifndef ULONG64_DEFINED +#define ULONG64_DEFINED +typedef unsigned long long ULONG64; +#endif + +/* Define basic alignment type used in block and byte pool operations. This data type must + be at least 32-bits in size and also be large enough to hold a pointer type. */ + +#ifndef ALIGN_TYPE_DEFINED +#define ALIGN_TYPE_DEFINED +#define ALIGN_TYPE ULONG +#endif + +#endif /* Define FileX internal protection macros. If FX_SINGLE_THREAD is defined, these protection macros are effectively disabled. However, for multi-thread uses, the macros are setup to utilize a ThreadX mutex for multiple thread access control into an open media. */ -#ifdef FX_SINGLE_THREAD +#if defined(FX_SINGLE_THREAD) || defined(FX_STANDALONE_ENABLE) #define FX_PROTECT #define FX_UNPROTECT #else @@ -96,16 +131,33 @@ typedef unsigned long long ULONG64; /* Define interrupt lockout constructs to protect the system date/time from being updated while they are being read. */ - +#ifndef FX_STANDALONE_ENABLE +#ifndef FX_INT_SAVE_AREA #define FX_INT_SAVE_AREA unsigned int old_interrupt_posture; -#define FX_DISABLE_INTS old_interrupt_posture = tx_interrupt_control(TX_INT_DISABLE); -#define FX_RESTORE_INTS tx_interrupt_control(old_interrupt_posture); +#endif +#ifndef FX_DISABLE_INTS +#define FX_DISABLE_INTS old_interrupt_posture = tx_interrupt_control(TX_INT_DISABLE); +#endif + +#ifndef FX_RESTORE_INTS +#define FX_RESTORE_INTS tx_interrupt_control(old_interrupt_posture); +#endif +#else +/* Disable use of ThreadX protection in standalone mode for FileX */ +#ifndef FX_LEGACY_INTERRUPT_PROTECTION +#define FX_LEGACY_INTERRUPT_PROTECTION +#endif +#define FX_INT_SAVE_AREA +#define FX_DISABLE_INTS +#define FX_RESTORE_INTS +#endif /* Define the error checking logic to determine if there is a caller error in the FileX API. The default definitions assume ThreadX is being used. This code can be completely turned off by just defining these macros to white space. */ +#ifndef FX_STANDALONE_ENABLE #ifndef TX_TIMER_PROCESS_IN_ISR #define FX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \ @@ -125,6 +177,10 @@ typedef unsigned long long ULONG64; (_tx_thread_current_ptr == TX_NULL)) \ return(FX_CALLER_ERROR); #endif +#else +#define FX_CALLER_CHECKING_EXTERNS +#define FX_CALLER_CHECKING_CODE +#endif /* Define the update rate of the system timer. These values may also be defined at the command @@ -146,7 +202,7 @@ typedef unsigned long long ULONG64; this value is derived from TX_TIMER_TICKS_PER_SECOND. */ #ifndef FX_UPDATE_RATE_IN_TICKS -#ifdef TX_TIMER_TICKS_PER_SECOND +#if (defined(TX_TIMER_TICKS_PER_SECOND) && (!defined(FX_STANDALONE_ENABLE))) #define FX_UPDATE_RATE_IN_TICKS (TX_TIMER_TICKS_PER_SECOND * FX_UPDATE_RATE_IN_SECONDS) #else #define FX_UPDATE_RATE_IN_TICKS 1000 @@ -158,7 +214,7 @@ typedef unsigned long long ULONG64; #ifdef FX_SYSTEM_INIT CHAR _fx_version_id[] = - "Copyright (c) Microsoft Corporation. All rights reserved. * FileX Cortex-M4/GNU Version 6.1 *"; + "Copyright (c) Microsoft Corporation. All rights reserved. * FileX Cortex-M4/GNU Version 6.1.5 *"; #else extern CHAR _fx_version_id[]; #endif diff --git a/ports/cortex_m7/gnu/inc/fx_port.h b/ports/cortex_m7/gnu/inc/fx_port.h index be7f34a..f77fd44 100644 --- a/ports/cortex_m7/gnu/inc/fx_port.h +++ b/ports/cortex_m7/gnu/inc/fx_port.h @@ -26,7 +26,7 @@ /* PORT SPECIFIC C INFORMATION RELEASE */ /* */ /* fx_port.h Cortex-M7/GNU */ -/* 6.1 */ +/* 6.1.5 */ /* */ /* AUTHOR */ /* */ @@ -47,6 +47,8 @@ /* 05-19-2020 William E. Lamie Initial Version 6.0 */ /* 09-30-2020 William E. Lamie Modified comment(s), */ /* resulting in version 6.1 */ +/* 03-02-2021 William E. Lamie Modified comment(s), */ +/* resulting in version 6.1.5 */ /* */ /**************************************************************************/ @@ -68,6 +70,7 @@ /* Include the ThreadX api file. */ +#ifndef FX_STANDALONE_ENABLE #include "tx_api.h" @@ -78,13 +81,45 @@ typedef unsigned long long ULONG64; #endif +#else + +/* Define compiler library include files. */ + +#include +#include + +#define VOID void +typedef char CHAR; +typedef char BOOL; +typedef unsigned char UCHAR; +typedef int INT; +typedef unsigned int UINT; +typedef long LONG; +typedef unsigned long ULONG; +typedef short SHORT; +typedef unsigned short USHORT; + +#ifndef ULONG64_DEFINED +#define ULONG64_DEFINED +typedef unsigned long long ULONG64; +#endif + +/* Define basic alignment type used in block and byte pool operations. This data type must + be at least 32-bits in size and also be large enough to hold a pointer type. */ + +#ifndef ALIGN_TYPE_DEFINED +#define ALIGN_TYPE_DEFINED +#define ALIGN_TYPE ULONG +#endif + +#endif /* Define FileX internal protection macros. If FX_SINGLE_THREAD is defined, these protection macros are effectively disabled. However, for multi-thread uses, the macros are setup to utilize a ThreadX mutex for multiple thread access control into an open media. */ -#ifdef FX_SINGLE_THREAD +#if defined(FX_SINGLE_THREAD) || defined(FX_STANDALONE_ENABLE) #define FX_PROTECT #define FX_UNPROTECT #else @@ -96,16 +131,33 @@ typedef unsigned long long ULONG64; /* Define interrupt lockout constructs to protect the system date/time from being updated while they are being read. */ - +#ifndef FX_STANDALONE_ENABLE +#ifndef FX_INT_SAVE_AREA #define FX_INT_SAVE_AREA unsigned int old_interrupt_posture; -#define FX_DISABLE_INTS old_interrupt_posture = tx_interrupt_control(TX_INT_DISABLE); -#define FX_RESTORE_INTS tx_interrupt_control(old_interrupt_posture); +#endif +#ifndef FX_DISABLE_INTS +#define FX_DISABLE_INTS old_interrupt_posture = tx_interrupt_control(TX_INT_DISABLE); +#endif + +#ifndef FX_RESTORE_INTS +#define FX_RESTORE_INTS tx_interrupt_control(old_interrupt_posture); +#endif +#else +/* Disable use of ThreadX protection in standalone mode for FileX */ +#ifndef FX_LEGACY_INTERRUPT_PROTECTION +#define FX_LEGACY_INTERRUPT_PROTECTION +#endif +#define FX_INT_SAVE_AREA +#define FX_DISABLE_INTS +#define FX_RESTORE_INTS +#endif /* Define the error checking logic to determine if there is a caller error in the FileX API. The default definitions assume ThreadX is being used. This code can be completely turned off by just defining these macros to white space. */ +#ifndef FX_STANDALONE_ENABLE #ifndef TX_TIMER_PROCESS_IN_ISR #define FX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \ @@ -125,6 +177,10 @@ typedef unsigned long long ULONG64; (_tx_thread_current_ptr == TX_NULL)) \ return(FX_CALLER_ERROR); #endif +#else +#define FX_CALLER_CHECKING_EXTERNS +#define FX_CALLER_CHECKING_CODE +#endif /* Define the update rate of the system timer. These values may also be defined at the command @@ -146,7 +202,7 @@ typedef unsigned long long ULONG64; this value is derived from TX_TIMER_TICKS_PER_SECOND. */ #ifndef FX_UPDATE_RATE_IN_TICKS -#ifdef TX_TIMER_TICKS_PER_SECOND +#if (defined(TX_TIMER_TICKS_PER_SECOND) && (!defined(FX_STANDALONE_ENABLE))) #define FX_UPDATE_RATE_IN_TICKS (TX_TIMER_TICKS_PER_SECOND * FX_UPDATE_RATE_IN_SECONDS) #else #define FX_UPDATE_RATE_IN_TICKS 1000 @@ -158,7 +214,7 @@ typedef unsigned long long ULONG64; #ifdef FX_SYSTEM_INIT CHAR _fx_version_id[] = - "Copyright (c) Microsoft Corporation. All rights reserved. * FileX Cortex-M7/GNU Version 6.1 *"; + "Copyright (c) Microsoft Corporation. All rights reserved. * FileX Cortex-M7/GNU Version 6.1.5 *"; #else extern CHAR _fx_version_id[]; #endif diff --git a/ports/generic/inc/fx_port.h b/ports/generic/inc/fx_port.h index af3d458..d5100aa 100644 --- a/ports/generic/inc/fx_port.h +++ b/ports/generic/inc/fx_port.h @@ -26,7 +26,7 @@ /* PORT SPECIFIC C INFORMATION RELEASE */ /* */ /* fx_port.h Generic */ -/* 6.1.2 */ +/* 6.1.5 */ /* */ /* AUTHOR */ /* */ @@ -45,6 +45,9 @@ /* DATE NAME DESCRIPTION */ /* */ /* 11-09-2020 William E. Lamie Initial Version 6.1.2 */ +/* 03-02-2021 William E. Lamie Modified comment(s), and */ +/* added standalone support, */ +/* resulting in version 6.1.5 */ /* */ /**************************************************************************/ @@ -66,6 +69,7 @@ /* Include the ThreadX api file. */ +#ifndef FX_STANDALONE_ENABLE #include "tx_api.h" @@ -76,13 +80,45 @@ typedef unsigned long long ULONG64; #endif +#else + +/* Define compiler library include files. */ + +#include +#include + +#define VOID void +typedef char CHAR; +typedef char BOOL; +typedef unsigned char UCHAR; +typedef int INT; +typedef unsigned int UINT; +typedef long LONG; +typedef unsigned long ULONG; +typedef short SHORT; +typedef unsigned short USHORT; + +#ifndef ULONG64_DEFINED +#define ULONG64_DEFINED +typedef unsigned long long ULONG64; +#endif + +/* Define basic alignment type used in block and byte pool operations. This data type must + be at least 32-bits in size and also be large enough to hold a pointer type. */ + +#ifndef ALIGN_TYPE_DEFINED +#define ALIGN_TYPE_DEFINED +#define ALIGN_TYPE ULONG +#endif + +#endif /* Define FileX internal protection macros. If FX_SINGLE_THREAD is defined, these protection macros are effectively disabled. However, for multi-thread uses, the macros are setup to utilize a ThreadX mutex for multiple thread access control into an open media. */ -#ifdef FX_SINGLE_THREAD +#if defined(FX_SINGLE_THREAD) || defined(FX_STANDALONE_ENABLE) #define FX_PROTECT #define FX_UNPROTECT #else @@ -94,6 +130,7 @@ typedef unsigned long long ULONG64; /* Define interrupt lockout constructs to protect the system date/time from being updated while they are being read. */ +#ifndef FX_STANDALONE_ENABLE #ifndef FX_INT_SAVE_AREA #define FX_INT_SAVE_AREA unsigned int old_interrupt_posture; #endif @@ -105,11 +142,21 @@ typedef unsigned long long ULONG64; #ifndef FX_RESTORE_INTS #define FX_RESTORE_INTS tx_interrupt_control(old_interrupt_posture); #endif +#else +/* Disable use of ThreadX protection in standalone mode for FileX */ +#ifndef FX_LEGACY_INTERRUPT_PROTECTION +#define FX_LEGACY_INTERRUPT_PROTECTION +#endif +#define FX_INT_SAVE_AREA +#define FX_DISABLE_INTS +#define FX_RESTORE_INTS +#endif /* Define the error checking logic to determine if there is a caller error in the FileX API. The default definitions assume ThreadX is being used. This code can be completely turned off by just defining these macros to white space. */ +#ifndef FX_STANDALONE_ENABLE #ifndef TX_TIMER_PROCESS_IN_ISR #define FX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \ @@ -129,6 +176,10 @@ typedef unsigned long long ULONG64; (_tx_thread_current_ptr == TX_NULL)) \ return(FX_CALLER_ERROR); #endif +#else +#define FX_CALLER_CHECKING_EXTERNS +#define FX_CALLER_CHECKING_CODE +#endif /* Define the update rate of the system timer. These values may also be defined at the command @@ -150,7 +201,7 @@ typedef unsigned long long ULONG64; this value is derived from TX_TIMER_TICKS_PER_SECOND. */ #ifndef FX_UPDATE_RATE_IN_TICKS -#ifdef TX_TIMER_TICKS_PER_SECOND +#if (defined(TX_TIMER_TICKS_PER_SECOND) && (!defined(FX_STANDALONE_ENABLE))) #define FX_UPDATE_RATE_IN_TICKS (TX_TIMER_TICKS_PER_SECOND * FX_UPDATE_RATE_IN_SECONDS) #else #define FX_UPDATE_RATE_IN_TICKS 1000 @@ -162,7 +213,7 @@ typedef unsigned long long ULONG64; #ifdef FX_SYSTEM_INIT CHAR _fx_version_id[] = - "Copyright (c) Microsoft Corporation. All rights reserved. * FileX Generic Version 6.1.2 *"; + "Copyright (c) Microsoft Corporation. All rights reserved. * FileX Generic Version 6.1.5 *"; #else extern CHAR _fx_version_id[]; #endif diff --git a/ports/linux/gnu/inc/fx_port.h b/ports/linux/gnu/inc/fx_port.h index be94c93..1985da0 100644 --- a/ports/linux/gnu/inc/fx_port.h +++ b/ports/linux/gnu/inc/fx_port.h @@ -26,7 +26,7 @@ /* PORT SPECIFIC C INFORMATION RELEASE */ /* */ /* fx_port.h Linux/GCC */ -/* 6.1 */ +/* 6.1.5 */ /* */ /* AUTHOR */ /* */ @@ -45,6 +45,9 @@ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 03-02-2021 William E. Lamie Modified comment(s), and */ +/* added standalone support, */ +/* resulting in version 6.1.5 */ /* */ /**************************************************************************/ @@ -67,8 +70,42 @@ /* Include the ThreadX api file. */ +#ifndef FX_STANDALONE_ENABLE + #include "tx_api.h" +#else + +/* Define compiler library include files. */ + +#include +#include + +#define VOID void +typedef char CHAR; +typedef char BOOL; +typedef unsigned char UCHAR; +typedef int INT; +typedef unsigned int UINT; +typedef long LONG; +typedef unsigned long ULONG; +typedef short SHORT; +typedef unsigned short USHORT; + +#ifndef ULONG64_DEFINED +#define ULONG64_DEFINED +typedef unsigned long long ULONG64; +#endif + +/* Define basic alignment type used in block and byte pool operations. This data type must + be at least 32-bits in size and also be large enough to hold a pointer type. */ + +#ifndef ALIGN_TYPE_DEFINED +#define ALIGN_TYPE_DEFINED +#define ALIGN_TYPE ULONG +#endif + +#endif #ifdef FX_REGRESSION_TEST /* Define parameters for regression test suite. */ @@ -228,7 +265,7 @@ extern VOID fault_tolerant_apply_log_callback(struct FX_MEDIA_STRUCT *media_ptr, /* Reduce the mutex error checking for testing purpose. */ -#ifdef FX_SINGLE_THREAD +#if defined(FX_SINGLE_THREAD) || defined(FX_STANDALONE_ENABLE) #define FX_PROTECT #define FX_UNPROTECT #else @@ -240,15 +277,25 @@ extern VOID fault_tolerant_apply_log_callback(struct FX_MEDIA_STRUCT *media_ptr, /* Define interrupt lockout constructs to protect the system date/time from being updated while they are being read. */ +#ifndef FX_STANDALONE_ENABLE #define FX_INT_SAVE_AREA unsigned int old_interrupt_posture; #define FX_DISABLE_INTS old_interrupt_posture = tx_interrupt_control(TX_INT_DISABLE); #define FX_RESTORE_INTS tx_interrupt_control(old_interrupt_posture); - +#else +/* Disable use of ThreadX protection in standalone mode for FileX */ +#ifndef FX_LEGACY_INTERRUPT_PROTECTION +#define FX_LEGACY_INTERRUPT_PROTECTION +#endif +#define FX_INT_SAVE_AREA +#define FX_DISABLE_INTS +#define FX_RESTORE_INTS +#endif /* Define the error checking logic to determine if there is a caller error in the FileX API. The default definitions assume ThreadX is being used. This code can be completely turned off by just defining these macros to white space. */ +#ifndef FX_STANDALONE_ENABLE #ifndef TX_TIMER_PROCESS_IN_ISR #define FX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \ @@ -268,7 +315,10 @@ extern VOID fault_tolerant_apply_log_callback(struct FX_MEDIA_STRUCT *media_ptr, (_tx_thread_current_ptr == TX_NULL)) \ return(FX_CALLER_ERROR); #endif - +#else +#define FX_CALLER_CHECKING_EXTERNS +#define FX_CALLER_CHECKING_CODE +#endif /* Define the update rate of the system timer. These values may also be defined at the command line when compiling the fx_system_initialize.c module in the FileX library build. Alternatively, they can @@ -283,13 +333,12 @@ extern VOID fault_tolerant_apply_log_callback(struct FX_MEDIA_STRUCT *media_ptr, #define FX_UPDATE_RATE_IN_TICKS 1000 /* Same update rate, but in ticks */ #endif -typedef unsigned long long UINT64; /* Define the version ID of FileX. This may be utilized by the application. */ #ifdef FX_SYSTEM_INIT CHAR _fx_version_id[] = - "Copyright (c) Microsoft Corporation. All rights reserved. * FileX Linux/GCC Version 6.1 *"; + "Copyright (c) Microsoft Corporation. All rights reserved. * FileX Linux/GCC Version 6.1.5 *"; #else extern CHAR _fx_version_id[]; #endif diff --git a/ports/win32/vs_2019/inc/fx_port.h b/ports/win32/vs_2019/inc/fx_port.h index ece09dd..bbf2d6d 100644 --- a/ports/win32/vs_2019/inc/fx_port.h +++ b/ports/win32/vs_2019/inc/fx_port.h @@ -26,7 +26,7 @@ /* PORT SPECIFIC C INFORMATION RELEASE */ /* */ /* fx_port.h Win32/Visual */ -/* 6.1 */ +/* 6.1.5 */ /* */ /* AUTHOR */ /* */ @@ -45,6 +45,9 @@ /* DATE NAME DESCRIPTION */ /* */ /* 09-30-2020 William E. Lamie Initial Version 6.1 */ +/* 03-02-2021 William E. Lamie Modified comment(s), and */ +/* added standalone support, */ +/* resulting in version 6.1.5 */ /* */ /**************************************************************************/ @@ -66,6 +69,7 @@ /* Include the ThreadX api file. */ +#ifndef FX_STANDALONE_ENABLE #include "tx_api.h" @@ -76,13 +80,46 @@ typedef unsigned long long ULONG64; #endif +#else + +/* Define compiler library include files. */ + +#include +#include + +#define VOID void +typedef char CHAR; +typedef char BOOL; +typedef unsigned char UCHAR; +typedef int INT; +typedef unsigned int UINT; +typedef long LONG; +typedef unsigned long ULONG; +typedef short SHORT; +typedef unsigned short USHORT; +#ifndef ULONG64_DEFINED +#define ULONG64_DEFINED +typedef unsigned long long ULONG64; +#endif + + +/* Define basic alignment type used in block and byte pool operations. This data type must + be at least 32-bits in size and also be large enough to hold a pointer type. */ + +#ifndef ALIGN_TYPE_DEFINED +#define ALIGN_TYPE_DEFINED +#define ALIGN_TYPE ULONG +#endif + + +#endif /* Define FileX internal protection macros. If FX_SINGLE_THREAD is defined, these protection macros are effectively disabled. However, for multi-thread uses, the macros are setup to utilize a ThreadX mutex for multiple thread access control into an open media. */ -#ifdef FX_SINGLE_THREAD +#if defined(FX_SINGLE_THREAD) || defined(FX_STANDALONE_ENABLE) #define FX_PROTECT #define FX_UNPROTECT #else @@ -95,15 +132,21 @@ typedef unsigned long long ULONG64; /* Define interrupt lockout constructs to protect the system date/time from being updated while they are being read. */ +#ifndef FX_STANDALONE_ENABLE #define FX_INT_SAVE_AREA unsigned int old_interrupt_posture; #define FX_DISABLE_INTS old_interrupt_posture = tx_interrupt_control(TX_INT_DISABLE); #define FX_RESTORE_INTS tx_interrupt_control(old_interrupt_posture); - +#else +#define FX_INT_SAVE_AREA +#define FX_DISABLE_INTS +#define FX_RESTORE_INTS +#endif /* Define the error checking logic to determine if there is a caller error in the FileX API. The default definitions assume ThreadX is being used. This code can be completely turned off by just defining these macros to white space. */ +#ifndef FX_STANDALONE_ENABLE #ifndef TX_TIMER_PROCESS_IN_ISR #define FX_CALLER_CHECKING_EXTERNS extern TX_THREAD *_tx_thread_current_ptr; \ @@ -123,7 +166,10 @@ typedef unsigned long long ULONG64; (_tx_thread_current_ptr == TX_NULL)) \ return(FX_CALLER_ERROR); #endif - +#else +#define FX_CALLER_CHECKING_EXTERNS +#define FX_CALLER_CHECKING_CODE +#endif /* Define the update rate of the system timer. These values may also be defined at the command line when compiling the fx_system_initialize.c module in the FileX library build. Alternatively, they can @@ -144,7 +190,7 @@ typedef unsigned long long ULONG64; this value is derived from TX_TIMER_TICKS_PER_SECOND. */ #ifndef FX_UPDATE_RATE_IN_TICKS -#ifdef TX_TIMER_TICKS_PER_SECOND +#if (defined(TX_TIMER_TICKS_PER_SECOND) && (!defined(FX_STANDALONE_ENABLE))) #define FX_UPDATE_RATE_IN_TICKS (TX_TIMER_TICKS_PER_SECOND * FX_UPDATE_RATE_IN_SECONDS) #else #define FX_UPDATE_RATE_IN_TICKS 1000 @@ -156,7 +202,7 @@ typedef unsigned long long ULONG64; #ifdef FX_SYSTEM_INIT CHAR _fx_version_id[] = - "Copyright (c) Microsoft Corporation. All rights reserved. * FileX Win32/Version 6.1 *"; + "Copyright (c) Microsoft Corporation. All rights reserved. * FileX Win32/Version 6.1.5 *"; #else extern CHAR _fx_version_id[]; #endif diff --git a/samples/demo_filex.c b/samples/demo_filex.c index 07d6d80..c4e53f2 100644 --- a/samples/demo_filex.c +++ b/samples/demo_filex.c @@ -1,6 +1,5 @@ /* This is a small demo of the high-performance FileX FAT file system. It includes setup for a small 34KB RAM disk and a loop that writes and reads a small file. */ - #include "fx_api.h" #ifdef FX_ENABLE_FAULT_TOLERANT #include "fx_fault_tolerant.h" @@ -33,25 +32,41 @@ void thread_0_entry(ULONG thread_input); FX_MEDIA ram_disk; FX_FILE my_file; -CHAR *ram_disk_memory; +#ifndef FX_STANDALONE_ENABLE +CHAR *ram_disk_memory; +#else +unsigned char ram_disk_memory[256*512]; +#endif /* Define ThreadX global data structures. */ +#ifndef FX_STANDALONE_ENABLE TX_THREAD thread_0; +#endif ULONG thread_0_counter; void main(void) { +#ifdef FX_STANDALONE_ENABLE + + /* Initialize FileX. */ + fx_system_initialize(); + + thread_0_entry(0); +#else /* Enter the ThreadX kernel. */ tx_kernel_enter(); +#endif + } /* Define what the initial system looks like. */ +#ifndef FX_STANDALONE_ENABLE void tx_application_define(void *first_unused_memory) { @@ -76,7 +91,7 @@ CHAR *pointer; fx_system_initialize(); } - +#endif void thread_0_entry(ULONG thread_input) {