mirror of
https://github.com/eclipse-threadx/filex.git
synced 2026-09-14 04:05:59 +08:00
Updated copyright headers and removed revision history
* Updated version number constants * Updated copyright headers and removed revision history
This commit is contained in:
@@ -58,13 +58,13 @@ void filex_file_date_time_set_application_define(void *first_unused_memory)
|
||||
#ifndef FX_STANDALONE_ENABLE
|
||||
UCHAR *pointer;
|
||||
|
||||
|
||||
|
||||
/* Setup the working pointer. */
|
||||
pointer = (UCHAR *) first_unused_memory;
|
||||
|
||||
/* Create the main thread. */
|
||||
tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0,
|
||||
pointer, DEMO_STACK_SIZE,
|
||||
tx_thread_create(&ftest_0, "thread 0", ftest_0_entry, 0,
|
||||
pointer, DEMO_STACK_SIZE,
|
||||
4, 4, TX_NO_TIME_SLICE, TX_AUTO_START);
|
||||
|
||||
pointer = pointer + DEMO_STACK_SIZE;
|
||||
@@ -105,20 +105,20 @@ FX_FILE my_file;
|
||||
printf("FileX Test: File date/time set test................................");
|
||||
|
||||
/* Format the media. This needs to be done before opening it! */
|
||||
status = fx_media_format(&ram_disk,
|
||||
status = fx_media_format(&ram_disk,
|
||||
_fx_ram_driver, // Driver entry
|
||||
ram_disk_memory, // RAM disk memory pointer
|
||||
cache_buffer, // Media buffer pointer
|
||||
CACHE_SIZE, // Media buffer size
|
||||
CACHE_SIZE, // Media buffer size
|
||||
"MY_RAM_DISK", // Volume Name
|
||||
1, // Number of FATs
|
||||
32, // Directory Entries
|
||||
0, // Hidden sectors
|
||||
512, // Total sectors
|
||||
128, // Sector size
|
||||
512, // Total sectors
|
||||
128, // Sector size
|
||||
1, // Sectors per cluster
|
||||
1, // Heads
|
||||
1); // Sectors per track
|
||||
1); // Sectors per track
|
||||
|
||||
/* Determine if the format had an error. */
|
||||
if (status)
|
||||
@@ -127,7 +127,7 @@ FX_FILE my_file;
|
||||
printf("ERROR!\n");
|
||||
test_control_return(1);
|
||||
}
|
||||
|
||||
|
||||
/* try to retrieve directory information before the media has been opened to generate an error */
|
||||
status = fx_directory_information_get(&ram_disk, "DOES_NOT_EXIST", &attributes, &size,
|
||||
&year, &month, &day, &hour, &minute, &second);
|
||||
@@ -136,7 +136,7 @@ FX_FILE my_file;
|
||||
printf("ERROR!\n");
|
||||
test_control_return(2);
|
||||
}
|
||||
|
||||
|
||||
/* Attempt to set the date and time for a file before the media is opened to generate an error */
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 2000, 1, 1, 1, 1, 1);
|
||||
if (status != FX_MEDIA_NOT_OPEN)
|
||||
@@ -169,10 +169,10 @@ FX_FILE my_file;
|
||||
printf("ERROR!\n");
|
||||
test_control_return(5);
|
||||
}
|
||||
|
||||
|
||||
/* test error checking */
|
||||
#ifndef FX_DISABLE_ERROR_CHECKING
|
||||
|
||||
|
||||
/* send a null pointer to generate an error */
|
||||
status = fx_directory_information_get(&ram_disk, "DOES_NOT_EXIST", FX_NULL, FX_NULL,
|
||||
FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL, FX_NULL);
|
||||
@@ -181,7 +181,7 @@ FX_FILE my_file;
|
||||
printf("ERROR!\n");
|
||||
test_control_return(6);
|
||||
}
|
||||
|
||||
|
||||
/* send null pointer to generate an error */
|
||||
status = fx_file_date_time_set(FX_NULL, "TEST.TXT", 0, 0, 0, 0, 0, 0);
|
||||
if (status != FX_PTR_ERROR)
|
||||
@@ -189,7 +189,7 @@ FX_FILE my_file;
|
||||
printf("ERROR!\n");
|
||||
test_control_return(7);
|
||||
}
|
||||
|
||||
|
||||
/* send an invalid year to generate an error */
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 0, 0, 0, 0, 0, 0);
|
||||
if (status != FX_INVALID_YEAR)
|
||||
@@ -197,7 +197,7 @@ FX_FILE my_file;
|
||||
printf("ERROR!\n");
|
||||
test_control_return(8);
|
||||
}
|
||||
|
||||
|
||||
/* send an invalid month to generate an error */
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 2015, 0, 1, 0, 0, 0);
|
||||
if (status != FX_INVALID_MONTH)
|
||||
@@ -205,7 +205,7 @@ FX_FILE my_file;
|
||||
printf("ERROR!\n");
|
||||
test_control_return(9);
|
||||
}
|
||||
|
||||
|
||||
/* send a valid and invalid day for each month to generate an error */
|
||||
for (i = 1; i <= 12; i++)
|
||||
{
|
||||
@@ -215,7 +215,7 @@ FX_FILE my_file;
|
||||
printf("ERROR!\n");
|
||||
test_control_return(10);
|
||||
}
|
||||
|
||||
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 2015, i, 1, 1, 1, 1);
|
||||
if (status != FX_SUCCESS)
|
||||
{
|
||||
@@ -223,7 +223,7 @@ FX_FILE my_file;
|
||||
test_control_return(11);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* send an invalid day for feb of a leap year */
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 2016, 2, 0, 0, 0, 0);
|
||||
if (status != FX_INVALID_DAY)
|
||||
@@ -231,7 +231,7 @@ FX_FILE my_file;
|
||||
printf("ERROR!\n");
|
||||
test_control_return(12);
|
||||
}
|
||||
|
||||
|
||||
/* send an invalid hour to generate an error */
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 2000, 1, 1, 99, 0, 0);
|
||||
if (status != FX_INVALID_HOUR)
|
||||
@@ -239,7 +239,7 @@ FX_FILE my_file;
|
||||
printf("ERROR!\n");
|
||||
test_control_return(13);
|
||||
}
|
||||
|
||||
|
||||
/* send an invalid minute to generate an error */
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 2000, 1, 1, 1, 99, 0);
|
||||
if (status != FX_INVALID_MINUTE)
|
||||
@@ -247,7 +247,7 @@ FX_FILE my_file;
|
||||
printf("ERROR!\n");
|
||||
test_control_return(14);
|
||||
}
|
||||
|
||||
|
||||
/* send an invalid second to generate an error */
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT", 2000, 1, 1, 1, 1, 99);
|
||||
if (status != FX_INVALID_SECOND)
|
||||
@@ -257,7 +257,7 @@ FX_FILE my_file;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* Attempt to set the date and time for a file that does not exist to generate an error */
|
||||
status = fx_file_date_time_set(&ram_disk, "DOES_NOT_EXIST", 2000, 1, 1, 1, 1, 1);
|
||||
if (status == FX_SUCCESS)
|
||||
@@ -270,17 +270,17 @@ FX_FILE my_file;
|
||||
fx_media_cache_invalidate(&ram_disk);
|
||||
|
||||
/* Set the date and time for the file. */
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
1999, 12, 31, 23, 59, 58);
|
||||
|
||||
/* Check the date/time set status. */
|
||||
if (status != FX_SUCCESS)
|
||||
if (status != FX_SUCCESS)
|
||||
{
|
||||
|
||||
printf("ERROR!\n");
|
||||
test_control_return(17);
|
||||
}
|
||||
|
||||
|
||||
/* try to retrieve directory information for something that doesnt exist to generate an error */
|
||||
status = fx_directory_information_get(&ram_disk, "DOES_NOT_EXIST", &attributes, &size,
|
||||
&year, &month, &day, &hour, &minute, &second);
|
||||
@@ -298,14 +298,14 @@ FX_FILE my_file;
|
||||
&year, &month, &day, &hour, &minute, &second);
|
||||
|
||||
/* Check the date/time status. */
|
||||
if ((status != FX_SUCCESS) || (attributes != FX_ARCHIVE) || (size != 0) ||
|
||||
if ((status != FX_SUCCESS) || (attributes != FX_ARCHIVE) || (size != 0) ||
|
||||
(year != 1999) || (month != 12) || (day != 31) || (hour != 23) || (minute != 59) || (second != 58))
|
||||
{
|
||||
|
||||
printf("ERROR!\n");
|
||||
test_control_return(19);
|
||||
}
|
||||
|
||||
|
||||
/* get the date/time for the other files while some are opened to get better code coverage */
|
||||
status = fx_file_open(&ram_disk, &my_file, "OPENED_FOR_WRITE.TXT", FX_OPEN_FOR_WRITE);
|
||||
status += fx_directory_information_get(&ram_disk, "OPENED_FOR_WRITE.TXT", &attributes, &size,
|
||||
@@ -319,7 +319,7 @@ FX_FILE my_file;
|
||||
}
|
||||
|
||||
/* Close the media. */
|
||||
status = fx_media_close(&ram_disk);
|
||||
status = fx_media_close(&ram_disk);
|
||||
|
||||
/* Determine if the test was successful. */
|
||||
if (status != FX_SUCCESS)
|
||||
@@ -330,11 +330,11 @@ FX_FILE my_file;
|
||||
}
|
||||
#ifndef FX_DISABLE_ERROR_CHECKING
|
||||
/* Set the date and time for with an invalid file name. */
|
||||
status = fx_file_date_time_set(&ram_disk, NULL,
|
||||
status = fx_file_date_time_set(&ram_disk, NULL,
|
||||
1999, 12, 31, 23, 59, 58);
|
||||
|
||||
/* Check the date/time set status. */
|
||||
if (status != FX_PTR_ERROR)
|
||||
if (status != FX_PTR_ERROR)
|
||||
{
|
||||
|
||||
printf("ERROR!\n");
|
||||
@@ -342,11 +342,11 @@ FX_FILE my_file;
|
||||
}
|
||||
|
||||
/* Set the date and time for with an invalid year. */
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
FX_MAXIMUM_YEAR+1, 12, 31, 23, 59, 58);
|
||||
|
||||
/* Check the date/time set status. */
|
||||
if (status != FX_INVALID_YEAR)
|
||||
if (status != FX_INVALID_YEAR)
|
||||
{
|
||||
|
||||
printf("ERROR!\n");
|
||||
@@ -354,11 +354,11 @@ FX_FILE my_file;
|
||||
}
|
||||
|
||||
/* Set the date and time for with an invalid day for January. */
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
2016, 1, 32, 23, 59, 58);
|
||||
|
||||
/* Check the date/time set status. */
|
||||
if (status != FX_INVALID_DAY)
|
||||
if (status != FX_INVALID_DAY)
|
||||
{
|
||||
|
||||
printf("ERROR!\n");
|
||||
@@ -366,11 +366,11 @@ FX_FILE my_file;
|
||||
}
|
||||
|
||||
/* Set the date and time for with an invalid day for Febuary leap year. */
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
2016, 2, 30, 23, 59, 58);
|
||||
|
||||
/* Check the date/time set status. */
|
||||
if (status != FX_INVALID_DAY)
|
||||
if (status != FX_INVALID_DAY)
|
||||
{
|
||||
|
||||
printf("ERROR!\n");
|
||||
@@ -378,11 +378,11 @@ FX_FILE my_file;
|
||||
}
|
||||
|
||||
/* Set the date and time for with a valid day for Febuary leap year. */
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
2016, 2, 29, 24, 59, 58);
|
||||
|
||||
/* Check the date/time set status. */
|
||||
if (status != FX_INVALID_HOUR)
|
||||
if (status != FX_INVALID_HOUR)
|
||||
{
|
||||
|
||||
printf("ERROR!\n");
|
||||
@@ -390,11 +390,11 @@ FX_FILE my_file;
|
||||
}
|
||||
|
||||
/* Set the date and time for with an invalid day for Febuary. */
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
2017, 2, 29, 23, 59, 58);
|
||||
|
||||
/* Check the date/time set status. */
|
||||
if (status != FX_INVALID_DAY)
|
||||
if (status != FX_INVALID_DAY)
|
||||
{
|
||||
|
||||
printf("ERROR!\n");
|
||||
@@ -402,11 +402,11 @@ FX_FILE my_file;
|
||||
}
|
||||
|
||||
/* Set the date and time for with an invalid day for March. */
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
2017, 3, 32, 23, 59, 58);
|
||||
|
||||
/* Check the date/time set status. */
|
||||
if (status != FX_INVALID_DAY)
|
||||
if (status != FX_INVALID_DAY)
|
||||
{
|
||||
|
||||
printf("ERROR!\n");
|
||||
@@ -414,11 +414,11 @@ FX_FILE my_file;
|
||||
}
|
||||
|
||||
/* Set the date and time for with an invalid day for April. */
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
2017, 4, 31, 23, 59, 58);
|
||||
|
||||
/* Check the date/time set status. */
|
||||
if (status != FX_INVALID_DAY)
|
||||
if (status != FX_INVALID_DAY)
|
||||
{
|
||||
|
||||
printf("ERROR!\n");
|
||||
@@ -426,11 +426,11 @@ FX_FILE my_file;
|
||||
}
|
||||
|
||||
/* Set the date and time for with an invalid day for May. */
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
2017, 5, 32, 23, 59, 58);
|
||||
|
||||
/* Check the date/time set status. */
|
||||
if (status != FX_INVALID_DAY)
|
||||
if (status != FX_INVALID_DAY)
|
||||
{
|
||||
|
||||
printf("ERROR!\n");
|
||||
@@ -438,11 +438,11 @@ FX_FILE my_file;
|
||||
}
|
||||
|
||||
/* Set the date and time for with an invalid day for June. */
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
2017, 6, 31, 23, 59, 58);
|
||||
|
||||
/* Check the date/time set status. */
|
||||
if (status != FX_INVALID_DAY)
|
||||
if (status != FX_INVALID_DAY)
|
||||
{
|
||||
|
||||
printf("ERROR!\n");
|
||||
@@ -450,11 +450,11 @@ FX_FILE my_file;
|
||||
}
|
||||
|
||||
/* Set the date and time for with an invalid day for July. */
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
2017, 7, 32, 23, 59, 58);
|
||||
|
||||
/* Check the date/time set status. */
|
||||
if (status != FX_INVALID_DAY)
|
||||
if (status != FX_INVALID_DAY)
|
||||
{
|
||||
|
||||
printf("ERROR!\n");
|
||||
@@ -462,11 +462,11 @@ FX_FILE my_file;
|
||||
}
|
||||
|
||||
/* Set the date and time for with an invalid day for August. */
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
2017, 8, 32, 23, 59, 58);
|
||||
|
||||
/* Check the date/time set status. */
|
||||
if (status != FX_INVALID_DAY)
|
||||
if (status != FX_INVALID_DAY)
|
||||
{
|
||||
|
||||
printf("ERROR!\n");
|
||||
@@ -474,11 +474,11 @@ FX_FILE my_file;
|
||||
}
|
||||
|
||||
/* Set the date and time for with an invalid day for September. */
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
2017, 9, 31, 23, 59, 58);
|
||||
|
||||
/* Check the date/time set status. */
|
||||
if (status != FX_INVALID_DAY)
|
||||
if (status != FX_INVALID_DAY)
|
||||
{
|
||||
|
||||
printf("ERROR!\n");
|
||||
@@ -486,11 +486,11 @@ FX_FILE my_file;
|
||||
}
|
||||
|
||||
/* Set the date and time for with an invalid day for October. */
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
2017, 10, 32, 23, 59, 58);
|
||||
|
||||
/* Check the date/time set status. */
|
||||
if (status != FX_INVALID_DAY)
|
||||
if (status != FX_INVALID_DAY)
|
||||
{
|
||||
|
||||
printf("ERROR!\n");
|
||||
@@ -498,11 +498,11 @@ FX_FILE my_file;
|
||||
}
|
||||
|
||||
/* Set the date and time for with an invalid day for November. */
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
2017, 11, 31, 23, 59, 58);
|
||||
|
||||
/* Check the date/time set status. */
|
||||
if (status != FX_INVALID_DAY)
|
||||
if (status != FX_INVALID_DAY)
|
||||
{
|
||||
|
||||
printf("ERROR!\n");
|
||||
@@ -510,11 +510,11 @@ FX_FILE my_file;
|
||||
}
|
||||
|
||||
/* Set the date and time for with an invalid day for December. */
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
status = fx_file_date_time_set(&ram_disk, "TEST.TXT",
|
||||
2017, 12, 32, 23, 59, 58);
|
||||
|
||||
/* Check the date/time set status. */
|
||||
if (status != FX_INVALID_DAY)
|
||||
if (status != FX_INVALID_DAY)
|
||||
{
|
||||
|
||||
printf("ERROR!\n");
|
||||
@@ -522,20 +522,20 @@ FX_FILE my_file;
|
||||
}
|
||||
#endif
|
||||
/* Format the media. This needs to be done before opening it! */
|
||||
status = fx_media_format(&ram_disk,
|
||||
status = fx_media_format(&ram_disk,
|
||||
_fx_ram_driver, // Driver entry
|
||||
ram_disk_memory, // RAM disk memory pointer
|
||||
cache_buffer, // Media buffer pointer
|
||||
CACHE_SIZE, // Media buffer size
|
||||
CACHE_SIZE, // Media buffer size
|
||||
"MY_RAM_DISK", // Volume Name
|
||||
1, // Number of FATs
|
||||
64, // Directory Entries
|
||||
0, // Hidden sectors
|
||||
4096, // Total sectors
|
||||
128, // Sector size
|
||||
4096, // Total sectors
|
||||
128, // Sector size
|
||||
1, // Sectors per cluster
|
||||
1, // Heads
|
||||
1); // Sectors per track
|
||||
1); // Sectors per track
|
||||
|
||||
/* Determine if the format had an error. */
|
||||
if (status)
|
||||
@@ -556,7 +556,7 @@ FX_FILE my_file;
|
||||
printf("ERROR!\n");
|
||||
test_control_return(39);
|
||||
}
|
||||
|
||||
|
||||
/* Create a bunch of files. */
|
||||
status = fx_file_create(&ram_disk, "TEST.TXT");
|
||||
status += fx_file_create(&ram_disk, "TEST1.TXT");
|
||||
@@ -601,7 +601,7 @@ FX_FILE my_file;
|
||||
status += fx_file_open(&ram_disk, &file_6, "TEST30.TXT", FX_OPEN_FOR_WRITE);
|
||||
|
||||
/* Now get information on the first file... requesting on the "second" parameter. */
|
||||
status += fx_directory_information_get(&ram_disk, "TEST.TXT", FX_NULL, FX_NULL,
|
||||
status += fx_directory_information_get(&ram_disk, "TEST.TXT", FX_NULL, FX_NULL,
|
||||
FX_NULL, FX_NULL, FX_NULL,
|
||||
FX_NULL, FX_NULL, &second);
|
||||
|
||||
@@ -614,7 +614,7 @@ FX_FILE my_file;
|
||||
}
|
||||
|
||||
/* Now get information on the first file... requesting on the "minute" parameter. */
|
||||
status += fx_directory_information_get(&ram_disk, "TEST.TXT", FX_NULL, FX_NULL,
|
||||
status += fx_directory_information_get(&ram_disk, "TEST.TXT", FX_NULL, FX_NULL,
|
||||
FX_NULL, FX_NULL, FX_NULL,
|
||||
FX_NULL, &minute, FX_NULL);
|
||||
|
||||
@@ -625,10 +625,10 @@ FX_FILE my_file;
|
||||
printf("ERROR!\n");
|
||||
test_control_return(41);
|
||||
}
|
||||
|
||||
|
||||
/* Close the media. */
|
||||
status = fx_media_close(&ram_disk);
|
||||
|
||||
|
||||
/* Determine if there was an error. */
|
||||
if (status != FX_SUCCESS)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user