Skip to content

Commit

Permalink
Fix #16, Move Table Header definitions from sc_app.h to sc_tbldefs.h
Browse files Browse the repository at this point in the history
  • Loading branch information
thnkslprpt committed Oct 24, 2022
1 parent b59d70a commit cfb1b1e
Show file tree
Hide file tree
Showing 15 changed files with 70 additions and 54 deletions.
1 change: 1 addition & 0 deletions fsw/src/sc_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "sc_perfids.h"
#include "sc_version.h"
#include "sc_verify.h"
#include "sc_tbldefs.h"
#include <string.h>

/**************************************************************************
Expand Down
54 changes: 0 additions & 54 deletions fsw/src/sc_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,6 @@ void SC_RegisterManageCmds(void);

#define SC_BYTES_IN_WORD 4 /**< \brief Number of bytes in "word" used to define table lengths */

#define SC_ATS_HEADER_SIZE (sizeof(SC_AtsEntryHeader_t)) /**< \brief ATS header size in bytes */
#define SC_RTS_HEADER_SIZE (sizeof(SC_RtsEntryHeader_t)) /**< \brief RTS header size in bytes */

#define SC_ATS_BUFF_SIZE32 (SC_ATS_BUFF_SIZE / 2) /**< \brief ATS buffer number of 32-bit elements */
#define SC_RTS_BUFF_SIZE32 (SC_RTS_BUFF_SIZE / 2) /**< \brief RTS buffer number of 32-bit elements */
#define SC_APPEND_BUFF_SIZE32 (SC_APPEND_BUFF_SIZE / 2) /**< \brief Append buffer number of 32-bit elements */
Expand Down Expand Up @@ -225,57 +222,6 @@ void SC_RegisterManageCmds(void);
#define SC_RTS_ID_TO_INDEX(id) ((id)-1) /**< \brief Convert RTS ID to index */
#define SC_RTS_INDEX_TO_ID(index) ((index) + 1) /**< \brief Convert RTS table index to ID */

/**
* \brief ATS Table Entry Header Type
*/
typedef struct
{
uint16 Pad; /**< \brief Structure padding */

uint16 CmdNumber; /**< \brief command number, range = 1 to SC_MAX_ATS_CMDS */

uint16 TimeTag_MS; /**< \brief Time tag most significant 16 bits */
uint16 TimeTag_LS; /**< \brief Time tag least significant 16 bits */

/*
* Note: the command packet data is variable length,
* the command packet header (not shown here),
* comes directly after the time tag
*/
} SC_AtsEntryHeader_t;

/**
* \brief ATS header and message header
*/
typedef struct
{
SC_AtsEntryHeader_t Header; /**< \brief ATS header */
CFE_MSG_Message_t Msg; /**< \brief MSG header */
} SC_AtsEntry_t;

/**
* \brief RTS Command Header Type
*/
typedef struct
{
SC_RelTimeTag_t TimeTag; /**< \brief Relative time tag */

/*
* Note: the command packet data is variable length,
* the command packet header (not shown here),
* comes directly after Time tag.
*/
} SC_RtsEntryHeader_t;

/**
* \brief RTS header and message header
*/
typedef struct
{
SC_RtsEntryHeader_t Header; /**< \brief RTS header */
CFE_MSG_Message_t Msg; /**< \brief MSG header */
} SC_RtsEntry_t;

/**
* \brief SC Operational Data Structure
*
Expand Down
1 change: 1 addition & 0 deletions fsw/src/sc_atsrq.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "sc_loads.h"
#include "sc_utils.h"
#include "sc_events.h"
#include "sc_tbldefs.h"

/**************************************************************************
**
Expand Down
1 change: 1 addition & 0 deletions fsw/src/sc_loads.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "sc_atsrq.h"
#include "sc_utils.h"
#include "sc_events.h"
#include "sc_tbldefs.h"
#include <string.h>

/**************************************************************************
Expand Down
57 changes: 57 additions & 0 deletions fsw/src/sc_tbldefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
#include "cfe.h"
#include "sc_platform_cfg.h"

/*************************************************************************
* Macro Definitions
*************************************************************************/
#define SC_ATS_HEADER_SIZE (sizeof(SC_AtsEntryHeader_t)) /**< \brief ATS header size in bytes */
#define SC_RTS_HEADER_SIZE (sizeof(SC_RtsEntryHeader_t)) /**< \brief RTS header size in bytes */

/**
* \defgroup cfscstblids ID definitions for cFE Table Services manage table request command
* \{
Expand Down Expand Up @@ -107,4 +113,55 @@ typedef struct
uint16 UseCtr; /**< \brief how many times RTS is run */
} SC_RtsInfoEntry_t;

/**
* \brief ATS Table Entry Header Type
*/
typedef struct
{
uint16 Pad; /**< \brief Structure padding */

uint16 CmdNumber; /**< \brief command number, range = 1 to SC_MAX_ATS_CMDS */

uint16 TimeTag_MS; /**< \brief Time tag most significant 16 bits */
uint16 TimeTag_LS; /**< \brief Time tag least significant 16 bits */

/*
* Note: the command packet data is variable length,
* the command packet header (not shown here),
* comes directly after the time tag
*/
} SC_AtsEntryHeader_t;

/**
* \brief ATS header and message header
*/
typedef struct
{
SC_AtsEntryHeader_t Header; /**< \brief ATS header */
CFE_MSG_Message_t Msg; /**< \brief MSG header */
} SC_AtsEntry_t;

/**
* \brief RTS Command Header Type
*/
typedef struct
{
SC_RelTimeTag_t TimeTag; /**< \brief Relative time tag */

/*
* Note: the command packet data is variable length,
* the command packet header (not shown here),
* comes directly after Time tag.
*/
} SC_RtsEntryHeader_t;

/**
* \brief RTS header and message header
*/
typedef struct
{
SC_RtsEntryHeader_t Header; /**< \brief RTS header */
CFE_MSG_Message_t Msg; /**< \brief MSG header */
} SC_RtsEntry_t;

#endif
1 change: 1 addition & 0 deletions fsw/src/sc_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include "cfe.h"
#include "sc_app.h"
#include "sc_tbldefs.h"

/**
* \brief Gets the current time from CFE
Expand Down
1 change: 1 addition & 0 deletions unit-test/sc_app_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "sc_loads.h"
#include "sc_msgids.h"
#include "sc_events.h"
#include "sc_tbldefs.h"
#include "sc_test_utils.h"
#include <unistd.h>
#include <stdlib.h>
Expand Down
1 change: 1 addition & 0 deletions unit-test/sc_atsrq_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "sc_loads.h"
#include "sc_msgids.h"
#include "sc_events.h"
#include "sc_tbldefs.h"
#include "sc_test_utils.h"
#include <unistd.h>
#include <stdlib.h>
Expand Down
1 change: 1 addition & 0 deletions unit-test/sc_cmds_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "sc_test_utils.h"
#include "sc_utils.h"
#include "sc_version.h"
#include "sc_tbldefs.h"
#include "cfe_tbl_msg.h"
#include <time.h>

Expand Down
1 change: 1 addition & 0 deletions unit-test/sc_loads_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "sc_loads.h"
#include "sc_msgids.h"
#include "sc_events.h"
#include "sc_tbldefs.h"
#include "sc_test_utils.h"
#include <unistd.h>
#include <stdlib.h>
Expand Down
1 change: 1 addition & 0 deletions unit-test/sc_state_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "sc_loads.h"
#include "sc_msgids.h"
#include "sc_events.h"
#include "sc_tbldefs.h"
#include "sc_test_utils.h"
#include <unistd.h>
#include <stdlib.h>
Expand Down
1 change: 1 addition & 0 deletions unit-test/sc_utils_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "sc_utils.h"
#include "sc_events.h"
#include "sc_msgids.h"
#include "sc_tbldefs.h"
#include "sc_test_utils.h"

/* UT includes */
Expand Down
1 change: 1 addition & 0 deletions unit-test/stubs/sc_utils_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
*/

#include "sc_utils.h"
#include "sc_tbldefs.h"

/* UT includes */
#include "uttest.h"
Expand Down
1 change: 1 addition & 0 deletions unit-test/utilities/sc_test_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
*/

#include "sc_app.h"
#include "sc_tbldefs.h"
#include "sc_test_utils.h"

/* UT includes */
Expand Down
1 change: 1 addition & 0 deletions unit-test/utilities/sc_test_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
*/

#include "sc_app.h"
#include "sc_tbldefs.h"
#include "utstubs.h"
#include "cfe_msgids.h"
#include "cfe_tbl_msg.h"
Expand Down

0 comments on commit cfb1b1e

Please sign in to comment.