Skip to content

Commit

Permalink
Merge pull request nasa#625 from dmknutsen/issue_410
Browse files Browse the repository at this point in the history
Fix nasa#410, separate SYSLOG configurable defaults for power on and proc…
  • Loading branch information
astrogeco authored Apr 28, 2020
2 parents 963ba09 + 95a3a98 commit 2890418
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 14 deletions.
38 changes: 28 additions & 10 deletions cmake/sample_defs/cpu1_platform_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -1005,22 +1005,40 @@
#define CFE_PLATFORM_ES_DEFAULT_CDS_REG_DUMP_FILE "/ram/cfe_cds_reg.log"

/**
** \cfeescfg Define Default System Log Mode
** \cfeescfg Define Default System Log Mode following Power On Reset
**
** \par Description:
** Defines the default mode for the operation of the ES System log. The log may
** operate in either Overwrite mode = 0, where once the log becomes full the
** oldest message in the log will be overwritten, or Discard mode = 1, where
** once the log becomes full the contents of the log are preserved and the new
** event is discarded. This constant may hold a value of either 0 or 1
** depending on the desired default log mode. Overwrite Mode = 0, Discard
** Mode = 1.
** Defines the default mode for the operation of the ES System log following a power
** on reset. The log may operate in either Overwrite mode = 0, where once the
** log becomes full the oldest message in the log will be overwritten, or
** Discard mode = 1, where once the log becomes full the contents of the log are
** preserved and the new event is discarded. This constant may hold a value of
** either 0 or 1 depending on the desired default.
** Overwrite Mode = 0, Discard Mode = 1.
**
** \par Limits
** There is a lower limit of 0 and an upper limit of 1 on this configuration
** paramater.
*/
#define CFE_PLATFORM_ES_DEFAULT_POR_SYSLOG_MODE 0

/**
** \cfeescfg Define Default System Log Mode following Processor Reset
**
** \par Description:
** Defines the default mode for the operation of the ES System log following a
** processor reset. The log may operate in either Overwrite mode = 0, where once
** the log becomes full the oldest message in the log will be overwritten, or
** Discard mode = 1, where once the log becomes full the contents of the log are
** preserved and the new event is discarded. This constant may hold a value of
** either 0 or 1 depending on the desired default.
** Overwrite Mode = 0, Discard Mode = 1.
**
** \par Limits
** There is a lower limit of 0 and an upper limit of 1 on this configuration
** paramater.
*/
#define CFE_PLATFORM_ES_DEFAULT_SYSLOG_MODE 1
#define CFE_PLATFORM_ES_DEFAULT_PR_SYSLOG_MODE 1

/**
** \cfeescfg Define Max Number of Performance IDs
Expand Down Expand Up @@ -1997,7 +2015,7 @@
#define CFE_ES_DEFAULT_ER_LOG_FILE CFE_PLATFORM_ES_DEFAULT_ER_LOG_FILE
#define CFE_ES_DEFAULT_PERF_DUMP_FILENAME CFE_PLATFORM_ES_DEFAULT_PERF_DUMP_FILENAME
#define CFE_ES_DEFAULT_CDS_REG_DUMP_FILE CFE_PLATFORM_ES_DEFAULT_CDS_REG_DUMP_FILE
#define CFE_ES_DEFAULT_SYSLOG_MODE CFE_PLATFORM_ES_DEFAULT_SYSLOG_MODE
#define CFE_ES_DEFAULT_SYSLOG_MODE CFE_PLATFORM_ES_DEFAULT_PR_SYSLOG_MODE
#define CFE_ES_PERF_MAX_IDS CFE_PLATFORM_ES_PERF_MAX_IDS
#define CFE_ES_PERF_DATA_BUFFER_SIZE CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE
#define CFE_ES_PERF_FILTMASK_NONE CFE_PLATFORM_ES_PERF_FILTMASK_NONE
Expand Down
11 changes: 9 additions & 2 deletions fsw/cfe-core/src/es/cfe_es_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,16 @@ int32 CFE_ES_TaskInit(void)
CFE_ES_TaskData.LimitCmd = 4;

/*
** Initialize systemlog to default mode
** Initialize systemlog to default Power On or Processor Reset mode
*/
CFE_ES_ResetDataPtr->SystemLogMode = CFE_PLATFORM_ES_DEFAULT_SYSLOG_MODE;
if (CFE_ES_GetResetType(NULL) == CFE_PSP_RST_TYPE_POWERON)
{
CFE_ES_ResetDataPtr->SystemLogMode = CFE_PLATFORM_ES_DEFAULT_POR_SYSLOG_MODE;
}
else
{
CFE_ES_ResetDataPtr->SystemLogMode = CFE_PLATFORM_ES_DEFAULT_PR_SYSLOG_MODE;
}

/*
** Register event filter table.
Expand Down
16 changes: 14 additions & 2 deletions fsw/cfe-core/unit-test/es_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -2528,15 +2528,27 @@ void TestTask(void)
"CFE_ES_TaskInit",
"Checksum fail");

/* Test successful task main process loop */
/* Test successful task main process loop - Power On Reset Path */
ES_ResetUnitTest();
CFE_ES_Global.TaskTable[1].RecordUsed = true; /* this is needed so CFE_ES_GetAppId works */
CFE_ES_Global.TaskTable[1].AppId = 1;
CFE_ES_ResetDataPtr->ResetVars.ResetType = 2;
UT_Report(__FILE__, __LINE__,
CFE_ES_TaskInit() == CFE_SUCCESS &&
CFE_ES_TaskData.HkPacket.Payload.CFECoreChecksum != 0xFFFF,
"CFE_ES_TaskInit",
"Checksum success");
"Checksum success, POR Path");

/* Test successful task main process loop - Processor Reset Path */
ES_ResetUnitTest();
CFE_ES_Global.TaskTable[1].RecordUsed = true; /* this is needed so CFE_ES_GetAppId works */
CFE_ES_Global.TaskTable[1].AppId = 1;
CFE_ES_ResetDataPtr->ResetVars.ResetType = 1;
UT_Report(__FILE__, __LINE__,
CFE_ES_TaskInit() == CFE_SUCCESS &&
CFE_ES_TaskData.HkPacket.Payload.CFECoreChecksum != 0xFFFF,
"CFE_ES_TaskInit",
"Checksum success, PR Path");

/* Test task main process loop with a register app failure */
ES_ResetUnitTest();
Expand Down

0 comments on commit 2890418

Please sign in to comment.