diff --git a/docs/cFE Application Developers Guide.md b/docs/cFE Application Developers Guide.md index 743fe2ef9..b62883d59 100644 --- a/docs/cFE Application Developers Guide.md +++ b/docs/cFE Application Developers Guide.md @@ -3208,17 +3208,16 @@ The structure of the standard file header is as follows: ```c typedef struct { - uint32 ContentType; /* Identifies the content type (magic #=’cFE1’) */ - uint32 SubType; /* Type of ContentType, if necessary */ - uint32 Length; /* Length of this primary header */ - uint32 SpacecraftID; /* Spacecraft that generated the file */ - uint32 ProcessorID; /* Processor that generated the file */ - uint32 ApplicationID; /* Application that generated the file */ + uint32 ContentType; /* Identifies the content type (magic #=’cFE1’) */ + uint32 SubType; /* Type of ContentType, if necessary */ + uint32 Length; /* Length of this primary header */ + uint32 SpacecraftID; /* Spacecraft that generated the file */ + uint32 ProcessorID; /* Processor that generated the file */ + uint32 ApplicationID; /* Application that generated the file */ - uint32 TimeSeconds; /* File creation timestamp (seconds) */ - uint32 TimeSubSeconds; /* File creation timestamp (sub-seconds) */ + CFE_TIME_SysTime_t FileCreateTime /* File creation timestamp */ - char Description[32]; /* File description */ + char Description[32]; /* File description */ } CFE_FS_Header_t; ``` @@ -3244,8 +3243,8 @@ The SpacecraftID, ProcessorID and ApplicationID are all automatically filled by cFE File Services routines when creating a cFE compliant file. These fields help identify where and how the file was created. -The TimeSeconds and TimeSubSeconds elements contain the Spacecraft Time -when the header was created. +The FileCreateTime member contains the Spacecraft Time when the header +was created. The Description field provides a brief ASCII description of the contents of the file. @@ -3260,22 +3259,22 @@ An example of this function is shown below: The opposite version of this file API is the CFE_FS_WriteHeader function. This function populates the given header data structure with -the SpacecraftID, ProcessorID, ApplicationID, TimeSeconds and -TimeSubsecs as obtained from the Executive and Time Services. The -Developer only needs to specify the SubType and Description fields. +the SpacecraftID, ProcessorID, ApplicationID, FileCreateTime.Seconds and +FileCreateTime.Subseconds as obtained from the Executive and Time Services. +The Developer only needs to specify the SubType and Description fields. After the function successfully writes the standard header to the file, the given header data structure contains all of the information and the file pointer associated with the specified file is pointing to the first byte past the standard header. In addition to the functions for obtaining and writing the entire -header, there are two functions for manipulating the TimeSeconds and -TimeSubseconds fields of the header. The first of these is the -CFE_FS_UpdateHeaderTime function. This function takes the specified -file and sets the TimeSeconds and TimeSubsecs fields equal to the -current time as obtained from CFE_TIME_GetTime. The second function, -CFE_FS_SetHeaderTime, allows the Developer to set the create time in -the standard header equal to a time specified using the +header, there are two functions for manipulating the FileCreateTime.Seconds +and FileCreateTime.Subseconds fields of the header. The first of these is +the CFE_FS_UpdateHeaderTime function. This function takes the specified +file and sets the FileCreateTime.Seconds and FileCreateTime.Subseconds +fields equal to the current time as obtained from CFE_TIME_GetTime. The +second function, CFE_FS_SetHeaderTime, allows the Developer to set the +create time in the standard header equal to a time specified using the CFE_TIME_SysTime_t data format. This function may be useful when time tagging experiment data with the time the data was acquired rather than the time the file was created. diff --git a/docs/src/mnem_maps/cfe_tbl_tlm_mnem_map b/docs/src/mnem_maps/cfe_tbl_tlm_mnem_map index a2eb427cb..e94c201b1 100644 --- a/docs/src/mnem_maps/cfe_tbl_tlm_mnem_map +++ b/docs/src/mnem_maps/cfe_tbl_tlm_mnem_map @@ -41,8 +41,7 @@ TBL_ACTBUFADD=$sc_$cpu_TBL_ActBufAdd \ TBL_IACTBUFADD=$sc_$cpu_TBL_IActBufAdd \ TBL_VALFUNCPTR=$sc_$cpu_TBL_ValFuncPtr \ TBL_TIMELASTUPD="$sc_$cpu_TBL_TimeLastUpd, $sc_$cpu_TBL_TLUSECONDS, $sc_$cpu_TBL_TLUSUBSECONDS" \ -TBL_FILECSECONDS=$sc_$cpu_TBL_FILECSECONDS \ -TBL_FILECSUBSECONDS=$sc_$cpu_TBL_FILECSUBSECONDS \ +TBL_FILECRTIME="$sc_$cpu_TBL_FileCrTime, $sc_$cpu_TBL_FCTSECONDS, $sc_$cpu_TBL_FCTSUBSECONDS" \ TBL_LOADEDONCE=$sc_$cpu_TBL_LoadedOnce \ TBL_UPDATEPNDNG=$sc_$cpu_TBL_UpdatePndng \ TBL_DUMPONLY=$sc_$cpu_TBL_DumpOnly \ @@ -51,4 +50,4 @@ TBL_NAME=$sc_$cpu_TBL_Name[CFE_TB_MAX_FULL_NAME_LEN] \ TBL_LASTFILEUPD=$sc_$cpu_TBL_LastFileUpd[OS_MAX_PATH_LEN] \ TBL_OWNERAPP=$sc_$cpu_TBL_OwnerApp[OS_MAX_API_NAME] \ TBL_CRITICAL=$sc_$cpu_TBL_Spare3 \ -TBL_SPARE4=$sc_$cpu_TBL_Spare4 +TBL_SPARE4=$sc_$cpu_TBL_Spare4 \ No newline at end of file diff --git a/modules/cfe_testcase/src/fs_header_test.c b/modules/cfe_testcase/src/fs_header_test.c index 528b7b358..22c4ab004 100644 --- a/modules/cfe_testcase/src/fs_header_test.c +++ b/modules/cfe_testcase/src/fs_header_test.c @@ -107,12 +107,13 @@ void TestTimeStamp(void) UtAssert_VOIDCALL(CFE_FS_InitHeader(&Header, TestDescription, CFE_FS_SubType_ES_ERLOG)); UtAssert_INT32_EQ(CFE_FS_WriteHeader(fd, &Header), sizeof(CFE_FS_Header_t)); UtAssert_INT32_EQ(CFE_FS_SetTimestamp(fd, NewTimestamp), CFE_SUCCESS); - UtAssert_INT32_EQ(OS_lseek(fd, 0, OS_SEEK_CUR), (offsetof(CFE_FS_Header_t, TimeSeconds) + sizeof(NewTimestamp))); + UtAssert_INT32_EQ(OS_lseek(fd, 0, OS_SEEK_CUR), + (offsetof(CFE_FS_Header_t, FileCreateTime.Seconds) + sizeof(NewTimestamp))); UtAssert_INT32_EQ(CFE_FS_ReadHeader(&ReadHeader, fd), sizeof(CFE_FS_Header_t)); - UtAssert_UINT32_EQ(0xFFFFFFFF, ReadHeader.TimeSeconds); - UtAssert_UINT32_EQ(0xFFFFFFFF, ReadHeader.TimeSubSeconds); + UtAssert_UINT32_EQ(0xFFFFFFFF, ReadHeader.FileCreateTime.Seconds); + UtAssert_UINT32_EQ(0xFFFFFFFF, ReadHeader.FileCreateTime.Subseconds); CFE_Assert_STATUS_ERROR(CFE_FS_SetTimestamp(OS_OBJECT_ID_UNDEFINED, NewTimestamp)); diff --git a/modules/core_api/fsw/inc/cfe_fs.h b/modules/core_api/fsw/inc/cfe_fs.h index 8eca284dd..c23bd7c1d 100644 --- a/modules/core_api/fsw/inc/cfe_fs.h +++ b/modules/core_api/fsw/inc/cfe_fs.h @@ -111,10 +111,8 @@ void CFE_FS_InitHeader(CFE_FS_Header_t *Hdr, const char *Description, uint32 Sub ** -# \link #CFE_FS_Header_t::SpacecraftID \c SpacecraftID \endlink - Filled with the Spacecraft ID ** -# \link #CFE_FS_Header_t::ProcessorID \c ProcessorID \endlink - Filled with the Processor ID ** -# \link #CFE_FS_Header_t::ApplicationID \c ApplicationID \endlink - Filled with the Application ID -** -# \link #CFE_FS_Header_t::TimeSeconds \c TimeSeconds \endlink - Filled with the Time, in seconds, as obtained -** by #CFE_TIME_GetTime -** -# \link #CFE_FS_Header_t::TimeSubSeconds \c TimeSubSeconds \endlink - Filled with the Time, subseconds, as -** obtained by #CFE_TIME_GetTime +** -# \link #CFE_FS_Header_t::FileCreateTime \c FileCreateTime \endlink - Filled with the Time, in seconds, +** as obtained by #CFE_TIME_GetTime ** ** \par Assumptions, External Events, and Notes: ** -# The File has already been successfully opened using #OS_OpenCreate and @@ -148,7 +146,7 @@ CFE_Status_t CFE_FS_WriteHeader(osal_id_t FileDes, CFE_FS_Header_t *Hdr); ** \brief Modifies the Time Stamp field in the Standard cFE File Header for the specified file ** ** \par Description -** This API will modify the \link #CFE_FS_Header_t::TimeSeconds timestamp \endlink found +** This API will modify the \link #CFE_FS_Header_t::FileCreateTime timestamp \endlink found ** in the Standard cFE File Header of the specified file. The timestamp will be replaced ** with the time specified by the caller. ** diff --git a/modules/core_api/fsw/inc/cfe_tbl_api_typedefs.h b/modules/core_api/fsw/inc/cfe_tbl_api_typedefs.h index 4a9caf06c..217fcd125 100644 --- a/modules/core_api/fsw/inc/cfe_tbl_api_typedefs.h +++ b/modules/core_api/fsw/inc/cfe_tbl_api_typedefs.h @@ -108,10 +108,9 @@ typedef enum CFE_TBL_SrcEnum /** \brief Table Info */ typedef struct CFE_TBL_Info { - size_t Size; /**< \brief Size, in bytes, of Table */ - uint32 NumUsers; /**< \brief Number of Apps with access to the table */ - uint32 FileCreateTimeSecs; /**< \brief File creation time from last file loaded into table */ - uint32 FileCreateTimeSubSecs; /**< \brief File creation time from last file loaded into table */ + size_t Size; /**< \brief Size, in bytes, of Table */ + uint32 NumUsers; /**< \brief Number of Apps with access to the table */ + CFE_TIME_SysTime_t FileCreateTime; /**< \brief File creation time from last file loaded into table */ uint32 Crc; /**< \brief Most recently calculated CRC by TBL services on table contents */ CFE_TIME_SysTime_t TimeOfLastUpdate; /**< \brief Time when Table was last updated */ bool TableLoadedOnce; /**< \brief Flag indicating whether table has been loaded once or not */ diff --git a/modules/fs/config/default_cfe_fs_filedef.h b/modules/fs/config/default_cfe_fs_filedef.h index b4450c975..721e22e1f 100644 --- a/modules/fs/config/default_cfe_fs_filedef.h +++ b/modules/fs/config/default_cfe_fs_filedef.h @@ -26,7 +26,8 @@ #define CFE_FS_FILEHDR_H #include "common_types.h" -#include "cfe_fs_interface_cfg.h" /* to define CFE_FS_HDR_DESC_MAX_LEN */ +#include "cfe_fs_interface_cfg.h" /* to define CFE_FS_HDR_DESC_MAX_LEN */ +#include "cfe_time_extern_typedefs.h" /* To get the definition of CFE_TIME_SysTime_t */ /** * @brief File subtypes used within cFE @@ -189,8 +190,7 @@ typedef struct CFE_FS_Header uint32 ProcessorID; /**< \brief Processor that generated the file */ uint32 ApplicationID; /**< \brief Application that generated the file */ - uint32 TimeSeconds; /**< \brief File creation timestamp (seconds) */ - uint32 TimeSubSeconds; /**< \brief File creation timestamp (sub-seconds) */ + CFE_TIME_SysTime_t FileCreateTime; /**< \brief File creation timestamp */ char Description[CFE_FS_HDR_DESC_MAX_LEN]; /**< \brief File description */ } CFE_FS_Header_t; diff --git a/modules/fs/eds/cfe_fs.xml b/modules/fs/eds/cfe_fs.xml index 3b2f7c2a8..58cab7dae 100644 --- a/modules/fs/eds/cfe_fs.xml +++ b/modules/fs/eds/cfe_fs.xml @@ -143,8 +143,7 @@ - - + diff --git a/modules/fs/fsw/src/cfe_fs_api.c b/modules/fs/fsw/src/cfe_fs_api.c index fbd0e54a0..aca788bf9 100644 --- a/modules/fs/fsw/src/cfe_fs_api.c +++ b/modules/fs/fsw/src/cfe_fs_api.c @@ -225,9 +225,9 @@ CFE_Status_t CFE_FS_WriteHeader(osal_id_t FileDes, CFE_FS_Header_t *Hdr) /* ** Fill in the timestamp fields... */ - Time = CFE_TIME_GetTime(); - Hdr->TimeSeconds = Time.Seconds; - Hdr->TimeSubSeconds = Time.Subseconds; + Time = CFE_TIME_GetTime(); + Hdr->FileCreateTime.Seconds = Time.Seconds; + Hdr->FileCreateTime.Subseconds = Time.Subseconds; /* ** Determine if this is a little endian processor @@ -285,7 +285,7 @@ CFE_Status_t CFE_FS_SetTimestamp(osal_id_t FileDes, CFE_TIME_SysTime_t NewTimest CFE_TIME_SysTime_t OutTimestamp = NewTimestamp; int32 FileOffset = 0; - FileOffset = ((char *)&TempHdr.TimeSeconds - (char *)&TempHdr.ContentType); + FileOffset = ((char *)&TempHdr.FileCreateTime.Seconds - (char *)&TempHdr.ContentType); OsStatus = OS_lseek(FileDes, FileOffset, OS_SEEK_SET); if (OsStatus == FileOffset) @@ -338,8 +338,8 @@ void CFE_FS_ByteSwapCFEHeader(CFE_FS_Header_t *Hdr) CFE_FS_ByteSwapUint32(&Hdr->SpacecraftID); CFE_FS_ByteSwapUint32(&Hdr->ProcessorID); CFE_FS_ByteSwapUint32(&Hdr->ApplicationID); - CFE_FS_ByteSwapUint32(&Hdr->TimeSeconds); - CFE_FS_ByteSwapUint32(&Hdr->TimeSubSeconds); + CFE_FS_ByteSwapUint32(&Hdr->FileCreateTime.Seconds); + CFE_FS_ByteSwapUint32(&Hdr->FileCreateTime.Subseconds); } /*---------------------------------------------------------------- diff --git a/modules/fs/ut-coverage/fs_UT.c b/modules/fs/ut-coverage/fs_UT.c index 36ace51e8..f8333a205 100644 --- a/modules/fs/ut-coverage/fs_UT.c +++ b/modules/fs/ut-coverage/fs_UT.c @@ -195,14 +195,14 @@ void Test_CFE_FS_ByteSwapCFEHeader(void) UtPrintf("Begin Test Byte Swap cFE Header"); UT_InitData(); - Hdr.ContentType = 0x11223344; - Hdr.SubType = 0x22334455; - Hdr.Length = 0x33445566; - Hdr.SpacecraftID = 0x44556677; - Hdr.ProcessorID = 0x55667788; - Hdr.ApplicationID = 0x66778899; - Hdr.TimeSeconds = 0x778899aa; - Hdr.TimeSubSeconds = 0x8899aabb; + Hdr.ContentType = 0x11223344; + Hdr.SubType = 0x22334455; + Hdr.Length = 0x33445566; + Hdr.SpacecraftID = 0x44556677; + Hdr.ProcessorID = 0x55667788; + Hdr.ApplicationID = 0x66778899; + Hdr.FileCreateTime.Seconds = 0x778899aa; + Hdr.FileCreateTime.Subseconds = 0x8899aabb; /* Test byte-swapping the header values */ CFE_FS_ByteSwapCFEHeader(&Hdr); @@ -213,8 +213,8 @@ void Test_CFE_FS_ByteSwapCFEHeader(void) UtAssert_UINT32_EQ(Hdr.SpacecraftID, 0x77665544); UtAssert_UINT32_EQ(Hdr.ProcessorID, 0x88776655); UtAssert_UINT32_EQ(Hdr.ApplicationID, 0x99887766); - UtAssert_UINT32_EQ(Hdr.TimeSeconds, 0xaa998877); - UtAssert_UINT32_EQ(Hdr.TimeSubSeconds, 0xbbaa9988); + UtAssert_UINT32_EQ(Hdr.FileCreateTime.Seconds, 0xaa998877); + UtAssert_UINT32_EQ(Hdr.FileCreateTime.Subseconds, 0xbbaa9988); } /* diff --git a/modules/tbl/config/default_cfe_tbl_msgdefs.h b/modules/tbl/config/default_cfe_tbl_msgdefs.h index 7bd8fd04b..a6b87e786 100644 --- a/modules/tbl/config/default_cfe_tbl_msgdefs.h +++ b/modules/tbl/config/default_cfe_tbl_msgdefs.h @@ -251,10 +251,8 @@ typedef struct CFE_TBL_TblRegPacket_Payload \brief Ptr to Owner App's function that validates tbl contents */ CFE_TIME_SysTime_t TimeOfLastUpdate; /**< \cfetlmmnemonic \TBL_TIMELASTUPD \brief Time when Table was last updated */ - uint32 FileCreateTimeSecs; /**< \cfetlmmnemonic \TBL_FILECSECONDS - \brief File creation time from last file loaded into table */ - uint32 FileCreateTimeSubSecs; /**< \cfetlmmnemonic \TBL_FILECSUBSECONDS - \brief File creation time from last file loaded into table */ + CFE_TIME_SysTime_t FileCreateTime; /**< \cfetlmmnemonic \TBL_FILECRTIME + \brief File creation time from last file loaded */ bool TableLoadedOnce; /**< \cfetlmmnemonic \TBL_LOADEDONCE \brief Flag indicating whether table has been loaded once or not */ bool LoadPending; /**< \cfetlmmnemonic \TBL_UPDATEPNDNG diff --git a/modules/tbl/eds/cfe_tbl.xml b/modules/tbl/eds/cfe_tbl.xml index 1024f7e0c..24b2a13be 100644 --- a/modules/tbl/eds/cfe_tbl.xml +++ b/modules/tbl/eds/cfe_tbl.xml @@ -292,14 +292,9 @@ \cfetlmmnemonic \TBL_TIMELASTUPD - + - \cfetlmmnemonic \TBL_FILECSECONDS - - - - - \cfetlmmnemonic \TBL_FILECSUBSECONDS + \cfetlmmnemonic \TBL_FILECRTIME diff --git a/modules/tbl/fsw/src/cfe_tbl_api.c b/modules/tbl/fsw/src/cfe_tbl_api.c index 5333557b7..b71d9dea3 100644 --- a/modules/tbl/fsw/src/cfe_tbl_api.c +++ b/modules/tbl/fsw/src/cfe_tbl_api.c @@ -431,8 +431,8 @@ CFE_Status_t CFE_TBL_Load(CFE_TBL_Handle_t TblHandle, CFE_TBL_SrcEnum_t SrcType, snprintf(RegRecPtr->Buffers[0].DataSource, sizeof(RegRecPtr->Buffers[0].DataSource), "Addr 0x%08lX", (unsigned long)SrcDataPtr); - RegRecPtr->Buffers[0].FileCreateTimeSecs = 0; - RegRecPtr->Buffers[0].FileCreateTimeSubSecs = 0; + RegRecPtr->Buffers[0].FileCreateTime.Seconds = 0; + RegRecPtr->Buffers[0].FileCreateTime.Subseconds = 0; CFE_EVS_SendEventWithAppID(CFE_TBL_LOAD_SUCCESS_INF_EID, CFE_EVS_EventType_DEBUG, CFE_TBL_Global.TableTaskAppId, "Successfully loaded '%s' from '%s'", RegRecPtr->Name, @@ -490,8 +490,8 @@ CFE_Status_t CFE_TBL_Load(CFE_TBL_Handle_t TblHandle, CFE_TBL_SrcEnum_t SrcType, snprintf(WorkingBufferPtr->DataSource, sizeof(WorkingBufferPtr->DataSource), "Addr 0x%08lX", (unsigned long)SrcDataPtr); - WorkingBufferPtr->FileCreateTimeSecs = 0; - WorkingBufferPtr->FileCreateTimeSubSecs = 0; + WorkingBufferPtr->FileCreateTime.Seconds = 0; + WorkingBufferPtr->FileCreateTime.Subseconds = 0; /* Compute the CRC on the specified table buffer */ WorkingBufferPtr->Crc = @@ -1113,10 +1113,11 @@ CFE_Status_t CFE_TBL_GetInfo(CFE_TBL_Info_t *TblInfoPtr, const char *TblName) TblInfoPtr->TableLoadedOnce = RegRecPtr->TableLoadedOnce; /* Return information on last load and update */ - TblInfoPtr->TimeOfLastUpdate = RegRecPtr->TimeOfLastUpdate; - TblInfoPtr->FileCreateTimeSecs = RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTimeSecs; - TblInfoPtr->FileCreateTimeSubSecs = RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTimeSubSecs; - TblInfoPtr->Crc = RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].Crc; + TblInfoPtr->TimeOfLastUpdate = RegRecPtr->TimeOfLastUpdate; + TblInfoPtr->FileCreateTime.Seconds = RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTime.Seconds; + TblInfoPtr->FileCreateTime.Subseconds = + RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTime.Subseconds; + TblInfoPtr->Crc = RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].Crc; strncpy(TblInfoPtr->LastFileLoaded, RegRecPtr->LastFileLoaded, sizeof(TblInfoPtr->LastFileLoaded) - 1); TblInfoPtr->LastFileLoaded[sizeof(TblInfoPtr->LastFileLoaded) - 1] = 0; @@ -1166,9 +1167,9 @@ CFE_Status_t CFE_TBL_DumpToBuffer(CFE_TBL_Handle_t TblHandle) memcpy(DumpCtrlPtr->DumpBufferPtr->BufferPtr, RegRecPtr->Buffers[0].BufferPtr, DumpCtrlPtr->Size); /* Save the current time so that the header in the dump file can have the correct time */ - DumpTime = CFE_TIME_GetTime(); - DumpCtrlPtr->DumpBufferPtr->FileCreateTimeSecs = DumpTime.Seconds; - DumpCtrlPtr->DumpBufferPtr->FileCreateTimeSubSecs = DumpTime.Subseconds; + DumpTime = CFE_TIME_GetTime(); + DumpCtrlPtr->DumpBufferPtr->FileCreateTime.Seconds = DumpTime.Seconds; + DumpCtrlPtr->DumpBufferPtr->FileCreateTime.Subseconds = DumpTime.Subseconds; /* Disassociate the dump request from the table */ RegRecPtr->DumpControlIndex = CFE_TBL_NO_DUMP_PENDING; diff --git a/modules/tbl/fsw/src/cfe_tbl_internal.c b/modules/tbl/fsw/src/cfe_tbl_internal.c index 03a1ede1e..8811fe36c 100644 --- a/modules/tbl/fsw/src/cfe_tbl_internal.c +++ b/modules/tbl/fsw/src/cfe_tbl_internal.c @@ -895,8 +895,8 @@ int32 CFE_TBL_LoadFromFile(const char *AppName, CFE_TBL_LoadBuff_t *WorkingBuffe WorkingBufferPtr->DataSource[sizeof(WorkingBufferPtr->DataSource) - 1] = '\0'; /* Save file creation time for later storage into Registry */ - WorkingBufferPtr->FileCreateTimeSecs = StdFileHeader.TimeSeconds; - WorkingBufferPtr->FileCreateTimeSubSecs = StdFileHeader.TimeSubSeconds; + WorkingBufferPtr->FileCreateTime.Seconds = StdFileHeader.FileCreateTime.Seconds; + WorkingBufferPtr->FileCreateTime.Subseconds = StdFileHeader.FileCreateTime.Subseconds; /* Compute the CRC on the specified table buffer */ WorkingBufferPtr->Crc = @@ -984,10 +984,10 @@ int32 CFE_TBL_UpdateInternal(CFE_TBL_Handle_t TblHandle, CFE_TBL_RegistryRec_t * RegRecPtr->LastFileLoaded[sizeof(RegRecPtr->LastFileLoaded) - 1] = 0; /* Save the file creation time from the loaded file into the Table Registry */ - RegRecPtr->Buffers[0].FileCreateTimeSecs = - CFE_TBL_Global.LoadBuffs[RegRecPtr->LoadInProgress].FileCreateTimeSecs; - RegRecPtr->Buffers[0].FileCreateTimeSubSecs = - CFE_TBL_Global.LoadBuffs[RegRecPtr->LoadInProgress].FileCreateTimeSubSecs; + RegRecPtr->Buffers[0].FileCreateTime.Seconds = + CFE_TBL_Global.LoadBuffs[RegRecPtr->LoadInProgress].FileCreateTime.Seconds; + RegRecPtr->Buffers[0].FileCreateTime.Subseconds = + CFE_TBL_Global.LoadBuffs[RegRecPtr->LoadInProgress].FileCreateTime.Subseconds; /* Save the previously computed CRC into the new buffer */ RegRecPtr->Buffers[0].Crc = CFE_TBL_Global.LoadBuffs[RegRecPtr->LoadInProgress].Crc; @@ -1329,9 +1329,10 @@ void CFE_TBL_UpdateCriticalTblCDS(CFE_TBL_RegistryRec_t *RegRecPtr) if (CritRegRecPtr != NULL) { /* Save information related to the source of the data stored in the table in Critical Table Registry */ - CritRegRecPtr->FileCreateTimeSecs = RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTimeSecs; - CritRegRecPtr->FileCreateTimeSubSecs = - RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTimeSubSecs; + CritRegRecPtr->FileCreateTime.Seconds = + RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTime.Seconds; + CritRegRecPtr->FileCreateTime.Subseconds = + RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTime.Subseconds; strncpy(CritRegRecPtr->LastFileLoaded, RegRecPtr->LastFileLoaded, sizeof(CritRegRecPtr->LastFileLoaded) - 1); CritRegRecPtr->LastFileLoaded[sizeof(CritRegRecPtr->LastFileLoaded) - 1] = '\0'; @@ -1748,8 +1749,8 @@ CFE_Status_t CFE_TBL_RestoreTableDataFromCDS(CFE_TBL_RegistryRec_t *RegRecPtr, c sizeof(WorkingBufferPtr->DataSource) - 1); WorkingBufferPtr->DataSource[sizeof(WorkingBufferPtr->DataSource) - 1] = '\0'; - WorkingBufferPtr->FileCreateTimeSecs = CritRegRecPtr->FileCreateTimeSecs; - WorkingBufferPtr->FileCreateTimeSubSecs = CritRegRecPtr->FileCreateTimeSubSecs; + WorkingBufferPtr->FileCreateTime.Seconds = CritRegRecPtr->FileCreateTime.Seconds; + WorkingBufferPtr->FileCreateTime.Subseconds = CritRegRecPtr->FileCreateTime.Subseconds; strncpy(RegRecPtr->LastFileLoaded, CritRegRecPtr->LastFileLoaded, sizeof(RegRecPtr->LastFileLoaded) - 1); @@ -1802,8 +1803,8 @@ void CFE_TBL_RegisterWithCriticalTableRegistry(CFE_TBL_CritRegRec_t *CritRegRecP CritRegRecPtr->CDSHandle = RegRecPtr->CDSHandle; strncpy(CritRegRecPtr->Name, TblName, sizeof(CritRegRecPtr->Name) - 1); CritRegRecPtr->Name[sizeof(CritRegRecPtr->Name) - 1] = '\0'; - CritRegRecPtr->FileCreateTimeSecs = 0; - CritRegRecPtr->FileCreateTimeSubSecs = 0; + CritRegRecPtr->FileCreateTime.Seconds = 0; + CritRegRecPtr->FileCreateTime.Subseconds = 0; CritRegRecPtr->LastFileLoaded[0] = '\0'; CritRegRecPtr->TimeOfLastUpdate.Seconds = 0; CritRegRecPtr->TimeOfLastUpdate.Subseconds = 0; @@ -1818,4 +1819,4 @@ void CFE_TBL_RegisterWithCriticalTableRegistry(CFE_TBL_CritRegRec_t *CritRegRecP /* Mark the table as critical for future reference */ RegRecPtr->CriticalTable = true; -} \ No newline at end of file +} diff --git a/modules/tbl/fsw/src/cfe_tbl_task.h b/modules/tbl/fsw/src/cfe_tbl_task.h index f3274d230..6f8bc459b 100644 --- a/modules/tbl/fsw/src/cfe_tbl_task.h +++ b/modules/tbl/fsw/src/cfe_tbl_task.h @@ -132,13 +132,12 @@ typedef struct */ typedef struct { - void * BufferPtr; /**< \brief Pointer to Load Buffer */ - uint32 FileCreateTimeSecs; /**< \brief File creation time from last file loaded into table */ - uint32 FileCreateTimeSubSecs; /**< \brief File creation time from last file loaded into table */ - uint32 Crc; /**< \brief Last calculated CRC for this buffer's contents */ - bool Taken; /**< \brief Flag indicating whether buffer is in use */ - bool Validated; /**< \brief Flag indicating whether the buffer has been successfully validated */ - char DataSource[OS_MAX_PATH_LEN]; /**< \brief Source of data put into buffer (filename or memory address) */ + void * BufferPtr; /**< \brief Pointer to Load Buffer */ + CFE_TIME_SysTime_t FileCreateTime; /**< \brief File creation time from last file loaded into table */ + uint32 Crc; /**< \brief Last calculated CRC for this buffer's contents */ + bool Taken; /**< \brief Flag indicating whether buffer is in use */ + bool Validated; /**< \brief Flag indicating whether the buffer has been successfully validated */ + char DataSource[OS_MAX_PATH_LEN]; /**< \brief Source of data put into buffer (filename or memory address) */ } CFE_TBL_LoadBuff_t; /*******************************************************************************/ @@ -204,10 +203,9 @@ typedef struct */ typedef struct { - CFE_ES_CDSHandle_t CDSHandle; /**< \brief Handle to Critical Data Store for Critical Tables */ - uint32 FileCreateTimeSecs; /**< \brief File creation time from last file loaded into table */ - uint32 FileCreateTimeSubSecs; /**< \brief File creation time from last file loaded into table */ - CFE_TIME_SysTime_t TimeOfLastUpdate; /**< \brief Time when Table was last updated */ + CFE_ES_CDSHandle_t CDSHandle; /**< \brief Handle to Critical Data Store for Critical Tables */ + CFE_TIME_SysTime_t FileCreateTime; /**< \brief File creation time from last file loaded into table */ + CFE_TIME_SysTime_t TimeOfLastUpdate; /**< \brief Time when Table was last updated */ char LastFileLoaded[OS_MAX_PATH_LEN]; /**< \brief Filename of last file loaded into table */ char Name[CFE_TBL_MAX_FULL_NAME_LEN]; /**< \brief Processor specific table name */ bool TableLoadedOnce; /**< \brief Flag indicating whether table has been loaded once or not */ @@ -235,18 +233,17 @@ typedef struct */ typedef struct { - CFE_ES_MemOffset_t Size; /**< \brief Size, in bytes, of Table */ - CFE_TIME_SysTime_t TimeOfLastUpdate; /**< \brief Time when Table was last updated */ - uint32 NumUsers; /**< \brief Number of applications that are sharing the table */ - int32 LoadInProgress; /**< \brief Flag identifies inactive buffer and whether load in progress */ - uint32 FileCreateTimeSecs; /**< \brief File creation time from last file loaded into table */ - uint32 FileCreateTimeSubSecs; /**< \brief File creation time from last file loaded into table */ - uint32 Crc; /**< \brief Most recent CRC computed by TBL Services on table contents */ - bool ValidationFunc; /**< \brief Flag indicating whether table has an associated Validation func*/ - bool TableLoadedOnce; /**< \brief Flag indicating whether table has been loaded once or not */ - bool LoadPending; /**< \brief Flag indicating an inactive buffer is ready to be copied */ - bool DumpOnly; /**< \brief Flag indicating Table is NOT to be loaded */ - bool DoubleBuffered; /**< \brief Flag indicating Table has a dedicated inactive buffer */ + CFE_ES_MemOffset_t Size; /**< \brief Size, in bytes, of Table */ + CFE_TIME_SysTime_t TimeOfLastUpdate; /**< \brief Time when Table was last updated */ + uint32 NumUsers; /**< \brief Number of applications that are sharing the table */ + int32 LoadInProgress; /**< \brief Flag identifies inactive buffer and whether load in progress */ + CFE_TIME_SysTime_t FileCreateTime; /**< \brief File creation time from last file loaded into table */ + uint32 Crc; /**< \brief Most recent CRC computed by TBL Services on table contents */ + bool ValidationFunc; /**< \brief Flag indicating whether table has an associated Validation func*/ + bool TableLoadedOnce; /**< \brief Flag indicating whether table has been loaded once or not */ + bool LoadPending; /**< \brief Flag indicating an inactive buffer is ready to be copied */ + bool DumpOnly; /**< \brief Flag indicating Table is NOT to be loaded */ + bool DoubleBuffered; /**< \brief Flag indicating Table has a dedicated inactive buffer */ char Name[CFE_TBL_MAX_FULL_NAME_LEN]; /**< \brief Processor specific table name */ char LastFileLoaded[OS_MAX_PATH_LEN]; /**< \brief Filename of last file loaded into table */ char OwnerAppName[OS_MAX_API_NAME]; /**< \brief Application Name of App that Registered Table */ diff --git a/modules/tbl/fsw/src/cfe_tbl_task_cmds.c b/modules/tbl/fsw/src/cfe_tbl_task_cmds.c index 832f05045..d9ec5b6f1 100644 --- a/modules/tbl/fsw/src/cfe_tbl_task_cmds.c +++ b/modules/tbl/fsw/src/cfe_tbl_task_cmds.c @@ -96,8 +96,8 @@ int32 CFE_TBL_SendHkCmd(const CFE_TBL_SendHkCmd_t *data) /* is the time of the actual capturing of the data, NOT the time when it was written to the file */ if (Status == CFE_TBL_INC_CMD_CTR) { - DumpTime.Seconds = DumpCtrlPtr->DumpBufferPtr->FileCreateTimeSecs; - DumpTime.Subseconds = DumpCtrlPtr->DumpBufferPtr->FileCreateTimeSubSecs; + DumpTime.Seconds = DumpCtrlPtr->DumpBufferPtr->FileCreateTime.Seconds; + DumpTime.Subseconds = DumpCtrlPtr->DumpBufferPtr->FileCreateTime.Subseconds; OsStatus = OS_OpenCreate(&FileDescriptor, DumpCtrlPtr->DumpBufferPtr->DataSource, OS_FILE_FLAG_NONE, OS_READ_WRITE); @@ -287,10 +287,10 @@ void CFE_TBL_GetTblRegData(void) CFE_TBL_Global.TblRegPacket.Payload.LoadPending = RegRecPtr->LoadPending; CFE_TBL_Global.TblRegPacket.Payload.DumpOnly = RegRecPtr->DumpOnly; CFE_TBL_Global.TblRegPacket.Payload.DoubleBuffered = RegRecPtr->DoubleBuffered; - CFE_TBL_Global.TblRegPacket.Payload.FileCreateTimeSecs = - RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTimeSecs; - CFE_TBL_Global.TblRegPacket.Payload.FileCreateTimeSubSecs = - RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTimeSubSecs; + CFE_TBL_Global.TblRegPacket.Payload.FileCreateTime.Seconds = + RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTime.Seconds; + CFE_TBL_Global.TblRegPacket.Payload.FileCreateTime.Subseconds = + RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTime.Subseconds; CFE_TBL_Global.TblRegPacket.Payload.Crc = RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].Crc; CFE_TBL_Global.TblRegPacket.Payload.Critical = RegRecPtr->CriticalTable; @@ -444,8 +444,9 @@ int32 CFE_TBL_LoadCmd(const CFE_TBL_LoadCmd_t *data) memcpy(WorkingBufferPtr->DataSource, LoadFilename, OS_MAX_PATH_LEN); /* Save file creation time for later storage into Registry */ - WorkingBufferPtr->FileCreateTimeSecs = StdFileHeader.TimeSeconds; - WorkingBufferPtr->FileCreateTimeSubSecs = StdFileHeader.TimeSubSeconds; + WorkingBufferPtr->FileCreateTime.Seconds = StdFileHeader.FileCreateTime.Seconds; + WorkingBufferPtr->FileCreateTime.Subseconds = + StdFileHeader.FileCreateTime.Subseconds; /* Compute the CRC on the specified table buffer */ WorkingBufferPtr->Crc = CFE_ES_CalculateCRC( @@ -1053,10 +1054,10 @@ bool CFE_TBL_DumpRegistryGetter(void *Meta, uint32 RecordNum, void **Buffer, siz StatePtr->DumpRecord.LoadPending = RegRecPtr->LoadPending; StatePtr->DumpRecord.DumpOnly = RegRecPtr->DumpOnly; StatePtr->DumpRecord.DoubleBuffered = RegRecPtr->DoubleBuffered; - StatePtr->DumpRecord.FileCreateTimeSecs = - RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTimeSecs; - StatePtr->DumpRecord.FileCreateTimeSubSecs = - RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTimeSubSecs; + StatePtr->DumpRecord.FileCreateTime.Seconds = + RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTime.Seconds; + StatePtr->DumpRecord.FileCreateTime.Subseconds = + RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].FileCreateTime.Subseconds; StatePtr->DumpRecord.Crc = RegRecPtr->Buffers[RegRecPtr->ActiveBufferIndex].Crc; StatePtr->DumpRecord.CriticalTable = RegRecPtr->CriticalTable; diff --git a/modules/tbl/ut-coverage/tbl_UT.c b/modules/tbl/ut-coverage/tbl_UT.c index b130539d4..2eb9dfb4d 100644 --- a/modules/tbl/ut-coverage/tbl_UT.c +++ b/modules/tbl/ut-coverage/tbl_UT.c @@ -1347,8 +1347,8 @@ void Test_CFE_TBL_SendHkCmd(void) DumpBuffPtr->Taken = true; DumpBuffPtr->Validated = true; DumpBuffPtr->BufferPtr = BuffPtr; - DumpBuffPtr->FileCreateTimeSecs = Secs; - DumpBuffPtr->FileCreateTimeSubSecs = SubSecs; + DumpBuffPtr->FileCreateTime.Seconds = Secs; + DumpBuffPtr->FileCreateTime.Subseconds = SubSecs; strncpy(DumpBuffPtr->DataSource, "hkSource", sizeof(DumpBuffPtr->DataSource) - 1); DumpBuffPtr->DataSource[sizeof(DumpBuffPtr->DataSource) - 1] = '\0'; CFE_TBL_Global.DumpControlBlocks[0].DumpBufferPtr = DumpBuffPtr; @@ -2426,8 +2426,8 @@ void Test_CFE_TBL_ReleaseAddresses(void) FileHeader.Description[sizeof(FileHeader.Description) - 1] = '\0'; FileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; FileHeader.SubType = CFE_FS_SubType_TBL_IMG; - FileHeader.TimeSeconds = 1704; - FileHeader.TimeSubSeconds = 104; + FileHeader.FileCreateTime.Seconds = 1704; + FileHeader.FileCreateTime.Subseconds = 104; strncpy(File.TblHeader.TableName, "ut_cfe_tbl.UT_RELEASE_TEST", sizeof(File.TblHeader.TableName) - 1); File.TblHeader.TableName[sizeof(File.TblHeader.TableName) - 1] = '\0'; UT_TBL_SetupHeader(&File.TblHeader, 0, sizeof(UT_Table1_t)); @@ -3085,8 +3085,8 @@ void Test_CFE_TBL_TblMod(void) FileHeader.Description[sizeof(FileHeader.Description) - 1] = '\0'; FileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; FileHeader.SubType = CFE_FS_SubType_TBL_IMG; - FileHeader.TimeSeconds = 1704; - FileHeader.TimeSubSeconds = 104; + FileHeader.FileCreateTime.Seconds = 1704; + FileHeader.FileCreateTime.Subseconds = 104; strncpy(File.TblHeader.TableName, "ut_cfe_tbl.UT_Table1", sizeof(File.TblHeader.TableName) - 1); File.TblHeader.TableName[sizeof(File.TblHeader.TableName) - 1] = '\0'; UT_TBL_SetupHeader(&File.TblHeader, 0, sizeof(UT_Table1_t)); @@ -3155,8 +3155,8 @@ void Test_CFE_TBL_TblMod(void) FileHeader.Description[sizeof(FileHeader.Description) - 1] = '\0'; FileHeader.ContentType = CFE_FS_FILE_CONTENT_ID; FileHeader.SubType = CFE_FS_SubType_TBL_IMG; - FileHeader.TimeSeconds = 1704; - FileHeader.TimeSubSeconds = 104; + FileHeader.FileCreateTime.Seconds = 1704; + FileHeader.FileCreateTime.Subseconds = 104; strncpy(File.TblHeader.TableName, "ut_cfe_tbl.UT_Table2", sizeof(File.TblHeader.TableName) - 1); File.TblHeader.TableName[sizeof(File.TblHeader.TableName) - 1] = '\0'; UT_TBL_SetupHeader(&File.TblHeader, 0, sizeof(UT_Table1_t));