Skip to content

Commit a95f0a5

Browse files
authored
Merge branch 'eclipse-threadx:main' into yajunxia/tsn
2 parents 03fe569 + ecccf8f commit a95f0a5

File tree

65 files changed

+2047
-614
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+2047
-614
lines changed

LICENSE

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
1-
MIT License
1+
The MIT License (MIT)
2+
Copyright (c) Microsoft Corporation
23

3-
Copyright (c) 2024 Azure RTOS
4+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
5+
associated documentation files (the "Software"), to deal in the Software without restriction,
6+
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
7+
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
8+
subject to the following conditions:
49

5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
10+
The above copyright notice and this permission notice shall be included in all copies or substantial
11+
portions of the Software.
1112

12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
14-
15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
14+
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
15+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
16+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
17+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

LICENSE-CODE

Lines changed: 0 additions & 17 deletions
This file was deleted.

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,6 @@ Eclipse ThreadX is easy to install, learn, use, debug, verify, certify, and main
9191
- Comprehensive and advanced feature set.
9292
- Quality documentation.
9393

94-
### One Simple License
95-
96-
There is no cost to use and test the source code and no cost for production licenses when deployed to pre-licensed devices, all other devices need a license.
97-
9894
### Full, highest-quality source code
9995

10096
Throughout the years, Eclipse ThreadX source code has set the bar in quality and ease of understanding. In addition, the convention of having one function per file provides for easy source navigation.

rtos-docs/filex/appendix-a.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,6 @@ UINT fx_media_check(FX_MEDIA *media_ptr, UCHAR *scratch_memory_ptr,
2626
2727
UINT fx_media_close(FX_MEDIA *media_ptr);
2828
UINT fx_media_close_notify_set(FX_MEDIA *media_ptr, VOID (*media_close_notify)(FX_MEDIA *media));
29-
UINT fx_media_exFAT_format(FX_MEDIA *media_ptr, VOID (*driver)(FX_MEDIA *media),
30-
VOID *driver_info_ptr, UCHAR *memory_ptr,
31-
UINT memory_size, CHAR *volume_name,
32-
UINT number_of_fats, ULONG64 hidden_sectors,
33-
ULONG64 total_sectors, UINT bytes_per_sector,
34-
UINT sectors_per_cluster, UINT volume_serial_number,
35-
UINT boundary_unit);
3629
UINT fx_media_extended_space_available(FX_MEDIA *media_ptr, ULONG64 *available_bytes_ptr);
3730
UINT fx_media_flush(FX_MEDIA *media_ptr);
3831
UINT fx_media_format(FX_MEDIA *media_ptr, VOID (*driver)(FX_MEDIA *media),

rtos-docs/filex/appendix-b.md

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,6 @@ description: Learn about the FileX constants.
99

1010
| Constant (by alphabetic) | Value |
1111
|--------------------------------------|----------------|
12-
|EXFAT_BIT_MAP_FIRST_TABLE |0|
13-
|EXFAT_BOOT_REGION_SIZE |24|
14-
|EXFAT_DEFAULT_BOUNDARY_UNIT |28|
15-
|EXFAT_FAT_BITS |2|
16-
|EXFAT_FAT_BYTES_PER_SECTOR_SHIFT |0x009|
17-
|EXFAT_FAT_DRIVE_SELECT |0x080|
18-
|EXFAT_FAT_FILE_SYS_REVISION |0x100|
19-
|EXFAT_FAT_NUM_OF_FATS |0x001|
20-
|EXFAT_FAT_VOLUME_FLAG |0x000|
21-
|EXFAT_FAT_VOLUME_NAME_FIELD_SIZE |11|
22-
|EXFAT_LAST_CLUSTER_MASK |0xFFFFFFFF|
23-
|EXFAT_MIN_NUM_OF_RESERVED_SECTORS |1|
24-
|EXFAT_NUM_OF_DIR_ENTRIES |2|
2512
|FX_12_BIT_FAT_SIZE |4086|
2613
|FX_12BIT_SIZE |3|
2714
|FX_16_BIT_FAT_SIZE |65525|
@@ -30,7 +17,6 @@ description: Learn about the FileX constants.
3017
|FX_ARCHIVE |0x20|
3118
|FX_BAD_CLUSTER |0xFFF7|
3219
|FX_BAD_CLUSTER_32 |0x0FFFFFF7|
33-
|FX_BAD_CLUSTER_EXFAT |0x0FFFFFF7|
3420
|FX_BASE_YEAR |1980|
3521
|FX_BIGDOS |0x06|
3622
|FX_BOOT_ERROR |0x01|
@@ -83,17 +69,6 @@ description: Learn about the FileX constants.
8369
|FX_END_OF_FILE |0x09|
8470
|FX_ERROR_FIXED |0x92|
8571
|FX_ERROR_NOT_FIXED |0x93|
86-
|FX_EXFAT |0x07|
87-
|FX_EXFAT_BIT_MAP_NUM_OF_CACHED_SECTORS|1|
88-
|FX_EXFAT_BITMAP_CLUSTER_FREE |0|
89-
|FX_EXFAT_BITMAP_CLUSTER_OCCUPIED |1|
90-
|FX_EXFAT_FAT_CHECK_SUM_OFFSET |11|
91-
|FX_EXFAT_FAT_MAIN_BOOT_SECTOR_OFFSET |1|
92-
|FX_EXFAT_FAT_MAIN_SYSTEM_AREA_SIZE |12|
93-
|FX_EXFAT_FAT_NUM_OF_SYSTEM_AREAS |2|
94-
|FX_EXFAT_FAT_OEM_PARAM_OFFSET |9|
95-
|FX_EXFAT_MAX_DIRECTORY_SIZE |0x10000000|
96-
|FX_EXFAT_SIZE_OF_FAT_ELEMENT_SHIFT |2|
9772
|FX_FALSE |0|
9873
|FX_FAT_CACHE_DEPTH |4|
9974
|FX_FAT_CACHE_HASH_MASK |0x3|
@@ -139,7 +114,6 @@ description: Learn about the FileX constants.
139114
|FX_LAST_CLUSTER_1_32 |0x0FFFFFF8|
140115
|FX_LAST_CLUSTER_2 |0xFFFF|
141116
|FX_LAST_CLUSTER_2_32 |0x0FFFFFFF|
142-
|FX_LAST_CLUSTER_EXFAT |0x0FFFFFFF|
143117
|FX_LONG_NAME |0xF|
144118
|FX_LONG_NAME_ENTRY_LEN |13|
145119
|FX_LOST_CLUSTER_ERROR |0x04|
@@ -189,10 +163,8 @@ description: Learn about the FileX constants.
189163
|FX_RESERVED |0x025|
190164
|FX_RESERVED_1 |0xFFF0|
191165
|FX_RESERVED_1_32 |0x0FFFFFF0|
192-
|FX_RESERVED_1_EXFAT |0xFFFFFFF8|
193166
|FX_RESERVED_2 |0xFFF6|
194167
|FX_RESERVED_2_32 |0x0FFFFFF6|
195-
|FX_RESERVED_2_EXFAT |0xFFFFFFFE|
196168
|FX_RESERVED_SECTOR |0x00E|
197169
|FX_ROOT_CLUSTER_32 |0x02C|
198170
|FX_ROOT_DIR_ENTRIES |0x011|
@@ -232,7 +204,6 @@ description: Learn about the FileX constants.
232204
|FX_DIR_ENTRY_DONE|0x00|
233205
|FX_DRIVER_READ|0|
234206
|FX_FALSE|0|
235-
|EXFAT_BIT_MAP_FIRST_TABLE|0|
236207
|FX_FREE_CLUSTER|0x0000|
237208
|FX_INITIAL_TIME|0x0000|
238209
|FX_JUMP_INSTR|0x000|
@@ -241,9 +212,6 @@ description: Learn about the FileX constants.
241212
|FX_SEEK_BEGIN|0|
242213
|FX_SUCCESS|0x00|
243214
|FX_UNKNOWN_SECTOR|0|
244-
|FX_EXFAT_FAT_MAIN_BOOT_SECTOR_OFFSET|0|
245-
|FX_EXFAT_BITMAP_CLUSTER_FREE|0|
246-
|EXFAT_FAT_VOLUME_FLAG|0x000|
247215
|FX_BOOT_ERROR|0x01|
248216
|FX_BOOT_SECTOR|1|
249217
|FX_DRIVER_WRITE|1|
@@ -252,13 +220,8 @@ description: Learn about the FileX constants.
252220
|FX_OPEN_FOR_WRITE|1|
253221
|FX_READ_ONLY|0x01|
254222
|FX_FAT12|0x01|
255-
|EXFAT_FAT_NUM_OF_FATS|0x001|
256223
|FX_SEEK_END|1|
257224
|FX_TRUE|1|
258-
|FX_EXFAT_BIT_MAP_NUM_OF_CACHED_SECTORS|1|
259-
|FX_EXFAT_BITMAP_CLUSTER_OCCUPIED|1|
260-
|FX_EXFAT_FAT_EXT_BOOT_SECTOR_OFFSET|1|
261-
EXFAT_MIN_NUM_OF_RESERVED_SECTORS|1|
262225
|FX_DIRECTORY_ERROR|0x02|
263226
|FX_HIDDEN|0x02|
264227
|FX_MEDIA_INVALID|0x02|
@@ -267,9 +230,6 @@ EXFAT_MIN_NUM_OF_RESERVED_SECTORS|1|
267230
|FX_FAT_SECTOR|2|
268231
|FX_OPEN_FOR_READ_FAST|2|
269232
|FX_SEEK_FORWARD|2|
270-
|FX_EXFAT_SIZE_OF_FAT_ELEMENT_SHIFT|2|
271-
|FX_EXFAT_FAT_NUM_OF_SYSTEM_AREAS|2|
272-
EXFAT_NUM_OF_DIR_ENTRIES|2|
273233
|FX_12BIT_SIZE|3|
274234
|FX_DIR_EXT_SIZE|3|
275235
|FX_DIRECTORY_SECTOR|3|
@@ -296,28 +256,22 @@ EXFAT_NUM_OF_DIR_ENTRIES|2|
296256
|FX_DRIVER_RELEASE_SECTORS|6|
297257
|FX_DRIVER_BOOT_WRITE|7|
298258
|FX_NOT_OPEN|0x07|
299-
|FX_EXFAT|0x07|
300259
|FX_DIR_NAME_SIZE|8|
301260
|FX_DIR_RESERVED|8|
302261
|FX_DRIVER_UNINIT|8|
303262
|FX_FILE_CORRUPT|0x08|
304263
|FX_FILE_SIZE_ERROR|0x08|
305264
|FX_VOLUME|0x08|
306265
|FX_END_OF_FILE|0x09|
307-
|EXFAT_FAT_BYTES_PER_SECTOR_SHIFT|0x009|
308266
|FX_YEAR_SHIFT|9|
309-
|FX_EXFAT_FAT_OEM_PARAM_OFFSET|9|
310267
|FX_NO_MORE_SPACE|0x0A|
311268
|FX_EF_MUST_BE_ZERO|11|
312-
|EXFAT_FAT_VOLUME_NAME_FIELD_SIZE|11|
313269
|FX_ALREADY_CREATED|0x0B|
314270
|FX_FAT32|0x0B|
315271
|FX_BYTES_SECTOR|0x00B|
316272
|FX_HOUR_SHIFT|11|
317-
|FX_EXFAT_FAT_CHECK_SUM_OFFSET|11|
318273
|FX_INVALID_NAME|0x0C|
319274
|FX_MAXIMUM_MONTH|12|
320-
|FX_EXFAT_FAT_MAIN_SYSTEM_AREA_SIZE|12|
321275
|FX_INVALID_PATH|0x0D|
322276
|FX_SECTORS_CLUSTER|0x00D|
323277
|FX_LONG_NAME_ENTRY_LEN|13|
@@ -346,7 +300,6 @@ EXFAT_NUM_OF_DIR_ENTRIES|2|
346300
|FX_INVALID_SECOND|0x17|
347301
|FX_MAXIMUM_HOUR|23|
348302
|FX_PTR_ERROR|0x18|
349-
|EXFAT_BOOT_REGION_SIZE|24|
350303
|FX_SECTORS_PER_TRK|0x018|
351304
|FX_INVALID_ATTR|0x19|
352305
|FX_HEADS|0x01A|
@@ -357,7 +310,6 @@ EXFAT_NUM_OF_DIR_ENTRIES|2|
357310
|FX_ARCHIVE|0x20|
358311
|FX_CALLER_ERROR|0x20|
359312
|FX_DIR_ENTRY_SIZE|32|
360-
EXFAT_FAT_BITS|32|
361313
|FX_HUGE_SECTORS|0x020|
362314
|FX_BUFFER_ERROR|0x21|
363315
|FX_MAX_LONG_NAME_LEN|33|
@@ -394,9 +346,7 @@ EXFAT_FAT_BITS|32|
394346
|FX_EF_RESERVED|113|
395347
|FX_EF_BOOT_CODE|120|
396348
|FX_YEAR_MASK|0x7F|
397-
|EXFAT_FAT_DRIVE_SELECT|0x80|
398349
|FX_FAT_MAP_SIZE|128|
399-
EXFAT_DEFAULT_BOUNDARY_UNIT|128|
400350
|FX_SECTOR_INVALID|0x89|
401351
|FX_IO_ERROR|0x90|
402352
|FX_NOT_ENOUGH_MEMORY|0x91|
@@ -409,7 +359,6 @@ EXFAT_DEFAULT_BOUNDARY_UNIT|128|
409359
|FX_SIG_BYTE_2|0xAA|
410360
|FX_DIR_ENTRY_FREE|0xE5|
411361
|FX_NO_FAT|0xFF|
412-
|EXFAT_FAT_FILE_SYS_REVISION|0x100|
413362
|FX_MAX_EX_FAT_NAME_LEN|255|
414363
|FX_MAXIMUM_PATH|256|
415364
|FX_SIG_OFFSET|0x1FE|
@@ -432,15 +381,9 @@ EXFAT_DEFAULT_BOUNDARY_UNIT|128|
432381
|FX_BAD_CLUSTER_32|0x0FFFFFF7|
433382
|FX_LAST_CLUSTER_1_32|0x0FFFFFF8|
434383
|FX_LAST_CLUSTER_2_32|0x0FFFFFFF|
435-
|FX_EXFAT_MAX_DIRECTORY_SIZE|0x10000000|
436384
|FX_FILE_ABORTED_ID|0x46494C41UL|
437385
|FX_FILE_CLOSED_ID|0x46494C43UL|
438386
|FX_FILE_ID|0x46494C45UL|
439387
|FX_MEDIA_ABORTED_ID|0x4D454441UL|
440388
|FX_MEDIA_CLOSED_ID|0x4D454443UL|
441-
|FX_MEDIA_ID|0x4D454449UL|
442-
|FX_RESERVED_1_EXFAT|0xFFFFFFF8|
443-
|FX_RESERVED_2_EXFAT|0xFFFFFFFE|
444-
|FX_BAD_CLUSTER_EXFAT|0xFFFFFFF7|
445-
|FX_LAST_CLUSTER_EXFAT|0xFFFFFFFF|
446-
EXFAT_LAST_CLUSTER_MASK|0xFFFFFFFF|
389+
|FX_MEDIA_ID|0x4D454449UL|

rtos-docs/filex/appendix-c.md

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,6 @@ typedef struct FX_DIR_ENTRY_STRUCT
3232
ULONG fx_dir_entry_last_search_byte_offset;
3333
ULONG64 fx_dir_entry_next_log_sector;
3434

35-
#ifdef FX_ENABLE_EXFAT
36-
CHAR fx_dir_entry_dont_use_fat;
37-
UCHAR fx_dir_entry_type;
38-
ULONG64 fx_dir_entry_available_file_size;
39-
ULONG fx_dir_entry_secondary_count;
40-
#endif
4135

4236
} FX_DIR_ENTRY;
4337
```
@@ -93,23 +87,6 @@ typedef struct FX_MEDIA_STRUCT
9387
ULONG64 fx_media_total_sectors;
9488
ULONG fx_media_total_clusters;
9589

96-
#ifdef FX_ENABLE_EXFAT
97-
ULONG fx_media_exfat_volume_serial_number;
98-
UINT fx_media_exfat_file_system_revision;
99-
UINT fx_media_exfat_volume_flag;
100-
USHORT fx_media_exfat_drive_select;
101-
USHORT fx_media_exfat_percent_in_use;
102-
UINT fx_media_exfat_bytes_per_sector_shift;
103-
UINT fx_media_exfat_sector_per_clusters_shift;
104-
UCHAR fx_media_exfat_bitmap_cache[512];
105-
ULONG fx_media_exfat_bitmap_start_sector;
106-
ULONG fx_media_exfat_bitmap_cache_size_in_sectors;
107-
ULONG fx_media_exfat_bitmap_cache_start_cluster;
108-
ULONG fx_media_exfat_bitmap_cache_end_cluster;
109-
UINT fx_media_exfat_bitmap_clusters_per_sector_shift;
110-
UINT fx_media_exfat_bitmap_cache_dirty;
111-
#endif
112-
11390
UINT fx_media_reserved_sectors;
11491
UINT fx_media_root_sector_start;
11592
UINT fx_media_root_sectors;

rtos-docs/filex/chapter1.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ FileX is a complete FAT format media and file management system for deeply embed
99

1010
## FileX Unique Features
1111

12-
FileX supports an unlimited number of media devices at the same time, including RAM disks, FLASH managers, and actual physical devices. It supports 12-, 16-, and 32-bit File Allocation Table (FAT) formats, and also supports Extended File Allocation Table (exFAT), contiguous file allocation, and is highly optimized for both size and performance. FileX also includes fault tolerant support, media open/ close, and file write callback functions.
12+
FileX supports an unlimited number of media devices at the same time, including RAM disks, FLASH managers, and actual physical devices. It supports 12-, 16-, and 32-bit File Allocation Table (FAT) formats, and also supports contiguous file allocation, and is highly optimized for both size and performance. FileX also includes fault tolerant support, media open/ close, and file write callback functions.
1313

1414
Designed to meet the growing need for FLASH devices, FileX uses the same design and coding methods as ThreadX. Like all Eclipse Foundation products, FileX is distributed with full ANSI C source code, and it has no run-time royalties.
1515

@@ -29,7 +29,6 @@ Designed to meet the growing need for FLASH devices, FileX uses the same design
2929
- Endian neutral
3030
- Easy-to-implement FileX I/O drivers
3131
- 12-, 16-, and 32-bit FAT support
32-
- exFAT support
3332
- Long filename support
3433
- Internal FAT entry cache
3534
- Unicode name support
@@ -91,12 +90,6 @@ FileX provides the very best deeply embedded file system technology in a manner
9190

9291
For a complete list of the FileX Version 5 Services, see [Appendix A](appendix-a.md).
9392

94-
## exFAT Support
95-
96-
exFAT (extended File Allocation Table) is a file system designed by Eclipse Foundation to allow file size to exceed 2GB, a limit imposed by FAT32 file systems. It is the default file system for SD cards with capacity over 32GB. SD cards or flash drives formatted with FileX exFAT format are compatible with Windows. exFAT supports file size up to one Exabyte (EB), which is approximately one billion GB.
97-
98-
Users wishing to use exFAT must recompile the FileX library with the symbol **_FX_ENABLE_EXFAT_** defined. When opening media, FileX detects the media type. If the media is formatted with exFAT, FileX reads and writes the file system following exFAT standard. To format new media with exFAT, use the service **_fx_media_exFAT_format_**. By default exFAT is not enabled.
99-
10093
## Fault Tolerant Support
10194

10295
The FileX Fault Tolerant Module is designed to prevent file system corruption caused by interruptions during the file or directory update. For example, when appending data to a file, FileX needs to update the content of the file, the directory entry, and possibly the FAT entries. If this sequence of update is interrupted (such as power glitch, or the media is ejected in the middle of the update), the file system is in an inconsistent state, which may affect the integrity of the entire file system, leading towards corruption of other files.
@@ -107,7 +100,7 @@ As FileX updates file or directory, log entries are created. After the update op
107100

108101
In case the file system update operation was interrupted, next time the media is mounted by FileX, the Fault Tolerant Module analyzes the log entries. The information in the log entries allows FileX to back out partial changes already applied to the file system (in case the failure happens during the early stage of the file update operation), or if the log entries contain re-do information, FileX is able to apply the changes required to finish the prior operation.
109102

110-
This fault tolerant feature is available to all FAT file systems supported by FileX, including FAT12, FAT16, FAT32, and exFAT. By default fault tolerant is not enabled in FileX. To enable the fault tolerant feature, FileX must be built with the symbol **FX_ENABLE_FAULT_TOLERANT** and **FX_FAULT_TOLERANT** defined. At run time, the application starts fault tolerant service by calling **_fx_fault_tolerant_enable_**.
103+
This fault tolerant feature is available to all FAT file systems supported by FileX, including FAT12, FAT16, and FAT32. By default fault tolerant is not enabled in FileX. To enable the fault tolerant feature, FileX must be built with the symbol **FX_ENABLE_FAULT_TOLERANT** and **FX_FAULT_TOLERANT** defined. At run time, the application starts fault tolerant service by calling **_fx_fault_tolerant_enable_**.
111104
After the service starts, all file and directory write operations go through the Fault Tolerant Module.
112105

113106
As fault tolerant service starts, it first detects whether or not the media is protected under the Fault Tolerant Module. If it is not, FileX assumes integrity of the file system, and starts protection by allocating free blocks from the file system to be used for logging and caching. If the Fault Tolerant Module logs are found on the file system, it analyzes the log entries. FileX reverts the prior operation or redoes the prior operation, depending on the content of the log entries. The file system becomes available after all the prior log entries are processed. This ensures that FIleX starts from a known good state.

0 commit comments

Comments
 (0)