Skip to content

Commit

Permalink
Merge pull request nasa#452 from CDKnightNASA/fix-308-createpipe_msgs
Browse files Browse the repository at this point in the history
Fix nasa#308, Improve SB create pipe error reporting
  • Loading branch information
astrogeco authored Feb 12, 2020
2 parents 3356da6 + 7d13f76 commit f26f323
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 6 deletions.
26 changes: 25 additions & 1 deletion fsw/cfe-core/src/inc/cfe_sb_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
** and when you're done adding, set this to the highest EID you used. It may
** be worthwhile to, on occasion, re-number the EID's to put them back in order.
*/
#define CFE_SB_MAX_EID 61
#define CFE_SB_MAX_EID 63

/*
** SB task event message ID's.
Expand Down Expand Up @@ -844,6 +844,30 @@
**/
#define CFE_SB_LEN_ERR_EID 61

/** \brief <tt> 'CreatePipeErr:Name Taken:app=\%s,ptr=0x\%x,depth=\%d,maxdepth=\%d' </tt>
** \event <tt> 'CreatePipeErr:Name Taken:app=\%s,ptr=0x\%x,depth=\%d,maxdepth=\%d' </tt>
**
** \par Type: ERROR
**
** \par Cause:
**
** This error event message is issued when the #CFE_SB_CreatePipe API tries to create
** a pipe with a name that is in use.
**/
#define CFE_SB_CR_PIPE_NAME_TAKEN_EID 62

/** \brief <tt> 'CreatePipeErr:No Free:app=\%s,ptr=0x\%x,depth=\%d,maxdepth=\%d' </tt>
** \event <tt> 'CreatePipeErr:No Free:app=\%s,ptr=0x\%x,depth=\%d,maxdepth=\%d' </tt>
**
** \par Type: ERROR
**
** \par Cause:
**
** This error event message is issued when the #CFE_SB_CreatePipe API is unable to
** create a queue because there are no queues free.
**/
#define CFE_SB_CR_PIPE_NO_FREE_EID 63


#endif /* _cfe_sb_events_ */

Expand Down
24 changes: 19 additions & 5 deletions fsw/cfe-core/src/sb/cfe_sb_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,27 @@ int32 CFE_SB_CreatePipe(CFE_SB_PipeId_t *PipeIdPtr, uint16 Depth, const char *

/* if OS_QueueCreate() failed because the pipe name passed in was already in use... */
/* let's make sure we don't alter the user's pipe ID data */
if (Status == CFE_OS_ERR_NAME_TAKEN){
*PipeIdPtr = OriginalPipeIdParamValue;
}

CFE_EVS_SendEventWithAppID(CFE_SB_CR_PIPE_ERR_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId,
switch(Status) {
case OS_ERR_NAME_TAKEN:
CFE_EVS_SendEventWithAppID(CFE_SB_CR_PIPE_NAME_TAKEN_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId,
"CreatePipeErr:OS_QueueCreate failed, name taken (app=%s, name=%s)",
CFE_SB_GetAppTskName(TskId,FullName), PipeName);

*PipeIdPtr = OriginalPipeIdParamValue;

break;
case OS_ERR_NO_FREE_IDS:
CFE_EVS_SendEventWithAppID(CFE_SB_CR_PIPE_NO_FREE_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId,
"CreatePipeErr:OS_QueueCreate failed, no free id's (app=%s)",
CFE_SB_GetAppTskName(TskId,FullName));

break;
default:
CFE_EVS_SendEventWithAppID(CFE_SB_CR_PIPE_ERR_EID,CFE_EVS_EventType_ERROR,CFE_SB.AppId,
"CreatePipeErr:OS_QueueCreate returned %d,app %s",
(int)Status,CFE_SB_GetAppTskName(TskId,FullName));
}/* end switch(Status) */

return CFE_SB_PIPE_CR_ERR;
}/* end if */

Expand Down

0 comments on commit f26f323

Please sign in to comment.