Skip to content

Commit

Permalink
Merge pull request #24 from dmknutsen/main
Browse files Browse the repository at this point in the history
Fix #6, remove implicit padding
  • Loading branch information
astrogeco authored May 4, 2022
2 parents 050a7ee + ad5b8dd commit d076920
Show file tree
Hide file tree
Showing 5 changed files with 170 additions and 128 deletions.
82 changes: 50 additions & 32 deletions fsw/src/cs_tbldefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@
*/
typedef struct
{
cpuaddr StartAddress; /**< \brief The Start address to Checksum */
uint16 State; /**< \brief Uses the CS_STATE_... defines from above */
uint16 Filler16; /** <\brief Padding */
cpuaddr StartAddress; /**< \brief The Start address to Checksum */
uint32 NumBytesToChecksum; /**< \brief The number of Bytes to Checksum */
} CS_Def_EepromMemory_Table_Entry_t;

Expand All @@ -79,13 +79,14 @@ typedef struct
*/
typedef struct
{
cpuaddr StartAddress; /**< \brief The Start address to Checksum */
uint16 State; /**< \brief Uses the CS_STATE_... defines from above */
uint16 ComputedYet; /**< \brief Have we computed an Integrity value yet */
cpuaddr StartAddress; /**< \brief The Start address to Checksum */
uint32 NumBytesToChecksum; /**< \brief The number of Bytes to Checksum */
uint32 ComparisonValue; /**< \brief The Memory Integrity Value */
uint32 ByteOffset; /**< \brief Where a previous unfinished calculation left off */
uint32 ByteOffset; /**< \brief Where a previous unfinished calc left off */
uint32 TempChecksumValue; /**< \brief The unfinished caluculation */
uint32 Filler32; /**< \brief Padding */
} CS_Res_EepromMemory_Table_Entry_t;

/**
Expand All @@ -111,15 +112,16 @@ typedef struct
*/
typedef struct
{
cpuaddr StartAddress; /**< \brief The Start address to Checksum */
uint16 State; /**< \brief Uses the CS_STATE_... defines from above */
uint16 ComputedYet; /**< \brief Have we computed an Integrity value yet */
cpuaddr StartAddress; /**< \brief The Start address to Checksum */
uint32 NumBytesToChecksum; /**< \brief The number of Bytes to Checksum */
uint32 ComparisonValue; /**< \brief The Memory Integrity Value */
uint32 ByteOffset; /**< \brief Where a previous unfinished calculation left off */
uint32 ByteOffset; /**< \brief Where a previous unfinished calc left off */
uint32 TempChecksumValue; /**< \brief The unfinished caluculation */
CFE_TBL_Handle_t TblHandle; /**< \brief handle recieved from table services */
CFE_TBL_Handle_t TblHandle; /**< \brief handle recieved from CFE_TBL */
bool IsCSOwner; /**< \brief Is CS the original owner of this table */
bool Filler8; /**< \brief Padding */
char Name[CFE_TBL_MAX_FULL_NAME_LEN]; /**< \brief name of the table */
} CS_Res_Tables_Table_Entry_t;

Expand All @@ -128,12 +130,12 @@ typedef struct
*/
typedef struct
{
cpuaddr StartAddress; /**< \brief The Start address to Checksum */
uint16 State; /**< \brief Uses the CS_STATE_... defines from above */
uint16 ComputedYet; /**< \brief Have we computed an Integrity value yet */
cpuaddr StartAddress; /**< \brief The Start address to Checksum */
uint32 NumBytesToChecksum; /**< \brief The number of Bytes to Checksum */
uint32 ComparisonValue; /**< \brief The Memory Integrity Value */
uint32 ByteOffset; /**< \brief Where a previous unfinished calculation left off */
uint32 ByteOffset; /**< \brief Where a previous unfinished calc left off */
uint32 TempChecksumValue; /**< \brief The unfinished caluculation */
char Name[OS_MAX_API_NAME]; /**< \brief name of the app */
} CS_Res_App_Table_Entry_t;
Expand Down Expand Up @@ -299,46 +301,57 @@ void CS_ProcessNewAppDefinitionTable(const CS_Def_App_Table_Entry_t *DefinitionT
*
* \param [in] DefinitionTableHandle A #CFE_TBL_Handle_t pointer
* that will get filled in with the
* table handle to the definition table
* table handle to the definition
* table
*
* \param [in] ResultsTableHandle A #CFE_TBL_Handle_t pointer
* that will get filled in with the
* table handle to the results table
* table handle to the results
* table
*
* \param [in] DefinitionTblPtr A pointer to the definiton table
* that we are operating on, it will get
* assigned during this call
* that we are operating on, it
* will get assigned during this
* call
*
* \param [in] ResultsTblPtr A pointer to the result table
* to operate on , it will get
* assigned during this call
*
* \param [in] Table The specific table we are operating on
* \param [in] Table The specific table we are
* operating on
*
* \param [in] DefinitionTableName The name of the definition table
*
* \param [in] ResultsTableName The name of the results table
*
* \param [in] NumEntries The number of entries in the table
* \param [in] NumEntries The number of entries in the
* table
*
* \param [in] DefinitionTableFileName The name of the file to load the definition
* table from
* \param [in] DefaultDefTableAddress The address of the default definition table
* that we may have to load from memory if the
* file is absent
* \param [in] DefinitionTableFileName The name of the file to load the
* definition table from
*
* \param [in] SizeofDefinitionTableEntry The sizeof an entry in the definition table
* \param [in] DefaultDefTableAddress The address of the default
* definition table that we may
* have to load from memory if
* the file is absent
*
* \param [in] SizeofResultsTableEntry The size of an enrty in the results table
*
* \param [in] CallBackFunction A pointer to a function used to validate the
* \param [in] SizeofDefinitionTableEntry The sizeof an entry in the
* definition table
* \param [out] * DefinitionTableHandle A #CFE_TBL_Handle_t pointer
* that will get filled in with the
* table handle to the definition table
* \param [out] * ResultsTableHandle A #CFE_TBL_Handle_t pointer
* that will get filled in with the
* table handle to the results table
*
* \param [in] SizeofResultsTableEntry The size of an enrty in the
* results table
*
* \param [in] CallBackFunction A pointer to a function used to
* validate the definition table
*
* \param [out] * DefinitionTableHandle A #CFE_TBL_Handle_t pointer that
* will get filled in with the tbl
* handle to the definition table
*
* \param [out] * ResultsTableHandle A #CFE_TBL_Handle_t pointer that
* will get filled in with the tbl
* handle to the results table
*
* \param [out] * DefinitionTblPtr A pointer to the definiton table
* that we are operating on
Expand Down Expand Up @@ -371,11 +384,16 @@ int32 CS_TableInit(CFE_TBL_Handle_t *DefinitionTableHandle, CFE_TBL_Handle_t *Re
*
* \param [in] ResultsTblPtr A pointer to the result table
* to operate on
* \param [in] DefinitionTableHandle A table handle to the definition table
* \param [in] ResultsTableHandle A table handle to the results table
* \param [in] DefinitionTableHandle A table handle to the definition
* table
*
* \param [in] ResultsTableHandle A table handle to the results
* table
*
* \param [in] NumEntries The number of entries in the table
* \param [in] Table The specific table we are operating on
*
* \param [in] Table The specific table we are operating
* on
*
* \return Execution status, see \ref CFEReturnCodes
* \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
Expand Down
54 changes: 26 additions & 28 deletions fsw/tables/cs_apptbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,39 +26,37 @@
** Includes
*************************************************************************/
#include "cfe.h"
#include "cs_platform_cfg.h"
#include "cfe_tbl_filedef.h"
#include "cs_msgdefs.h"
#include "cs_platform_cfg.h"
#include "cs_tbldefs.h"
#include "cfe_tbl_filedef.h"

CS_Def_App_Table_Entry_t CS_AppTable[CS_MAX_NUM_APP_TABLE_ENTRIES] = {
/* State Name */
/* 0 */ {CS_STATE_EMPTY, ""},
/* 1 */ {CS_STATE_EMPTY, ""},
/* 2 */ {CS_STATE_EMPTY, ""},
/* 3 */ {CS_STATE_EMPTY, ""},
/* 4 */ {CS_STATE_EMPTY, ""},
/* 5 */ {CS_STATE_EMPTY, ""},
/* 6 */ {CS_STATE_EMPTY, ""},
/* 7 */ {CS_STATE_EMPTY, ""},
/* 8 */ {CS_STATE_EMPTY, ""},
/* 9 */ {CS_STATE_EMPTY, ""},
/* 10 */ {CS_STATE_EMPTY, ""},
/* 11 */ {CS_STATE_EMPTY, ""},
/* 12 */ {CS_STATE_EMPTY, ""},
/* 13 */ {CS_STATE_EMPTY, ""},
/* 14 */ {CS_STATE_EMPTY, ""},
/* 15 */ {CS_STATE_EMPTY, ""},
/* 16 */ {CS_STATE_EMPTY, ""},
/* 17 */ {CS_STATE_EMPTY, ""},
/* 18 */ {CS_STATE_EMPTY, ""},
/* 19 */ {CS_STATE_EMPTY, ""},
/* 20 */ {CS_STATE_EMPTY, ""},
/* 21 */ {CS_STATE_EMPTY, ""},
/* 22 */ {CS_STATE_EMPTY, ""},
/* 23 */ {CS_STATE_EMPTY, ""}

};
/* 0 */ {.State = CS_STATE_EMPTY, .Name = ""},
/* 1 */ {.State = CS_STATE_EMPTY, .Name = ""},
/* 2 */ {.State = CS_STATE_EMPTY, .Name = ""},
/* 3 */ {.State = CS_STATE_EMPTY, .Name = ""},
/* 4 */ {.State = CS_STATE_EMPTY, .Name = ""},
/* 5 */ {.State = CS_STATE_EMPTY, .Name = ""},
/* 6 */ {.State = CS_STATE_EMPTY, .Name = ""},
/* 7 */ {.State = CS_STATE_EMPTY, .Name = ""},
/* 8 */ {.State = CS_STATE_EMPTY, .Name = ""},
/* 9 */ {.State = CS_STATE_EMPTY, .Name = ""},
/* 10 */ {.State = CS_STATE_EMPTY, .Name = ""},
/* 11 */ {.State = CS_STATE_EMPTY, .Name = ""},
/* 12 */ {.State = CS_STATE_EMPTY, .Name = ""},
/* 13 */ {.State = CS_STATE_EMPTY, .Name = ""},
/* 14 */ {.State = CS_STATE_EMPTY, .Name = ""},
/* 15 */ {.State = CS_STATE_EMPTY, .Name = ""},
/* 16 */ {.State = CS_STATE_EMPTY, .Name = ""},
/* 17 */ {.State = CS_STATE_EMPTY, .Name = ""},
/* 18 */ {.State = CS_STATE_EMPTY, .Name = ""},
/* 19 */ {.State = CS_STATE_EMPTY, .Name = ""},
/* 20 */ {.State = CS_STATE_EMPTY, .Name = ""},
/* 21 */ {.State = CS_STATE_EMPTY, .Name = ""},
/* 22 */ {.State = CS_STATE_EMPTY, .Name = ""},
/* 23 */ {.State = CS_STATE_EMPTY, .Name = ""}};

/*
** Table file header
Expand Down
54 changes: 34 additions & 20 deletions fsw/tables/cs_eepromtbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,45 @@
** Includes
*************************************************************************/
#include "cfe.h"
#include "cs_platform_cfg.h"
#include "cfe_tbl_filedef.h"
#include "cs_msgdefs.h"
#include "cs_platform_cfg.h"
#include "cs_tbldefs.h"
#include "cfe_tbl_filedef.h"

CS_Def_EepromMemory_Table_Entry_t CS_EepromTable[CS_MAX_NUM_EEPROM_TABLE_ENTRIES] = {
/* State Filler StartAddress NumBytes */
/* 0 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000},
/* 1 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000},
/* 2 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000},
/* 3 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000},
/* 4 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000},
/* 5 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000},
/* 6 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000},
/* 7 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000},
/* 8 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000},
/* 9 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000},
/* 10 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000},
/* 11 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000},
/* 12 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000},
/* 13 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000},
/* 14 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000},
/* 15 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000}

};
/* 0 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000},
/* 1 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000},
/* 2 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000},
/* 3 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000},
/* 4 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000},
/* 5 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000},
/* 6 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000},
/* 7 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000},
/* 8 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000},
/* 9 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000},
/* 10 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000},
/* 11 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000},
/* 12 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000},
/* 13 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000},
/* 14 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000},
/* 15 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}};

/*
** Table file header
Expand Down
54 changes: 34 additions & 20 deletions fsw/tables/cs_memorytbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,45 @@
** Includes
*************************************************************************/
#include "cfe.h"
#include "cs_platform_cfg.h"
#include "cfe_tbl_filedef.h"
#include "cs_msgdefs.h"
#include "cs_platform_cfg.h"
#include "cs_tbldefs.h"
#include "cfe_tbl_filedef.h"

CS_Def_EepromMemory_Table_Entry_t CS_MemoryTable[CS_MAX_NUM_MEMORY_TABLE_ENTRIES] = {
/* State Filler StartAddress NumBytes */
/* 0 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000},
/* 1 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000},
/* 2 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000},
/* 3 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000},
/* 4 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000},
/* 5 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000},
/* 6 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000},
/* 7 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000},
/* 8 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000},
/* 9 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000},
/* 10 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000},
/* 11 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000},
/* 12 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000},
/* 13 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000},
/* 14 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000},
/* 15 */ {CS_STATE_EMPTY, 0x1234, 0x00000000, 0x00000000}

};
/* 0 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000},
/* 1 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000},
/* 2 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000},
/* 3 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000},
/* 4 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000},
/* 5 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000},
/* 6 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000},
/* 7 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000},
/* 8 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000},
/* 9 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000},
/* 10 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000},
/* 11 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000},
/* 12 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000},
/* 13 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000},
/* 14 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000},
/* 15 */
{.State = CS_STATE_EMPTY, .Filler16 = 0x1234, .StartAddress = 0x00000000, .NumBytesToChecksum = 0x00000000}};

/*
** Table file header
Expand Down
Loading

0 comments on commit d076920

Please sign in to comment.