Skip to content

Commit

Permalink
Merge pull request nasa#1111 from skliper/fix996-max_queue_depth
Browse files Browse the repository at this point in the history
Fix nasa#996, Remove CFE_PLATFORM_SB_MAX_PIPE_DEPTH in favor of OS_QUEUE_MAX_DEPTH
  • Loading branch information
astrogeco authored Feb 3, 2021
2 parents 3a1b9e1 + bd051ff commit 64aeec0
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 35 deletions.
18 changes: 0 additions & 18 deletions cmake/sample_defs/cpu1_platform_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,24 +130,6 @@
*/
#define CFE_PLATFORM_SB_BUF_MEMORY_BYTES 524288


/**
** \cfesbcfg Maximum depth allowed when creating an SB pipe
**
** \par Description:
** The value of this constant dictates the maximum pipe depth that an
** application may request. The pipe depth is given as a paramter in the
** #CFE_SB_CreatePipe API.
**
** \par Limits
** This parameter has a lower limit of 1. There are no restrictions on the
** upper limit however, the maximum pipe depth is system dependent and should
** be verified. Pipe Depth values that are checked against this configuration
** are defined by a 16 bit data word.
*/
#define CFE_PLATFORM_SB_MAX_PIPE_DEPTH 256


/**
** \cfesbcfg Highest Valid Message Id
**
Expand Down
2 changes: 1 addition & 1 deletion fsw/cfe-core/src/inc/cfe_sb_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
**
** This error event message is issued when the #CFE_SB_CreatePipe API receives a bad
** argument. In this case, a bad argument is defined by the following:
** A NULL PipeIdPtr, PipeDepth = 0 and PipeDepth > cfg param #CFE_PLATFORM_SB_MAX_PIPE_DEPTH
** A NULL PipeIdPtr, PipeDepth = 0 and PipeDepth > maximum pipe depth
**/
#define CFE_SB_CR_PIPE_BAD_ARG_EID 2

Expand Down
2 changes: 1 addition & 1 deletion fsw/cfe-core/src/inc/cfe_sb_msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ typedef struct CFE_SB_StatsTlm_Payload {
\brief Max number of SB message buffers in use */

uint32 MaxPipeDepthAllowed;/**< \cfetlmmnemonic \SB_SMMPDALW
\brief cFE Cfg Param \link #CFE_PLATFORM_SB_MAX_PIPE_DEPTH \endlink */
\brief Maximum allowed pipe depth */
CFE_SB_PipeDepthStats_t PipeDepthStats[CFE_MISSION_SB_MAX_PIPES];/**< \cfetlmmnemonic \SB_SMPDS
\brief Pipe Depth Statistics #CFE_SB_PipeDepthStats_t*/
} CFE_SB_StatsTlm_Payload_t;
Expand Down
4 changes: 2 additions & 2 deletions fsw/cfe-core/src/sb/cfe_sb_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ int32 CFE_SB_CreatePipe(CFE_SB_PipeId_t *PipeIdPtr, uint16 Depth, const char *
CFE_ES_GetTaskID(&TskId);

/* check input parameters */
if((PipeIdPtr == NULL) || (Depth > CFE_PLATFORM_SB_MAX_PIPE_DEPTH) || (Depth == 0))
if((PipeIdPtr == NULL) || (Depth > OS_QUEUE_MAX_DEPTH) || (Depth == 0))
{
PendingEventId = CFE_SB_CR_PIPE_BAD_ARG_EID;
Status = CFE_SB_BAD_ARGUMENT;
Expand Down Expand Up @@ -255,7 +255,7 @@ int32 CFE_SB_CreatePipe(CFE_SB_PipeId_t *PipeIdPtr, uint16 Depth, const char *
case CFE_SB_CR_PIPE_BAD_ARG_EID:
CFE_EVS_SendEventWithAppID(CFE_SB_CR_PIPE_BAD_ARG_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId,
"CreatePipeErr:Bad Input Arg:app=%s,ptr=0x%lx,depth=%d,maxdepth=%d",
CFE_SB_GetAppTskName(TskId,FullName),(unsigned long)PipeIdPtr,(int)Depth,CFE_PLATFORM_SB_MAX_PIPE_DEPTH);
CFE_SB_GetAppTskName(TskId,FullName),(unsigned long)PipeIdPtr,(int)Depth,OS_QUEUE_MAX_DEPTH);
break;

case CFE_SB_MAX_PIPES_MET_EID:
Expand Down
2 changes: 1 addition & 1 deletion fsw/cfe-core/src/sb/cfe_sb_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ int32 CFE_SB_AppInit(void){
CFE_SB.StatTlmMsg.Payload.MaxMsgIdsAllowed = CFE_PLATFORM_SB_MAX_MSG_IDS;
CFE_SB.StatTlmMsg.Payload.MaxPipesAllowed = CFE_PLATFORM_SB_MAX_PIPES;
CFE_SB.StatTlmMsg.Payload.MaxMemAllowed = CFE_PLATFORM_SB_BUF_MEMORY_BYTES;
CFE_SB.StatTlmMsg.Payload.MaxPipeDepthAllowed = CFE_PLATFORM_SB_MAX_PIPE_DEPTH;
CFE_SB.StatTlmMsg.Payload.MaxPipeDepthAllowed = OS_QUEUE_MAX_DEPTH;
CFE_SB.StatTlmMsg.Payload.MaxSubscriptionsAllowed =
((CFE_PLATFORM_SB_MAX_MSG_IDS)*(CFE_PLATFORM_SB_MAX_DEST_PER_PKT));

Expand Down
4 changes: 0 additions & 4 deletions fsw/cfe-core/src/sb/cfe_sb_verify.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@
#error CFE_PLATFORM_SB_MAX_DEST_PER_PKT cannot be less than 1!
#endif

#if CFE_PLATFORM_SB_MAX_PIPE_DEPTH < 1
#error CFE_PLATFORM_SB_MAX_PIPE_DEPTH cannot be less than 1!
#endif

#if CFE_PLATFORM_SB_HIGHEST_VALID_MSGID < 1
#error CFE_PLATFORM_SB_HIGHEST_VALID_MSGID cannot be less than 1!
#endif
Expand Down
13 changes: 5 additions & 8 deletions fsw/cfe-core/unit-test/sb_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -1608,20 +1608,17 @@ void Test_CreatePipe_NullPtr(void)
*/
void Test_CreatePipe_ValPipeDepth(void)
{
CFE_SB_PipeId_t PipeIdReturned[3];
CFE_SB_PipeId_t PipeIdReturned[2];

ASSERT(CFE_SB_CreatePipe(&PipeIdReturned[0], 99, "TestPipe99"));
ASSERT(CFE_SB_CreatePipe(&PipeIdReturned[1], 255, "TestPipe255"));
ASSERT(CFE_SB_CreatePipe(&PipeIdReturned[2],
CFE_PLATFORM_SB_MAX_PIPE_DEPTH, "TestPipeMaxDepth"));
ASSERT(CFE_SB_CreatePipe(&PipeIdReturned[0], 1, "TestPipeMin"));
ASSERT(CFE_SB_CreatePipe(&PipeIdReturned[1], OS_QUEUE_MAX_DEPTH, "TestPipeMax"));

EVTCNT(3);
EVTCNT(2);

EVTSENT(CFE_SB_PIPE_ADDED_EID);

TEARDOWN(CFE_SB_DeletePipe(PipeIdReturned[0]));
TEARDOWN(CFE_SB_DeletePipe(PipeIdReturned[1]));
TEARDOWN(CFE_SB_DeletePipe(PipeIdReturned[2]));

} /* end Test_CreatePipe_ValPipeDepth */

Expand All @@ -1636,7 +1633,7 @@ void Test_CreatePipe_InvalPipeDepth(void)
ASSERT_EQ(CFE_SB_CreatePipe(&PipeIdReturned[0], 0, "TestPipe1"), CFE_SB_BAD_ARGUMENT);
UT_SetDeferredRetcode(UT_KEY(OS_QueueCreate), 1, OS_SUCCESS);
ASSERT_EQ(CFE_SB_CreatePipe(&PipeIdReturned[1],
CFE_PLATFORM_SB_MAX_PIPE_DEPTH + 1, "TestPipeMaxDepPlus1"), CFE_SB_BAD_ARGUMENT);
OS_QUEUE_MAX_DEPTH + 1, "TestPipeMaxDepPlus1"), CFE_SB_BAD_ARGUMENT);
UT_SetDeferredRetcode(UT_KEY(OS_QueueCreate), 1, OS_SUCCESS);
ASSERT_EQ(CFE_SB_CreatePipe(&PipeIdReturned[2], 0xffff, "TestPipeffff"), CFE_SB_BAD_ARGUMENT);

Expand Down

0 comments on commit 64aeec0

Please sign in to comment.