Skip to content

Commit

Permalink
Fix nasa#157, Move function prototypes to header file
Browse files Browse the repository at this point in the history
  • Loading branch information
thnkslprpt committed May 2, 2023
1 parent 81d85da commit d81ddd3
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 44 deletions.
41 changes: 4 additions & 37 deletions fsw/src/to_lab_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,46 +30,12 @@
#include "to_lab_sub_table.h"

/*
** Global Data Section
** TO Global Data Section
*/
typedef struct
{
CFE_SB_PipeId_t Tlm_pipe;
CFE_SB_PipeId_t Cmd_pipe;
osal_id_t TLMsockid;
bool downlink_on;
char tlm_dest_IP[17];
bool suppress_sendto;

TO_LAB_HkTlm_t HkTlm;
TO_LAB_DataTypesTlm_t DataTypesTlm;
} TO_LAB_GlobalData_t;

TO_LAB_GlobalData_t TO_LAB_Global;

TO_LAB_Subs_t * TO_LAB_Subs;
CFE_TBL_Handle_t TO_SubTblHandle;

/*
** Prototypes Section
*/
void TO_LAB_openTLM(void);
int32 TO_LAB_init(void);
void TO_LAB_exec_local_command(CFE_SB_Buffer_t *SBBufPtr);
void TO_LAB_process_commands(void);
void TO_LAB_forward_telemetry(void);

/*
* Individual Command Handler prototypes
*/
int32 TO_LAB_AddPacket(const TO_LAB_AddPacketCmd_t *data);
int32 TO_LAB_Noop(const TO_LAB_NoopCmd_t *data);
int32 TO_LAB_EnableOutput(const TO_LAB_EnableOutputCmd_t *data);
int32 TO_LAB_RemoveAll(const TO_LAB_RemoveAllCmd_t *data);
int32 TO_LAB_RemovePacket(const TO_LAB_RemovePacketCmd_t *data);
int32 TO_LAB_ResetCounters(const TO_LAB_ResetCountersCmd_t *data);
int32 TO_LAB_SendDataTypes(const TO_LAB_SendDataTypesCmd_t *data);
int32 TO_LAB_SendHousekeeping(const CFE_MSG_CommandHeader_t *data);
TO_LAB_Subs_t * TO_LAB_Subs;
CFE_TBL_Handle_t TO_SubTblHandle;

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Expand Down Expand Up @@ -344,6 +310,7 @@ void TO_LAB_exec_local_command(CFE_SB_Buffer_t *SBBufPtr)
"L%d TO: Invalid Function Code Rcvd In Ground Command 0x%x", __LINE__,
(unsigned int)CommandCode);
++TO_LAB_Global.HkTlm.Payload.CommandErrorCounter;
break;
}
}

Expand Down
52 changes: 45 additions & 7 deletions fsw/src/to_lab_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@
#include "common_types.h"
#include "osapi.h"

/*****************************************************************************/
#include "to_lab_msg.h"

/************************************************************************
* Macro Definitions
************************************************************************/

#define TO_LAB_TASK_MSEC 500 /* run at 2 Hz */
#define TO_LAB_UNUSED CFE_SB_MSGID_RESERVED
Expand All @@ -52,13 +56,47 @@
#define cfgTLM_PORT 1235
#define TO_LAB_VERSION_NUM "5.1.0"

/******************************************************************************/
/************************************************************************
** Type Definitions
*************************************************************************/

/*
** Prototypes Section
*/
void TO_LAB_AppMain(void);
/**
* CI global data structure
*/
typedef struct
{
CFE_SB_PipeId_t Tlm_pipe;
CFE_SB_PipeId_t Cmd_pipe;
osal_id_t TLMsockid;
bool downlink_on;
char tlm_dest_IP[17];
bool suppress_sendto;

/******************************************************************************/
TO_LAB_HkTlm_t HkTlm;
TO_LAB_DataTypesTlm_t DataTypesTlm;
} TO_LAB_GlobalData_t;

/************************************************************************
* Function Prototypes
************************************************************************/

void TO_LAB_AppMain(void);
void TO_LAB_openTLM(void);
int32 TO_LAB_init(void);
void TO_LAB_exec_local_command(CFE_SB_Buffer_t *SBBufPtr);
void TO_LAB_process_commands(void);
void TO_LAB_forward_telemetry(void);

/*
* Individual Command Handler prototypes
*/
int32 TO_LAB_AddPacket(const TO_LAB_AddPacketCmd_t *data);
int32 TO_LAB_Noop(const TO_LAB_NoopCmd_t *data);
int32 TO_LAB_EnableOutput(const TO_LAB_EnableOutputCmd_t *data);
int32 TO_LAB_RemoveAll(const TO_LAB_RemoveAllCmd_t *data);
int32 TO_LAB_RemovePacket(const TO_LAB_RemovePacketCmd_t *data);
int32 TO_LAB_ResetCounters(const TO_LAB_ResetCountersCmd_t *data);
int32 TO_LAB_SendDataTypes(const TO_LAB_SendDataTypesCmd_t *data);
int32 TO_LAB_SendHousekeeping(const CFE_MSG_CommandHeader_t *data);

#endif

0 comments on commit d81ddd3

Please sign in to comment.