Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #173, more complete definition of READ_UPLINK #174

Merged
merged 1 commit into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions config/default_ci_lab_msgstruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ typedef struct
CFE_MSG_CommandHeader_t CommandHeader;
} CI_LAB_SendHkCmd_t;

typedef struct
{
CFE_MSG_CommandHeader_t CommandHeader;
} CI_LAB_ReadUplinkCmd_t;

typedef struct
{
CFE_MSG_TelemetryHeader_t TelemetryHeader;
Expand Down
12 changes: 11 additions & 1 deletion eds/ci_lab.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
<ContainerDataType name="SendHkCmd" baseType="CFE_HDR/CommandHeader">
</ContainerDataType>

<ContainerDataType name="ReadUplinkCmd" baseType="CFE_HDR/CommandHeader">
</ContainerDataType>

<ContainerDataType name="CommandBase" baseType="CFE_HDR/CommandHeader">
</ContainerDataType>

Expand Down Expand Up @@ -78,27 +81,34 @@
</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="READ_UPLINK" shortDescription="Read Uplink interface" type="CFE_SB/Telecommand">
<GenericTypeMapSet>
<GenericTypeMap name="TelecommandDataType" type="ReadUplinkCmd" />
</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="ReadUplinkTopicId" initialValue="${CFE_MISSION/CI_LAB_READ_UPLINK_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="READ_UPLINK" parameter="TopicId" variableRef="ReadUplinkTopicId" />
<ParameterMap interface="HK_TLM" parameter="TopicId" variableRef="HkTlmTopicId" />
</ParameterMapSet>
</Implementation>
Expand Down
8 changes: 8 additions & 0 deletions fsw/src/ci_lab_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,11 @@ CFE_Status_t CI_LAB_SendHkCmd(const CI_LAB_SendHkCmd_t *cmd)
CFE_SB_TransmitMsg(CFE_MSG_PTR(CI_LAB_Global.HkTlm.TelemetryHeader), true);
return CFE_SUCCESS;
}

CFE_Status_t CI_LAB_ReadUplinkCmd(const CI_LAB_ReadUplinkCmd_t *cmd)
{
/* Any occurrence of this request will cause CI to read ONLY on this request thereafter */
CI_LAB_Global.Scheduled = true;
CI_LAB_ReadUpLink();
return CFE_SUCCESS;
}
15 changes: 15 additions & 0 deletions fsw/src/ci_lab_cmds.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,19 @@ CFE_Status_t CI_LAB_ResetCountersCmd(const CI_LAB_ResetCountersCmd_t *cmd);
*/
CFE_Status_t CI_LAB_SendHkCmd(const CI_LAB_SendHkCmd_t *cmd);

/**
* @brief Read Uplink command packets
*
* This allows servicing of the CI_LAB uplink to be scheduled in a designated timeslot.
*
* For backward compatibility, CI_LAB will service the uplink periodically by default,
* using a local timeout. However, if this message is sent by the system scheduler,
* CI_LAB will stop servicing based on the timeout and ONLY based on that command.
*
* @param cmd Input message pointer
* @returns CFE Status code
* @retval #CFE_SUCCESS on successful processing
*/
CFE_Status_t CI_LAB_ReadUplinkCmd(const CI_LAB_ReadUplinkCmd_t *cmd);

#endif
3 changes: 1 addition & 2 deletions fsw/src/ci_lab_dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ void CI_LAB_TaskPipe(const CFE_SB_Buffer_t *SBBufPtr)
break;

case CI_LAB_READ_UPLINK_MID:
CI_LAB_Global.Scheduled = true;
CI_LAB_ReadUpLink();
CI_LAB_ReadUplinkCmd((const CI_LAB_ReadUplinkCmd_t *)SBBufPtr);
break;

default:
Expand Down
24 changes: 17 additions & 7 deletions fsw/src/ci_lab_eds_dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,24 @@
/*
* Define a lookup table for CI lab command codes
*/
static const CI_LAB_Application_Component_Telecommand_DispatchTable_t CI_LAB_TC_DISPATCH_TABLE = {
/* clang-format off */
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}};
{
.NoopCmd_indication = CI_LAB_NoopCmd,
.ResetCountersCmd_indication = CI_LAB_ResetCountersCmd,
},
.SEND_HK =
{
.indication = CI_LAB_SendHkCmd
},
.READ_UPLINK =
{
.indication = CI_LAB_ReadUplinkCmd
}
};
/* clang-format on */

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
/* Name: CI_LAB_TaskPipe */
Expand Down
Loading