-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #169, initial inclusion of EDS file
- Loading branch information
Showing
4 changed files
with
370 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
GSC-18128-1, "Core Flight Executive Version 6.7" | ||
LEW-19710-1, "CCSDS electronic data sheet implementation" | ||
Copyright (c) 2006-2019 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. | ||
This document adheres to the Electronic Data Sheet (EDS) XML schema | ||
as prescribed in CCSDS book 876.0. | ||
Purpose: | ||
This describes all interface objects for the Executive Services (CFE_ES) | ||
core application | ||
--> | ||
<PackageFile xmlns="http://www.ccsds.org/schema/sois/seds"> | ||
<Package name="CI_LAB" shortDescription="Command Ingest"> | ||
<DataTypeSet> | ||
<ContainerDataType name="HkTlm_Payload" shortDescription="CI_LAB_Lab housekeeping"> | ||
<EntryList> | ||
<Entry name="CommandCounter" type="BASE_TYPES/uint8" /> | ||
<Entry name="CommandErrorCounter" type="BASE_TYPES/uint8" /> | ||
<Entry name="EnableChecksums" type="BASE_TYPES/uint8" /> | ||
<Entry name="SocketConnected" type="BASE_TYPES/uint8" /> | ||
<Entry name="IngestPackets" type="BASE_TYPES/uint32" /> | ||
<Entry name="IngestErrors" type="BASE_TYPES/uint32" /> | ||
</EntryList> | ||
</ContainerDataType> | ||
|
||
<ContainerDataType name="SendHkCmd" baseType="CFE_HDR/CommandHeader"> | ||
</ContainerDataType> | ||
|
||
<ContainerDataType name="CommandBase" baseType="CFE_HDR/CommandHeader"> | ||
</ContainerDataType> | ||
|
||
<ContainerDataType name="HkTlm" baseType="CFE_HDR/TelemetryHeader"> | ||
<EntryList> | ||
<Entry type="HkTlm_Payload" name="Payload" /> | ||
</EntryList> | ||
</ContainerDataType> | ||
|
||
|
||
<ContainerDataType name="NoopCmd" baseType="CommandBase"> | ||
<ConstraintSet> | ||
<ValueConstraint entry="Sec.FunctionCode" value="0" /> | ||
</ConstraintSet> | ||
</ContainerDataType> | ||
|
||
<ContainerDataType name="ResetCountersCmd" baseType="CommandBase"> | ||
<ConstraintSet> | ||
<ValueConstraint entry="Sec.FunctionCode" value="1" /> | ||
</ConstraintSet> | ||
</ContainerDataType> | ||
|
||
</DataTypeSet> | ||
|
||
<ComponentSet> | ||
<Component name="Application"> | ||
<RequiredInterfaceSet> | ||
<Interface name="CMD" shortDescription="Software bus telecommand interface" type="CFE_SB/Telecommand"> | ||
<GenericTypeMapSet> | ||
<GenericTypeMap name="TelecommandDataType" type="CommandBase" /> | ||
</GenericTypeMapSet> | ||
</Interface> | ||
<Interface name="SEND_HK" shortDescription="Send telemetry command interface" type="CFE_SB/Telecommand"> | ||
<!-- This uses a bare spacepacket with no payload --> | ||
<GenericTypeMapSet> | ||
<GenericTypeMap name="TelecommandDataType" type="SendHkCmd" /> | ||
</GenericTypeMapSet> | ||
</Interface> | ||
<Interface name="HK_TLM" shortDescription="Software bus housekeeping telemetry interface" type="CFE_SB/Telemetry"> | ||
<GenericTypeMapSet> | ||
<GenericTypeMap name="TelemetryDataType" type="HkTlm" /> | ||
</GenericTypeMapSet> | ||
</Interface> | ||
</RequiredInterfaceSet> | ||
<Implementation> | ||
<VariableSet> | ||
<Variable type="BASE_TYPES/uint16" readOnly="true" name="CmdTopicId" initialValue="${CFE_MISSION/CI_LAB_CMD_TOPICID}" /> | ||
<Variable type="BASE_TYPES/uint16" readOnly="true" name="SendHkTopicId" initialValue="${CFE_MISSION/CI_LAB_SEND_HK_TOPICID}" /> | ||
<Variable type="BASE_TYPES/uint16" readOnly="true" name="HkTlmTopicId" initialValue="${CFE_MISSION/CI_LAB_HK_TLM_TOPICID}" /> | ||
</VariableSet> | ||
<!-- Assign fixed numbers to the "TopicId" parameter of each interface --> | ||
<ParameterMapSet> | ||
<ParameterMap interface="CMD" parameter="TopicId" variableRef="CmdTopicId" /> | ||
<ParameterMap interface="SEND_HK" parameter="TopicId" variableRef="SendHkTopicId" /> | ||
<ParameterMap interface="HK_TLM" parameter="TopicId" variableRef="HkTlmTopicId" /> | ||
</ParameterMapSet> | ||
</Implementation> | ||
</Component> | ||
</ComponentSet> | ||
|
||
</Package> | ||
</PackageFile> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
/************************************************************************ | ||
* 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 | ||
* This file contains the source code for the Command Ingest task. | ||
*/ | ||
|
||
/* | ||
** Include Files: | ||
*/ | ||
|
||
#include "ci_lab_app.h" | ||
#include "ci_lab_perfids.h" | ||
#include "ci_lab_msgids.h" | ||
#include "ci_lab_version.h" | ||
|
||
#include "cfe_config.h" | ||
|
||
#include "edslib_datatypedb.h" | ||
#include "ci_lab_eds_typedefs.h" | ||
#include "cfe_missionlib_api.h" | ||
#include "cfe_missionlib_runtime.h" | ||
#include "cfe_mission_eds_parameters.h" | ||
#include "cfe_mission_eds_interface_parameters.h" | ||
|
||
|
||
/* | ||
* --------------------------------------- | ||
* In an EDS configuration - the data from the network is encoded | ||
* and needs to be read into an intermediate buffer first | ||
* --------------------------------------- | ||
*/ | ||
CFE_Status_t CI_LAB_GetInputBuffer(void **BufferOut, size_t *SizeOut) | ||
{ | ||
static CFE_HDR_CommandHeader_PackedBuffer_t InputBuffer; | ||
|
||
*BufferOut = &InputBuffer; | ||
*SizeOut = sizeof(InputBuffer); | ||
|
||
return CFE_SUCCESS; | ||
} | ||
|
||
/* | ||
* --------------------------------------- | ||
* In an EDS configuration - the data from the network is encoded | ||
* and this function translates the intermediate buffer content | ||
* to an instance of the CFE_SB_Buffer_t that can be sent to SB. | ||
* --------------------------------------- | ||
*/ | ||
CFE_Status_t CI_LAB_DecodeInputMessage(void *SourceBuffer, size_t SourceSize, CFE_SB_Buffer_t **DestBufferOut) | ||
{ | ||
int32 EdsStatus; | ||
uint32 BitSize; | ||
CFE_SB_SoftwareBus_PubSub_Interface_t PubSubParams; | ||
CFE_SB_Listener_Component_t ListenerParams; | ||
EdsLib_DataTypeDB_TypeInfo_t CmdHdrInfo; | ||
EdsLib_Id_t EdsId; | ||
CFE_SB_Buffer_t * IngestBufPtr; | ||
CFE_Status_t ResultStatus; | ||
|
||
const EdsLib_DatabaseObject_t *EDS_DB = CFE_Config_GetObjPointer(CFE_CONFIGID_MISSION_EDS_DB); | ||
|
||
ResultStatus = CFE_STATUS_VALIDATION_FAILURE; | ||
IngestBufPtr = NULL; | ||
|
||
do | ||
{ | ||
EdsId = EDSLIB_MAKE_ID(EDS_INDEX(CFE_HDR), CFE_HDR_CommandHeader_DATADICTIONARY); | ||
EdsStatus = EdsLib_DataTypeDB_GetTypeInfo(EDS_DB, EdsId, &CmdHdrInfo); | ||
if (EdsStatus != EDSLIB_SUCCESS) | ||
{ | ||
OS_printf("EdsLib_DataTypeDB_GetTypeInfo(): %d\n", (int)EdsStatus); | ||
break; | ||
} | ||
|
||
/* sanity check - validate the incoming packet is at least the size of a command header */ | ||
BitSize = 8 * SourceSize; | ||
if (BitSize < CmdHdrInfo.Size.Bits) | ||
{ | ||
OS_printf("CI_LAB: Size mismatch, BitSize=%lu (packet) / %lu (min)\n", | ||
(unsigned long)BitSize, (unsigned long)CmdHdrInfo.Size.Bits); | ||
|
||
ResultStatus = CFE_STATUS_WRONG_MSG_LENGTH; | ||
break; | ||
} | ||
|
||
/* Now get a SB Buffer, as a place to put the decoded data */ | ||
IngestBufPtr = CFE_SB_AllocateMessageBuffer(sizeof(CFE_HDR_CommandHeader_Buffer_t)); | ||
if (IngestBufPtr == NULL) | ||
{ | ||
CFE_EVS_SendEvent(CI_LAB_INGEST_ALLOC_ERR_EID, CFE_EVS_EventType_ERROR, | ||
"CI_LAB: buffer allocation failed\n"); | ||
|
||
ResultStatus = CFE_SB_BUF_ALOC_ERR; | ||
break; | ||
} | ||
|
||
/* Packet is in external wire-format byte order - unpack it and copy */ | ||
EdsId = EDSLIB_MAKE_ID(EDS_INDEX(CFE_HDR), CFE_HDR_CommandHeader_DATADICTIONARY); | ||
EdsStatus = EdsLib_DataTypeDB_UnpackPartialObject(EDS_DB, &EdsId, IngestBufPtr, SourceBuffer, | ||
sizeof(CFE_HDR_CommandHeader_t), BitSize, 0); | ||
if (EdsStatus != EDSLIB_SUCCESS) | ||
{ | ||
OS_printf("EdsLib_DataTypeDB_UnpackPartialObject(1): %d\n", (int)EdsStatus); | ||
break; | ||
} | ||
|
||
/* Header decoded successfully - Now need to determine the type for the rest of the payload */ | ||
CFE_MissionLib_Get_PubSub_Parameters(&PubSubParams, &IngestBufPtr->Msg.BaseMsg); | ||
CFE_MissionLib_UnmapListenerComponent(&ListenerParams, &PubSubParams); | ||
|
||
EdsStatus = CFE_MissionLib_GetArgumentType(&CFE_SOFTWAREBUS_INTERFACE, CFE_SB_Telecommand_Interface_ID, | ||
ListenerParams.Telecommand.TopicId, 1, 1, &EdsId); | ||
if (EdsStatus != CFE_MISSIONLIB_SUCCESS) | ||
{ | ||
OS_printf("CFE_MissionLib_GetArgumentType(): %d\n", (int)EdsStatus); | ||
break; | ||
} | ||
|
||
EdsStatus = EdsLib_DataTypeDB_UnpackPartialObject(EDS_DB, &EdsId, IngestBufPtr, SourceBuffer, | ||
sizeof(CFE_HDR_CommandHeader_Buffer_t), BitSize, sizeof(CFE_HDR_CommandHeader_t)); | ||
if (EdsStatus != EDSLIB_SUCCESS) | ||
{ | ||
OS_printf("EdsLib_DataTypeDB_UnpackPartialObject(2): %d\n", (int)EdsStatus); | ||
break; | ||
} | ||
|
||
/* Verify that the checksum and basic fields are correct, and recompute the length entry */ | ||
EdsStatus = EdsLib_DataTypeDB_VerifyUnpackedObject(EDS_DB, EdsId, IngestBufPtr, SourceBuffer, | ||
EDSLIB_DATATYPEDB_RECOMPUTE_LENGTH); | ||
if (EdsStatus != EDSLIB_SUCCESS) | ||
{ | ||
OS_printf("EdsLib_DataTypeDB_VerifyUnpackedObject(): %d\n", (int)EdsStatus); | ||
break; | ||
} | ||
|
||
/* Finally - at this point, we should have a fully decoded buffer */ | ||
ResultStatus = CFE_SUCCESS; | ||
} | ||
while(false); | ||
|
||
if (ResultStatus != CFE_SUCCESS && IngestBufPtr != NULL) | ||
{ | ||
CFE_SB_ReleaseMessageBuffer(IngestBufPtr); | ||
IngestBufPtr = NULL; | ||
} | ||
|
||
*DestBufferOut = IngestBufPtr; | ||
|
||
return ResultStatus; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/******************************************************************************* | ||
** | ||
** GSC-18128-1, "Core Flight Executive Version 6.7" | ||
** | ||
** Copyright (c) 2006-2019 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: ci_lab_app.c | ||
** | ||
** Purpose: | ||
** This file contains the source code for the Command Ingest task. | ||
** | ||
*******************************************************************************/ | ||
|
||
/* | ||
** Include Files: | ||
*/ | ||
|
||
#include "ci_lab_app.h" | ||
#include "ci_lab_eventids.h" | ||
#include "ci_lab_dispatch.h" | ||
#include "ci_lab_cmds.h" | ||
|
||
#include "ci_lab_eds_dictionary.h" | ||
#include "ci_lab_eds_dispatcher.h" | ||
|
||
/* | ||
* Define a lookup table for CI lab command codes | ||
*/ | ||
static const CI_LAB_Application_Component_Telecommand_DispatchTable_t CI_LAB_TC_DISPATCH_TABLE = { | ||
.CMD = | ||
{ | ||
.NoopCmd_indication = CI_LAB_NoopCmd, | ||
.ResetCountersCmd_indication = CI_LAB_ResetCountersCmd, | ||
|
||
}, | ||
.SEND_HK = {.indication = CI_LAB_SendHkCmd}}; | ||
|
||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/ | ||
/* Name: CI_LAB_TaskPipe */ | ||
/* */ | ||
/* Purpose: */ | ||
/* This routine will process any packet that is received on the CI command*/ | ||
/* pipe. The packets received on the CI command pipe are listed here: */ | ||
/* */ | ||
/* 1. NOOP command (from ground) */ | ||
/* 2. Request to reset telemetry counters (from ground) */ | ||
/* 3. Request for housekeeping telemetry packet (from HS task) */ | ||
/* */ | ||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | ||
void CI_LAB_TaskPipe(const CFE_SB_Buffer_t *SBBufPtr) | ||
{ | ||
CFE_SB_MsgId_t MsgId; | ||
CFE_Status_t Status; | ||
|
||
CFE_MSG_GetMsgId(&SBBufPtr->Msg, &MsgId); | ||
|
||
Status = CI_LAB_Application_Component_Telecommand_Dispatch(CFE_SB_Telecommand_indication_Command_ID, SBBufPtr, | ||
&CI_LAB_TC_DISPATCH_TABLE); | ||
|
||
if (Status != CFE_SUCCESS) | ||
{ | ||
CFE_MSG_GetMsgId(&SBBufPtr->Msg, &MsgId); | ||
CI_LAB_Global.HkTlm.Payload.CommandErrorCounter++; | ||
CFE_EVS_SendEvent(CI_LAB_MID_ERR_EID, CFE_EVS_EventType_ERROR, "CI: invalid command packet,MID = 0x%x", | ||
(unsigned int)CFE_SB_MsgIdToValue(MsgId)); | ||
} | ||
|
||
} /* End CI_LAB_TaskPipe */ |