From d24fba8d082f5c8f4785b7dc9d3a99f8212018ae Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Wed, 31 Jan 2024 21:10:02 -0500 Subject: [PATCH] Fix #173, more complete definition of READ_UPLINK Add this command to EDS and implement the other hooks per the patterns --- config/default_ci_lab_msgstruct.h | 5 +++++ eds/ci_lab.xml | 12 +++++++++++- fsw/src/ci_lab_cmds.c | 8 ++++++++ fsw/src/ci_lab_cmds.h | 15 +++++++++++++++ fsw/src/ci_lab_dispatch.c | 3 +-- fsw/src/ci_lab_eds_dispatch.c | 24 +++++++++++++++++------- 6 files changed, 57 insertions(+), 10 deletions(-) diff --git a/config/default_ci_lab_msgstruct.h b/config/default_ci_lab_msgstruct.h index 9680039..8c874a9 100644 --- a/config/default_ci_lab_msgstruct.h +++ b/config/default_ci_lab_msgstruct.h @@ -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; diff --git a/eds/ci_lab.xml b/eds/ci_lab.xml index 52c4d80..2fbc822 100644 --- a/eds/ci_lab.xml +++ b/eds/ci_lab.xml @@ -45,6 +45,9 @@ + + + @@ -78,27 +81,34 @@ - + + + + + + + + diff --git a/fsw/src/ci_lab_cmds.c b/fsw/src/ci_lab_cmds.c index 2a02fe8..e19d9fc 100644 --- a/fsw/src/ci_lab_cmds.c +++ b/fsw/src/ci_lab_cmds.c @@ -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; +} \ No newline at end of file diff --git a/fsw/src/ci_lab_cmds.h b/fsw/src/ci_lab_cmds.h index b399ee4..a26ff76 100644 --- a/fsw/src/ci_lab_cmds.h +++ b/fsw/src/ci_lab_cmds.h @@ -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 diff --git a/fsw/src/ci_lab_dispatch.c b/fsw/src/ci_lab_dispatch.c index 174b00c..6cd94a0 100644 --- a/fsw/src/ci_lab_dispatch.c +++ b/fsw/src/ci_lab_dispatch.c @@ -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: diff --git a/fsw/src/ci_lab_eds_dispatch.c b/fsw/src/ci_lab_eds_dispatch.c index fbe7383..18c0d67 100644 --- a/fsw/src/ci_lab_eds_dispatch.c +++ b/fsw/src/ci_lab_eds_dispatch.c @@ -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 */