Skip to content

Commit 2890418

Browse files
authored
Merge pull request #625 from dmknutsen/issue_410
Fix #410, separate SYSLOG configurable defaults for power on and proc…
2 parents 963ba09 + 95a3a98 commit 2890418

File tree

3 files changed

+51
-14
lines changed

3 files changed

+51
-14
lines changed

cmake/sample_defs/cpu1_platform_cfg.h

+28-10
Original file line numberDiff line numberDiff line change
@@ -1005,22 +1005,40 @@
10051005
#define CFE_PLATFORM_ES_DEFAULT_CDS_REG_DUMP_FILE "/ram/cfe_cds_reg.log"
10061006

10071007
/**
1008-
** \cfeescfg Define Default System Log Mode
1008+
** \cfeescfg Define Default System Log Mode following Power On Reset
10091009
**
10101010
** \par Description:
1011-
** Defines the default mode for the operation of the ES System log. The log may
1012-
** operate in either Overwrite mode = 0, where once the log becomes full the
1013-
** oldest message in the log will be overwritten, or Discard mode = 1, where
1014-
** once the log becomes full the contents of the log are preserved and the new
1015-
** event is discarded. This constant may hold a value of either 0 or 1
1016-
** depending on the desired default log mode. Overwrite Mode = 0, Discard
1017-
** Mode = 1.
1011+
** Defines the default mode for the operation of the ES System log following a power
1012+
** on reset. The log may operate in either Overwrite mode = 0, where once the
1013+
** log becomes full the oldest message in the log will be overwritten, or
1014+
** Discard mode = 1, where once the log becomes full the contents of the log are
1015+
** preserved and the new event is discarded. This constant may hold a value of
1016+
** either 0 or 1 depending on the desired default.
1017+
** Overwrite Mode = 0, Discard Mode = 1.
1018+
**
1019+
** \par Limits
1020+
** There is a lower limit of 0 and an upper limit of 1 on this configuration
1021+
** paramater.
1022+
*/
1023+
#define CFE_PLATFORM_ES_DEFAULT_POR_SYSLOG_MODE 0
1024+
1025+
/**
1026+
** \cfeescfg Define Default System Log Mode following Processor Reset
1027+
**
1028+
** \par Description:
1029+
** Defines the default mode for the operation of the ES System log following a
1030+
** processor reset. The log may operate in either Overwrite mode = 0, where once
1031+
** the log becomes full the oldest message in the log will be overwritten, or
1032+
** Discard mode = 1, where once the log becomes full the contents of the log are
1033+
** preserved and the new event is discarded. This constant may hold a value of
1034+
** either 0 or 1 depending on the desired default.
1035+
** Overwrite Mode = 0, Discard Mode = 1.
10181036
**
10191037
** \par Limits
10201038
** There is a lower limit of 0 and an upper limit of 1 on this configuration
10211039
** paramater.
10221040
*/
1023-
#define CFE_PLATFORM_ES_DEFAULT_SYSLOG_MODE 1
1041+
#define CFE_PLATFORM_ES_DEFAULT_PR_SYSLOG_MODE 1
10241042

10251043
/**
10261044
** \cfeescfg Define Max Number of Performance IDs
@@ -1997,7 +2015,7 @@
19972015
#define CFE_ES_DEFAULT_ER_LOG_FILE CFE_PLATFORM_ES_DEFAULT_ER_LOG_FILE
19982016
#define CFE_ES_DEFAULT_PERF_DUMP_FILENAME CFE_PLATFORM_ES_DEFAULT_PERF_DUMP_FILENAME
19992017
#define CFE_ES_DEFAULT_CDS_REG_DUMP_FILE CFE_PLATFORM_ES_DEFAULT_CDS_REG_DUMP_FILE
2000-
#define CFE_ES_DEFAULT_SYSLOG_MODE CFE_PLATFORM_ES_DEFAULT_SYSLOG_MODE
2018+
#define CFE_ES_DEFAULT_SYSLOG_MODE CFE_PLATFORM_ES_DEFAULT_PR_SYSLOG_MODE
20012019
#define CFE_ES_PERF_MAX_IDS CFE_PLATFORM_ES_PERF_MAX_IDS
20022020
#define CFE_ES_PERF_DATA_BUFFER_SIZE CFE_PLATFORM_ES_PERF_DATA_BUFFER_SIZE
20032021
#define CFE_ES_PERF_FILTMASK_NONE CFE_PLATFORM_ES_PERF_FILTMASK_NONE

fsw/cfe-core/src/es/cfe_es_task.c

+9-2
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,16 @@ int32 CFE_ES_TaskInit(void)
227227
CFE_ES_TaskData.LimitCmd = 4;
228228

229229
/*
230-
** Initialize systemlog to default mode
230+
** Initialize systemlog to default Power On or Processor Reset mode
231231
*/
232-
CFE_ES_ResetDataPtr->SystemLogMode = CFE_PLATFORM_ES_DEFAULT_SYSLOG_MODE;
232+
if (CFE_ES_GetResetType(NULL) == CFE_PSP_RST_TYPE_POWERON)
233+
{
234+
CFE_ES_ResetDataPtr->SystemLogMode = CFE_PLATFORM_ES_DEFAULT_POR_SYSLOG_MODE;
235+
}
236+
else
237+
{
238+
CFE_ES_ResetDataPtr->SystemLogMode = CFE_PLATFORM_ES_DEFAULT_PR_SYSLOG_MODE;
239+
}
233240

234241
/*
235242
** Register event filter table.

fsw/cfe-core/unit-test/es_UT.c

+14-2
Original file line numberDiff line numberDiff line change
@@ -2528,15 +2528,27 @@ void TestTask(void)
25282528
"CFE_ES_TaskInit",
25292529
"Checksum fail");
25302530

2531-
/* Test successful task main process loop */
2531+
/* Test successful task main process loop - Power On Reset Path */
25322532
ES_ResetUnitTest();
25332533
CFE_ES_Global.TaskTable[1].RecordUsed = true; /* this is needed so CFE_ES_GetAppId works */
25342534
CFE_ES_Global.TaskTable[1].AppId = 1;
2535+
CFE_ES_ResetDataPtr->ResetVars.ResetType = 2;
25352536
UT_Report(__FILE__, __LINE__,
25362537
CFE_ES_TaskInit() == CFE_SUCCESS &&
25372538
CFE_ES_TaskData.HkPacket.Payload.CFECoreChecksum != 0xFFFF,
25382539
"CFE_ES_TaskInit",
2539-
"Checksum success");
2540+
"Checksum success, POR Path");
2541+
2542+
/* Test successful task main process loop - Processor Reset Path */
2543+
ES_ResetUnitTest();
2544+
CFE_ES_Global.TaskTable[1].RecordUsed = true; /* this is needed so CFE_ES_GetAppId works */
2545+
CFE_ES_Global.TaskTable[1].AppId = 1;
2546+
CFE_ES_ResetDataPtr->ResetVars.ResetType = 1;
2547+
UT_Report(__FILE__, __LINE__,
2548+
CFE_ES_TaskInit() == CFE_SUCCESS &&
2549+
CFE_ES_TaskData.HkPacket.Payload.CFECoreChecksum != 0xFFFF,
2550+
"CFE_ES_TaskInit",
2551+
"Checksum success, PR Path");
25402552

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

0 commit comments

Comments
 (0)