Skip to content

Commit

Permalink
Fix #1528, Move NO_SUCH_TABLE_ERR_EID into FindTableInRegistry and make
Browse files Browse the repository at this point in the history
optional
  • Loading branch information
thnkslprpt committed Mar 30, 2023
1 parent 7c03369 commit ae95ec6
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 63 deletions.
21 changes: 21 additions & 0 deletions cmake/sample_defs/cpu1_platform_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -1666,6 +1666,27 @@
#define CFE_PLATFORM_TBL_VALID_PRID_3 0
#define CFE_PLATFORM_TBL_VALID_PRID_4 0

/**
** \cfeevscfg Define whether or not to send an event if table not found in registry
**
** \par Description:
** This configuration parameter sets whether or not to send an event if a table is
** not found in the registry when calling CFE_TBL_FindTableInRegistry.
**
** Note: If the table is not found, CFE_TBL_FindTableInRegistry returns
** CFE_TBL_NOT_FOUND, whether or not this configuration parameter is set to true.
** If the event reports are not needed, this parameter can therefore be set to
** false, and the implications of the table not being found can be handled via the
** return code.
**
** If set to true, an event will be sent with Event ID CFE_TBL_NO_SUCH_TABLE_ERR_EID.
** If set to false, no event will be sent.
**
** \par Limits
** The valid settings are true or false.
*/
#define CFE_PLATFORM_TBL_SEND_EVENT_IF_TABLE_NOT_FOUND true

/** \cfeescfg Poll timer for startup sync delay
**
** \par Description:
Expand Down
8 changes: 8 additions & 0 deletions modules/tbl/fsw/src/cfe_tbl_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,14 @@ int16 CFE_TBL_FindTableInRegistry(const char *TblName)
}
} while ((RegIndx == CFE_TBL_NOT_FOUND) && (i < (CFE_PLATFORM_TBL_MAX_NUM_TABLES - 1)));

#if (CFE_PLATFORM_TBL_SEND_EVENT_IF_TABLE_NOT_FOUND == true)
if (RegIndx == CFE_TBL_NOT_FOUND)
{
CFE_EVS_SendEvent(CFE_TBL_NO_SUCH_TABLE_ERR_EID, CFE_EVS_EventType_ERROR,
"Unable to locate '%s' in Table Registry", TblName);
}
#endif

return RegIndx;
}

Expand Down
32 changes: 1 addition & 31 deletions modules/tbl/fsw/src/cfe_tbl_task_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,12 +373,7 @@ int32 CFE_TBL_LoadCmd(const CFE_TBL_LoadCmd_t *data)
/* Locate specified table in registry */
RegIndex = CFE_TBL_FindTableInRegistry(TblFileHeader.TableName);

if (RegIndex == CFE_TBL_NOT_FOUND)
{
CFE_EVS_SendEvent(CFE_TBL_NO_SUCH_TABLE_ERR_EID, CFE_EVS_EventType_ERROR,
"Unable to locate '%s' in Table Registry", TblFileHeader.TableName);
}
else
if (RegIndex != CFE_TBL_NOT_FOUND)
{
/* Translate the registry index into a record pointer */
RegRecPtr = &CFE_TBL_Global.Registry[RegIndex];
Expand Down Expand Up @@ -660,11 +655,6 @@ int32 CFE_TBL_DumpCmd(const CFE_TBL_DumpCmd_t *data)
}
}
}
else /* Table could not be found in Registry */
{
CFE_EVS_SendEvent(CFE_TBL_NO_SUCH_TABLE_ERR_EID, CFE_EVS_EventType_ERROR,
"Unable to locate '%s' in Table Registry", TableName);
}

return ReturnCode;
}
Expand Down Expand Up @@ -925,11 +915,6 @@ int32 CFE_TBL_ValidateCmd(const CFE_TBL_ValidateCmd_t *data)
}
}
}
else /* Table could not be found in Registry */
{
CFE_EVS_SendEvent(CFE_TBL_NO_SUCH_TABLE_ERR_EID, CFE_EVS_EventType_ERROR,
"Unable to locate '%s' in Table Registry", TableName);
}

return ReturnCode;
}
Expand Down Expand Up @@ -1003,11 +988,6 @@ int32 CFE_TBL_ActivateCmd(const CFE_TBL_ActivateCmd_t *data)
"Cannot activate table '%s'. No Inactive image available", TableName);
}
}
else /* Table could not be found in Registry */
{
CFE_EVS_SendEvent(CFE_TBL_NO_SUCH_TABLE_ERR_EID, CFE_EVS_EventType_ERROR,
"Unable to locate '%s' in Table Registry", TableName);
}

return ReturnCode;
}
Expand Down Expand Up @@ -1283,11 +1263,6 @@ int32 CFE_TBL_SendRegistryCmd(const CFE_TBL_SendRegistryCmd_t *data)
/* Increment Successful Command Counter */
ReturnCode = CFE_TBL_INC_CMD_CTR;
}
else /* Table could not be found in Registry */
{
CFE_EVS_SendEvent(CFE_TBL_NO_SUCH_TABLE_ERR_EID, CFE_EVS_EventType_ERROR,
"Unable to locate '%s' in Table Registry", TableName);
}

return ReturnCode;
}
Expand Down Expand Up @@ -1421,11 +1396,6 @@ int32 CFE_TBL_AbortLoadCmd(const CFE_TBL_AbortLoadCmd_t *data)
"Cannot abort load of '%s'. No load started.", TableName);
}
}
else /* Table could not be found in Registry */
{
CFE_EVS_SendEvent(CFE_TBL_NO_SUCH_TABLE_ERR_EID, CFE_EVS_EventType_ERROR,
"Unable to locate '%s' in Table Registry", TableName);
}

return ReturnCode;
}
Expand Down
Loading

0 comments on commit ae95ec6

Please sign in to comment.