Skip to content

Commit

Permalink
Merge pull request nasa#2275 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
cFE Integration candidate: Caelum-rc4+dev44
  • Loading branch information
dzbaker authored Mar 30, 2023
2 parents 7c03369 + 9f1a206 commit 7af467e
Show file tree
Hide file tree
Showing 36 changed files with 1,560 additions and 1,188 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## Development Build: v7.0.0-rc4+dev260
- add more generic status codes
- separate dispatcher for messages
- See <https://github.com/nasa/cFE/pull/2259> and <https://github.com/nasa/cFE/pull/2263>

## Development Build: v7.0.0-rc4+dev254
- improve 64-bit memory address handling in CMD/TLM
- See <https://github.com/nasa/cFE/pull/2256>
Expand Down
24 changes: 24 additions & 0 deletions modules/core_api/fsw/inc/cfe_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,30 @@ char *CFE_ES_StatusToString(CFE_Status_t status, CFE_StatusString_t *status_stri
*/
#define CFE_STATUS_REQUEST_ALREADY_PENDING ((int32)0xc8000006)

/**
* @brief Request or input value failed basic structural validation
*
* A message or table input was not in the proper format to be understood
* and processed by an application, and was rejected.
*/
#define CFE_STATUS_VALIDATION_FAILURE ((int32)0xc8000007)

/**
* @brief Request or input value is out of range
*
* A message, table, or function call input contained a value that was outside
* the acceptable range, and the request was rejected.
*/
#define CFE_STATUS_RANGE_ERROR ((int32)0xc8000008)

/**
* @brief Cannot process request at this time
*
* The system is not currently in the correct state to accept the request at
* this time.
*/
#define CFE_STATUS_INCORRECT_STATE ((int32)0xc8000009)

/**
* @brief Not Implemented
*
Expand Down
2 changes: 1 addition & 1 deletion modules/core_api/fsw/inc/cfe_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#define CFE_VERSION_H

/* Development Build Macro Definitions */
#define CFE_BUILD_NUMBER 254 /**< @brief Development: Number of development git commits since CFE_BUILD_BASELINE */
#define CFE_BUILD_NUMBER 260 /**< @brief Development: Number of development git commits since CFE_BUILD_BASELINE */
#define CFE_BUILD_BASELINE "v7.0.0-rc4" /**< @brief Development: Reference git tag for build number */

/* See \ref cfsversions for definitions */
Expand Down
2 changes: 1 addition & 1 deletion modules/core_private/ut-stubs/inc/ut_support.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ void UT_SetupBasicMsgDispatch(const UT_TaskPipeDispatchId_t *DispatchReq, CFE_MS
** \returns
** This function does not return a value.
******************************************************************************/
void UT_CallTaskPipe(void (*TaskPipeFunc)(CFE_SB_Buffer_t *), CFE_MSG_Message_t *MsgPtr, size_t MsgSize,
void UT_CallTaskPipe(void (*TaskPipeFunc)(const CFE_SB_Buffer_t *), const CFE_MSG_Message_t *MsgPtr, size_t MsgSize,
UT_TaskPipeDispatchId_t DispatchId);

/*****************************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion modules/core_private/ut-stubs/src/ut_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ void UT_SetupBasicMsgDispatch(const UT_TaskPipeDispatchId_t *DispatchReq, CFE_MS
** This first sets up the various stubs according to the test case,
** then invokes the pipe function.
*/
void UT_CallTaskPipe(void (*TaskPipeFunc)(CFE_SB_Buffer_t *), CFE_MSG_Message_t *MsgPtr, size_t MsgSize,
void UT_CallTaskPipe(void (*TaskPipeFunc)(const CFE_SB_Buffer_t *), const CFE_MSG_Message_t *MsgPtr, size_t MsgSize,
UT_TaskPipeDispatchId_t DispatchId)
{
union
Expand Down
1 change: 1 addition & 0 deletions modules/es/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ set(es_SOURCES
fsw/src/cfe_es_backgroundtask.c
fsw/src/cfe_es_cds.c
fsw/src/cfe_es_cds_mempool.c
fsw/src/cfe_es_dispatch.c
fsw/src/cfe_es_erlog.c
fsw/src/cfe_es_generic_pool.c
fsw/src/cfe_es_mempool.c
Expand Down
285 changes: 285 additions & 0 deletions modules/es/fsw/src/cfe_es_dispatch.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,285 @@
/************************************************************************
* NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes”
*
* Copyright (c) 2020 United States Government as represented by the
* Administrator of the National Aeronautics and Space Administration.
* All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
************************************************************************/

/**
* @file
*
* Msg pipe dispatcher routines for CFE ES
*/

/*
* Includes
*/
#include "cfe_es_module_all.h"

#include "cfe_version.h"
#include "target_config.h"
#include "cfe_es_verify.h"

#include "cfe_config.h"

#include <string.h>

/*----------------------------------------------------------------
*
* Application-scope internal function
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
bool CFE_ES_VerifyCmdLength(const CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength)
{
bool result = true;
CFE_MSG_Size_t ActualLength = 0;
CFE_MSG_FcnCode_t FcnCode = 0;
CFE_SB_MsgId_t MsgId = CFE_SB_INVALID_MSG_ID;

CFE_MSG_GetSize(MsgPtr, &ActualLength);

/*
** Verify the command packet length
*/
if (ExpectedLength != ActualLength)
{
CFE_MSG_GetMsgId(MsgPtr, &MsgId);
CFE_MSG_GetFcnCode(MsgPtr, &FcnCode);

CFE_EVS_SendEvent(CFE_ES_LEN_ERR_EID, CFE_EVS_EventType_ERROR,
"Invalid msg length: ID = 0x%X, CC = %u, Len = %u, Expected = %u",
(unsigned int)CFE_SB_MsgIdToValue(MsgId), (unsigned int)FcnCode, (unsigned int)ActualLength,
(unsigned int)ExpectedLength);
result = false;
CFE_ES_Global.TaskData.CommandErrorCounter++;
}

return result;
}

/*----------------------------------------------------------------
*
* Application-scope internal function
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
void CFE_ES_TaskPipe(const CFE_SB_Buffer_t *SBBufPtr)
{
CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID;
CFE_MSG_FcnCode_t CommandCode = 0;

CFE_MSG_GetMsgId(&SBBufPtr->Msg, &MessageID);
switch (CFE_SB_MsgIdToValue(MessageID))
{
/*
** Housekeeping telemetry request
*/
case CFE_ES_SEND_HK_MID:
CFE_ES_HousekeepingCmd((const CFE_ES_SendHkCmd_t *)SBBufPtr);
break;

/*
** ES task ground commands
*/
case CFE_ES_CMD_MID:

CFE_MSG_GetFcnCode(&SBBufPtr->Msg, &CommandCode);
switch (CommandCode)
{
case CFE_ES_NOOP_CC:
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_NoopCmd_t)))
{
CFE_ES_NoopCmd((const CFE_ES_NoopCmd_t *)SBBufPtr);
}
break;

case CFE_ES_RESET_COUNTERS_CC:
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_ResetCountersCmd_t)))
{
CFE_ES_ResetCountersCmd((const CFE_ES_ResetCountersCmd_t *)SBBufPtr);
}
break;

case CFE_ES_RESTART_CC:
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_RestartCmd_t)))
{
CFE_ES_RestartCmd((const CFE_ES_RestartCmd_t *)SBBufPtr);
}
break;

case CFE_ES_START_APP_CC:
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_StartAppCmd_t)))
{
CFE_ES_StartAppCmd((const CFE_ES_StartAppCmd_t *)SBBufPtr);
}
break;

case CFE_ES_STOP_APP_CC:
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_StopAppCmd_t)))
{
CFE_ES_StopAppCmd((const CFE_ES_StopAppCmd_t *)SBBufPtr);
}
break;

case CFE_ES_RESTART_APP_CC:
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_RestartAppCmd_t)))
{
CFE_ES_RestartAppCmd((const CFE_ES_RestartAppCmd_t *)SBBufPtr);
}
break;

case CFE_ES_RELOAD_APP_CC:
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_ReloadAppCmd_t)))
{
CFE_ES_ReloadAppCmd((const CFE_ES_ReloadAppCmd_t *)SBBufPtr);
}
break;

case CFE_ES_QUERY_ONE_CC:
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_QueryOneCmd_t)))
{
CFE_ES_QueryOneCmd((const CFE_ES_QueryOneCmd_t *)SBBufPtr);
}
break;

case CFE_ES_QUERY_ALL_CC:
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_QueryAllCmd_t)))
{
CFE_ES_QueryAllCmd((const CFE_ES_QueryAllCmd_t *)SBBufPtr);
}
break;

case CFE_ES_QUERY_ALL_TASKS_CC:
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_QueryAllTasksCmd_t)))
{
CFE_ES_QueryAllTasksCmd((const CFE_ES_QueryAllTasksCmd_t *)SBBufPtr);
}
break;

case CFE_ES_CLEAR_SYSLOG_CC:
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_ClearSysLogCmd_t)))
{
CFE_ES_ClearSysLogCmd((const CFE_ES_ClearSysLogCmd_t *)SBBufPtr);
}
break;

case CFE_ES_WRITE_SYSLOG_CC:
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_WriteSysLogCmd_t)))
{
CFE_ES_WriteSysLogCmd((const CFE_ES_WriteSysLogCmd_t *)SBBufPtr);
}
break;

case CFE_ES_OVER_WRITE_SYSLOG_CC:
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_OverWriteSysLogCmd_t)))
{
CFE_ES_OverWriteSysLogCmd((const CFE_ES_OverWriteSysLogCmd_t *)SBBufPtr);
}
break;

case CFE_ES_CLEAR_ER_LOG_CC:
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_ClearERLogCmd_t)))
{
CFE_ES_ClearERLogCmd((const CFE_ES_ClearERLogCmd_t *)SBBufPtr);
}
break;

case CFE_ES_WRITE_ER_LOG_CC:
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_WriteERLogCmd_t)))
{
CFE_ES_WriteERLogCmd((const CFE_ES_WriteERLogCmd_t *)SBBufPtr);
}
break;

case CFE_ES_START_PERF_DATA_CC:
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_StartPerfDataCmd_t)))
{
CFE_ES_StartPerfDataCmd((const CFE_ES_StartPerfDataCmd_t *)SBBufPtr);
}
break;

case CFE_ES_STOP_PERF_DATA_CC:
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_StopPerfDataCmd_t)))
{
CFE_ES_StopPerfDataCmd((const CFE_ES_StopPerfDataCmd_t *)SBBufPtr);
}
break;

case CFE_ES_SET_PERF_FILTER_MASK_CC:
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_SetPerfFilterMaskCmd_t)))
{
CFE_ES_SetPerfFilterMaskCmd((const CFE_ES_SetPerfFilterMaskCmd_t *)SBBufPtr);
}
break;

case CFE_ES_SET_PERF_TRIGGER_MASK_CC:
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_SetPerfTriggerMaskCmd_t)))
{
CFE_ES_SetPerfTriggerMaskCmd((const CFE_ES_SetPerfTriggerMaskCmd_t *)SBBufPtr);
}
break;

case CFE_ES_RESET_PR_COUNT_CC:
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_ResetPRCountCmd_t)))
{
CFE_ES_ResetPRCountCmd((const CFE_ES_ResetPRCountCmd_t *)SBBufPtr);
}
break;

case CFE_ES_SET_MAX_PR_COUNT_CC:
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_SetMaxPRCountCmd_t)))
{
CFE_ES_SetMaxPRCountCmd((const CFE_ES_SetMaxPRCountCmd_t *)SBBufPtr);
}
break;

case CFE_ES_DELETE_CDS_CC:
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_DeleteCDSCmd_t)))
{
CFE_ES_DeleteCDSCmd((const CFE_ES_DeleteCDSCmd_t *)SBBufPtr);
}
break;

case CFE_ES_SEND_MEM_POOL_STATS_CC:
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_SendMemPoolStatsCmd_t)))
{
CFE_ES_SendMemPoolStatsCmd((const CFE_ES_SendMemPoolStatsCmd_t *)SBBufPtr);
}
break;

case CFE_ES_DUMP_CDS_REGISTRY_CC:
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_DumpCDSRegistryCmd_t)))
{
CFE_ES_DumpCDSRegistryCmd((const CFE_ES_DumpCDSRegistryCmd_t *)SBBufPtr);
}
break;

default:
CFE_EVS_SendEvent(CFE_ES_CC1_ERR_EID, CFE_EVS_EventType_ERROR,
"Invalid ground command code: ID = 0x%X, CC = %d",
(unsigned int)CFE_SB_MsgIdToValue(MessageID), (int)CommandCode);
CFE_ES_Global.TaskData.CommandErrorCounter++;
break;
}
break;

default:

CFE_EVS_SendEvent(CFE_ES_MID_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid command pipe message ID: 0x%X",
(unsigned int)CFE_SB_MsgIdToValue(MessageID));
CFE_ES_Global.TaskData.CommandErrorCounter++;
break;
}
}
Loading

0 comments on commit 7af467e

Please sign in to comment.