Skip to content

Commit

Permalink
Merge pull request nasa#73 from thnkslprpt/fix-72-convert-int32-retur…
Browse files Browse the repository at this point in the history
…n-codes-to-CFE_Status_t

Fix nasa#72, Convert `int32` return codes and variables to `CFE_Status_t`
  • Loading branch information
dzbaker authored May 25, 2023
2 parents 71d4cd4 + 855369d commit d89f08c
Show file tree
Hide file tree
Showing 10 changed files with 124 additions and 123 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#core Flight System (cFS) Memory Manager Application (MM)
# core Flight System (cFS) Memory Manager Application (MM)

## Introduction

Expand Down
10 changes: 5 additions & 5 deletions fsw/src/mm_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ MM_AppData_t MM_AppData;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void MM_AppMain(void)
{
int32 Status = CFE_SUCCESS;
CFE_Status_t Status = CFE_SUCCESS;
CFE_SB_Buffer_t *BufPtr = NULL;

/*
Expand Down Expand Up @@ -127,9 +127,9 @@ void MM_AppMain(void)
/* MM initialization */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int32 MM_AppInit(void)
CFE_Status_t MM_AppInit(void)
{
int32 Status = CFE_SUCCESS;
CFE_Status_t Status = CFE_SUCCESS;

/*
** MM doesn't use the critical data store and
Expand Down Expand Up @@ -539,7 +539,7 @@ bool MM_SymTblToFileCmd(const CFE_SB_Buffer_t *BufPtr)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
bool MM_EepromWriteEnaCmd(const CFE_SB_Buffer_t *BufPtr)
{
int32 cFE_Status = CFE_PSP_ERROR; /* Set to error since we explicitly test for success */
CFE_Status_t cFE_Status = CFE_PSP_ERROR; /* Set to error since we explicitly test for success */
MM_EepromWriteEnaCmd_t *CmdPtr = NULL;
size_t ExpectedLength = sizeof(MM_EepromWriteEnaCmd_t);
bool Result = false;
Expand Down Expand Up @@ -585,7 +585,7 @@ bool MM_EepromWriteEnaCmd(const CFE_SB_Buffer_t *BufPtr)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
bool MM_EepromWriteDisCmd(const CFE_SB_Buffer_t *BufPtr)
{
int32 cFE_Status = CFE_PSP_ERROR; /* Set to error since we explicitly test for success */
CFE_Status_t cFE_Status = CFE_PSP_ERROR; /* Set to error since we explicitly test for success */
MM_EepromWriteDisCmd_t *CmdPtr = NULL;
size_t ExpectedLength = sizeof(MM_EepromWriteDisCmd_t);
bool Result = false;
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 @@ -113,7 +113,7 @@ void MM_AppMain(void);
* \return Execution status, see \ref CFEReturnCodes
* \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
*/
int32 MM_AppInit(void);
CFE_Status_t MM_AppInit(void);

/**
* \brief Process a command pipe message
Expand Down
28 changes: 14 additions & 14 deletions fsw/src/mm_load.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@ bool MM_PokeCmd(const CFE_SB_Buffer_t *BufPtr)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
bool MM_PokeMem(const MM_PokeCmd_t *CmdPtr, cpuaddr DestAddress)
{
uint8 ByteValue;
uint16 WordValue;
int32 PSP_Status = CFE_PSP_SUCCESS;
uint32 DataValue = 0;
uint32 BytesProcessed = 0;
bool ValidPoke = false;
uint8 DataSize = 0; /* only used for giving MEM type/size in events */
uint32 EventID = 0;
uint8 ByteValue;
uint16 WordValue;
CFE_Status_t PSP_Status = CFE_PSP_SUCCESS;
uint32 DataValue = 0;
uint32 BytesProcessed = 0;
bool ValidPoke = false;
uint8 DataSize = 0; /* only used for giving MEM type/size in events */
uint32 EventID = 0;

/* Write input number of bits to destination address */
switch (CmdPtr->DataSize)
Expand Down Expand Up @@ -193,12 +193,12 @@ bool MM_PokeMem(const MM_PokeCmd_t *CmdPtr, cpuaddr DestAddress)
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
bool MM_PokeEeprom(const MM_PokeCmd_t *CmdPtr, cpuaddr DestAddress)
{
uint8 ByteValue;
uint16 WordValue;
int32 PSP_Status;
uint32 DataValue = 0;
uint32 BytesProcessed = 0;
bool ValidPoke = false;
uint8 ByteValue;
uint16 WordValue;
CFE_Status_t PSP_Status;
uint32 DataValue = 0;
uint32 BytesProcessed = 0;
bool ValidPoke = false;

CFE_ES_PerfLogEntry(MM_EEPROM_POKE_PERF_ID);

Expand Down
54 changes: 27 additions & 27 deletions fsw/src/mm_mem16.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ extern MM_AppData_t MM_AppData;
bool MM_LoadMem16FromFile(osal_id_t FileHandle, const char *FileName, const MM_LoadDumpFileHeader_t *FileHeader,
cpuaddr DestAddress)
{
uint32 i;
int32 ReadLength;
int32 PSP_Status = CFE_PSP_SUCCESS;
int32 BytesProcessed = 0;
int32 BytesRemaining = FileHeader->NumOfBytes;
uint16 *DataPointer16 = (uint16 *)DestAddress;
uint16 *ioBuffer16 = (uint16 *)&MM_AppData.LoadBuffer[0];
uint32 SegmentSize = MM_MAX_LOAD_DATA_SEG;
bool Valid = false;
uint32 i;
int32 ReadLength;
CFE_Status_t PSP_Status = CFE_PSP_SUCCESS;
int32 BytesProcessed = 0;
int32 BytesRemaining = FileHeader->NumOfBytes;
uint16 * DataPointer16 = (uint16 *)DestAddress;
uint16 * ioBuffer16 = (uint16 *)&MM_AppData.LoadBuffer[0];
uint32 SegmentSize = MM_MAX_LOAD_DATA_SEG;
bool Valid = false;

while (BytesRemaining != 0)
{
Expand Down Expand Up @@ -134,15 +134,15 @@ bool MM_LoadMem16FromFile(osal_id_t FileHandle, const char *FileName, const MM_L
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
bool MM_DumpMem16ToFile(osal_id_t FileHandle, const char *FileName, const MM_LoadDumpFileHeader_t *FileHeader)
{
bool Valid = true;
int32 OS_Status;
int32 PSP_Status = CFE_PSP_SUCCESS;
uint32 i;
uint32 BytesProcessed = 0;
uint32 BytesRemaining = FileHeader->NumOfBytes;
uint16 *DataPointer16 = (uint16 *)(FileHeader->SymAddress.Offset);
uint16 *ioBuffer16 = (uint16 *)&MM_AppData.DumpBuffer[0];
uint32 SegmentSize = MM_MAX_DUMP_DATA_SEG;
bool Valid = true;
int32 OS_Status;
CFE_Status_t PSP_Status = CFE_PSP_SUCCESS;
uint32 i;
uint32 BytesProcessed = 0;
uint32 BytesRemaining = FileHeader->NumOfBytes;
uint16 * DataPointer16 = (uint16 *)(FileHeader->SymAddress.Offset);
uint16 * ioBuffer16 = (uint16 *)&MM_AppData.DumpBuffer[0];
uint32 SegmentSize = MM_MAX_DUMP_DATA_SEG;

while (BytesRemaining != 0)
{
Expand Down Expand Up @@ -220,15 +220,15 @@ bool MM_DumpMem16ToFile(osal_id_t FileHandle, const char *FileName, const MM_Loa
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
bool MM_FillMem16(cpuaddr DestAddress, const MM_FillMemCmd_t *CmdPtr)
{
uint32 i;
int32 PSP_Status = CFE_PSP_SUCCESS;
uint32 BytesProcessed = 0;
uint32 BytesRemaining = CmdPtr->NumOfBytes;
uint32 NewBytesRemaining;
uint16 FillPattern16 = (uint16)CmdPtr->FillPattern;
uint16 *DataPointer16 = (uint16 *)DestAddress;
uint32 SegmentSize = MM_MAX_FILL_DATA_SEG;
bool Result = true;
uint32 i;
CFE_Status_t PSP_Status = CFE_PSP_SUCCESS;
uint32 BytesProcessed = 0;
uint32 BytesRemaining = CmdPtr->NumOfBytes;
uint32 NewBytesRemaining;
uint16 FillPattern16 = (uint16)CmdPtr->FillPattern;
uint16 * DataPointer16 = (uint16 *)DestAddress;
uint32 SegmentSize = MM_MAX_FILL_DATA_SEG;
bool Result = true;

/* Check fill size and warn if not a multiple of 2 */
if ((BytesRemaining % 2) != 0)
Expand Down
54 changes: 27 additions & 27 deletions fsw/src/mm_mem32.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ extern MM_AppData_t MM_AppData;
bool MM_LoadMem32FromFile(osal_id_t FileHandle, const char *FileName, const MM_LoadDumpFileHeader_t *FileHeader,
cpuaddr DestAddress)
{
uint32 i;
int32 ReadLength;
int32 PSP_Status = CFE_PSP_SUCCESS;
int32 BytesProcessed = 0;
int32 BytesRemaining = FileHeader->NumOfBytes;
uint32 *DataPointer32 = (uint32 *)DestAddress;
uint32 *ioBuffer32 = (uint32 *)&MM_AppData.LoadBuffer[0];
uint32 SegmentSize = MM_MAX_LOAD_DATA_SEG;
bool Valid = false;
uint32 i;
int32 ReadLength;
CFE_Status_t PSP_Status = CFE_PSP_SUCCESS;
int32 BytesProcessed = 0;
int32 BytesRemaining = FileHeader->NumOfBytes;
uint32 * DataPointer32 = (uint32 *)DestAddress;
uint32 * ioBuffer32 = (uint32 *)&MM_AppData.LoadBuffer[0];
uint32 SegmentSize = MM_MAX_LOAD_DATA_SEG;
bool Valid = false;

while (BytesRemaining != 0)
{
Expand Down Expand Up @@ -134,15 +134,15 @@ bool MM_LoadMem32FromFile(osal_id_t FileHandle, const char *FileName, const MM_L
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
bool MM_DumpMem32ToFile(osal_id_t FileHandle, const char *FileName, const MM_LoadDumpFileHeader_t *FileHeader)
{
bool Valid = true;
int32 OS_Status;
int32 PSP_Status = CFE_PSP_SUCCESS;
uint32 i;
uint32 BytesProcessed = 0;
uint32 BytesRemaining = FileHeader->NumOfBytes;
uint32 *DataPointer32 = (uint32 *)(FileHeader->SymAddress.Offset);
uint32 *ioBuffer32 = (uint32 *)&MM_AppData.DumpBuffer[0];
uint32 SegmentSize = MM_MAX_DUMP_DATA_SEG;
bool Valid = true;
int32 OS_Status;
CFE_Status_t PSP_Status = CFE_PSP_SUCCESS;
uint32 i;
uint32 BytesProcessed = 0;
uint32 BytesRemaining = FileHeader->NumOfBytes;
uint32 * DataPointer32 = (uint32 *)(FileHeader->SymAddress.Offset);
uint32 * ioBuffer32 = (uint32 *)&MM_AppData.DumpBuffer[0];
uint32 SegmentSize = MM_MAX_DUMP_DATA_SEG;

while (BytesRemaining != 0)
{
Expand Down Expand Up @@ -221,15 +221,15 @@ bool MM_DumpMem32ToFile(osal_id_t FileHandle, const char *FileName, const MM_Loa
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
bool MM_FillMem32(cpuaddr DestAddress, const MM_FillMemCmd_t *CmdPtr)
{
uint32 i;
int32 PSP_Status = CFE_PSP_SUCCESS;
uint32 BytesProcessed = 0;
uint32 BytesRemaining = CmdPtr->NumOfBytes;
uint32 NewBytesRemaining;
uint32 FillPattern32 = CmdPtr->FillPattern;
uint32 *DataPointer32 = (uint32 *)(DestAddress);
uint32 SegmentSize = MM_MAX_FILL_DATA_SEG;
bool Result = true;
uint32 i;
CFE_Status_t PSP_Status = CFE_PSP_SUCCESS;
uint32 BytesProcessed = 0;
uint32 BytesRemaining = CmdPtr->NumOfBytes;
uint32 NewBytesRemaining;
uint32 FillPattern32 = CmdPtr->FillPattern;
uint32 * DataPointer32 = (uint32 *)(DestAddress);
uint32 SegmentSize = MM_MAX_FILL_DATA_SEG;
bool Result = true;

/* Check fill size and warn if not a multiple of 4 */
if ((BytesRemaining % 4) != 0)
Expand Down
52 changes: 26 additions & 26 deletions fsw/src/mm_mem8.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ extern MM_AppData_t MM_AppData;
bool MM_LoadMem8FromFile(osal_id_t FileHandle, const char *FileName, const MM_LoadDumpFileHeader_t *FileHeader,
cpuaddr DestAddress)
{
uint32 i;
int32 ReadLength;
int32 PSP_Status = CFE_PSP_SUCCESS;
int32 BytesProcessed = 0;
int32 BytesRemaining = FileHeader->NumOfBytes;
uint8 *DataPointer8 = (uint8 *)DestAddress;
uint8 *ioBuffer8 = (uint8 *)&MM_AppData.LoadBuffer[0];
uint32 SegmentSize = MM_MAX_LOAD_DATA_SEG;
bool Valid = false;
uint32 i;
int32 ReadLength;
CFE_Status_t PSP_Status = CFE_PSP_SUCCESS;
int32 BytesProcessed = 0;
int32 BytesRemaining = FileHeader->NumOfBytes;
uint8 * DataPointer8 = (uint8 *)DestAddress;
uint8 * ioBuffer8 = (uint8 *)&MM_AppData.LoadBuffer[0];
uint32 SegmentSize = MM_MAX_LOAD_DATA_SEG;
bool Valid = false;

while (BytesRemaining != 0)
{
Expand Down Expand Up @@ -134,15 +134,15 @@ bool MM_LoadMem8FromFile(osal_id_t FileHandle, const char *FileName, const MM_Lo
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
bool MM_DumpMem8ToFile(osal_id_t FileHandle, const char *FileName, const MM_LoadDumpFileHeader_t *FileHeader)
{
bool Valid = true;
int32 OS_Status;
int32 PSP_Status = CFE_PSP_SUCCESS;
uint32 i;
uint32 BytesProcessed = 0;
uint32 BytesRemaining = FileHeader->NumOfBytes;
uint8 *DataPointer8 = (uint8 *)(FileHeader->SymAddress.Offset);
uint8 *ioBuffer8 = (uint8 *)&MM_AppData.DumpBuffer[0];
uint32 SegmentSize = MM_MAX_DUMP_DATA_SEG;
bool Valid = true;
int32 OS_Status;
CFE_Status_t PSP_Status = CFE_PSP_SUCCESS;
uint32 i;
uint32 BytesProcessed = 0;
uint32 BytesRemaining = FileHeader->NumOfBytes;
uint8 * DataPointer8 = (uint8 *)(FileHeader->SymAddress.Offset);
uint8 * ioBuffer8 = (uint8 *)&MM_AppData.DumpBuffer[0];
uint32 SegmentSize = MM_MAX_DUMP_DATA_SEG;

while (BytesRemaining != 0)
{
Expand Down Expand Up @@ -220,14 +220,14 @@ bool MM_DumpMem8ToFile(osal_id_t FileHandle, const char *FileName, const MM_Load
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
bool MM_FillMem8(cpuaddr DestAddress, const MM_FillMemCmd_t *CmdPtr)
{
uint32 i;
int32 PSP_Status = CFE_PSP_SUCCESS;
uint32 BytesProcessed = 0;
uint32 BytesRemaining = CmdPtr->NumOfBytes;
uint8 FillPattern8 = (uint8)CmdPtr->FillPattern;
uint8 *DataPointer8 = (uint8 *)DestAddress;
uint32 SegmentSize = MM_MAX_FILL_DATA_SEG;
bool Result = true;
uint32 i;
CFE_Status_t PSP_Status = CFE_PSP_SUCCESS;
uint32 BytesProcessed = 0;
uint32 BytesRemaining = CmdPtr->NumOfBytes;
uint8 FillPattern8 = (uint8)CmdPtr->FillPattern;
uint8 * DataPointer8 = (uint8 *)DestAddress;
uint32 SegmentSize = MM_MAX_FILL_DATA_SEG;
bool Result = true;

while (BytesRemaining != 0)
{
Expand Down
10 changes: 5 additions & 5 deletions fsw/src/mm_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,11 @@ bool MM_VerifyPeekPokeParams(cpuaddr Address, MM_MemType_t MemType, uint8 SizeIn
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
bool MM_VerifyLoadDumpParams(cpuaddr Address, MM_MemType_t MemType, uint32 SizeInBytes, uint8 VerifyType)
{
bool Valid = true;
int32 PSP_Status;
uint32 MaxSize = 0;
uint32 PSP_MemType = 0;
char MemTypeStr[MM_MAX_MEM_TYPE_STR_LEN];
bool Valid = true;
CFE_Status_t PSP_Status;
uint32 MaxSize = 0;
uint32 PSP_MemType = 0;
char MemTypeStr[MM_MAX_MEM_TYPE_STR_LEN];

if ((VerifyType != MM_VERIFY_LOAD) && (VerifyType != MM_VERIFY_DUMP) && (VerifyType != MM_VERIFY_EVENT) &&
(VerifyType != MM_VERIFY_FILL) && (VerifyType != MM_VERIFY_WID))
Expand Down
Loading

0 comments on commit d89f08c

Please sign in to comment.