From fce3a6eac28e39cbda39d52667f8c7079268eaab Mon Sep 17 00:00:00 2001 From: Jacob Hageman Date: Thu, 21 May 2020 11:08:25 -0400 Subject: [PATCH] Fix #20, Apply standard style --- fsw/mission_inc/to_lab_perfids.h | 6 +- fsw/platform_inc/to_lab_msgids.h | 11 +- fsw/platform_inc/to_lab_sub_table.h | 54 ++-- fsw/src/to_lab_app.c | 424 +++++++++++++--------------- fsw/src/to_lab_app.h | 17 +- fsw/src/to_lab_events.h | 43 ++- fsw/src/to_lab_msg.h | 89 +++--- fsw/src/to_lab_version.h | 10 +- 8 files changed, 307 insertions(+), 347 deletions(-) diff --git a/fsw/mission_inc/to_lab_perfids.h b/fsw/mission_inc/to_lab_perfids.h index c1461c7..d8157c9 100644 --- a/fsw/mission_inc/to_lab_perfids.h +++ b/fsw/mission_inc/to_lab_perfids.h @@ -20,7 +20,7 @@ ** ** File: to_lab_perfids.h ** -** Purpose: +** Purpose: ** Define TO Lab Performance IDs ** ** Notes: @@ -29,8 +29,8 @@ #ifndef _to_lab_perfids_h_ #define _to_lab_perfids_h_ -#define TO_MAIN_TASK_PERF_ID 34 -#define TO_SOCKET_SEND_PERF_ID 35 +#define TO_MAIN_TASK_PERF_ID 34 +#define TO_SOCKET_SEND_PERF_ID 35 #endif /* _to_lab_perfids_h_ */ diff --git a/fsw/platform_inc/to_lab_msgids.h b/fsw/platform_inc/to_lab_msgids.h index 120201f..c75110e 100644 --- a/fsw/platform_inc/to_lab_msgids.h +++ b/fsw/platform_inc/to_lab_msgids.h @@ -20,7 +20,7 @@ ** ** File: to_lab_msgids.h ** -** Purpose: +** Purpose: ** Define TO Lab Message IDs ** ** Notes: @@ -29,12 +29,11 @@ #ifndef _to_lab_msgids_h_ #define _to_lab_msgids_h_ +#define TO_LAB_CMD_MID 0x1880 +#define TO_LAB_SEND_HK_MID 0x1881 -#define TO_LAB_CMD_MID 0x1880 -#define TO_LAB_SEND_HK_MID 0x1881 - -#define TO_LAB_HK_TLM_MID 0x0880 -#define TO_LAB_DATA_TYPES_MID 0x0881 +#define TO_LAB_HK_TLM_MID 0x0880 +#define TO_LAB_DATA_TYPES_MID 0x0881 #endif /* _to_lab_msgids_h_ */ diff --git a/fsw/platform_inc/to_lab_sub_table.h b/fsw/platform_inc/to_lab_sub_table.h index e48e08d..7ce00c7 100644 --- a/fsw/platform_inc/to_lab_sub_table.h +++ b/fsw/platform_inc/to_lab_sub_table.h @@ -20,14 +20,14 @@ ** ** File: to_sub_table.h ** -** Purpose: -** Define TO Lab CPU specific subscription table +** Purpose: +** Define TO Lab CPU specific subscription table ** ** Notes: ** *************************************************************************/ -/* +/* ** Add the proper include file for the message IDs below */ #include "cfe_msgids.h" @@ -47,13 +47,12 @@ #include "lc_msgids.h" #endif -static TO_subscription_t TO_SubTable[] = -{ - /* CFS App Subscriptions */ - {CFE_SB_MSGID_WRAP_VALUE(TO_LAB_HK_TLM_MID), {0,0}, 4}, - {CFE_SB_MSGID_WRAP_VALUE(TO_LAB_DATA_TYPES_MID), {0,0}, 4}, - {CFE_SB_MSGID_WRAP_VALUE(CI_LAB_HK_TLM_MID), {0,0}, 4}, - {CFE_SB_MSGID_WRAP_VALUE(SAMPLE_APP_HK_TLM_MID), {0,0}, 4}, +static TO_subscription_t TO_SubTable[] = { + /* CFS App Subscriptions */ + {CFE_SB_MSGID_WRAP_VALUE(TO_LAB_HK_TLM_MID), {0, 0}, 4}, + {CFE_SB_MSGID_WRAP_VALUE(TO_LAB_DATA_TYPES_MID), {0, 0}, 4}, + {CFE_SB_MSGID_WRAP_VALUE(CI_LAB_HK_TLM_MID), {0, 0}, 4}, + {CFE_SB_MSGID_WRAP_VALUE(SAMPLE_APP_HK_TLM_MID), {0, 0}, 4}, #if 0 /* Add these if needed */ @@ -64,29 +63,28 @@ static TO_subscription_t TO_SubTable[] = {LC_HK_TLM_MID, {0,0}, 4}, #endif - /* cFE Core subscriptions */ - {CFE_SB_MSGID_WRAP_VALUE(CFE_ES_HK_TLM_MID), {0,0}, 4}, - {CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_HK_TLM_MID), {0,0}, 4}, - {CFE_SB_MSGID_WRAP_VALUE(CFE_SB_HK_TLM_MID), {0,0}, 4}, - {CFE_SB_MSGID_WRAP_VALUE(CFE_TBL_HK_TLM_MID), {0,0}, 4}, - {CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_HK_TLM_MID), {0,0}, 4}, - {CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_DIAG_TLM_MID), {0,0}, 4}, - {CFE_SB_MSGID_WRAP_VALUE(CFE_SB_STATS_TLM_MID), {0,0}, 4}, - {CFE_SB_MSGID_WRAP_VALUE(CFE_TBL_REG_TLM_MID), {0,0}, 4}, - {CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_LONG_EVENT_MSG_MID), {0,0}, 32}, + /* cFE Core subscriptions */ + {CFE_SB_MSGID_WRAP_VALUE(CFE_ES_HK_TLM_MID), {0, 0}, 4}, + {CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_HK_TLM_MID), {0, 0}, 4}, + {CFE_SB_MSGID_WRAP_VALUE(CFE_SB_HK_TLM_MID), {0, 0}, 4}, + {CFE_SB_MSGID_WRAP_VALUE(CFE_TBL_HK_TLM_MID), {0, 0}, 4}, + {CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_HK_TLM_MID), {0, 0}, 4}, + {CFE_SB_MSGID_WRAP_VALUE(CFE_TIME_DIAG_TLM_MID), {0, 0}, 4}, + {CFE_SB_MSGID_WRAP_VALUE(CFE_SB_STATS_TLM_MID), {0, 0}, 4}, + {CFE_SB_MSGID_WRAP_VALUE(CFE_TBL_REG_TLM_MID), {0, 0}, 4}, + {CFE_SB_MSGID_WRAP_VALUE(CFE_EVS_LONG_EVENT_MSG_MID), {0, 0}, 32}, #ifndef CFE_OMIT_DEPRECATED_6_7 - {CFE_SB_MSGID_WRAP_VALUE(CFE_ES_SHELL_TLM_MID), {0,0}, 32}, + {CFE_SB_MSGID_WRAP_VALUE(CFE_ES_SHELL_TLM_MID), {0, 0}, 32}, #endif - {CFE_SB_MSGID_WRAP_VALUE(CFE_ES_APP_TLM_MID), {0,0}, 4}, - {CFE_SB_MSGID_WRAP_VALUE(CFE_ES_MEMSTATS_TLM_MID), {0,0}, 4}, + {CFE_SB_MSGID_WRAP_VALUE(CFE_ES_APP_TLM_MID), {0, 0}, 4}, + {CFE_SB_MSGID_WRAP_VALUE(CFE_ES_MEMSTATS_TLM_MID), {0, 0}, 4}, - {TO_UNUSED, {0,0}, 0}, - {TO_UNUSED, {0,0}, 0}, - {TO_UNUSED, {0,0}, 0} -}; + {TO_UNUSED, {0, 0}, 0}, + {TO_UNUSED, {0, 0}, 0}, + {TO_UNUSED, {0, 0}, 0}}; /************************ -** End of File Comment ** +** End of File Comment ** ************************/ diff --git a/fsw/src/to_lab_app.c b/fsw/src/to_lab_app.c index 91b83c7..9cf0628 100644 --- a/fsw/src/to_lab_app.c +++ b/fsw/src/to_lab_app.c @@ -20,7 +20,7 @@ ** ** File: to_lab_app.c ** -** Purpose: +** Purpose: ** his file contains the source code for the TO lab application ** ** Notes: @@ -34,14 +34,13 @@ #include "to_lab_perfids.h" #include "to_lab_version.h" - /* ** Global Data Section */ typedef union { - CFE_SB_Msg_t MsgHdr; - TO_LAB_HkTlm_t HkTlm; + CFE_SB_Msg_t MsgHdr; + TO_LAB_HkTlm_t HkTlm; } TO_LAB_HkTlm_Buffer_t; typedef union @@ -52,12 +51,12 @@ typedef union typedef struct { - CFE_SB_PipeId_t Tlm_pipe; - CFE_SB_PipeId_t Cmd_pipe; - uint32 TLMsockid; - bool downlink_on; - char tlm_dest_IP[17]; - bool suppress_sendto; + CFE_SB_PipeId_t Tlm_pipe; + CFE_SB_PipeId_t Cmd_pipe; + uint32 TLMsockid; + bool downlink_on; + char tlm_dest_IP[17]; + bool suppress_sendto; TO_LAB_HkTlm_Buffer_t HkBuf; TO_LAB_DataTypes_Buffer_t DataTypesBuf; @@ -68,7 +67,7 @@ TO_LAB_GlobalData_t TO_LAB_Global; /* ** Include the TO subscription table ** This header is in the platform include directory -** and can be changed for default TO subscriptions in +** and can be changed for default TO subscriptions in ** each CPU. */ #include "to_lab_sub_table.h" @@ -76,17 +75,11 @@ TO_LAB_GlobalData_t TO_LAB_Global; /* ** Event Filter Table */ -static CFE_EVS_BinFilter_t CFE_TO_EVS_Filters[] = - { /* Event ID mask */ - {TO_INIT_INF_EID, 0x0000}, - {TO_CRCMDPIPE_ERR_EID, 0x0000}, - {TO_SUBSCRIBE_ERR_EID, 0x0000}, - {TO_TLMOUTSOCKET_ERR_EID, 0x0000}, - {TO_TLMOUTSTOP_ERR_EID, 0x0000}, - {TO_MSGID_ERR_EID, 0x0000}, - {TO_FNCODE_ERR_EID, 0x0000}, - {TO_NOOP_INF_EID, 0x0000} - }; +static CFE_EVS_BinFilter_t CFE_TO_EVS_Filters[] = {/* Event ID mask */ + {TO_INIT_INF_EID, 0x0000}, {TO_CRCMDPIPE_ERR_EID, 0x0000}, + {TO_SUBSCRIBE_ERR_EID, 0x0000}, {TO_TLMOUTSOCKET_ERR_EID, 0x0000}, + {TO_TLMOUTSTOP_ERR_EID, 0x0000}, {TO_MSGID_ERR_EID, 0x0000}, + {TO_FNCODE_ERR_EID, 0x0000}, {TO_NOOP_INF_EID, 0x0000}}; /* ** Prototypes Section @@ -109,7 +102,6 @@ int32 TO_LAB_ResetCounters(const TO_LAB_ResetCounters_t *data); int32 TO_LAB_SendDataTypes(const TO_LAB_SendDataTypes_t *data); int32 TO_LAB_SendHousekeeping(const CCSDS_CommandPacket_t *data); - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* TO_Lab_AppMain() -- Application entry point and main process loop */ @@ -117,20 +109,20 @@ int32 TO_LAB_SendHousekeeping(const CCSDS_CommandPacket_t *data); /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ void TO_Lab_AppMain(void) { - uint32 RunStatus = CFE_ES_RunStatus_APP_RUN; - - CFE_ES_PerfLogEntry(TO_MAIN_TASK_PERF_ID); + uint32 RunStatus = CFE_ES_RunStatus_APP_RUN; + + CFE_ES_PerfLogEntry(TO_MAIN_TASK_PERF_ID); - TO_LAB_init(); + TO_LAB_init(); - /* - ** TO RunLoop - */ - while(CFE_ES_RunLoop(&RunStatus) == true) - { + /* + ** TO RunLoop + */ + while (CFE_ES_RunLoop(&RunStatus) == true) + { CFE_ES_PerfLogExit(TO_MAIN_TASK_PERF_ID); - OS_TaskDelay(TO_TASK_MSEC); /*2 Hz*/ + OS_TaskDelay(TO_TASK_MSEC); /*2 Hz*/ CFE_ES_PerfLogEntry(TO_MAIN_TASK_PERF_ID); @@ -139,25 +131,24 @@ void TO_Lab_AppMain(void) TO_LAB_process_commands(); } - CFE_ES_ExitApp(RunStatus); + CFE_ES_ExitApp(RunStatus); } /* End of TO_Lab_AppMain() */ /* ** TO delete callback function. -** This function will be called in the event that the TO app is killed. +** This function will be called in the event that the TO app is killed. ** It will close the network socket for TO */ void TO_delete_callback(void) { OS_printf("TO delete callback -- Closing TO Network socket.\n"); - if ( TO_LAB_Global.downlink_on ) + if (TO_LAB_Global.downlink_on) { OS_close(TO_LAB_Global.TLMsockid); } } - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* TO_init() -- TO initialization */ @@ -165,79 +156,71 @@ void TO_delete_callback(void) /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ void TO_LAB_init(void) { - int32 status; - char PipeName[16]; - uint16 PipeDepth; - uint16 i; - char ToTlmPipeName[16]; - uint16 ToTlmPipeDepth; + int32 status; + char PipeName[16]; + uint16 PipeDepth; + uint16 i; + char ToTlmPipeName[16]; + uint16 ToTlmPipeDepth; CFE_ES_RegisterApp(); TO_LAB_Global.downlink_on = false; - PipeDepth = TO_LAB_CMD_PIPE_DEPTH; - strcpy(PipeName, "TO_LAB_CMD_PIPE"); + PipeDepth = TO_LAB_CMD_PIPE_DEPTH; + strcpy(PipeName, "TO_LAB_CMD_PIPE"); ToTlmPipeDepth = TO_LAB_TLM_PIPE_DEPTH; - strcpy(ToTlmPipeName, "TO_LAB_TLM_PIPE"); + strcpy(ToTlmPipeName, "TO_LAB_TLM_PIPE"); /* ** Register event filter table... */ - CFE_EVS_Register(CFE_TO_EVS_Filters, - sizeof(CFE_TO_EVS_Filters)/sizeof(CFE_EVS_BinFilter_t), + CFE_EVS_Register(CFE_TO_EVS_Filters, sizeof(CFE_TO_EVS_Filters) / sizeof(CFE_EVS_BinFilter_t), CFE_EVS_EventFilter_BINARY); /* ** Initialize housekeeping packet (clear user data area)... */ - CFE_SB_InitMsg(&TO_LAB_Global.HkBuf.MsgHdr, - TO_LAB_HK_TLM_MID, - sizeof(TO_LAB_Global.HkBuf.HkTlm), true); + CFE_SB_InitMsg(&TO_LAB_Global.HkBuf.MsgHdr, TO_LAB_HK_TLM_MID, sizeof(TO_LAB_Global.HkBuf.HkTlm), true); /* Subscribe to my commands */ status = CFE_SB_CreatePipe(&TO_LAB_Global.Cmd_pipe, PipeDepth, PipeName); if (status == CFE_SUCCESS) { - CFE_SB_Subscribe(TO_LAB_CMD_MID, TO_LAB_Global.Cmd_pipe); - CFE_SB_Subscribe(TO_LAB_SEND_HK_MID, TO_LAB_Global.Cmd_pipe); + CFE_SB_Subscribe(TO_LAB_CMD_MID, TO_LAB_Global.Cmd_pipe); + CFE_SB_Subscribe(TO_LAB_SEND_HK_MID, TO_LAB_Global.Cmd_pipe); } else - CFE_EVS_SendEvent(TO_CRCMDPIPE_ERR_EID,CFE_EVS_EventType_ERROR, - "L%d TO Can't create cmd pipe status %i",__LINE__,(int)status); + CFE_EVS_SendEvent(TO_CRCMDPIPE_ERR_EID, CFE_EVS_EventType_ERROR, "L%d TO Can't create cmd pipe status %i", + __LINE__, (int)status); /* Create TO TLM pipe */ status = CFE_SB_CreatePipe(&TO_LAB_Global.Tlm_pipe, ToTlmPipeDepth, ToTlmPipeName); if (status != CFE_SUCCESS) { - CFE_EVS_SendEvent(TO_TLMPIPE_ERR_EID,CFE_EVS_EventType_ERROR, - "L%d TO Can't create Tlm pipe status %i",__LINE__,(int)status); + CFE_EVS_SendEvent(TO_TLMPIPE_ERR_EID, CFE_EVS_EventType_ERROR, "L%d TO Can't create Tlm pipe status %i", + __LINE__, (int)status); } /* Subscriptions for TLM pipe*/ - for (i=0; (i < (sizeof(TO_SubTable)/sizeof(TO_subscription_t))); i++) + for (i = 0; (i < (sizeof(TO_SubTable) / sizeof(TO_subscription_t))); i++) { - if(CFE_SB_IsValidMsgId(TO_SubTable[i].Stream)) - status = CFE_SB_SubscribeEx(TO_SubTable[i].Stream, - TO_LAB_Global.Tlm_pipe, - TO_SubTable[i].Flags, - TO_SubTable[i].BufLimit); - - if (status != CFE_SUCCESS) - CFE_EVS_SendEvent(TO_SUBSCRIBE_ERR_EID,CFE_EVS_EventType_ERROR, - "L%d TO Can't subscribe to stream 0x%x status %i", __LINE__, - (unsigned int)CFE_SB_MsgIdToValue(TO_SubTable[i].Stream),(int)status); + if (CFE_SB_IsValidMsgId(TO_SubTable[i].Stream)) + status = CFE_SB_SubscribeEx(TO_SubTable[i].Stream, TO_LAB_Global.Tlm_pipe, TO_SubTable[i].Flags, + TO_SubTable[i].BufLimit); + + if (status != CFE_SUCCESS) + CFE_EVS_SendEvent(TO_SUBSCRIBE_ERR_EID, CFE_EVS_EventType_ERROR, + "L%d TO Can't subscribe to stream 0x%x status %i", __LINE__, + (unsigned int)CFE_SB_MsgIdToValue(TO_SubTable[i].Stream), (int)status); } - + /* ** Install the delete handler */ OS_TaskInstallDeleteHandler(&TO_delete_callback); - CFE_EVS_SendEvent (TO_INIT_INF_EID, CFE_EVS_EventType_INFORMATION, - "TO Lab Initialized. Version %d.%d.%d.%d Awaiting enable command.", - TO_LAB_MAJOR_VERSION, - TO_LAB_MINOR_VERSION, - TO_LAB_REVISION, - TO_LAB_MISSION_REV); - + CFE_EVS_SendEvent(TO_INIT_INF_EID, CFE_EVS_EventType_INFORMATION, + "TO Lab Initialized. Version %d.%d.%d.%d Awaiting enable command.", TO_LAB_MAJOR_VERSION, + TO_LAB_MINOR_VERSION, TO_LAB_REVISION, TO_LAB_MISSION_REV); + } /* End of TO_Init() */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -249,25 +232,22 @@ int32 TO_LAB_EnableOutput(const TO_LAB_EnableOutput_t *data) { const TO_LAB_EnableOutput_Payload_t *pCmd = &data->Payload; - (void) CFE_SB_MessageStringGet(TO_LAB_Global.tlm_dest_IP, pCmd->dest_IP, "", - sizeof (TO_LAB_Global.tlm_dest_IP), - sizeof (pCmd->dest_IP)); + (void)CFE_SB_MessageStringGet(TO_LAB_Global.tlm_dest_IP, pCmd->dest_IP, "", sizeof(TO_LAB_Global.tlm_dest_IP), + sizeof(pCmd->dest_IP)); TO_LAB_Global.suppress_sendto = false; - CFE_EVS_SendEvent(TO_TLMOUTENA_INF_EID,CFE_EVS_EventType_INFORMATION, - "TO telemetry output enabled for IP %s", TO_LAB_Global.tlm_dest_IP); + CFE_EVS_SendEvent(TO_TLMOUTENA_INF_EID, CFE_EVS_EventType_INFORMATION, "TO telemetry output enabled for IP %s", + TO_LAB_Global.tlm_dest_IP); - if( !TO_LAB_Global.downlink_on ) /* Then turn it on, otherwise we will just switch destination addresses*/ + if (!TO_LAB_Global.downlink_on) /* Then turn it on, otherwise we will just switch destination addresses*/ { - TO_LAB_openTLM(); - TO_LAB_Global.downlink_on = true; + TO_LAB_openTLM(); + TO_LAB_Global.downlink_on = true; } ++TO_LAB_Global.HkBuf.HkTlm.Payload.CommandCounter; return CFE_SUCCESS; } /* End of TO_LAB_EnableOutput() */ - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* */ /* TO_process_commands() -- Process command pipe message */ @@ -275,38 +255,37 @@ int32 TO_LAB_EnableOutput(const TO_LAB_EnableOutput_t *data) /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ void TO_LAB_process_commands(void) { - CFE_SB_Msg_t *MsgPtr; - CFE_SB_MsgId_t MsgId; + CFE_SB_Msg_t * MsgPtr; + CFE_SB_MsgId_t MsgId; - while(1) + while (1) { - switch (CFE_SB_RcvMsg(&MsgPtr, TO_LAB_Global.Cmd_pipe, CFE_SB_POLL)) - { - case CFE_SUCCESS: - - MsgId = CFE_SB_GetMsgId(MsgPtr); - /* For SB return statuses that imply a message: process it. */ - switch (CFE_SB_MsgIdToValue(MsgId)) - { - case TO_LAB_CMD_MID: - TO_LAB_exec_local_command(MsgPtr); - break; - - case TO_LAB_SEND_HK_MID: - TO_LAB_SendHousekeeping((const CCSDS_CommandPacket_t *)MsgPtr); - break; - - default: - CFE_EVS_SendEvent(TO_MSGID_ERR_EID,CFE_EVS_EventType_ERROR, - "L%d TO: Invalid Msg ID Rcvd 0x%x",__LINE__, - (unsigned int)CFE_SB_MsgIdToValue(MsgId)); - break; - } - break; + switch (CFE_SB_RcvMsg(&MsgPtr, TO_LAB_Global.Cmd_pipe, CFE_SB_POLL)) + { + case CFE_SUCCESS: + + MsgId = CFE_SB_GetMsgId(MsgPtr); + /* For SB return statuses that imply a message: process it. */ + switch (CFE_SB_MsgIdToValue(MsgId)) + { + case TO_LAB_CMD_MID: + TO_LAB_exec_local_command(MsgPtr); + break; + + case TO_LAB_SEND_HK_MID: + TO_LAB_SendHousekeeping((const CCSDS_CommandPacket_t *)MsgPtr); + break; + + default: + CFE_EVS_SendEvent(TO_MSGID_ERR_EID, CFE_EVS_EventType_ERROR, "L%d TO: Invalid Msg ID Rcvd 0x%x", + __LINE__, (unsigned int)CFE_SB_MsgIdToValue(MsgId)); + break; + } + break; default: - /* Exit command processing loop if no message received. */ - return; - } + /* Exit command processing loop if no message received. */ + return; + } } } /* End of TO_process_commands() */ @@ -322,38 +301,37 @@ void TO_LAB_exec_local_command(CFE_SB_MsgPtr_t cmd) switch (CommandCode) { - case TO_NOP_CC: + case TO_NOP_CC: TO_LAB_Noop((const TO_LAB_Noop_t *)cmd); break; - case TO_RESET_STATUS_CC: - TO_LAB_ResetCounters((const TO_LAB_ResetCounters_t*)cmd); + case TO_RESET_STATUS_CC: + TO_LAB_ResetCounters((const TO_LAB_ResetCounters_t *)cmd); break; - case TO_SEND_DATA_TYPES_CC: + case TO_SEND_DATA_TYPES_CC: TO_LAB_SendDataTypes((const TO_LAB_SendDataTypes_t *)cmd); break; - case TO_ADD_PKT_CC: + case TO_ADD_PKT_CC: TO_LAB_AddPacket((const TO_LAB_AddPacket_t *)cmd); break; - case TO_REMOVE_PKT_CC: + case TO_REMOVE_PKT_CC: TO_LAB_RemovePacket((const TO_LAB_RemovePacket_t *)cmd); break; - case TO_REMOVE_ALL_PKT_CC: + case TO_REMOVE_ALL_PKT_CC: TO_LAB_RemoveAll((const TO_LAB_RemoveAll_t *)cmd); break; - case TO_OUTPUT_ENABLE_CC: + case TO_OUTPUT_ENABLE_CC: TO_LAB_EnableOutput((const TO_LAB_EnableOutput_t *)cmd); break; - default: - CFE_EVS_SendEvent(TO_FNCODE_ERR_EID,CFE_EVS_EventType_ERROR, - "L%d TO: Invalid Function Code Rcvd In Ground Command 0x%x",__LINE__, - CommandCode); + default: + CFE_EVS_SendEvent(TO_FNCODE_ERR_EID, CFE_EVS_EventType_ERROR, + "L%d TO: Invalid Function Code Rcvd In Ground Command 0x%x", __LINE__, CommandCode); ++TO_LAB_Global.HkBuf.HkTlm.Payload.CommandErrorCounter; } @@ -366,8 +344,7 @@ void TO_LAB_exec_local_command(CFE_SB_MsgPtr_t cmd) /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ int32 TO_LAB_Noop(const TO_LAB_Noop_t *data) { - CFE_EVS_SendEvent(TO_NOOP_INF_EID,CFE_EVS_EventType_INFORMATION, - "No-op command"); + CFE_EVS_SendEvent(TO_NOOP_INF_EID, CFE_EVS_EventType_INFORMATION, "No-op command"); ++TO_LAB_Global.HkBuf.HkTlm.Payload.CommandCounter; return CFE_SUCCESS; } @@ -380,7 +357,7 @@ int32 TO_LAB_Noop(const TO_LAB_Noop_t *data) int32 TO_LAB_ResetCounters(const TO_LAB_ResetCounters_t *data) { TO_LAB_Global.HkBuf.HkTlm.Payload.CommandErrorCounter = 0; - TO_LAB_Global.HkBuf.HkTlm.Payload.CommandCounter = 0; + TO_LAB_Global.HkBuf.HkTlm.Payload.CommandCounter = 0; return CFE_SUCCESS; } /* End of TO_LAB_ResetCounters() */ @@ -391,12 +368,11 @@ int32 TO_LAB_ResetCounters(const TO_LAB_ResetCounters_t *data) /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ int32 TO_LAB_SendDataTypes(const TO_LAB_SendDataTypes_t *data) { - int16 i; - char string_variable[10] = "ABCDEFGHIJ"; + int16 i; + char string_variable[10] = "ABCDEFGHIJ"; /* initialize data types packet */ - CFE_SB_InitMsg(&TO_LAB_Global.DataTypesBuf.MsgHdr, - TO_LAB_DATA_TYPES_MID, + CFE_SB_InitMsg(&TO_LAB_Global.DataTypesBuf.MsgHdr, TO_LAB_DATA_TYPES_MID, sizeof(TO_LAB_Global.DataTypesBuf.DataTypes), true); CFE_SB_TimeStampMsg(&TO_LAB_Global.DataTypesBuf.MsgHdr); @@ -414,20 +390,21 @@ int32 TO_LAB_SendDataTypes(const TO_LAB_SendDataTypes_t *data) #endif TO_LAB_Global.DataTypesBuf.DataTypes.Payload.bl1 = false; TO_LAB_Global.DataTypesBuf.DataTypes.Payload.bl2 = true; - TO_LAB_Global.DataTypesBuf.DataTypes.Payload.b1 = 16; - TO_LAB_Global.DataTypesBuf.DataTypes.Payload.b2 = 127; - TO_LAB_Global.DataTypesBuf.DataTypes.Payload.b3 = 0x7F; - TO_LAB_Global.DataTypesBuf.DataTypes.Payload.b4 = 0x45; - TO_LAB_Global.DataTypesBuf.DataTypes.Payload.w1 = 0x2468; - TO_LAB_Global.DataTypesBuf.DataTypes.Payload.w2 = 0x7FFF; + TO_LAB_Global.DataTypesBuf.DataTypes.Payload.b1 = 16; + TO_LAB_Global.DataTypesBuf.DataTypes.Payload.b2 = 127; + TO_LAB_Global.DataTypesBuf.DataTypes.Payload.b3 = 0x7F; + TO_LAB_Global.DataTypesBuf.DataTypes.Payload.b4 = 0x45; + TO_LAB_Global.DataTypesBuf.DataTypes.Payload.w1 = 0x2468; + TO_LAB_Global.DataTypesBuf.DataTypes.Payload.w2 = 0x7FFF; TO_LAB_Global.DataTypesBuf.DataTypes.Payload.dw1 = 0x12345678; TO_LAB_Global.DataTypesBuf.DataTypes.Payload.dw2 = 0x87654321; - TO_LAB_Global.DataTypesBuf.DataTypes.Payload.f1 = 90.01; - TO_LAB_Global.DataTypesBuf.DataTypes.Payload.f2 = .0000045; + TO_LAB_Global.DataTypesBuf.DataTypes.Payload.f1 = 90.01; + TO_LAB_Global.DataTypesBuf.DataTypes.Payload.f2 = .0000045; TO_LAB_Global.DataTypesBuf.DataTypes.Payload.df1 = 99.9; TO_LAB_Global.DataTypesBuf.DataTypes.Payload.df2 = .4444; - for (i=0; i < 10; i++) TO_LAB_Global.DataTypesBuf.DataTypes.Payload.str[i] = string_variable[i]; + for (i = 0; i < 10; i++) + TO_LAB_Global.DataTypesBuf.DataTypes.Payload.str[i] = string_variable[i]; CFE_SB_SendMsg(&TO_LAB_Global.DataTypesBuf.MsgHdr); @@ -454,15 +431,16 @@ int32 TO_LAB_SendHousekeeping(const CCSDS_CommandPacket_t *data) /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ void TO_LAB_openTLM(void) { - int32 status; + int32 status; - status = OS_SocketOpen(&TO_LAB_Global.TLMsockid, OS_SocketDomain_INET, OS_SocketType_DATAGRAM); - if ( status != OS_SUCCESS ) - { - CFE_EVS_SendEvent(TO_TLMOUTSOCKET_ERR_EID,CFE_EVS_EventType_ERROR, "L%d, TO TLM socket error: %d",__LINE__, (int)status); - } + status = OS_SocketOpen(&TO_LAB_Global.TLMsockid, OS_SocketDomain_INET, OS_SocketType_DATAGRAM); + if (status != OS_SUCCESS) + { + CFE_EVS_SendEvent(TO_TLMOUTSOCKET_ERR_EID, CFE_EVS_EventType_ERROR, "L%d, TO TLM socket error: %d", __LINE__, + (int)status); + } -/*---------------- Add static arp entries ----------------*/ + /*---------------- Add static arp entries ----------------*/ } /* End of TO_open_TLM() */ @@ -474,25 +452,17 @@ void TO_LAB_openTLM(void) int32 TO_LAB_AddPacket(const TO_LAB_AddPacket_t *data) { const TO_LAB_AddPacket_Payload_t *pCmd = &data->Payload; - int32 status; + int32 status; - status = CFE_SB_SubscribeEx(pCmd->Stream, - TO_LAB_Global.Tlm_pipe, - pCmd->Flags, - pCmd->BufLimit); + status = CFE_SB_SubscribeEx(pCmd->Stream, TO_LAB_Global.Tlm_pipe, pCmd->Flags, pCmd->BufLimit); - if(status != CFE_SUCCESS) - CFE_EVS_SendEvent(TO_ADDPKT_ERR_EID,CFE_EVS_EventType_ERROR, - "L%d TO Can't subscribe 0x%x status %i",__LINE__, - (unsigned int)CFE_SB_MsgIdToValue(pCmd->Stream), - (int)status); + if (status != CFE_SUCCESS) + CFE_EVS_SendEvent(TO_ADDPKT_ERR_EID, CFE_EVS_EventType_ERROR, "L%d TO Can't subscribe 0x%x status %i", __LINE__, + (unsigned int)CFE_SB_MsgIdToValue(pCmd->Stream), (int)status); else - CFE_EVS_SendEvent(TO_ADDPKT_INF_EID,CFE_EVS_EventType_INFORMATION, - "L%d TO AddPkt 0x%x, QoS %d.%d, limit %d",__LINE__, - (unsigned int)CFE_SB_MsgIdToValue(pCmd->Stream), - pCmd->Flags.Priority, - pCmd->Flags.Reliability, - pCmd->BufLimit); + CFE_EVS_SendEvent(TO_ADDPKT_INF_EID, CFE_EVS_EventType_INFORMATION, "L%d TO AddPkt 0x%x, QoS %d.%d, limit %d", + __LINE__, (unsigned int)CFE_SB_MsgIdToValue(pCmd->Stream), pCmd->Flags.Priority, + pCmd->Flags.Reliability, pCmd->BufLimit); ++TO_LAB_Global.HkBuf.HkTlm.Payload.CommandCounter; return CFE_SUCCESS; @@ -506,18 +476,16 @@ int32 TO_LAB_AddPacket(const TO_LAB_AddPacket_t *data) int32 TO_LAB_RemovePacket(const TO_LAB_RemovePacket_t *data) { const TO_LAB_RemovePacket_Payload_t *pCmd = &data->Payload; - int32 status; + int32 status; status = CFE_SB_Unsubscribe(pCmd->Stream, TO_LAB_Global.Tlm_pipe); - if(status != CFE_SUCCESS) - CFE_EVS_SendEvent(TO_REMOVEPKT_ERR_EID,CFE_EVS_EventType_ERROR, - "L%d TO Can't Unsubscribe to Stream 0x%x on pipe %d, status %i",__LINE__, - (unsigned int)CFE_SB_MsgIdToValue(pCmd->Stream), - TO_LAB_Global.Tlm_pipe, (int)status); + if (status != CFE_SUCCESS) + CFE_EVS_SendEvent(TO_REMOVEPKT_ERR_EID, CFE_EVS_EventType_ERROR, + "L%d TO Can't Unsubscribe to Stream 0x%x on pipe %d, status %i", __LINE__, + (unsigned int)CFE_SB_MsgIdToValue(pCmd->Stream), TO_LAB_Global.Tlm_pipe, (int)status); else - CFE_EVS_SendEvent(TO_REMOVEPKT_INF_EID,CFE_EVS_EventType_INFORMATION, - "L%d TO RemovePkt 0x%x",__LINE__, - (unsigned int)CFE_SB_MsgIdToValue(pCmd->Stream)); + CFE_EVS_SendEvent(TO_REMOVEPKT_INF_EID, CFE_EVS_EventType_INFORMATION, "L%d TO RemovePkt 0x%x", __LINE__, + (unsigned int)CFE_SB_MsgIdToValue(pCmd->Stream)); ++TO_LAB_Global.HkBuf.HkTlm.Payload.CommandCounter; return CFE_SUCCESS; } /* End of TO_LAB_RemovePacket() */ @@ -529,37 +497,37 @@ int32 TO_LAB_RemovePacket(const TO_LAB_RemovePacket_t *data) /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ int32 TO_LAB_RemoveAll(const TO_LAB_RemoveAll_t *data) { - int32 status; - int i; + int32 status; + int i; - for (i=0; (i < (sizeof(TO_SubTable)/sizeof(TO_subscription_t))); i++) + for (i = 0; (i < (sizeof(TO_SubTable) / sizeof(TO_subscription_t))); i++) { - if (CFE_SB_IsValidMsgId(TO_SubTable[i].Stream)) - { - status = CFE_SB_Unsubscribe(TO_SubTable[i].Stream, TO_LAB_Global.Tlm_pipe); - - if(status != CFE_SUCCESS) - CFE_EVS_SendEvent(TO_REMOVEALLPTKS_ERR_EID,CFE_EVS_EventType_ERROR, - "L%d TO Can't Unsubscribe to stream 0x%x status %i", __LINE__, - (unsigned int)CFE_SB_MsgIdToValue(TO_SubTable[i].Stream), (int)status); - } + if (CFE_SB_IsValidMsgId(TO_SubTable[i].Stream)) + { + status = CFE_SB_Unsubscribe(TO_SubTable[i].Stream, TO_LAB_Global.Tlm_pipe); + + if (status != CFE_SUCCESS) + CFE_EVS_SendEvent(TO_REMOVEALLPTKS_ERR_EID, CFE_EVS_EventType_ERROR, + "L%d TO Can't Unsubscribe to stream 0x%x status %i", __LINE__, + (unsigned int)CFE_SB_MsgIdToValue(TO_SubTable[i].Stream), (int)status); + } } /* remove commands as well */ status = CFE_SB_Unsubscribe(TO_LAB_CMD_MID, TO_LAB_Global.Cmd_pipe); - if(status != CFE_SUCCESS) - CFE_EVS_SendEvent(TO_REMOVECMDTO_ERR_EID,CFE_EVS_EventType_ERROR, - "L%d TO Can't Unsubscribe to cmd stream 0x%x status %i", __LINE__, - (unsigned int)CFE_SB_MsgIdToValue(TO_LAB_CMD_MID), (int)status); + if (status != CFE_SUCCESS) + CFE_EVS_SendEvent(TO_REMOVECMDTO_ERR_EID, CFE_EVS_EventType_ERROR, + "L%d TO Can't Unsubscribe to cmd stream 0x%x status %i", __LINE__, + (unsigned int)CFE_SB_MsgIdToValue(TO_LAB_CMD_MID), (int)status); status = CFE_SB_Unsubscribe(TO_LAB_SEND_HK_MID, TO_LAB_Global.Cmd_pipe); if (status != CFE_SUCCESS) - CFE_EVS_SendEvent(TO_REMOVEHKTO_ERR_EID,CFE_EVS_EventType_ERROR, - "L%d TO Can't Unsubscribe to cmd stream 0x%x status %i", __LINE__, - (unsigned int)CFE_SB_MsgIdToValue(TO_LAB_CMD_MID), (int)status); + CFE_EVS_SendEvent(TO_REMOVEHKTO_ERR_EID, CFE_EVS_EventType_ERROR, + "L%d TO Can't Unsubscribe to cmd stream 0x%x status %i", __LINE__, + (unsigned int)CFE_SB_MsgIdToValue(TO_LAB_CMD_MID), (int)status); - CFE_EVS_SendEvent(TO_REMOVEALLPKTS_INF_EID,CFE_EVS_EventType_INFORMATION, - "L%d TO Unsubscribed to all Commands and Telemetry", __LINE__); + CFE_EVS_SendEvent(TO_REMOVEALLPKTS_INF_EID, CFE_EVS_EventType_INFORMATION, + "L%d TO Unsubscribed to all Commands and Telemetry", __LINE__); ++TO_LAB_Global.HkBuf.HkTlm.Payload.CommandCounter; return CFE_SUCCESS; @@ -572,11 +540,11 @@ int32 TO_LAB_RemoveAll(const TO_LAB_RemoveAll_t *data) /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ void TO_LAB_forward_telemetry(void) { - OS_SockAddr_t d_addr; - int32 status; - int32 CFE_SB_status; - uint16 size; - CFE_SB_Msg_t *PktPtr; + OS_SockAddr_t d_addr; + int32 status; + int32 CFE_SB_status; + uint16 size; + CFE_SB_Msg_t *PktPtr; OS_SocketAddrInit(&d_addr, OS_SocketDomain_INET); OS_SocketAddrSetPort(&d_addr, cfgTLM_PORT); @@ -585,33 +553,33 @@ void TO_LAB_forward_telemetry(void) do { - CFE_SB_status = CFE_SB_RcvMsg(&PktPtr, TO_LAB_Global.Tlm_pipe, CFE_SB_POLL); - - if ( (CFE_SB_status == CFE_SUCCESS) && (TO_LAB_Global.suppress_sendto == false) ) - { - size = CFE_SB_GetTotalMsgLength(PktPtr); - - if(TO_LAB_Global.downlink_on == true) - { - CFE_ES_PerfLogEntry(TO_SOCKET_SEND_PERF_ID); - - status = OS_SocketSendTo(TO_LAB_Global.TLMsockid, PktPtr, size, &d_addr); - - CFE_ES_PerfLogExit(TO_SOCKET_SEND_PERF_ID); - } - else - { - status = 0; - } - if (status < 0) - { - CFE_EVS_SendEvent(TO_TLMOUTSTOP_ERR_EID,CFE_EVS_EventType_ERROR, - "L%d TO sendto error %d. Tlm output supressed\n", __LINE__, (int)status); - TO_LAB_Global.suppress_sendto = true; - } - } - /* If CFE_SB_status != CFE_SUCCESS, then no packet was received from CFE_SB_RcvMsg() */ - }while(CFE_SB_status == CFE_SUCCESS); + CFE_SB_status = CFE_SB_RcvMsg(&PktPtr, TO_LAB_Global.Tlm_pipe, CFE_SB_POLL); + + if ((CFE_SB_status == CFE_SUCCESS) && (TO_LAB_Global.suppress_sendto == false)) + { + size = CFE_SB_GetTotalMsgLength(PktPtr); + + if (TO_LAB_Global.downlink_on == true) + { + CFE_ES_PerfLogEntry(TO_SOCKET_SEND_PERF_ID); + + status = OS_SocketSendTo(TO_LAB_Global.TLMsockid, PktPtr, size, &d_addr); + + CFE_ES_PerfLogExit(TO_SOCKET_SEND_PERF_ID); + } + else + { + status = 0; + } + if (status < 0) + { + CFE_EVS_SendEvent(TO_TLMOUTSTOP_ERR_EID, CFE_EVS_EventType_ERROR, + "L%d TO sendto error %d. Tlm output supressed\n", __LINE__, (int)status); + TO_LAB_Global.suppress_sendto = true; + } + } + /* If CFE_SB_status != CFE_SUCCESS, then no packet was received from CFE_SB_RcvMsg() */ + } while (CFE_SB_status == CFE_SUCCESS); } /* End of TO_forward_telemetry() */ /************************/ diff --git a/fsw/src/to_lab_app.h b/fsw/src/to_lab_app.h index f541696..095e9ca 100644 --- a/fsw/src/to_lab_app.h +++ b/fsw/src/to_lab_app.h @@ -20,7 +20,7 @@ ** ** File: to_lab_app.h ** -** Purpose: +** Purpose: ** Define TO Lab Application header file ** ** Notes: @@ -46,21 +46,21 @@ /*****************************************************************************/ -#define TO_TASK_MSEC 500 /* run at 2 Hz */ -#define TO_UNUSED CFE_SB_MSGID_RESERVED +#define TO_TASK_MSEC 500 /* run at 2 Hz */ +#define TO_UNUSED CFE_SB_MSGID_RESERVED /** * Depth of pipe for commands to the TO_LAB application itself */ -#define TO_LAB_CMD_PIPE_DEPTH 8 +#define TO_LAB_CMD_PIPE_DEPTH 8 /** * Depth of pipe for telemetry forwarded through the TO_LAB application */ -#define TO_LAB_TLM_PIPE_DEPTH OS_QUEUE_MAX_DEPTH +#define TO_LAB_TLM_PIPE_DEPTH OS_QUEUE_MAX_DEPTH -#define cfgTLM_ADDR "192.168.1.81" -#define cfgTLM_PORT 1235 +#define cfgTLM_ADDR "192.168.1.81" +#define cfgTLM_PORT 1235 #define TO_LAB_VERSION_NUM "5.1.0" /******************************************************************************/ @@ -72,5 +72,4 @@ void TO_Lab_AppMain(void); /******************************************************************************/ -#endif /* _to_lab_app_h_ */ - +#endif /* _to_lab_app_h_ */ diff --git a/fsw/src/to_lab_events.h b/fsw/src/to_lab_events.h index de0eebe..d9c1ad2 100644 --- a/fsw/src/to_lab_events.h +++ b/fsw/src/to_lab_events.h @@ -20,7 +20,7 @@ ** ** File: to_lab_events.h ** -** Purpose: +** Purpose: ** Define TO Lab Event messages ** ** Notes: @@ -32,28 +32,27 @@ /*****************************************************************************/ /* Event message ID's */ -#define TO_EVM_RESERVED 0 +#define TO_EVM_RESERVED 0 -#define TO_INIT_INF_EID 1 -#define TO_CRCMDPIPE_ERR_EID 2 -#define TO_TLMOUTENA_INF_EID 3 -#define TO_SUBSCRIBE_ERR_EID 4 -#define TO_TLMPIPE_ERR_EID 5 -#define TO_TLMOUTSOCKET_ERR_EID 6 -#define TO_TLMOUTSTOP_ERR_EID 7 -#define TO_MSGID_ERR_EID 8 -#define TO_FNCODE_ERR_EID 9 -#define TO_ADDPKT_ERR_EID 10 -#define TO_REMOVEPKT_ERR_EID 11 -#define TO_REMOVEALLPTKS_ERR_EID 12 -#define TO_REMOVECMDTO_ERR_EID 13 -#define TO_REMOVEHKTO_ERR_EID 14 -#define TO_ADDPKT_INF_EID 15 -#define TO_REMOVEPKT_INF_EID 16 -#define TO_REMOVEALLPKTS_INF_EID 17 -#define TO_NOOP_INF_EID 18 +#define TO_INIT_INF_EID 1 +#define TO_CRCMDPIPE_ERR_EID 2 +#define TO_TLMOUTENA_INF_EID 3 +#define TO_SUBSCRIBE_ERR_EID 4 +#define TO_TLMPIPE_ERR_EID 5 +#define TO_TLMOUTSOCKET_ERR_EID 6 +#define TO_TLMOUTSTOP_ERR_EID 7 +#define TO_MSGID_ERR_EID 8 +#define TO_FNCODE_ERR_EID 9 +#define TO_ADDPKT_ERR_EID 10 +#define TO_REMOVEPKT_ERR_EID 11 +#define TO_REMOVEALLPTKS_ERR_EID 12 +#define TO_REMOVECMDTO_ERR_EID 13 +#define TO_REMOVEHKTO_ERR_EID 14 +#define TO_ADDPKT_INF_EID 15 +#define TO_REMOVEPKT_INF_EID 16 +#define TO_REMOVEALLPKTS_INF_EID 17 +#define TO_NOOP_INF_EID 18 /******************************************************************************/ -#endif /* _to_lab_events_h_ */ - +#endif /* _to_lab_events_h_ */ diff --git a/fsw/src/to_lab_msg.h b/fsw/src/to_lab_msg.h index 88eaf0b..b095603 100644 --- a/fsw/src/to_lab_msg.h +++ b/fsw/src/to_lab_msg.h @@ -20,7 +20,7 @@ ** ** File: to_lab_msg.h ** -** Purpose: +** Purpose: ** Define TO Lab Messages and info ** ** Notes: @@ -29,36 +29,36 @@ #ifndef _to_lab_msg_h_ #define _to_lab_msg_h_ -#define TO_NOP_CC 0 /* no-op command */ -#define TO_RESET_STATUS_CC 1 /* reset status */ -#define TO_ADD_PKT_CC 2 /* add packet */ -#define TO_SEND_DATA_TYPES_CC 3 /* send data types */ -#define TO_REMOVE_PKT_CC 4 /* remove packet */ -#define TO_REMOVE_ALL_PKT_CC 5 /* remove all packet */ -#define TO_OUTPUT_ENABLE_CC 6 /* output enable */ +#define TO_NOP_CC 0 /* no-op command */ +#define TO_RESET_STATUS_CC 1 /* reset status */ +#define TO_ADD_PKT_CC 2 /* add packet */ +#define TO_SEND_DATA_TYPES_CC 3 /* send data types */ +#define TO_REMOVE_PKT_CC 4 /* remove packet */ +#define TO_REMOVE_ALL_PKT_CC 5 /* remove all packet */ +#define TO_OUTPUT_ENABLE_CC 6 /* output enable */ /******************************************************************************/ typedef struct { - uint8 CommandCounter; - uint8 CommandErrorCounter; - uint8 spareToAlign[2]; + uint8 CommandCounter; + uint8 CommandErrorCounter; + uint8 spareToAlign[2]; } TO_LAB_HkTlm_Payload_t; typedef struct { - uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; TO_LAB_HkTlm_Payload_t Payload; } TO_LAB_HkTlm_t; -#define TO_HK_TLM_LNGTH sizeof(TO_LAB_HkTlm_t) +#define TO_HK_TLM_LNGTH sizeof(TO_LAB_HkTlm_t) /******************************************************************************/ typedef struct { - uint16 synch; + uint16 synch; #if 0 bit_field bit1:1; bit_field bit2:1; @@ -69,22 +69,22 @@ typedef struct bit_field nibble1:4; bit_field nibble2:4; #endif - uint8 bl1, bl2; /* boolean */ - int8 b1, b2, b3, b4; - int16 w1,w2; - int32 dw1, dw2; - float f1, f2; - double df1, df2; - char str[10]; + uint8 bl1, bl2; /* boolean */ + int8 b1, b2, b3, b4; + int16 w1, w2; + int32 dw1, dw2; + float f1, f2; + double df1, df2; + char str[10]; } TO_LAB_DataTypes_Payload_t; typedef struct { - uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; + uint8 TlmHeader[CFE_SB_TLM_HDR_SIZE]; TO_LAB_DataTypes_Payload_t Payload; } TO_LAB_DataTypes_t; -#define TO_DATA_TYPES_LNGTH sizeof (TO_LAB_DataTypes_t) +#define TO_DATA_TYPES_LNGTH sizeof(TO_LAB_DataTypes_t) /******************************************************************************/ @@ -101,63 +101,62 @@ typedef struct * * This matches the pattern in CFE core and other modules. */ -typedef TO_LAB_NoArgsCmd_t TO_LAB_Noop_t; -typedef TO_LAB_NoArgsCmd_t TO_LAB_ResetCounters_t; -typedef TO_LAB_NoArgsCmd_t TO_LAB_RemoveAll_t; -typedef TO_LAB_NoArgsCmd_t TO_LAB_SendDataTypes_t; +typedef TO_LAB_NoArgsCmd_t TO_LAB_Noop_t; +typedef TO_LAB_NoArgsCmd_t TO_LAB_ResetCounters_t; +typedef TO_LAB_NoArgsCmd_t TO_LAB_RemoveAll_t; +typedef TO_LAB_NoArgsCmd_t TO_LAB_SendDataTypes_t; typedef struct { - CFE_SB_MsgId_t Stream; - uint16 PktSize; - CFE_SB_Qos_t Flags; - uint8 BufLimit; + CFE_SB_MsgId_t Stream; + uint16 PktSize; + CFE_SB_Qos_t Flags; + uint8 BufLimit; } TO_LAB_AddPacket_Payload_t; typedef struct { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; + uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; TO_LAB_AddPacket_Payload_t Payload; -} TO_LAB_AddPacket_t; - +} TO_LAB_AddPacket_t; /*****************************************************************************/ -typedef struct { - CFE_SB_MsgId_t Stream; - CFE_SB_Qos_t Flags; - uint16 BufLimit; +typedef struct +{ + CFE_SB_MsgId_t Stream; + CFE_SB_Qos_t Flags; + uint16 BufLimit; } TO_subscription_t; /******************************************************************************/ typedef struct { - CFE_SB_MsgId_t Stream; -} TO_LAB_RemovePacket_Payload_t; + CFE_SB_MsgId_t Stream; +} TO_LAB_RemovePacket_Payload_t; typedef struct { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; + uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; TO_LAB_RemovePacket_Payload_t Payload; -} TO_LAB_RemovePacket_t; +} TO_LAB_RemovePacket_t; /******************************************************************************/ typedef struct { - char dest_IP[16]; + char dest_IP[16]; } TO_LAB_EnableOutput_Payload_t; typedef struct { - uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; + uint8 CmdHeader[CFE_SB_CMD_HDR_SIZE]; TO_LAB_EnableOutput_Payload_t Payload; } TO_LAB_EnableOutput_t; /******************************************************************************/ - #endif /* _to_lab_msg_h_ */ /************************/ diff --git a/fsw/src/to_lab_version.h b/fsw/src/to_lab_version.h index a961459..59bf307 100644 --- a/fsw/src/to_lab_version.h +++ b/fsw/src/to_lab_version.h @@ -29,12 +29,10 @@ #ifndef _to_lab_version_h_ #define _to_lab_version_h_ - -#define TO_LAB_MAJOR_VERSION 2 -#define TO_LAB_MINOR_VERSION 3 -#define TO_LAB_REVISION 4 -#define TO_LAB_MISSION_REV 0 - +#define TO_LAB_MAJOR_VERSION 2 +#define TO_LAB_MINOR_VERSION 3 +#define TO_LAB_REVISION 4 +#define TO_LAB_MISSION_REV 0 #endif /* _to_lab_version_h_ */