Skip to content

Commit

Permalink
Fix nasa#921, Update remaining cFE source/tests to use CFE_Status_t
Browse files Browse the repository at this point in the history
  • Loading branch information
thnkslprpt committed Mar 31, 2023
1 parent 7af467e commit 53fc364
Show file tree
Hide file tree
Showing 80 changed files with 730 additions and 708 deletions.
30 changes: 15 additions & 15 deletions docs/cFE Application Developers Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -839,20 +839,20 @@ the newly-created resource. This ID is used in all other functions that use
the binary semaphore.
```c
int32 OS_BinSemCreate(uint32 *xxx_SEM_ID, const char *xxx_SEM_NAME,
CFE_Status_t OS_BinSemCreate(uint32 *xxx_SEM_ID, const char *xxx_SEM_NAME,
uint32 sem_initial_value, uint32 options);
```

There are two options for pending on a binary semaphore:

```c
int32 OS_BinSemTake( uint32 xxx_SEM_ID );
CFE_Status_t OS_BinSemTake( uint32 xxx_SEM_ID );
```
which waits indefinitely for a semaphore to become available, and
```c
int32 OS_BinSemTimedWait( uint32 xxx_SEM_ID , uint32 timeout_in_milliseconds );
CFE_Status_t OS_BinSemTimedWait( uint32 xxx_SEM_ID , uint32 timeout_in_milliseconds );
```

which waits for a specified timeout period and quits if the semaphore
Expand All @@ -861,7 +861,7 @@ has not become available.
A binary semaphore is given by using this function:

```c
int32 OS_BinSemGive( uint32 xxx_SEM_ID );
CFE_Status_t OS_BinSemGive( uint32 xxx_SEM_ID );
```
For more detail on these functions (including arguments and return codes, refer
Expand All @@ -886,26 +886,26 @@ ID of the newly-created resource. This ID is used in all other functions that
use the binary semaphore.
```c
int32 OS_CountSemCreate(uint32 *xxx_SEM_ID, const char *xxx_SEM_NAME,
CFE_Status_t OS_CountSemCreate(uint32 *xxx_SEM_ID, const char *xxx_SEM_NAME,
uint32 sem_initial_value, uint32 options);
```

There are two options for pending on a counting semaphore:

```c
int32 OS_CountSemTake( uint32 xxx_SEM_ID );
CFE_Status_t OS_CountSemTake( uint32 xxx_SEM_ID );
```
which waits indefinitely for a semaphore to become available, and
```c
int32 OS_CountSemTimedWait( uint32 xxx_SEM_ID , uint32 timeout_in_milliseconds );
CFE_Status_t OS_CountSemTimedWait( uint32 xxx_SEM_ID , uint32 timeout_in_milliseconds );
```

A counting semaphore is given by using this function:

```c
int32 OS_CountSemGive( uint32 xxx_SEM_ID );
CFE_Status_t OS_CountSemGive( uint32 xxx_SEM_ID );
```
For more detail on these functions (including arguments and return codes, refer
Expand Down Expand Up @@ -941,12 +941,12 @@ have the same level of indentation, and there should be exactly one
entry point and one exit point to the protected region.
```c
int32 OS_MutSemTake( uint32 xxx_MUT_ID );
CFE_Status_t OS_MutSemTake( uint32 xxx_MUT_ID );
/* protected region */
Use the resource...
int32 OS_MutSemGive( uint32 xxx_MUT_ID );
CFE_Status_t OS_MutSemGive( uint32 xxx_MUT_ID );
```

The code in the protected region should be kept as short as possible;
Expand All @@ -966,25 +966,25 @@ of the entire system.
An application creates a mutex by calling:

```c
int32 OS_MutSemCreate (uint32 *sem_id, const char *sem_name, uint32 options);
CFE_Status_t OS_MutSemCreate (uint32 *sem_id, const char *sem_name, uint32 options);
```
and deletes it by calling:
```c
int32 OS_MutSemDelete (uint32 sem_id);
CFE_Status_t OS_MutSemDelete (uint32 sem_id);
```

An application takes a mutex by calling:

```c
int32 OS_MutSemTake( uint32 xxx_MUT_ID );
CFE_Status_t OS_MutSemTake( uint32 xxx_MUT_ID );
```
and gives it by calling:
```c
int32 OS_MutSemGive( uint32 xxx_MUT_ID );
CFE_Status_t OS_MutSemGive( uint32 xxx_MUT_ID );
```

There is no function for taking a mutex with a timeout limit since
Expand Down Expand Up @@ -1372,7 +1372,7 @@ function, then the Developer can use the CFE_ES_WriteToSysLog
function. This function has the following prototype:
```c
int32 CFE_ES_WriteToSysLog(const char *pSpecString, ...);
CFE_Status_t CFE_ES_WriteToSysLog(const char *pSpecString, ...);
```

The function acts just like a standard 'C' printf function and records
Expand Down
6 changes: 3 additions & 3 deletions modules/cfe_assert/inc/cfe_assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ typedef void (*CFE_Assert_StatusCallback_t)(uint8 MessageType, const char *Prefi
** \return #CFE_SUCCESS if successful, or error code
**
*************************************************************************/
int32 CFE_Assert_LibInit(CFE_ES_LibId_t LibId);
CFE_Status_t CFE_Assert_LibInit(CFE_ES_LibId_t LibId);

/************************************************************************/
/** \brief Start Test
Expand All @@ -251,7 +251,7 @@ int32 CFE_Assert_LibInit(CFE_ES_LibId_t LibId);
** \return #CFE_SUCCESS if successful, or error code
**
*************************************************************************/
int32 CFE_Assert_RegisterTest(const char *TestName);
CFE_Status_t CFE_Assert_RegisterTest(const char *TestName);

/************************************************************************/
/** \brief Execute Test and Exit
Expand Down Expand Up @@ -298,7 +298,7 @@ void CFE_Assert_RegisterCallback(CFE_Assert_StatusCallback_t Callback);
* \retval #CFE_SUCCESS if file was opened successfully
*
*/
int32 CFE_Assert_OpenLogFile(const char *Filename);
CFE_Status_t CFE_Assert_OpenLogFile(const char *Filename);

/************************************************************************/
/** \brief Complete a test log file
Expand Down
4 changes: 2 additions & 2 deletions modules/cfe_assert/src/cfe_assert_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void CFE_Assert_RegisterCallback(CFE_Assert_StatusCallback_t Callback)
/*
* Opens a log file to "tee" the test output to
*/
int32 CFE_Assert_OpenLogFile(const char *Filename)
CFE_Status_t CFE_Assert_OpenLogFile(const char *Filename)
{
int32 OsStatus;
char * Ext;
Expand Down Expand Up @@ -104,7 +104,7 @@ void CFE_Assert_CloseLogFile(void)
/*
* Initialization Function for this library
*/
int32 CFE_Assert_LibInit(CFE_ES_LibId_t LibId)
CFE_Status_t CFE_Assert_LibInit(CFE_ES_LibId_t LibId)
{
int32 OsStatus;

Expand Down
4 changes: 2 additions & 2 deletions modules/cfe_assert/src/cfe_assert_runner.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ void CFE_Assert_StatusReport(uint8 MessageType, const char *Prefix, const char *
CFE_EVS_SendEvent(MessageType, EventType, "[%5s] %s", Prefix, OutputMessage);
}

int32 CFE_Assert_RegisterTest(const char *TestName)
CFE_Status_t CFE_Assert_RegisterTest(const char *TestName)
{
int32 rc;
CFE_Status_t rc;
char SetupSegmentName[64];
CFE_ES_AppId_t SelfId;

Expand Down
4 changes: 2 additions & 2 deletions modules/cfe_testcase/src/time_external_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@

#include "cfe_test.h"

int32 TestCallbackFunction(void)
CFE_Status_t TestCallbackFunction(void)
{
CFE_FT_Global.Count += 1;
return CFE_SUCCESS;
}

int32 TestCallbackFunction2(void)
CFE_Status_t TestCallbackFunction2(void)
{
CFE_FT_Global.Count = 0;
return CFE_SUCCESS;
Expand Down
2 changes: 1 addition & 1 deletion modules/config/fsw/src/cfe_config_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ void CFE_Config_SetupBasicBuildInfo(void)
* See description in header file for argument/return detail
*
*-----------------------------------------------------------------*/
int32 CFE_Config_Init(void)
CFE_Status_t CFE_Config_Init(void)
{
/* Clear the table, just in case it was not already cleared from initial program loading */
memset(&CFE_Config_Global, 0, sizeof(CFE_Config_Global));
Expand Down
2 changes: 1 addition & 1 deletion modules/config/ut-coverage/test_cfe_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ void Test_CFE_Config_Init(void)
{
/*
* Test case for:
* int32 CFE_Config_Init(void)
* CFE_Status_t CFE_Config_Init(void)
*/
UtAssert_INT32_EQ(CFE_Config_Init(), CFE_SUCCESS);
}
Expand Down
12 changes: 6 additions & 6 deletions modules/core_api/fsw/inc/cfe_es.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ CFE_Status_t CFE_ES_AppID_ToIndex(CFE_ES_AppId_t AppID, uint32 *Idx);
* @retval #CFE_SUCCESS @copybrief CFE_SUCCESS
* @retval #CFE_ES_ERR_RESOURCEID_NOT_VALID @copybrief CFE_ES_ERR_RESOURCEID_NOT_VALID
*/
int32 CFE_ES_LibID_ToIndex(CFE_ES_LibId_t LibId, uint32 *Idx);
CFE_Status_t CFE_ES_LibID_ToIndex(CFE_ES_LibId_t LibId, uint32 *Idx);

/**
* @brief Obtain an index value correlating to an ES Task ID
Expand Down Expand Up @@ -748,7 +748,7 @@ CFE_Status_t CFE_ES_GetTaskInfo(CFE_ES_TaskInfo_t *TaskInfo, CFE_ES_TaskId_t Tas
** \sa #CFE_ES_GetLibIDByName, #CFE_ES_GetLibName
**
******************************************************************************/
int32 CFE_ES_GetLibInfo(CFE_ES_AppInfo_t *LibInfo, CFE_ES_LibId_t LibId);
CFE_Status_t CFE_ES_GetLibInfo(CFE_ES_AppInfo_t *LibInfo, CFE_ES_LibId_t LibId);

/*****************************************************************************/
/**
Expand Down Expand Up @@ -780,7 +780,7 @@ int32 CFE_ES_GetLibInfo(CFE_ES_AppInfo_t *LibInfo, CFE_ES_LibId_t LibId);
** \sa #CFE_ES_GetLibInfo, #CFE_ES_GetAppInfo
**
******************************************************************************/
int32 CFE_ES_GetModuleInfo(CFE_ES_AppInfo_t *ModuleInfo, CFE_ResourceId_t ResourceId);
CFE_Status_t CFE_ES_GetModuleInfo(CFE_ES_AppInfo_t *ModuleInfo, CFE_ResourceId_t ResourceId);

/**@}*/

Expand Down Expand Up @@ -1337,7 +1337,7 @@ CFE_Status_t CFE_ES_PoolCreateEx(CFE_ES_MemHandle_t *PoolID, void *MemPtr, size_
** \sa #CFE_ES_PoolCreate, #CFE_ES_PoolCreateNoSem, #CFE_ES_GetPoolBuf, #CFE_ES_PutPoolBuf, #CFE_ES_GetMemPoolStats
**
******************************************************************************/
int32 CFE_ES_PoolDelete(CFE_ES_MemHandle_t PoolID);
CFE_Status_t CFE_ES_PoolDelete(CFE_ES_MemHandle_t PoolID);

/*****************************************************************************/
/**
Expand Down Expand Up @@ -1365,7 +1365,7 @@ int32 CFE_ES_PoolDelete(CFE_ES_MemHandle_t PoolID);
*#CFE_ES_GetPoolBufInfo
**
******************************************************************************/
int32 CFE_ES_GetPoolBuf(CFE_ES_MemPoolBuf_t *BufPtr, CFE_ES_MemHandle_t Handle, size_t Size);
CFE_Status_t CFE_ES_GetPoolBuf(CFE_ES_MemPoolBuf_t *BufPtr, CFE_ES_MemHandle_t Handle, size_t Size);

/*****************************************************************************/
/**
Expand Down Expand Up @@ -1416,7 +1416,7 @@ CFE_Status_t CFE_ES_GetPoolBufInfo(CFE_ES_MemHandle_t Handle, CFE_ES_MemPoolBuf_
*#CFE_ES_GetPoolBufInfo
**
******************************************************************************/
int32 CFE_ES_PutPoolBuf(CFE_ES_MemHandle_t Handle, CFE_ES_MemPoolBuf_t BufPtr);
CFE_Status_t CFE_ES_PutPoolBuf(CFE_ES_MemHandle_t Handle, CFE_ES_MemPoolBuf_t BufPtr);

/*****************************************************************************/
/**
Expand Down
12 changes: 6 additions & 6 deletions modules/core_api/fsw/inc/cfe_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,9 @@ const char *CFE_FS_GetDefaultExtension(CFE_FS_FileCategory_t FileCategory);
** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
**
******************************************************************************/
int32 CFE_FS_ParseInputFileNameEx(char *OutputBuffer, const char *InputBuffer, size_t OutputBufSize,
size_t InputBufSize, const char *DefaultInput, const char *DefaultPath,
const char *DefaultExtension);
CFE_Status_t CFE_FS_ParseInputFileNameEx(char *OutputBuffer, const char *InputBuffer, size_t OutputBufSize,
size_t InputBufSize, const char *DefaultInput, const char *DefaultPath,
const char *DefaultExtension);

/*****************************************************************************/
/**
Expand Down Expand Up @@ -284,8 +284,8 @@ int32 CFE_FS_ParseInputFileNameEx(char *OutputBuffer, const char *InputBuffer, s
**
**---------------------------------------------------------------------------------------
*/
int32 CFE_FS_ParseInputFileName(char *OutputBuffer, const char *InputName, size_t OutputBufSize,
CFE_FS_FileCategory_t FileCategory);
CFE_Status_t CFE_FS_ParseInputFileName(char *OutputBuffer, const char *InputName, size_t OutputBufSize,
CFE_FS_FileCategory_t FileCategory);

/*****************************************************************************/
/**
Expand Down Expand Up @@ -334,7 +334,7 @@ CFE_Status_t CFE_FS_ExtractFilenameFromPath(const char *OriginalPath, char *File
** \retval #CFE_SUCCESS \copybrief CFE_SUCCESS
**
******************************************************************************/
int32 CFE_FS_BackgroundFileDumpRequest(CFE_FS_FileWriteMetaData_t *Meta);
CFE_Status_t CFE_FS_BackgroundFileDumpRequest(CFE_FS_FileWriteMetaData_t *Meta);

/*****************************************************************************/
/**
Expand Down
4 changes: 3 additions & 1 deletion modules/core_api/fsw/inc/cfe_resourceid.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
#ifndef CFE_RESOURCEID_H
#define CFE_RESOURCEID_H

#include "cfe_error.h"

/*
* The basic resource ID API definitions
*/
Expand Down Expand Up @@ -216,6 +218,6 @@ CFE_ResourceId_t CFE_ResourceId_FindNext(CFE_ResourceId_t StartId, uint32 TableS
* @retval #CFE_ES_BAD_ARGUMENT @copybrief CFE_ES_BAD_ARGUMENT
* @retval #CFE_ES_ERR_RESOURCEID_NOT_VALID @copybrief CFE_ES_ERR_RESOURCEID_NOT_VALID
*/
int32 CFE_ResourceId_ToIndex(CFE_ResourceId_t Id, uint32 BaseValue, uint32 TableSize, uint32 *Idx);
CFE_Status_t CFE_ResourceId_ToIndex(CFE_ResourceId_t Id, uint32 BaseValue, uint32 TableSize, uint32 *Idx);

#endif /* CFE_RESOURCEID_H */
8 changes: 4 additions & 4 deletions modules/core_api/fsw/inc/cfe_sb.h
Original file line number Diff line number Diff line change
Expand Up @@ -644,8 +644,8 @@ void CFE_SB_TimeStampMsg(CFE_MSG_Message_t *MsgPtr);
** \retval #CFE_SB_BAD_ARGUMENT \copybrief CFE_SB_BAD_ARGUMENT
**
*/
int32 CFE_SB_MessageStringSet(char *DestStringPtr, const char *SourceStringPtr, size_t DestMaxSize,
size_t SourceMaxSize);
CFE_Status_t CFE_SB_MessageStringSet(char *DestStringPtr, const char *SourceStringPtr, size_t DestMaxSize,
size_t SourceMaxSize);

/*****************************************************************************/
/**
Expand Down Expand Up @@ -724,8 +724,8 @@ size_t CFE_SB_GetUserDataLength(const CFE_MSG_Message_t *MsgPtr);
** \retval #CFE_SB_BAD_ARGUMENT \copybrief CFE_SB_BAD_ARGUMENT
**
*/
int32 CFE_SB_MessageStringGet(char *DestStringPtr, const char *SourceStringPtr, const char *DefaultString,
size_t DestMaxSize, size_t SourceMaxSize);
CFE_Status_t CFE_SB_MessageStringGet(char *DestStringPtr, const char *SourceStringPtr, const char *DefaultString,
size_t DestMaxSize, size_t SourceMaxSize);
/** @} */

/** @defgroup CFEAPISBMessageID cFE Message ID APIs
Expand Down
Loading

0 comments on commit 53fc364

Please sign in to comment.