Skip to content

Commit

Permalink
Fix #1123, Convert global CFE_SB_Default_Qos to macro
Browse files Browse the repository at this point in the history
  • Loading branch information
skliper committed Jan 27, 2021
1 parent 4374482 commit 7a2dcce
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 37 deletions.
15 changes: 6 additions & 9 deletions docs/src/cfe_sb.dox
Original file line number Diff line number Diff line change
Expand Up @@ -445,12 +445,10 @@
Quality of Service (QOS) for off-board routing and is of the type #CFE_SB_Qos_t. This structure
has two members named priority and reliability. The Quality parameter is currently unused by
the software bus. It is a placeholder to be used with the future software bus capability of
inter-processor communication. Although currently the software bus does not read the Quality
values, it would be best to set this parameter to the value defined as #CFE_SB_Default_Qos.
This value is set internally by the software bus with values of zero for priority and
reliability. The values of zero will correspond to low priority and low reliability. Setting
the QOS value to the #CFE_SB_Default_Qos will ensure seamless integration when the software
bus is expanded to support inter-processor communication.
inter-processor communication. Although currently the software bus does not implement quality
of service.

A default quality of services is provided via the #CFE_SB_DEFAULT_QOS macro.

Next: \ref cfesbugknwnprob <BR>
Prev: \ref cfesbugroutcntrl <BR>
Expand Down Expand Up @@ -569,9 +567,8 @@
</B><TR><TD WIDTH="5%"> &nbsp; <TD WIDTH="95%">
The QOS parameter is currently unused by the software bus. It is a placeholder to be
used with the future software bus capability of inter-processor communication. Setting
the QOS value to the SB defined #CFE_SB_Default_Qos (QOS.Priority=0,QOS.Reliability=0)
will ensure seamless integration when the software bus is expanded to support
inter-processor communication.
the QOS as #CFE_SB_DEFAULT_QOS will ensure seamless integration when the software bus
is expanded to support inter-processor communication.
<TR><TD COLSPAN=2 WIDTH="100%"> <B>(Q)
Can I confirm my software bus buffer was delivered?
</B><TR><TD WIDTH="5%"> &nbsp; <TD WIDTH="95%">
Expand Down
12 changes: 7 additions & 5 deletions fsw/cfe-core/src/inc/cfe_sb.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,10 @@ typedef struct {
uint8 Reliability;/**< \brief Specify high(1) or low(0) message transfer reliability for off-board routing, currently unused */
}CFE_SB_Qos_t;

extern CFE_SB_Qos_t CFE_SB_Default_Qos;/**< \brief Defines a default priority and reliabilty for off-board routing */

#define CFE_SB_DEFAULT_QOS ((CFE_SB_Qos_t) {0}) /**< \brief Default Qos macro */
#ifndef CFE_OMIT_DEPRECATED_6_8
#define CFE_SB_Default_Qos CFE_SB_DEFAULT_QOS /**< \deprecated use CFE_SB_DEFAULT_QOS */
#endif

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

Expand Down Expand Up @@ -397,7 +399,7 @@ CFE_Status_t CFE_SB_GetPipeIdByName(CFE_SB_PipeId_t *PipeIdPtr, const char *Pip
** should be sent to.
**
** \param[in] Quality The requested Quality of Service (QoS) required of
** the messages. Most callers will use #CFE_SB_Default_Qos
** the messages. Most callers will use #CFE_SB_DEFAULT_QOS
** for this parameter.
**
** \param[in] MsgLim The maximum number of messages with this Message ID to
Expand All @@ -421,7 +423,7 @@ CFE_Status_t CFE_SB_SubscribeEx(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId, C
** \par Description
** This routine adds the specified pipe to the destination list for
** the specified message ID. This is the same as #CFE_SB_SubscribeEx
** with the Quality field set to #CFE_SB_Default_Qos and MsgLim set
** with the Quality field set to #CFE_SB_DEFAULT_QOS and MsgLim set
** to #CFE_PLATFORM_SB_DEFAULT_MSG_LIMIT (4).
**
** \par Assumptions, External Events, and Notes:
Expand Down Expand Up @@ -456,7 +458,7 @@ CFE_Status_t CFE_SB_Subscribe(CFE_SB_MsgId_t MsgId, CFE_SB_PipeId_t PipeId);
** \par Description
** This routine adds the specified pipe to the destination list for
** the specified message ID. This is similar to #CFE_SB_SubscribeEx
** with the Quality field set to #CFE_SB_Default_Qos and MsgLim set
** with the Quality field set to #CFE_SB_DEFAULT_QOS and MsgLim set
** to #CFE_PLATFORM_SB_DEFAULT_MSG_LIMIT, but will not report the subscription.
** Subscription Reporting is enabled for interprocessor communication
** by way of the Software Bus Network (SBN) Application.
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 @@ -878,7 +878,7 @@ int32 CFE_SB_SubscribeLocal(CFE_SB_MsgId_t MsgId,
CFE_SB_PipeId_t PipeId,
uint16 MsgLim)
{
return CFE_SB_SubscribeFull(MsgId,PipeId,CFE_SB_Default_Qos,MsgLim,
return CFE_SB_SubscribeFull(MsgId,PipeId,CFE_SB_DEFAULT_QOS,MsgLim,
(uint8)CFE_SB_LOCAL);

}/* end CFE_SB_SubscribeLocal */
Expand All @@ -889,7 +889,7 @@ int32 CFE_SB_SubscribeLocal(CFE_SB_MsgId_t MsgId,
int32 CFE_SB_Subscribe(CFE_SB_MsgId_t MsgId,
CFE_SB_PipeId_t PipeId)
{
return CFE_SB_SubscribeFull(MsgId,PipeId,CFE_SB_Default_Qos,
return CFE_SB_SubscribeFull(MsgId,PipeId,CFE_SB_DEFAULT_QOS,
(uint16)CFE_PLATFORM_SB_DEFAULT_MSG_LIMIT,
(uint8)CFE_SB_GLOBAL);

Expand Down
3 changes: 0 additions & 3 deletions fsw/cfe-core/src/sb/cfe_sb_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ int32 CFE_SB_EarlyInit (void) {
/* ensure entire CFE_SB global data structure is purged first */
memset(&CFE_SB, 0, sizeof(CFE_SB));

CFE_SB_Default_Qos.Priority = CFE_SB_QOS_LOW_PRIORITY;
CFE_SB_Default_Qos.Reliability = CFE_SB_QOS_LOW_RELIABILITY;

Stat = OS_MutSemCreate(&CFE_SB.SharedDataMutexId, "CFE_SB_DataMutex", 0);
if(Stat != OS_SUCCESS){
CFE_ES_WriteToSysLog("SB shared data mutex creation failed! RC=0x%08x\n",(unsigned int)Stat);
Expand Down
3 changes: 0 additions & 3 deletions fsw/cfe-core/src/sb/cfe_sb_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@
#define CFE_SB_CMD_PIPE_NAME "SB_CMD_PIPE"
#define CFE_SB_MAX_CFG_FILE_EVENTS_TO_FILTER 8

#define CFE_SB_QOS_LOW_PRIORITY 0
#define CFE_SB_QOS_LOW_RELIABILITY 0

#define CFE_SB_PIPE_OVERFLOW (-1)
#define CFE_SB_PIPE_WR_ERR (-2)
#define CFE_SB_USECNT_ERR (-3)
Expand Down
1 change: 0 additions & 1 deletion fsw/cfe-core/src/sb/cfe_sb_task.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@

/* Task Globals */
cfe_sb_t CFE_SB;
CFE_SB_Qos_t CFE_SB_Default_Qos;

/* Local structure for file writing callbacks */
typedef struct
Expand Down
7 changes: 3 additions & 4 deletions fsw/cfe-core/unit-test/sb_UT.c
Original file line number Diff line number Diff line change
Expand Up @@ -3034,7 +3034,7 @@ void Test_TransmitMsg_MsgLimitExceeded(void)
SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "MsgLimTestPipe"));

/* Set maximum allowed messages on the pipe at one time to 1 */
CFE_SB_SubscribeEx(MsgId, PipeId, CFE_SB_Default_Qos, 1);
CFE_SB_SubscribeEx(MsgId, PipeId, CFE_SB_DEFAULT_QOS, 1);

UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false);
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false);
Expand Down Expand Up @@ -3930,7 +3930,6 @@ void Test_CFE_SB_BadPipeInfo(void)
CFE_SB_PipeId_t PipeId;
CFE_SB_PipeD_t *PipeDscPtr;
uint16 PipeDepth = 10;
CFE_SB_Qos_t CFE_SB_Default_Qos;
CFE_ES_ResourceID_t AppID;

SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "TestPipe1"));
Expand All @@ -3946,7 +3945,7 @@ void Test_CFE_SB_BadPipeInfo(void)
/* Reset the pipe ID and delete the pipe */
PipeDscPtr->PipeId = PipeId;

ASSERT_EQ(CFE_SB_SubscribeFull(SB_UT_FIRST_VALID_MID , PipeId, CFE_SB_Default_Qos,
ASSERT_EQ(CFE_SB_SubscribeFull(SB_UT_FIRST_VALID_MID , PipeId, CFE_SB_DEFAULT_QOS,
CFE_PLATFORM_SB_DEFAULT_MSG_LIMIT, 2), CFE_SB_BAD_ARGUMENT);

EVTCNT(4);
Expand Down Expand Up @@ -4050,7 +4049,7 @@ void Test_SB_TransmitMsgPaths_LimitErr(void)
SETUP(CFE_SB_CreatePipe(&PipeId, PipeDepth, "MsgLimTestPipe"));

/* Set maximum allowed messages on the pipe at one time to 1 */
SETUP(CFE_SB_SubscribeEx(MsgId, PipeId, CFE_SB_Default_Qos, 1));
SETUP(CFE_SB_SubscribeEx(MsgId, PipeId, CFE_SB_DEFAULT_QOS, 1));

UT_SetDataBuffer(UT_KEY(CFE_MSG_GetMsgId), &MsgId, sizeof(MsgId), false);
UT_SetDataBuffer(UT_KEY(CFE_MSG_GetSize), &Size, sizeof(Size), false);
Expand Down
10 changes: 0 additions & 10 deletions fsw/cfe-core/ut-stubs/ut_sb_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,6 @@ typedef struct

} CFE_SB_StubMsg_MetaData_t;


/*
** Global variables
**
** NOTE: CFE_SB_Default_Qos is an oddball in that it is directly referenced by the code
** in other applications. Therefore the UT stub has to instantiate this in order to get
** any dependent code to link.
*/
CFE_SB_Qos_t CFE_SB_Default_Qos;

static CFE_SB_StubMsg_MetaData_t* CFE_SB_StubMsg_GetMetaData(const CFE_MSG_Message_t *MsgPtr)
{
CFE_SB_StubMsg_MetaData_t* MetaPtr;
Expand Down

0 comments on commit 7a2dcce

Please sign in to comment.