Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions config/default_sc_fcncodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -408,42 +408,6 @@
*/
#define SC_APPEND_ATS_CC 11

/**
* \brief Request from cFE Table Services to manage a table
*
* \par Description
* This command signals a need for the host application (SC)
* to allow cFE Table Services to manage the specified table.
* For loadable tables, this command indicates that a table
* update is available. For dump only tables, this command
* indicates that cFE Table Services wants to dump the table
* data. In either case, the host application must call the
* table manage API function so that the pending function
* can be executed within the context of the host.
*
* Note: There is no reason for this command to be sent from
* any source other than cFE Table Services.
*
* \par Command Structure
* #SC_ManageTableCmd_t
*
* \par Command Verification
* Successful execution of this command may be verified via:
* - cFE Table Services housekeeping telemetry
*
* \par Error Conditions
* This command may fail for the following reason(s):
* - Invalid table ID
* - Unexpected result during manage of loadable table
*
* \par Evidence of failure for this command may be verified via:
* - cFE Table Services housekeeping telemetry
* - Error specific SC event message
*
* \par Criticality
* None
*/
#define SC_MANAGE_TABLE_CC 12

/**
* \brief START a group of RTS
Expand Down
10 changes: 0 additions & 10 deletions config/default_sc_msgstruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,16 +226,6 @@ typedef struct
SC_SetContinueAtsOnFailureCmd_Payload_t Payload;
} SC_ContinueAtsOnFailureCmd_t;

/**
* \brief Manage Table Command
*
* For command details see #SC_MANAGE_TABLE_CC
*/
typedef struct
{
CFE_MSG_CommandHeader_t CommandHeader; /**< \brief Command Header */
CFE_TBL_NotifyCmd_Payload_t Payload;
} SC_ManageTableCmd_t;

/**
* \brief RTS Group Command
Expand Down
13 changes: 0 additions & 13 deletions config/default_sc_tbldefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,6 @@
#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
* \{
*/
#define SC_TBL_ID_ATS_0 (1) /**< \brief ATS 0 Table ID */
#define SC_TBL_ID_APPEND (SC_TBL_ID_ATS_0 + SC_NUMBER_OF_ATS) /**< \brief Append Table ID */
#define SC_TBL_ID_RTS_0 (SC_TBL_ID_APPEND + 1) /**< \brief RTS 0 Table ID */
#define SC_TBL_ID_RTS_INFO (SC_TBL_ID_RTS_0 + SC_NUMBER_OF_RTS) /**< \brief RTS Info Table ID */
#define SC_TBL_ID_RTP_CTRL (SC_TBL_ID_RTS_INFO + 1) /**< \brief RTS Control Table ID */
#define SC_TBL_ID_ATS_INFO (SC_TBL_ID_RTP_CTRL + 1) /**< \brief ATS Info Table ID */
#define SC_TBL_ID_ATP_CTRL (SC_TBL_ID_ATS_INFO + 1) /**< \brief ATS Control Table ID */
#define SC_TBL_ID_ATS_CMD_0 (SC_TBL_ID_ATP_CTRL + 1) /**< \brief ATS 0 Command Table ID */
/**\}*/

/************************************************************************
* Type Definitions
Expand Down
22 changes: 0 additions & 22 deletions fsw/inc/sc_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -1244,28 +1244,6 @@
*/
#define SC_BEGINATS_INVLD_INDEX_ERR_EID 128

/**
* \brief SC RTS Table Manage RTS Index Invalid Event ID
*
* \par Type: ERROR
*
* \par Cause:
* This event message is issued when an invalid RTS index is received
* in the SC_ManageRtsTable function
*/
#define SC_TABLE_MANAGE_RTS_INV_INDEX_ERR_EID 129

/**
* \brief SC ATS Table Manage ATS Index Invalid Event ID
*
* \par Type: ERROR
*
* \par Cause:
* This event message is issued when an invalid ATS index is received
* in the SC_ManageAtsTable function
*/
#define SC_TABLE_MANAGE_ATS_INV_INDEX_ERR_EID 130

/**
* \brief SC ATS Table Load ATS Index Invalid Event ID
*
Expand Down
88 changes: 59 additions & 29 deletions fsw/src/sc_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@
}
else if (Result == CFE_SB_TIME_OUT)
{
/* no action, but also no error */
/* Perform table maintenance when no other work to do */
SC_ManageTables();
}
else
{
Expand Down Expand Up @@ -301,9 +302,6 @@
return Result;
}

/* Register for table update notification commands */
SC_RegisterManageCmds();

return CFE_SUCCESS;
}

Expand Down Expand Up @@ -572,42 +570,74 @@
"RTS table files not loaded at initialization = %d of %d", (int)NotLoadedCount, SC_NUMBER_OF_RTS);
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* Register to receive cFE table manage request commands */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

void SC_RegisterManageCmds(void)
void SC_ManageTables(void)

Check notice

Code scanning / CodeQL

Long function without assertion Note

All functions of more than 10 lines should have at least one assertion.

Check notice

Code scanning / CodeQL

Function too long Note

SC_ManageTables has too many lines (71, while 60 are allowed).
{
int32 i;
CFE_Status_t GetAddressResult;
uint16 i;
void *TblPtrNew;

CFE_TBL_Handle_t TblHandles[5] = {SC_OperData.RtsInfoHandle, SC_OperData.RtsCtrlBlckHandle,
SC_OperData.AtsInfoHandle, SC_OperData.AtsCtrlBlckHandle,
SC_OperData.AppendTblHandle};
uint32 params[5] = {SC_TBL_ID_RTS_INFO, SC_TBL_ID_RTP_CTRL, SC_TBL_ID_ATS_INFO, SC_TBL_ID_ATP_CTRL,
SC_TBL_ID_APPEND};
/* Dump-only tables */
CFE_TBL_Manage(SC_OperData.RtsInfoHandle);
CFE_TBL_Manage(SC_OperData.RtsCtrlBlckHandle);
CFE_TBL_Manage(SC_OperData.AtsInfoHandle);
CFE_TBL_Manage(SC_OperData.AtsCtrlBlckHandle);

for (i = 0; i < 5; i++)
/* ATS Command Status tables */
for (i = 0; i < SC_NUMBER_OF_ATS; i++)
{
CFE_TBL_NotifyByMessage(TblHandles[i], CFE_SB_ValueToMsgId(SC_CMD_MID), SC_MANAGE_TABLE_CC, params[i]);
CFE_TBL_Manage(SC_OperData.AtsCmdStatusHandle[i]);
}

for (i = 0; i < SC_NUMBER_OF_ATS; i++)
/* ATS Append table */
CFE_TBL_ReleaseAddress(SC_OperData.AppendTblHandle);
CFE_TBL_Manage(SC_OperData.AppendTblHandle);
GetAddressResult = CFE_TBL_GetAddress(&TblPtrNew, SC_OperData.AppendTblHandle);
SC_OperData.AppendTblAddr = TblPtrNew;
if (GetAddressResult == CFE_TBL_INFO_UPDATED)
{
/* Register for ATS cmd status table manage request commands */
CFE_TBL_NotifyByMessage(SC_OperData.AtsCmdStatusHandle[i], CFE_SB_ValueToMsgId(SC_CMD_MID), SC_MANAGE_TABLE_CC,
SC_TBL_ID_ATS_CMD_0 + i);
SC_UpdateAppend();
}
else if ((GetAddressResult != CFE_SUCCESS) && (GetAddressResult != CFE_TBL_ERR_NEVER_LOADED))
{
CFE_EVS_SendEvent(SC_TABLE_MANAGE_APPEND_ERR_EID, CFE_EVS_EventType_ERROR,
"ATS Append table manage process error: Result = 0x%X", (unsigned int)GetAddressResult);
}

/* Register for ATS table manage request commands */
CFE_TBL_NotifyByMessage(SC_OperData.AtsTblHandle[i], CFE_SB_ValueToMsgId(SC_CMD_MID), SC_MANAGE_TABLE_CC,
SC_TBL_ID_ATS_0 + i);
/* ATS tables */
for (i = 0; i < SC_NUMBER_OF_ATS; i++)
{
CFE_TBL_ReleaseAddress(SC_OperData.AtsTblHandle[i]);
CFE_TBL_Manage(SC_OperData.AtsTblHandle[i]);
GetAddressResult = CFE_TBL_GetAddress(&TblPtrNew, SC_OperData.AtsTblHandle[i]);
SC_OperData.AtsTblAddr[i] = TblPtrNew;
if (GetAddressResult == CFE_TBL_INFO_UPDATED)
{
SC_LoadAts(SC_ATS_IDX_C(i));
}
else if ((GetAddressResult != CFE_SUCCESS) && (GetAddressResult != CFE_TBL_ERR_NEVER_LOADED))
{
CFE_EVS_SendEvent(SC_TABLE_MANAGE_ATS_ERR_EID, CFE_EVS_EventType_ERROR,
"ATS table manage process error: ATS = %u, Result = 0x%X",
SC_IDNUM_AS_UINT(SC_AtsIndexToNum(SC_ATS_IDX_C(i))), (unsigned int)GetAddressResult);
}
}

/* RTS tables */
for (i = 0; i < SC_NUMBER_OF_RTS; i++)
{
/* Register for RTS table manage request commands */
CFE_TBL_NotifyByMessage(SC_OperData.RtsTblHandle[i], CFE_SB_ValueToMsgId(SC_CMD_MID), SC_MANAGE_TABLE_CC,
SC_TBL_ID_RTS_0 + i);
CFE_TBL_ReleaseAddress(SC_OperData.RtsTblHandle[i]);
CFE_TBL_Manage(SC_OperData.RtsTblHandle[i]);
GetAddressResult = CFE_TBL_GetAddress(&TblPtrNew, SC_OperData.RtsTblHandle[i]);
SC_OperData.RtsTblAddr[i] = TblPtrNew;
if (GetAddressResult == CFE_TBL_INFO_UPDATED)
{
SC_LoadRts(SC_RTS_IDX_C(i));
}
else if ((GetAddressResult != CFE_SUCCESS) && (GetAddressResult != CFE_TBL_ERR_NEVER_LOADED))
{
CFE_EVS_SendEvent(SC_TABLE_MANAGE_RTS_ERR_EID, CFE_EVS_EventType_ERROR,
"RTS table manage process error: RTS = %u, Result = 0x%X",
SC_IDNUM_AS_UINT(SC_RtsIndexToNum(SC_RTS_IDX_C(i))), (unsigned int)GetAddressResult);
}
}
}
19 changes: 5 additions & 14 deletions fsw/src/sc_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,25 +222,16 @@ CFE_Status_t SC_GetLoadTablePointers(void);
void SC_LoadDefaultTables(void);

/**
* \brief Register to receive cFE Table Services manage request commands
* \brief Manage all SC tables
*
* \par Description
* This function provides cFE Table Services with the information
* necessary to send a notification command when one of the SC dump
* only tables has a dump pending, or when one of the SC loadable
* tables has a load pending. Upon receipt of the command, the
* command handler will call the cFE Table Services API function
* to manage the table. This sequence of events ensures that dump
* tables are not being updated by SC at the same moment that the
* dump occurs, and likewise, that loadable tables are not being
* referenced by SC at the moment that the update occurs.
* This function checks and manages all SC tables and provides
* an opportunity to reload them if they have been updated.
*
* \par Assumptions, External Events, and Notes:
* None
*
* \sa #SC_ManageTableCmd
* None
*/
void SC_RegisterManageCmds(void);
void SC_ManageTables(void);

/************************************************************************
* Macro Definitions
Expand Down
Loading
Loading