Skip to content

Commit 7af467e

Browse files
authored
Merge pull request #2275 from nasa/integration-candidate
cFE Integration candidate: Caelum-rc4+dev44
2 parents 7c03369 + 9f1a206 commit 7af467e

36 files changed

+1560
-1188
lines changed

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## Development Build: v7.0.0-rc4+dev260
4+
- add more generic status codes
5+
- separate dispatcher for messages
6+
- See <https://github.com/nasa/cFE/pull/2259> and <https://github.com/nasa/cFE/pull/2263>
7+
38
## Development Build: v7.0.0-rc4+dev254
49
- improve 64-bit memory address handling in CMD/TLM
510
- See <https://github.com/nasa/cFE/pull/2256>

modules/core_api/fsw/inc/cfe_error.h

+24
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,30 @@ char *CFE_ES_StatusToString(CFE_Status_t status, CFE_StatusString_t *status_stri
202202
*/
203203
#define CFE_STATUS_REQUEST_ALREADY_PENDING ((int32)0xc8000006)
204204

205+
/**
206+
* @brief Request or input value failed basic structural validation
207+
*
208+
* A message or table input was not in the proper format to be understood
209+
* and processed by an application, and was rejected.
210+
*/
211+
#define CFE_STATUS_VALIDATION_FAILURE ((int32)0xc8000007)
212+
213+
/**
214+
* @brief Request or input value is out of range
215+
*
216+
* A message, table, or function call input contained a value that was outside
217+
* the acceptable range, and the request was rejected.
218+
*/
219+
#define CFE_STATUS_RANGE_ERROR ((int32)0xc8000008)
220+
221+
/**
222+
* @brief Cannot process request at this time
223+
*
224+
* The system is not currently in the correct state to accept the request at
225+
* this time.
226+
*/
227+
#define CFE_STATUS_INCORRECT_STATE ((int32)0xc8000009)
228+
205229
/**
206230
* @brief Not Implemented
207231
*

modules/core_api/fsw/inc/cfe_version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#define CFE_VERSION_H
2727

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

3232
/* See \ref cfsversions for definitions */

modules/core_private/ut-stubs/inc/ut_support.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ void UT_SetupBasicMsgDispatch(const UT_TaskPipeDispatchId_t *DispatchReq, CFE_MS
252252
** \returns
253253
** This function does not return a value.
254254
******************************************************************************/
255-
void UT_CallTaskPipe(void (*TaskPipeFunc)(CFE_SB_Buffer_t *), CFE_MSG_Message_t *MsgPtr, size_t MsgSize,
255+
void UT_CallTaskPipe(void (*TaskPipeFunc)(const CFE_SB_Buffer_t *), const CFE_MSG_Message_t *MsgPtr, size_t MsgSize,
256256
UT_TaskPipeDispatchId_t DispatchId);
257257

258258
/*****************************************************************************/

modules/core_private/ut-stubs/src/ut_support.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ void UT_SetupBasicMsgDispatch(const UT_TaskPipeDispatchId_t *DispatchReq, CFE_MS
236236
** This first sets up the various stubs according to the test case,
237237
** then invokes the pipe function.
238238
*/
239-
void UT_CallTaskPipe(void (*TaskPipeFunc)(CFE_SB_Buffer_t *), CFE_MSG_Message_t *MsgPtr, size_t MsgSize,
239+
void UT_CallTaskPipe(void (*TaskPipeFunc)(const CFE_SB_Buffer_t *), const CFE_MSG_Message_t *MsgPtr, size_t MsgSize,
240240
UT_TaskPipeDispatchId_t DispatchId)
241241
{
242242
union

modules/es/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ set(es_SOURCES
1313
fsw/src/cfe_es_backgroundtask.c
1414
fsw/src/cfe_es_cds.c
1515
fsw/src/cfe_es_cds_mempool.c
16+
fsw/src/cfe_es_dispatch.c
1617
fsw/src/cfe_es_erlog.c
1718
fsw/src/cfe_es_generic_pool.c
1819
fsw/src/cfe_es_mempool.c

modules/es/fsw/src/cfe_es_dispatch.c

+285
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,285 @@
1+
/************************************************************************
2+
* NASA Docket No. GSC-18,719-1, and identified as “core Flight System: Bootes”
3+
*
4+
* Copyright (c) 2020 United States Government as represented by the
5+
* Administrator of the National Aeronautics and Space Administration.
6+
* All Rights Reserved.
7+
*
8+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
9+
* not use this file except in compliance with the License. You may obtain
10+
* a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
************************************************************************/
18+
19+
/**
20+
* @file
21+
*
22+
* Msg pipe dispatcher routines for CFE ES
23+
*/
24+
25+
/*
26+
* Includes
27+
*/
28+
#include "cfe_es_module_all.h"
29+
30+
#include "cfe_version.h"
31+
#include "target_config.h"
32+
#include "cfe_es_verify.h"
33+
34+
#include "cfe_config.h"
35+
36+
#include <string.h>
37+
38+
/*----------------------------------------------------------------
39+
*
40+
* Application-scope internal function
41+
* See description in header file for argument/return detail
42+
*
43+
*-----------------------------------------------------------------*/
44+
bool CFE_ES_VerifyCmdLength(const CFE_MSG_Message_t *MsgPtr, size_t ExpectedLength)
45+
{
46+
bool result = true;
47+
CFE_MSG_Size_t ActualLength = 0;
48+
CFE_MSG_FcnCode_t FcnCode = 0;
49+
CFE_SB_MsgId_t MsgId = CFE_SB_INVALID_MSG_ID;
50+
51+
CFE_MSG_GetSize(MsgPtr, &ActualLength);
52+
53+
/*
54+
** Verify the command packet length
55+
*/
56+
if (ExpectedLength != ActualLength)
57+
{
58+
CFE_MSG_GetMsgId(MsgPtr, &MsgId);
59+
CFE_MSG_GetFcnCode(MsgPtr, &FcnCode);
60+
61+
CFE_EVS_SendEvent(CFE_ES_LEN_ERR_EID, CFE_EVS_EventType_ERROR,
62+
"Invalid msg length: ID = 0x%X, CC = %u, Len = %u, Expected = %u",
63+
(unsigned int)CFE_SB_MsgIdToValue(MsgId), (unsigned int)FcnCode, (unsigned int)ActualLength,
64+
(unsigned int)ExpectedLength);
65+
result = false;
66+
CFE_ES_Global.TaskData.CommandErrorCounter++;
67+
}
68+
69+
return result;
70+
}
71+
72+
/*----------------------------------------------------------------
73+
*
74+
* Application-scope internal function
75+
* See description in header file for argument/return detail
76+
*
77+
*-----------------------------------------------------------------*/
78+
void CFE_ES_TaskPipe(const CFE_SB_Buffer_t *SBBufPtr)
79+
{
80+
CFE_SB_MsgId_t MessageID = CFE_SB_INVALID_MSG_ID;
81+
CFE_MSG_FcnCode_t CommandCode = 0;
82+
83+
CFE_MSG_GetMsgId(&SBBufPtr->Msg, &MessageID);
84+
switch (CFE_SB_MsgIdToValue(MessageID))
85+
{
86+
/*
87+
** Housekeeping telemetry request
88+
*/
89+
case CFE_ES_SEND_HK_MID:
90+
CFE_ES_HousekeepingCmd((const CFE_ES_SendHkCmd_t *)SBBufPtr);
91+
break;
92+
93+
/*
94+
** ES task ground commands
95+
*/
96+
case CFE_ES_CMD_MID:
97+
98+
CFE_MSG_GetFcnCode(&SBBufPtr->Msg, &CommandCode);
99+
switch (CommandCode)
100+
{
101+
case CFE_ES_NOOP_CC:
102+
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_NoopCmd_t)))
103+
{
104+
CFE_ES_NoopCmd((const CFE_ES_NoopCmd_t *)SBBufPtr);
105+
}
106+
break;
107+
108+
case CFE_ES_RESET_COUNTERS_CC:
109+
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_ResetCountersCmd_t)))
110+
{
111+
CFE_ES_ResetCountersCmd((const CFE_ES_ResetCountersCmd_t *)SBBufPtr);
112+
}
113+
break;
114+
115+
case CFE_ES_RESTART_CC:
116+
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_RestartCmd_t)))
117+
{
118+
CFE_ES_RestartCmd((const CFE_ES_RestartCmd_t *)SBBufPtr);
119+
}
120+
break;
121+
122+
case CFE_ES_START_APP_CC:
123+
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_StartAppCmd_t)))
124+
{
125+
CFE_ES_StartAppCmd((const CFE_ES_StartAppCmd_t *)SBBufPtr);
126+
}
127+
break;
128+
129+
case CFE_ES_STOP_APP_CC:
130+
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_StopAppCmd_t)))
131+
{
132+
CFE_ES_StopAppCmd((const CFE_ES_StopAppCmd_t *)SBBufPtr);
133+
}
134+
break;
135+
136+
case CFE_ES_RESTART_APP_CC:
137+
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_RestartAppCmd_t)))
138+
{
139+
CFE_ES_RestartAppCmd((const CFE_ES_RestartAppCmd_t *)SBBufPtr);
140+
}
141+
break;
142+
143+
case CFE_ES_RELOAD_APP_CC:
144+
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_ReloadAppCmd_t)))
145+
{
146+
CFE_ES_ReloadAppCmd((const CFE_ES_ReloadAppCmd_t *)SBBufPtr);
147+
}
148+
break;
149+
150+
case CFE_ES_QUERY_ONE_CC:
151+
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_QueryOneCmd_t)))
152+
{
153+
CFE_ES_QueryOneCmd((const CFE_ES_QueryOneCmd_t *)SBBufPtr);
154+
}
155+
break;
156+
157+
case CFE_ES_QUERY_ALL_CC:
158+
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_QueryAllCmd_t)))
159+
{
160+
CFE_ES_QueryAllCmd((const CFE_ES_QueryAllCmd_t *)SBBufPtr);
161+
}
162+
break;
163+
164+
case CFE_ES_QUERY_ALL_TASKS_CC:
165+
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_QueryAllTasksCmd_t)))
166+
{
167+
CFE_ES_QueryAllTasksCmd((const CFE_ES_QueryAllTasksCmd_t *)SBBufPtr);
168+
}
169+
break;
170+
171+
case CFE_ES_CLEAR_SYSLOG_CC:
172+
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_ClearSysLogCmd_t)))
173+
{
174+
CFE_ES_ClearSysLogCmd((const CFE_ES_ClearSysLogCmd_t *)SBBufPtr);
175+
}
176+
break;
177+
178+
case CFE_ES_WRITE_SYSLOG_CC:
179+
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_WriteSysLogCmd_t)))
180+
{
181+
CFE_ES_WriteSysLogCmd((const CFE_ES_WriteSysLogCmd_t *)SBBufPtr);
182+
}
183+
break;
184+
185+
case CFE_ES_OVER_WRITE_SYSLOG_CC:
186+
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_OverWriteSysLogCmd_t)))
187+
{
188+
CFE_ES_OverWriteSysLogCmd((const CFE_ES_OverWriteSysLogCmd_t *)SBBufPtr);
189+
}
190+
break;
191+
192+
case CFE_ES_CLEAR_ER_LOG_CC:
193+
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_ClearERLogCmd_t)))
194+
{
195+
CFE_ES_ClearERLogCmd((const CFE_ES_ClearERLogCmd_t *)SBBufPtr);
196+
}
197+
break;
198+
199+
case CFE_ES_WRITE_ER_LOG_CC:
200+
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_WriteERLogCmd_t)))
201+
{
202+
CFE_ES_WriteERLogCmd((const CFE_ES_WriteERLogCmd_t *)SBBufPtr);
203+
}
204+
break;
205+
206+
case CFE_ES_START_PERF_DATA_CC:
207+
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_StartPerfDataCmd_t)))
208+
{
209+
CFE_ES_StartPerfDataCmd((const CFE_ES_StartPerfDataCmd_t *)SBBufPtr);
210+
}
211+
break;
212+
213+
case CFE_ES_STOP_PERF_DATA_CC:
214+
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_StopPerfDataCmd_t)))
215+
{
216+
CFE_ES_StopPerfDataCmd((const CFE_ES_StopPerfDataCmd_t *)SBBufPtr);
217+
}
218+
break;
219+
220+
case CFE_ES_SET_PERF_FILTER_MASK_CC:
221+
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_SetPerfFilterMaskCmd_t)))
222+
{
223+
CFE_ES_SetPerfFilterMaskCmd((const CFE_ES_SetPerfFilterMaskCmd_t *)SBBufPtr);
224+
}
225+
break;
226+
227+
case CFE_ES_SET_PERF_TRIGGER_MASK_CC:
228+
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_SetPerfTriggerMaskCmd_t)))
229+
{
230+
CFE_ES_SetPerfTriggerMaskCmd((const CFE_ES_SetPerfTriggerMaskCmd_t *)SBBufPtr);
231+
}
232+
break;
233+
234+
case CFE_ES_RESET_PR_COUNT_CC:
235+
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_ResetPRCountCmd_t)))
236+
{
237+
CFE_ES_ResetPRCountCmd((const CFE_ES_ResetPRCountCmd_t *)SBBufPtr);
238+
}
239+
break;
240+
241+
case CFE_ES_SET_MAX_PR_COUNT_CC:
242+
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_SetMaxPRCountCmd_t)))
243+
{
244+
CFE_ES_SetMaxPRCountCmd((const CFE_ES_SetMaxPRCountCmd_t *)SBBufPtr);
245+
}
246+
break;
247+
248+
case CFE_ES_DELETE_CDS_CC:
249+
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_DeleteCDSCmd_t)))
250+
{
251+
CFE_ES_DeleteCDSCmd((const CFE_ES_DeleteCDSCmd_t *)SBBufPtr);
252+
}
253+
break;
254+
255+
case CFE_ES_SEND_MEM_POOL_STATS_CC:
256+
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_SendMemPoolStatsCmd_t)))
257+
{
258+
CFE_ES_SendMemPoolStatsCmd((const CFE_ES_SendMemPoolStatsCmd_t *)SBBufPtr);
259+
}
260+
break;
261+
262+
case CFE_ES_DUMP_CDS_REGISTRY_CC:
263+
if (CFE_ES_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_ES_DumpCDSRegistryCmd_t)))
264+
{
265+
CFE_ES_DumpCDSRegistryCmd((const CFE_ES_DumpCDSRegistryCmd_t *)SBBufPtr);
266+
}
267+
break;
268+
269+
default:
270+
CFE_EVS_SendEvent(CFE_ES_CC1_ERR_EID, CFE_EVS_EventType_ERROR,
271+
"Invalid ground command code: ID = 0x%X, CC = %d",
272+
(unsigned int)CFE_SB_MsgIdToValue(MessageID), (int)CommandCode);
273+
CFE_ES_Global.TaskData.CommandErrorCounter++;
274+
break;
275+
}
276+
break;
277+
278+
default:
279+
280+
CFE_EVS_SendEvent(CFE_ES_MID_ERR_EID, CFE_EVS_EventType_ERROR, "Invalid command pipe message ID: 0x%X",
281+
(unsigned int)CFE_SB_MsgIdToValue(MessageID));
282+
CFE_ES_Global.TaskData.CommandErrorCounter++;
283+
break;
284+
}
285+
}

0 commit comments

Comments
 (0)