Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix #10, Rename MM_ResetHk to MM_ResetHkData + memset global data at initialization #91

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ A clear and concise description of what the contribution is.
**Testing performed**
Steps taken to test the contribution:
1. Build steps '...'
1. Execution steps '...'
2. Execution steps '...'

**Expected behavior changes**
A clear and concise description of how this contribution will change behavior and level of impact.
Expand Down
2 changes: 1 addition & 1 deletion fsw/inc/mm_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ typedef struct
/**
* \brief Save Symbol Table To File Command
*
* For command details see #MM_SYMTBL_TO_FILE_CC
* For command details see #MM_SYM_TBL_TO_FILE_CC
*/
typedef struct
{
Expand Down
4 changes: 2 additions & 2 deletions fsw/inc/mm_msgdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@
* \par Criticality
* None
*
* \sa #MM_SYMTBL_TO_FILE_CC
* \sa #MM_SYM_TBL_TO_FILE_CC
*/
#define MM_LOOKUP_SYM_CC 9

Expand Down Expand Up @@ -644,7 +644,7 @@
*
* \sa #MM_LOOKUP_SYM_CC
*/
#define MM_SYMTBL_TO_FILE_CC 10
#define MM_SYM_TBL_TO_FILE_CC 10

/**
* \brief EEPROM Write Enable
Expand Down
2 changes: 1 addition & 1 deletion fsw/inc/mm_platform_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
#define MM_MAX_LOAD_FILE_DATA_EEPROM (128 * 1024)

/**
* \brief Maximum number of bytes for an uninterruptable load
* \brief Maximum number of bytes for an uninterruptible load
*
* \par Description:
* Maximum number of bytes that can be loaded with the
Expand Down
15 changes: 6 additions & 9 deletions fsw/src/mm_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,14 @@ CFE_Status_t MM_AppInit(void)
** If this changes add it here as shown in the qq_app.c template
*/

/* Zero out the global data structure */
memset(&MM_AppData, 0, sizeof(MM_AppData));

/*
** Setup the RunStatus variable
*/
MM_AppData.RunStatus = CFE_ES_RunStatus_APP_RUN;

/*
** Initialize application command execution counters
*/
MM_AppData.HkPacket.Payload.CmdCounter = 0;
MM_AppData.HkPacket.Payload.ErrCounter = 0;

/*
** Register for event services
*/
Expand Down Expand Up @@ -210,7 +207,7 @@ CFE_Status_t MM_AppInit(void)
/*
** Initialize MM housekeeping information
*/
MM_ResetHk();
MM_ResetHkData();

/*
** Application startup event message
Expand Down Expand Up @@ -251,7 +248,7 @@ void MM_AppPipe(const CFE_SB_Buffer_t *BufPtr)
** MM ground commands
*/
case MM_CMD_MID:
MM_ResetHk(); /* Clear all "Last Action" data */
MM_ResetHkData(); /* Clear all "Last Action" data */

CFE_MSG_GetFcnCode(&BufPtr->Msg, &CommandCode);
switch (CommandCode)
Expand Down Expand Up @@ -326,7 +323,7 @@ void MM_AppPipe(const CFE_SB_Buffer_t *BufPtr)
}
break;

case MM_SYMTBL_TO_FILE_CC:
case MM_SYM_TBL_TO_FILE_CC:
if (MM_VerifyCmdLength(&BufPtr->Msg, sizeof(MM_SymTblToFileCmd_t)))
{
CmdResult = MM_SymTblToFileCmd(BufPtr);
Expand Down
2 changes: 1 addition & 1 deletion fsw/src/mm_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ bool MM_LookupSymbolCmd(const CFE_SB_Buffer_t *msg);
*
* \param[in] msg Pointer to Software Bus buffer
*
* \sa #MM_SYMTBL_TO_FILE_CC
* \sa #MM_SYM_TBL_TO_FILE_CC
*/
bool MM_SymTblToFileCmd(const CFE_SB_Buffer_t *msg);

Expand Down
4 changes: 2 additions & 2 deletions fsw/src/mm_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ extern MM_AppData_t MM_AppData;
/* Reset the local housekeeping variables to default parameters */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void MM_ResetHk(void)
void MM_ResetHkData(void)
{
MM_AppData.HkPacket.Payload.LastAction = MM_NOACTION;
MM_AppData.HkPacket.Payload.MemType = MM_NOMEMTYPE;
Expand Down Expand Up @@ -541,7 +541,7 @@ bool MM_ResolveSymAddr(MM_SymAddr_t *SymAddr, cpuaddr *ResolvedAddr)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* Compute the CRC of data in a file */
/* Operates from the current location of the file poiner to EOF */
/* Operates from the current location of the file pointer to EOF */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int32 MM_ComputeCRCFromFile(osal_id_t FileHandle, uint32 *CrcPtr, uint32 TypeCRC)
Expand Down
2 changes: 1 addition & 1 deletion fsw/src/mm_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
* This function does not zero the command execution counter
* or the command error counter
*/
void MM_ResetHk(void);
void MM_ResetHkData(void);

/**
* \brief Segment break
Expand Down
2 changes: 1 addition & 1 deletion fsw/src/mm_verify.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
#endif

/*
* Maximum number of bytes for an uninterruptable load
* Maximum number of bytes for an uninterruptible load
*/
#if MM_MAX_UNINTERRUPTIBLE_DATA < 1
#error MM_MAX_UNINTERRUPTIBLE_DATA cannot be less than 1
Expand Down
12 changes: 6 additions & 6 deletions unit-test/mm_app_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ void MM_AppPipe_Test_LookupSymbolFail(void)
void MM_AppPipe_Test_SymTblToFileSuccess(void)
{
CFE_SB_MsgId_t TestMsgId = CFE_SB_ValueToMsgId(MM_CMD_MID);
CFE_MSG_FcnCode_t FcnCode = MM_SYMTBL_TO_FILE_CC;
CFE_MSG_FcnCode_t FcnCode = MM_SYM_TBL_TO_FILE_CC;
size_t MsgSize = sizeof(UT_CmdBuf.SymTblToFileCmd);

UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false);
Expand Down Expand Up @@ -945,7 +945,7 @@ void MM_AppPipe_Test_SymTblToFileSuccess(void)
void MM_AppPipe_Test_SymTblToFileFail(void)
{
CFE_SB_MsgId_t TestMsgId = CFE_SB_ValueToMsgId(MM_CMD_MID);
CFE_MSG_FcnCode_t FcnCode = MM_SYMTBL_TO_FILE_CC;
CFE_MSG_FcnCode_t FcnCode = MM_SYM_TBL_TO_FILE_CC;
size_t MsgSize = sizeof(UT_CmdBuf.SymTblToFileCmd);

UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &TestMsgId, sizeof(TestMsgId), false);
Expand Down Expand Up @@ -1321,7 +1321,7 @@ void MM_LookupSymbolCmd_Test_SymbolLookupError(void)
void MM_SymTblToFileCmd_Test_Nominal(void)
{
CFE_SB_MsgId_t TestMsgId = CFE_SB_ValueToMsgId(MM_CMD_MID);
CFE_MSG_FcnCode_t FcnCode = MM_SYMTBL_TO_FILE_CC;
CFE_MSG_FcnCode_t FcnCode = MM_SYM_TBL_TO_FILE_CC;
size_t MsgSize = sizeof(UT_CmdBuf.SymTblToFileCmd);
int32 strCmpResult;
char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH];
Expand Down Expand Up @@ -1367,7 +1367,7 @@ void MM_SymTblToFileCmd_Test_Nominal(void)
void MM_SymTblToFileCmd_Test_SymbolFilenameNull(void)
{
CFE_SB_MsgId_t TestMsgId = CFE_SB_ValueToMsgId(MM_CMD_MID);
CFE_MSG_FcnCode_t FcnCode = MM_SYMTBL_TO_FILE_CC;
CFE_MSG_FcnCode_t FcnCode = MM_SYM_TBL_TO_FILE_CC;
size_t MsgSize = sizeof(UT_CmdBuf.SymTblToFileCmd);
int32 strCmpResult;
char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH];
Expand Down Expand Up @@ -1407,7 +1407,7 @@ void MM_SymTblToFileCmd_Test_SymbolFilenameNull(void)
void MM_SymTblToFileCmd_Test_SymbolTableDumpError(void)
{
CFE_SB_MsgId_t TestMsgId = CFE_SB_ValueToMsgId(MM_CMD_MID);
CFE_MSG_FcnCode_t FcnCode = MM_SYMTBL_TO_FILE_CC;
CFE_MSG_FcnCode_t FcnCode = MM_SYM_TBL_TO_FILE_CC;
size_t MsgSize = sizeof(UT_CmdBuf.SymTblToFileCmd);
int32 strCmpResult;
char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH];
Expand Down Expand Up @@ -1602,7 +1602,7 @@ void MM_EepromWriteDisCmd_Test_Error(void)
/* ignore dummy message length check */
UT_SetDefaultReturnValue(UT_KEY(MM_VerifyCmdLength), true);

/* Set to generate error message MM_EEPROM_WRITE_DISA_ERR_EID */
/* Set to generate error message MM_EEPROM_WRITE_DIS_ERR_EID */
UT_SetDeferredRetcode(UT_KEY(CFE_PSP_EepromWriteDisable), 1, -1);

/* Execute the function being tested */
Expand Down
2 changes: 1 addition & 1 deletion unit-test/mm_dump_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -1669,7 +1669,7 @@ void MM_DumpInEventCmd_Test_Nominal(void)
char ExpectedEventString[CFE_MISSION_EVS_MAX_MESSAGE_LENGTH];
bool Result;

/* The event string is dynamically generated with string contatentation
/* The event string is dynamically generated with string concatenation
and is reported in context_CFE_EVS_SendEvent as a single string.
The event string cannot be matched to a preformatted value. */
snprintf(ExpectedEventString, CFE_MISSION_EVS_MAX_MESSAGE_LENGTH, "%%s");
Expand Down
6 changes: 3 additions & 3 deletions unit-test/mm_utils_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ uint8 call_count_CFE_EVS_SendEvent;
* Function Definitions
*/

void MM_ResetHk_Test(void)
void MM_ResetHkData_Test(void)
{
MM_AppData.HkPacket.Payload.LastAction = 1;
MM_AppData.HkPacket.Payload.MemType = 2;
Expand All @@ -64,7 +64,7 @@ void MM_ResetHk_Test(void)
MM_AppData.HkPacket.Payload.FileName[0] = 6;

/* Execute the function being tested */
MM_ResetHk();
MM_ResetHkData();

/* Verify results */
UtAssert_True(MM_AppData.HkPacket.Payload.LastAction == MM_NOACTION, "MM_AppData.HkPacket.Payload.LastAction == MM_NOACTION");
Expand Down Expand Up @@ -3571,7 +3571,7 @@ void MM_ComputeCRCFromFile_Test(void)
*/
void UtTest_Setup(void)
{
UtTest_Add(MM_ResetHk_Test, MM_Test_Setup, MM_Test_TearDown, "MM_ResetHk_Test");
UtTest_Add(MM_ResetHkData_Test, MM_Test_Setup, MM_Test_TearDown, "MM_ResetHkData_Test");
UtTest_Add(MM_VerifyCmdLength_Test_Nominal, MM_Test_Setup, MM_Test_TearDown, "MM_VerifyCmdLength_Test_Nominal");
UtTest_Add(MM_VerifyCmdLength_Test_HKRequestLengthError, MM_Test_Setup, MM_Test_TearDown,
"MM_VerifyCmdLength_Test_HKRequestLengthError");
Expand Down
4 changes: 2 additions & 2 deletions unit-test/stubs/mm_utils_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
#include "utassert.h"
#include "utstubs.h"

void MM_ResetHk(void)
void MM_ResetHkData(void)
{
UT_DEFAULT_IMPL(MM_ResetHk);
UT_DEFAULT_IMPL(MM_ResetHkData);
}

void MM_SegmentBreak(void)
Expand Down
Loading