Skip to content

Commit

Permalink
Merge pull request #49 from havencarlson/fix#9
Browse files Browse the repository at this point in the history
Fix #9, move Memory Types to enums
  • Loading branch information
dzbaker authored Oct 20, 2022
2 parents 8acf44c + 0effff6 commit 2efdc96
Show file tree
Hide file tree
Showing 8 changed files with 553 additions and 553 deletions.
2 changes: 1 addition & 1 deletion fsw/src/mm_filedefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ typedef struct
MM_SymAddr_t SymAddress; /**< \brief Symbolic load address or fully resolved dump address */
uint32 NumOfBytes; /**< \brief Bytes to load or bytes dumped */
uint32 Crc; /**< \brief CRC value for load or dump data */
uint8 MemType; /**< \brief Memory type used */
MM_MemType_t MemType; /**< \brief Memory type used */
uint8 Spare[3]; /**< \brief Structure Padding */
} MM_LoadDumpFileHeader_t;

Expand Down
39 changes: 26 additions & 13 deletions fsw/src/mm_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,19 @@
* Type Definitions
************************************************************************/

/**
* \brief Memory Types
*/
typedef enum
{
MM_NOMEMTYPE = 0, /**< \brief Used to indicate that no memtype specified */
MM_RAM = 1, /**< \brief Normal RAM, no special access required */
MM_EEPROM = 2, /**< \brief EEPROM, requires special access for writes */
MM_MEM8 = 3, /**< \brief Optional memory type that is only 8-bit read/write */
MM_MEM16 = 4, /**< \brief Optional memory type that is only 16-bit read/write */
MM_MEM32 = 5 /**< \brief Optional memory type that is only 32-bit read/write */
} MM_MemType_t;

/**
* \defgroup cfsmmcmdstructs CFS Memory Manager Command Structures
* \{
Expand Down Expand Up @@ -75,7 +88,7 @@ typedef struct
CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */

uint8 DataSize; /**< \brief Size of the data to be read */
uint8 MemType; /**< \brief Memory type to peek data from */
MM_MemType_t MemType; /**< \brief Memory type to peek data from */
uint8 Padding[2]; /**< \brief Structure padding */
MM_SymAddr_t SrcSymAddress; /**< \brief Symbolic source peek address */
} MM_PeekCmd_t;
Expand All @@ -90,7 +103,7 @@ typedef struct
CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */

uint8 DataSize; /**< \brief Size of the data to be written */
uint8 MemType; /**< \brief Memory type to poke data to */
MM_MemType_t MemType; /**< \brief Memory type to poke data to */
uint8 Padding[2]; /**< \brief Structure padding */
uint32 Data; /**< \brief Data to be written */
MM_SymAddr_t DestSymAddress; /**< \brief Symbolic destination poke address */
Expand Down Expand Up @@ -121,7 +134,7 @@ typedef struct
{
CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */

uint8 MemType; /**< \brief Memory dump type */
MM_MemType_t MemType; /**< \brief Memory dump type */
uint8 NumOfBytes; /**< \brief Number of bytes to be dumped */
uint16 Padding; /**< \brief Structure padding */
MM_SymAddr_t SrcSymAddress; /**< \brief Symbolic source address */
Expand All @@ -148,7 +161,7 @@ typedef struct
{
CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */

uint8 MemType; /**< \brief Memory dump type */
MM_MemType_t MemType; /**< \brief Memory dump type */
uint8 Padding[3]; /**< \brief Structure padding */
uint32 NumOfBytes; /**< \brief Number of bytes to be dumped */
MM_SymAddr_t SrcSymAddress; /**< \brief Symbol plus optional offset */
Expand All @@ -164,7 +177,7 @@ typedef struct
{
CFE_MSG_CommandHeader_t CmdHeader; /**< \brief Command header */

uint8 MemType; /**< \brief Memory type */
MM_MemType_t MemType; /**< \brief Memory type */
uint8 Padding[3]; /**< \brief Structure padding */
uint32 NumOfBytes; /**< \brief Number of bytes to fill */
uint32 FillPattern; /**< \brief Fill pattern to use */
Expand Down Expand Up @@ -233,14 +246,14 @@ typedef struct
{
CFE_MSG_TelemetryHeader_t TlmHeader; /**< \brief Telemetry header */

uint8 CmdCounter; /**< \brief MM Application Command Counter */
uint8 ErrCounter; /**< \brief MM Application Command Error Counter */
uint8 LastAction; /**< \brief Last command action executed */
uint8 MemType; /**< \brief Memory type for last command */
cpuaddr Address; /**< \brief Fully resolved address used for last command */
uint32 DataValue; /**< \brief Last command data (fill pattern or peek/poke value) */
uint32 BytesProcessed; /**< \brief Bytes processed for last command */
char FileName[OS_MAX_PATH_LEN]; /**< \brief Name of the data file used for last command, where applicable */
uint8 CmdCounter; /**< \brief MM Application Command Counter */
uint8 ErrCounter; /**< \brief MM Application Command Error Counter */
uint8 LastAction; /**< \brief Last command action executed */
MM_MemType_t MemType; /**< \brief Memory type for last command */
cpuaddr Address; /**< \brief Fully resolved address used for last command */
uint32 DataValue; /**< \brief Last command data (fill pattern or peek/poke value) */
uint32 BytesProcessed; /**< \brief Bytes processed for last command */
char FileName[OS_MAX_PATH_LEN]; /**< \brief Name of the data file used for last command, where applicable */
} MM_HkPacket_t;

/**\}*/
Expand Down
13 changes: 0 additions & 13 deletions fsw/src/mm_msgdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,6 @@
#define MM_DWORD_BIT_WIDTH 32 /**< \brief Double word bit width */
/**\}*/

/**
* \name MM Memory Types
* \{
*/
#define MM_NOMEMTYPE 0 /**< \brief Used to indicate that no memtype specified */
#define MM_RAM 1 /**< \brief Normal RAM, no special access required */
#define MM_EEPROM 2 /**< \brief EEPROM, requires special access for writes */
#define MM_MEM8 3 /**< \brief Optional memory type that is only 8-bit read/write */
#define MM_MEM16 4 /**< \brief Optional memory type that is only 16-bit read/write */
#define MM_MEM32 5 /**< \brief Optional memory type that is only 32-bit read/write */
#define MM_NUM_MEMTYPES 6 /**< \brief Number of memory types */
/**\}*/

/**
* \name Misc Initialization Values
* \{
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 @@ -134,7 +134,7 @@ bool MM_VerifyCmdLength(const CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength)
/* Verify peek and poke command parameters */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
bool MM_VerifyPeekPokeParams(cpuaddr Address, uint8 MemType, uint8 SizeInBits)
bool MM_VerifyPeekPokeParams(cpuaddr Address, MM_MemType_t MemType, uint8 SizeInBits)
{
bool Valid = true;
uint8 SizeInBytes;
Expand Down Expand Up @@ -296,7 +296,7 @@ bool MM_VerifyPeekPokeParams(cpuaddr Address, uint8 MemType, uint8 SizeInBits)
/* Verify load/dump memory parameters */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
bool MM_VerifyLoadDumpParams(cpuaddr Address, uint8 MemType, uint32 SizeInBytes, uint8 VerifyType)
bool MM_VerifyLoadDumpParams(cpuaddr Address, MM_MemType_t MemType, uint32 SizeInBytes, uint8 VerifyType)
{
bool Valid = true;
int32 PSP_Status;
Expand Down
4 changes: 2 additions & 2 deletions fsw/src/mm_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ bool MM_VerifyCmdLength(const CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength);
* \retval true Validation passed
* \retval false Validation failed
*/
bool MM_VerifyPeekPokeParams(cpuaddr Address, uint8 MemType, uint8 SizeInBits);
bool MM_VerifyPeekPokeParams(cpuaddr Address, MM_MemType_t MemType, uint8 SizeInBits);

/**
* \brief Verify memory load and dump parameters
Expand All @@ -130,7 +130,7 @@ bool MM_VerifyPeekPokeParams(cpuaddr Address, uint8 MemType, uint8 SizeInBits);
* \retval true Validation passed
* \retval false Validation failed
*/
bool MM_VerifyLoadDumpParams(cpuaddr Address, uint8 MemType, uint32 SizeInBytes, uint8 VerifyType);
bool MM_VerifyLoadDumpParams(cpuaddr Address, MM_MemType_t MemType, uint32 SizeInBytes, uint8 VerifyType);

/**
* \brief Verify 32 bit alignment
Expand Down
6 changes: 3 additions & 3 deletions unit-test/mm_load_tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ int32 UT_MM_LOAD_TEST_CFE_SymbolLookupHook3(void *UserObj, int32 StubRetcode, ui
return true;
}

int8 UT_MM_CFE_OS_ReadHook1_MemType;
int32 UT_MM_CFE_OS_ReadHook_RunCount;
int32 UT_MM_CFE_OS_ReadHook1(void *UserObj, int32 StubRetcode, uint32 CallCount, const UT_StubContext_t *Context)
MM_MemType_t UT_MM_CFE_OS_ReadHook1_MemType;
int32 UT_MM_CFE_OS_ReadHook_RunCount;
int32 UT_MM_CFE_OS_ReadHook1(void *UserObj, int32 StubRetcode, uint32 CallCount, const UT_StubContext_t *Context)
{
void *buffer = *(void **)Context->ArgPtr[1];

Expand Down
Loading

0 comments on commit 2efdc96

Please sign in to comment.