Skip to content

Commit

Permalink
Fix #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 Apr 20, 2024
1 parent 28a5820 commit 74c5e58
Show file tree
Hide file tree
Showing 87 changed files with 880 additions and 858 deletions.
72 changes: 36 additions & 36 deletions docs/cFE Application Developers Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -930,20 +930,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 @@ -952,7 +952,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 @@ -977,26 +977,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 @@ -1032,12 +1032,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 @@ -1057,25 +1057,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 @@ -1297,8 +1297,8 @@ SAMPLE_TaskData_t SAMPLE_TaskData;
int32 SAMPLE_TaskInit(void)
{
int32 Status = CFE_SUCCESS;
uint32 CDSCrc;
CFE_Status_t Status = CFE_SUCCESS;
uint32 CDSCrc;
/* Create the Critical Data Store */
Status = CFE_ES_RegisterCDS(&SAMPLE_TaskData.MyCDSHandle,
Expand Down Expand Up @@ -1345,7 +1345,7 @@ int32 SAMPLE_TaskInit(void)
void SAMPLE_TaskMain(void)
{
int32 Status = CFE_SUCCESS;
CFE_Status_t Status = CFE_SUCCESS;
...
Expand Down Expand Up @@ -1471,7 +1471,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 Expand Up @@ -1500,9 +1500,9 @@ FILE: xx_app.c

void XX_AppMain(void)
{
uint32 RunStatus = CFE_ES_RunStatus_APP_RUN;
uint32 RunStatus = CFE_ES_RunStatus_APP_RUN;
CFE_SB_Buffer_t *SBBufPtr;
int32 Result = CFE_SUCCESS;
CFE_Status_t Result = CFE_SUCCESS;

/* Performance Log (start time counter) */
CFE_ES_PerfLogEntry(XX_APPMAIN_PERF_ID);
Expand Down Expand Up @@ -1735,7 +1735,7 @@ SAMPLE_AppData_t; SAMPLE_AppData;
...

{
int32 Status;
CFE_Status_t Status;

...
Status = CFE_SB_CreatePipe( &SAMPLE_AppData.SAMPLE_Pipe_1, /* Variable to hold Pipe ID */
Expand Down Expand Up @@ -1775,7 +1775,7 @@ follows:
FILE: sample_app.c

{
int32 Status;
CFE_Status_t Status;

...
Status = CFE_SB_DeletePipe(SAMPLE_Pipe_1); /* Delete pipe created earlier */
Expand Down Expand Up @@ -1830,7 +1830,7 @@ SAMPLE_AppData_t SAMPLE_AppData;

...
{
int32 Status;
CFE_Status_t Status;

...
Status = CFE_SB_SubscribeEX(SAMPLE_CMDID_1, /* Msg Id to Receive */
Expand Down Expand Up @@ -1878,7 +1878,7 @@ Message IDs. The following is a sample of the API to accomplish this:

```c
{
int32 Status;
CFE_Status_t Status;

...
Status = CFE_SB_Unsubscribe(SAMPLE_CMDID_1, /* Msg Id to Not Receive */
Expand Down Expand Up @@ -1946,7 +1946,7 @@ SAMPLE_AppData_t SAMPLE_AppData; /* Instantiate Task Data */

...
{
int32 Status;
CFE_Status_t Status;

...
Status = CFE_MSG_Init(CFE_MSG_PTR(SAMPLE_AppData.HkPacket.TelemetryHeader), /* Location of SB Message Data Buffer */
Expand Down Expand Up @@ -2473,7 +2473,7 @@ SAMPLE_AppData_t SAMPLE_AppData; /* Instantiate Task Data */

...
{
int32 Status;
CFE_Status_t Status;

...
/*
Expand Down Expand Up @@ -2516,7 +2516,7 @@ resetting a specific Event ID filter counter is shown below:
FILE: sample_app.c

{
int32 Status;
CFE_Status_t Status;

...
Status = CFE_EVS_ResetFilter(SAMPLE_MID_ERR_EID); /* Reset filter for command pkt errors */
Expand Down Expand Up @@ -2748,7 +2748,7 @@ CFE_TBL_Handle_t MyTableHandle; /* Handle to MyTable */

...
{
int32 Status;
CFE_Status_t Status;

...
/*
Expand Down Expand Up @@ -2778,7 +2778,7 @@ of this is shown in Section 8.5.1.

```c
{
int32 Status = CFE_SUCCESS;
CFE_Status_t Status = CFE_SUCCESS;
SAMPLE_MyTable_t *MyTblPtr;

...
Expand Down Expand Up @@ -2871,8 +2871,8 @@ Table Validation Request has been made as shown below:

```c
{
int32 Status = CFE_SUCCESS;
boolean FinishedManaging = FALSE;
CFE_Status_t Status = CFE_SUCCESS;
boolean FinishedManaging = FALSE;

while (!FinishedManaging)
{
Expand Down Expand Up @@ -2926,7 +2926,7 @@ CFE_TBL_Handle_t MyTableHandle /* Handle to MyTable */
SAMPLE_MyTable_t MyTblInitData = { 0x1234, 0x5678, { 2, 3, 4, ... }, ...};
...
{
int32 Status;
CFE_Status_t Status;

...
/*
Expand All @@ -2946,7 +2946,7 @@ memory image, the code would look something like the following:
```c
{
int32 Status;
CFE_Status_t Status;
...
/*
Expand Down Expand Up @@ -3074,7 +3074,7 @@ FILE: xx_tbl.c
int32 XX_TableInit(void)
{
int32 Status = CFE_SUCCESS;
CFE_Status_t Status = CFE_SUCCESS;
...
/*
Expand Down Expand Up @@ -3111,8 +3111,8 @@ int32 XX_TableInit(void)
int32 XX_ValidateTable(void *TableData)
{
/* Default to successful validation */
int32 Status = CFE_SUCCESS;
int32 i = 0;
CFE_Status_t Status = CFE_SUCCESS;
int32 i = 0;
XX_MyTable_t *MyTblPtr = (XX_MyTable_t *)TblPtr;
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 @@ -255,7 +255,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 @@ -268,7 +268,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 @@ -315,7 +315,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
6 changes: 3 additions & 3 deletions modules/cfe_assert/src/cfe_assert_runner.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,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 Expand Up @@ -280,7 +280,7 @@ int32 CFE_Assert_RegisterTest(const char *TestName)

void CFE_Assert_ExecuteTest(void)
{
int32 rc;
CFE_Status_t rc;
CFE_ES_AppId_t AppId;

/*
Expand Down
2 changes: 1 addition & 1 deletion modules/cfe_testcase/src/message_id_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void TestGetTypeFromMsgId(void)
UtPrintf("Testing: CFE_MSG_GetTypeFromMsgId");
CFE_SB_MsgId_t msgid = CFE_SB_INVALID_MSG_ID;
CFE_MSG_Type_t msgtype;
int32 status;
CFE_Status_t status;

/*
* Response not verified because msgid 0 could be out of range based on implementation and
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 @@ -210,7 +210,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
Loading

0 comments on commit 74c5e58

Please sign in to comment.