Skip to content

Commit

Permalink
Merge pull request #161 from skliper:fix160-more_configurable
Browse files Browse the repository at this point in the history
Fix #160, Configurable timeouts and loops
  • Loading branch information
dzbaker committed Dec 5, 2023
2 parents 024b5ed + 0013d43 commit de0c265
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
15 changes: 15 additions & 0 deletions config/default_ci_lab_internal_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,21 @@
*/
#define CI_LAB_MAX_INGEST 768

/**
* @brief Number of packets to process per ingest cycle
*/
#define CI_LAB_MAX_INGEST_PKTS 10

/**
* @brief SB Receive timeout
*/
#define CI_LAB_SB_RECEIVE_TIMEOUT 500

/**
* @brief Uplink Receive timeout
*/
#define CI_LAB_UPLINK_RECEIVE_TIMEOUT OS_CHECK

/**
* @brief The depth of the command input pipe
*
Expand Down
8 changes: 4 additions & 4 deletions fsw/src/ci_lab_app.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ void CI_LAB_AppMain(void)
{
CFE_ES_PerfLogExit(CI_LAB_MAIN_TASK_PERF_ID);

/* Pend on receipt of command packet -- timeout set to 500 millisecs */
status = CFE_SB_ReceiveBuffer(&SBBufPtr, CI_LAB_Global.CommandPipe, 500);
/* Receive SB buffer, configurable timeout */
status = CFE_SB_ReceiveBuffer(&SBBufPtr, CI_LAB_Global.CommandPipe, CI_LAB_SB_RECEIVE_TIMEOUT);

CFE_ES_PerfLogEntry(CI_LAB_MAIN_TASK_PERF_ID);

Expand Down Expand Up @@ -207,7 +207,7 @@ void CI_LAB_ReadUpLink(void)
CFE_Status_t CfeStatus;
CFE_SB_Buffer_t *SBBufPtr;

for (i = 0; i <= 10; i++)
for (i = 0; i <= CI_LAB_MAX_INGEST_PKTS; i++)
{
if (CI_LAB_Global.NetBufPtr == NULL)
{
Expand All @@ -220,7 +220,7 @@ void CI_LAB_ReadUpLink(void)
}

OsStatus = OS_SocketRecvFrom(CI_LAB_Global.SocketID, CI_LAB_Global.NetBufPtr, CI_LAB_Global.NetBufSize,
&CI_LAB_Global.SocketAddress, OS_CHECK);
&CI_LAB_Global.SocketAddress, CI_LAB_UPLINK_RECEIVE_TIMEOUT);
if (OsStatus > 0)
{
CFE_ES_PerfLogEntry(CI_LAB_SOCKET_RCV_PERF_ID);
Expand Down

0 comments on commit de0c265

Please sign in to comment.