diff --git a/fsw/src/md_cmds.c b/fsw/src/md_cmds.c index 97d1090..51b6c60 100644 --- a/fsw/src/md_cmds.c +++ b/fsw/src/md_cmds.c @@ -47,14 +47,9 @@ void MD_ProcessStartCmd(const CFE_SB_Buffer_t *BufPtr) int32 NumTblInMask = 0; /* Purely as info for event message */ uint16 TableId = 0; uint16 TableIndex = 0; - MD_CmdStartStop_t *Start = NULL; + MD_CmdStartStop_t *Start = (MD_CmdStartStop_t *)BufPtr; bool AnyTablesInMask = false; - /* - ** Cast message to StartStop Command. - */ - Start = (MD_CmdStartStop_t *)BufPtr; - /* Preview tables specified by command: */ /* Check that there's at least one valid table specified. */ for (TableId = 1; TableId <= MD_NUM_DWELL_TABLES; TableId++) @@ -138,16 +133,11 @@ void MD_ProcessStopCmd(const CFE_SB_Buffer_t *BufPtr) int32 ErrorCount = 0; int32 Status = CFE_SUCCESS; int32 NumTblInMask = 0; /* Purely as info for event message */ - MD_CmdStartStop_t *Stop = NULL; + MD_CmdStartStop_t *Stop = (MD_CmdStartStop_t *)BufPtr; uint16 TableId = 0; uint16 TableIndex = 0; bool AnyTablesInMask = false; - /* - ** Cast message to StartStop Command. - */ - Stop = (MD_CmdStartStop_t *)BufPtr; - for (TableId = 1; TableId <= MD_NUM_DWELL_TABLES; TableId++) { if (MD_TableIsInMask(TableId, Stop->TableMask)) @@ -418,15 +408,10 @@ void MD_ProcessJamCmd(const CFE_SB_Buffer_t *BufPtr) void MD_ProcessSignatureCmd(const CFE_SB_Buffer_t *BufPtr) { int32 Status = CFE_SUCCESS; - MD_CmdSetSignature_t *SignatureCmd = NULL; + MD_CmdSetSignature_t *SignatureCmd = (MD_CmdSetSignature_t *)BufPtr; uint16 TblId = 0; uint16 StringLength; - /* - ** Cast message to Signature Command. - */ - SignatureCmd = (MD_CmdSetSignature_t *)BufPtr; - TblId = SignatureCmd->TableId; /* diff --git a/fsw/src/md_dwell_pkt.c b/fsw/src/md_dwell_pkt.c index 03a1e2e..45ee4e3 100644 --- a/fsw/src/md_dwell_pkt.c +++ b/fsw/src/md_dwell_pkt.c @@ -148,14 +148,11 @@ void MD_DwellLoop(void) int32 MD_GetDwellData(uint16 TblIndex, uint16 EntryIndex) { - uint8 NumBytes = 0; /* Num of bytes to read */ - uint32 MemReadVal = 0; /* 1-, 2-, or 4-byte value */ - MD_DwellPacketControl_t *TblPtr = NULL; /* Points to table struct */ - cpuaddr DwellAddress; /* dwell address */ - int32 Status = CFE_SUCCESS; - - /* Initialize pointer to current table */ - TblPtr = (MD_DwellPacketControl_t *)&MD_AppData.MD_DwellTables[TblIndex]; + uint8 NumBytes = 0; /* Num of bytes to read */ + uint32 MemReadVal = 0; /* 1-, 2-, or 4-byte value */ + MD_DwellPacketControl_t *TblPtr = &MD_AppData.MD_DwellTables[TblIndex]; + int32 Status = CFE_SUCCESS; + cpuaddr DwellAddress; /* dwell address */ /* How many bytes to read?*/ NumBytes = TblPtr->Entry[EntryIndex].Length; diff --git a/fsw/src/md_dwell_tbl.c b/fsw/src/md_dwell_tbl.c index 8cf2dfe..2a4cbdf 100644 --- a/fsw/src/md_dwell_tbl.c +++ b/fsw/src/md_dwell_tbl.c @@ -303,13 +303,10 @@ void MD_CopyUpdatedTbl(MD_DwellTableLoad_t *MD_LoadTablePtr, uint8 TblIndex) uint8 EntryIndex; cpuaddr ResolvedAddr = 0; MD_TableLoadEntry_t * ThisLoadEntry = NULL; - MD_DwellPacketControl_t *LocalControlStruct = NULL; + MD_DwellPacketControl_t *LocalControlStruct = &MD_AppData.MD_DwellTables[TblIndex]; /* Null check on MD_LoadTablePtr not necessary - table passed validation */ - /* Assign pointer to internal control structure. */ - LocalControlStruct = &MD_AppData.MD_DwellTables[TblIndex]; - /* Copy 'Enabled' field from load structure to internal control structure. */ LocalControlStruct->Enabled = MD_LoadTablePtr->Enabled; @@ -351,9 +348,9 @@ void MD_CopyUpdatedTbl(MD_DwellTableLoad_t *MD_LoadTablePtr, uint8 TblIndex) /******************************************************************************/ int32 MD_UpdateTableEnabledField(uint16 TableIndex, uint16 FieldValue) { - int32 Status = CFE_SUCCESS; - int32 GetAddressResult = CFE_SUCCESS; - MD_DwellTableLoad_t *MD_LoadTablePtr = NULL; + int32 Status = CFE_SUCCESS; + MD_DwellTableLoad_t *MD_LoadTablePtr = NULL; + int32 GetAddressResult; GetAddressResult = CFE_TBL_GetAddress((void *)&MD_LoadTablePtr, MD_AppData.MD_TableHandle[TableIndex]); @@ -431,9 +428,9 @@ int32 MD_UpdateTableDwellEntry(uint16 TableIndex, uint16 EntryIndex, uint16 NewL int32 MD_UpdateTableSignature(uint16 TableIndex, char NewSignature[MD_SIGNATURE_FIELD_LENGTH]) { - int32 Status = CFE_SUCCESS; - int32 GetAddressResult = CFE_SUCCESS; - MD_DwellTableLoad_t *MD_LoadTablePtr = NULL; + int32 Status = CFE_SUCCESS; + MD_DwellTableLoad_t *MD_LoadTablePtr = NULL; + int32 GetAddressResult; /* Get pointer to Table */ GetAddressResult = CFE_TBL_GetAddress((void *)&MD_LoadTablePtr, MD_AppData.MD_TableHandle[TableIndex]);