Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

strawman for #888 - return code for cFE #889

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions fsw/cfe-core/src/inc/cfe_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,19 @@
/* Include Files */
#include "osapi.h"

/*
* Define a type for readability.
*/

typedef int32 CFE_Status_t;
typedef CFE_Status_t CFE_RC_t;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have two typedefs?


/*
* Utility macros.
*/
#define CFE_ISSUCCESS(S) ((S) & CFE_SEVERITY_BITMASK != CFE_SEVERITY_ERROR)
#define CFE_ISINFO(S) ((S) & CFE_SEVERITY_BITMASK == CFE_SEVERITY_INFO)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can these be inline functions instead? These are just as fast but more type safe and don't have the same risks/issues as macros.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just as fast if inlining is enabled. If it's not, and these are "real" functions, there's a decent amount of overhead.

If they are declared inline, they should be static inline at least, to avoid GOT/PLT lookup and such.


/*
** Status Codes are 32 bit values formatted as follows:
**
Expand Down
65 changes: 33 additions & 32 deletions fsw/cfe-core/src/inc/cfe_es.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "cfe_es_extern_typedefs.h"
#include "cfe_mission_cfg.h"
#include "cfe_perfids.h"
#include "cfe_error.h"

/*****************************************************************************/

Expand Down Expand Up @@ -176,7 +177,7 @@ static inline uint32 CFE_ES_ResourceID_FromInteger(unsigned long Value)
* @return Execution status, see @ref CFEReturnCodes
* @retval #CFE_SUCCESS @copybrief CFE_SUCCESS
*/
int32 CFE_ES_AppID_ToIndex(uint32 AppID, uint32 *Idx);
CFE_RC_t CFE_ES_AppID_ToIndex(uint32 AppID, uint32 *Idx);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use CFE_ReturnCode_t ? I like spelling out things as much as possible

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of typing, and causes more line wrapping...I'm open though if that's the consensus.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I use autocomplete on Atom. I assume this type would be used by app developers so I'd rather be explicit. If it's just internal to cFE then I feel slightly better about abbreviations


/**
* @brief Obtain an index value correlating to an ES Task ID
Expand All @@ -200,7 +201,7 @@ int32 CFE_ES_AppID_ToIndex(uint32 AppID, uint32 *Idx);
* @return Execution status, see @ref CFEReturnCodes
* @retval #CFE_SUCCESS @copybrief CFE_SUCCESS
*/
int32 CFE_ES_TaskID_ToIndex(uint32 TaskID, uint32 *Idx);
CFE_RC_t CFE_ES_TaskID_ToIndex(uint32 TaskID, uint32 *Idx);

/**
* \brief Application Information
Expand Down Expand Up @@ -407,7 +408,7 @@ void CFE_ES_Main(uint32 StartType, uint32 StartSubtype, uint32 ModeId , const ch
** \sa #CFE_ES_Main
**
******************************************************************************/
int32 CFE_ES_ResetCFE(uint32 ResetType);
CFE_RC_t CFE_ES_ResetCFE(uint32 ResetType);
/**@}*/

/** @defgroup CFEAPIESAppControl cFE Application Control APIs
Expand All @@ -431,7 +432,7 @@ int32 CFE_ES_ResetCFE(uint32 ResetType);
** \sa #CFE_ES_ReloadApp, #CFE_ES_DeleteApp
**
******************************************************************************/
int32 CFE_ES_RestartApp(uint32 AppID);
CFE_RC_t CFE_ES_RestartApp(uint32 AppID);

/*****************************************************************************/
/**
Expand All @@ -458,7 +459,7 @@ int32 CFE_ES_RestartApp(uint32 AppID);
** \sa #CFE_ES_RestartApp, #CFE_ES_DeleteApp, #CFE_ES_START_APP_CC
**
******************************************************************************/
int32 CFE_ES_ReloadApp(uint32 AppID, const char *AppFileName);
CFE_RC_t CFE_ES_ReloadApp(uint32 AppID, const char *AppFileName);

/*****************************************************************************/
/**
Expand All @@ -477,7 +478,7 @@ int32 CFE_ES_ReloadApp(uint32 AppID, const char *AppFileName);
** \sa #CFE_ES_RestartApp, #CFE_ES_ReloadApp
**
******************************************************************************/
int32 CFE_ES_DeleteApp(uint32 AppID);
CFE_RC_t CFE_ES_DeleteApp(uint32 AppID);
/**@}*/

/** @defgroup CFEAPIESAppBehavior cFE Application Behavior APIs
Expand Down Expand Up @@ -562,7 +563,7 @@ bool CFE_ES_RunLoop(uint32 *ExitStatus);
** \sa #CFE_ES_RunLoop
**
******************************************************************************/
int32 CFE_ES_WaitForSystemState(uint32 MinSystemState, uint32 TimeOutMilliseconds);
CFE_RC_t CFE_ES_WaitForSystemState(uint32 MinSystemState, uint32 TimeOutMilliseconds);

/*****************************************************************************/
/**
Expand Down Expand Up @@ -611,7 +612,7 @@ void CFE_ES_WaitForStartupSync(uint32 TimeOutMilliseconds);
** \sa #CFE_ES_ExitApp, #CFE_ES_RunLoop
**
******************************************************************************/
int32 CFE_ES_RegisterApp(void);
CFE_RC_t CFE_ES_RegisterApp(void);

/*****************************************************************************/
/**
Expand Down Expand Up @@ -686,7 +687,7 @@ int32 CFE_ES_GetResetType(uint32 *ResetSubtypePtr);
** \sa #CFE_ES_GetResetType, #CFE_ES_GetAppIDByName, #CFE_ES_GetAppName, #CFE_ES_GetTaskInfo
**
******************************************************************************/
int32 CFE_ES_GetAppID(uint32 *AppIdPtr);
CFE_RC_t CFE_ES_GetAppID(uint32 *AppIdPtr);

/*****************************************************************************/
/**
Expand All @@ -708,7 +709,7 @@ int32 CFE_ES_GetAppID(uint32 *AppIdPtr);
** \retval #CFE_ES_ERR_TASKID \copybrief CFE_ES_ERR_TASKID
**
******************************************************************************/
int32 CFE_ES_GetTaskID(uint32 *TaskIdPtr);
CFE_RC_t CFE_ES_GetTaskID(uint32 *TaskIdPtr);

/*****************************************************************************/
/**
Expand All @@ -734,7 +735,7 @@ int32 CFE_ES_GetTaskID(uint32 *TaskIdPtr);
** \sa #CFE_ES_GetResetType, #CFE_ES_GetAppID, #CFE_ES_GetAppName, #CFE_ES_GetTaskInfo
**
******************************************************************************/
int32 CFE_ES_GetAppIDByName(uint32 *AppIdPtr, const char *AppName);
CFE_RC_t CFE_ES_GetAppIDByName(uint32 *AppIdPtr, const char *AppName);

/*****************************************************************************/
/**
Expand Down Expand Up @@ -766,7 +767,7 @@ int32 CFE_ES_GetAppIDByName(uint32 *AppIdPtr, const char *AppName);
** \sa #CFE_ES_GetResetType, #CFE_ES_GetAppID, #CFE_ES_GetAppIDByName, #CFE_ES_GetTaskInfo
**
******************************************************************************/
int32 CFE_ES_GetAppName(char *AppName, uint32 AppId, uint32 BufferLength);
CFE_RC_t CFE_ES_GetAppName(char *AppName, uint32 AppId, uint32 BufferLength);

/*****************************************************************************/
/**
Expand Down Expand Up @@ -795,7 +796,7 @@ int32 CFE_ES_GetAppName(char *AppName, uint32 AppId, uint32 BufferLength);
** \sa #CFE_ES_GetResetType, #CFE_ES_GetAppID, #CFE_ES_GetAppIDByName, #CFE_ES_GetAppName
**
******************************************************************************/
int32 CFE_ES_GetAppInfo(CFE_ES_AppInfo_t *AppInfo, uint32 AppId);
CFE_RC_t CFE_ES_GetAppInfo(CFE_ES_AppInfo_t *AppInfo, uint32 AppId);

/*****************************************************************************/
/**
Expand Down Expand Up @@ -824,7 +825,7 @@ int32 CFE_ES_GetAppInfo(CFE_ES_AppInfo_t *AppInfo, uint32 AppId);
** \sa #CFE_ES_GetResetType, #CFE_ES_GetAppID, #CFE_ES_GetAppIDByName, #CFE_ES_GetAppName
**
******************************************************************************/
int32 CFE_ES_GetTaskInfo(CFE_ES_TaskInfo_t *TaskInfo, uint32 TaskId);
CFE_RC_t CFE_ES_GetTaskInfo(CFE_ES_TaskInfo_t *TaskInfo, uint32 TaskId);
/**@}*/

/** @defgroup CFEAPIESChildTask cFE Child Task APIs
Expand All @@ -849,7 +850,7 @@ int32 CFE_ES_GetTaskInfo(CFE_ES_TaskInfo_t *TaskInfo, uint32 TaskId);
** \sa #CFE_ES_CreateChildTask, #CFE_ES_DeleteChildTask, #CFE_ES_ExitChildTask
**
******************************************************************************/
int32 CFE_ES_RegisterChildTask(void);
CFE_RC_t CFE_ES_RegisterChildTask(void);

/*****************************************************************************/
/**
Expand Down Expand Up @@ -888,7 +889,7 @@ int32 CFE_ES_RegisterChildTask(void);
** \sa #CFE_ES_RegisterChildTask, #CFE_ES_DeleteChildTask, #CFE_ES_ExitChildTask
**
******************************************************************************/
int32 CFE_ES_CreateChildTask(uint32 *TaskIdPtr,
CFE_RC_t CFE_ES_CreateChildTask(uint32 *TaskIdPtr,
const char *TaskName,
CFE_ES_ChildTaskMainFuncPtr_t FunctionPtr,
uint32 *StackPtr,
Expand Down Expand Up @@ -916,7 +917,7 @@ int32 CFE_ES_CreateChildTask(uint32 *TaskIdPtr,
** \sa #CFE_ES_RegisterChildTask, #CFE_ES_CreateChildTask, #CFE_ES_ExitChildTask
**
******************************************************************************/
int32 CFE_ES_DeleteChildTask(uint32 TaskId);
CFE_RC_t CFE_ES_DeleteChildTask(uint32 TaskId);

/*****************************************************************************/
/**
Expand Down Expand Up @@ -965,7 +966,7 @@ void CFE_ES_ExitChildTask(void);
** \retval #CFE_ES_ERR_SYS_LOG_FULL \copybrief CFE_ES_ERR_SYS_LOG_FULL
**
******************************************************************************/
int32 CFE_ES_WriteToSysLog(const char *SpecStringPtr, ...) OS_PRINTF(1,2);
CFE_RC_t CFE_ES_WriteToSysLog(const char *SpecStringPtr, ...) OS_PRINTF(1,2);

/*****************************************************************************/
/**
Expand Down Expand Up @@ -1051,7 +1052,7 @@ void CFE_ES_ProcessAsyncEvent(void);
** \sa #CFE_ES_CopyToCDS, #CFE_ES_RestoreFromCDS
**
******************************************************************************/
int32 CFE_ES_RegisterCDS(CFE_ES_CDSHandle_t *HandlePtr, int32 BlockSize, const char *Name);
CFE_RC_t CFE_ES_RegisterCDS(CFE_ES_CDSHandle_t *HandlePtr, int32 BlockSize, const char *Name);

/*****************************************************************************/
/**
Expand All @@ -1077,7 +1078,7 @@ int32 CFE_ES_RegisterCDS(CFE_ES_CDSHandle_t *HandlePtr, int32 BlockSize, const c
** \sa #CFE_ES_RegisterCDS, #CFE_ES_RestoreFromCDS
**
*/
int32 CFE_ES_CopyToCDS(CFE_ES_CDSHandle_t Handle, void *DataToCopy);
CFE_RC_t CFE_ES_CopyToCDS(CFE_ES_CDSHandle_t Handle, void *DataToCopy);

/*****************************************************************************/
/**
Expand Down Expand Up @@ -1106,7 +1107,7 @@ int32 CFE_ES_CopyToCDS(CFE_ES_CDSHandle_t Handle, void *DataToCopy);
** \sa #CFE_ES_RegisterCDS, #CFE_ES_CopyToCDS
**
*/
int32 CFE_ES_RestoreFromCDS(void *RestoreToMemory, CFE_ES_CDSHandle_t Handle);
CFE_RC_t CFE_ES_RestoreFromCDS(void *RestoreToMemory, CFE_ES_CDSHandle_t Handle);
/**@}*/

/** @defgroup CFEAPIESMemManage cFE Memory Manager APIs
Expand Down Expand Up @@ -1140,7 +1141,7 @@ int32 CFE_ES_RestoreFromCDS(void *RestoreToMemory, CFE_ES_CDSHandle_t Handle);
** \sa #CFE_ES_PoolCreate, #CFE_ES_PoolCreateEx, #CFE_ES_GetPoolBuf, #CFE_ES_PutPoolBuf, #CFE_ES_GetMemPoolStats
**
******************************************************************************/
int32 CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *HandlePtr, uint8 *MemPtr, uint32 Size);
CFE_RC_t CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *HandlePtr, uint8 *MemPtr, uint32 Size);

/*****************************************************************************/
/**
Expand Down Expand Up @@ -1169,7 +1170,7 @@ int32 CFE_ES_PoolCreateNoSem(CFE_ES_MemHandle_t *HandlePtr, uint8 *MemPtr, uint3
** \sa #CFE_ES_PoolCreateNoSem, #CFE_ES_PoolCreateEx, #CFE_ES_GetPoolBuf, #CFE_ES_PutPoolBuf, #CFE_ES_GetMemPoolStats
**
******************************************************************************/
int32 CFE_ES_PoolCreate(CFE_ES_MemHandle_t *HandlePtr, uint8 *MemPtr, uint32 Size);
CFE_RC_t CFE_ES_PoolCreate(CFE_ES_MemHandle_t *HandlePtr, uint8 *MemPtr, uint32 Size);

/*****************************************************************************/
/**
Expand Down Expand Up @@ -1207,7 +1208,7 @@ int32 CFE_ES_PoolCreate(CFE_ES_MemHandle_t *HandlePtr, uint8 *MemPtr, uint32 Siz
** \sa #CFE_ES_PoolCreate, #CFE_ES_PoolCreateNoSem, #CFE_ES_GetPoolBuf, #CFE_ES_PutPoolBuf, #CFE_ES_GetMemPoolStats
**
******************************************************************************/
int32 CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *HandlePtr, uint8 *MemPtr, uint32 Size, uint32 NumBlockSizes, uint32 *BlockSizes, uint16 UseMutex);
CFE_RC_t CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *HandlePtr, uint8 *MemPtr, uint32 Size, uint32 NumBlockSizes, uint32 *BlockSizes, uint16 UseMutex);

/*****************************************************************************/
/**
Expand Down Expand Up @@ -1256,7 +1257,7 @@ int32 CFE_ES_GetPoolBuf(uint32 **BufPtr, CFE_ES_MemHandle_t HandlePtr, uint32 Si
** \sa #CFE_ES_PoolCreate, #CFE_ES_PoolCreateNoSem, #CFE_ES_PoolCreateEx, #CFE_ES_GetPoolBuf, #CFE_ES_GetMemPoolStats, #CFE_ES_PutPoolBuf
**
******************************************************************************/
int32 CFE_ES_GetPoolBufInfo(CFE_ES_MemHandle_t HandlePtr, uint32 *BufPtr);
CFE_RC_t CFE_ES_GetPoolBufInfo(CFE_ES_MemHandle_t HandlePtr, uint32 *BufPtr);

/*****************************************************************************/
/**
Expand Down Expand Up @@ -1305,7 +1306,7 @@ int32 CFE_ES_PutPoolBuf(CFE_ES_MemHandle_t HandlePtr, uint32 *BufPtr);
** \sa #CFE_ES_PoolCreate, #CFE_ES_PoolCreateNoSem, #CFE_ES_PoolCreateEx, #CFE_ES_GetPoolBuf, #CFE_ES_PutPoolBuf
**
******************************************************************************/
int32 CFE_ES_GetMemPoolStats(CFE_ES_MemPoolStats_t *BufPtr, CFE_ES_MemHandle_t Handle);
CFE_RC_t CFE_ES_GetMemPoolStats(CFE_ES_MemPoolStats_t *BufPtr, CFE_ES_MemHandle_t Handle);
/**@}*/

/** @defgroup CFEAPIESPerfMon cFE Performance Monitor APIs
Expand Down Expand Up @@ -1397,7 +1398,7 @@ void CFE_ES_PerfLogAdd(uint32 Marker, uint32 EntryExit);
** \sa #CFE_ES_IncrementGenCounter, #CFE_ES_DeleteGenCounter, #CFE_ES_SetGenCount, #CFE_ES_GetGenCount, #CFE_ES_GetGenCounterIDByName
**
******************************************************************************/
int32 CFE_ES_RegisterGenCounter(uint32 *CounterIdPtr, const char *CounterName);
CFE_RC_t CFE_ES_RegisterGenCounter(uint32 *CounterIdPtr, const char *CounterName);

/*****************************************************************************/
/**
Expand All @@ -1418,7 +1419,7 @@ int32 CFE_ES_RegisterGenCounter(uint32 *CounterIdPtr, const char *CounterName);
** \sa #CFE_ES_IncrementGenCounter, #CFE_ES_RegisterGenCounter, #CFE_ES_SetGenCount, #CFE_ES_GetGenCount, #CFE_ES_GetGenCounterIDByName
**
******************************************************************************/
int32 CFE_ES_DeleteGenCounter(uint32 CounterId);
CFE_RC_t CFE_ES_DeleteGenCounter(uint32 CounterId);

/*****************************************************************************/
/**
Expand All @@ -1439,7 +1440,7 @@ int32 CFE_ES_DeleteGenCounter(uint32 CounterId);
** \sa #CFE_ES_RegisterGenCounter, #CFE_ES_DeleteGenCounter, #CFE_ES_SetGenCount, #CFE_ES_GetGenCount, #CFE_ES_GetGenCounterIDByName
**
******************************************************************************/
int32 CFE_ES_IncrementGenCounter(uint32 CounterId);
CFE_RC_t CFE_ES_IncrementGenCounter(uint32 CounterId);

/*****************************************************************************/
/**
Expand All @@ -1462,7 +1463,7 @@ int32 CFE_ES_IncrementGenCounter(uint32 CounterId);
** \sa #CFE_ES_RegisterGenCounter, #CFE_ES_DeleteGenCounter, #CFE_ES_IncrementGenCounter, #CFE_ES_GetGenCount, #CFE_ES_GetGenCounterIDByName
**
******************************************************************************/
int32 CFE_ES_SetGenCount(uint32 CounterId, uint32 Count);
CFE_RC_t CFE_ES_SetGenCount(uint32 CounterId, uint32 Count);

/*****************************************************************************/
/**
Expand All @@ -1485,7 +1486,7 @@ int32 CFE_ES_SetGenCount(uint32 CounterId, uint32 Count);
** \sa #CFE_ES_RegisterGenCounter, #CFE_ES_DeleteGenCounter, #CFE_ES_SetGenCount, #CFE_ES_IncrementGenCounter, #CFE_ES_GetGenCounterIDByName
**
******************************************************************************/
int32 CFE_ES_GetGenCount(uint32 CounterId, uint32 *Count);
CFE_RC_t CFE_ES_GetGenCount(uint32 CounterId, uint32 *Count);


/*****************************************************************************/
Expand All @@ -1508,7 +1509,7 @@ int32 CFE_ES_GetGenCount(uint32 CounterId, uint32 *Count);
**
** \sa #CFE_ES_RegisterGenCounter, #CFE_ES_DeleteGenCounter, #CFE_ES_SetGenCount, #CFE_ES_IncrementGenCounter, #CFE_ES_GetGenCount
******************************************************************************/
int32 CFE_ES_GetGenCounterIDByName(uint32 *CounterIdPtr, const char *CounterName);
CFE_RC_t CFE_ES_GetGenCounterIDByName(uint32 *CounterIdPtr, const char *CounterName);
/**@}*/

#endif /* _cfe_es_ */
Loading