Skip to content

Commit

Permalink
Merge pull request #201 from jphickey/fix-200-osal-id-type
Browse files Browse the repository at this point in the history
Fix #200, Update PSP to use osal_id_t
  • Loading branch information
astrogeco authored Oct 12, 2020
2 parents b383f7c + 0816003 commit b1e9057
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion fsw/inc/cfe_psp.h
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ extern void CFE_PSP_SetDefaultExceptionEnvironment(void);


extern uint32 CFE_PSP_Exception_GetCount(void);
extern int32 CFE_PSP_Exception_GetSummary(uint32 *ContextLogId, uint32 *TaskId, char *ReasonBuf, uint32 ReasonSize);
extern int32 CFE_PSP_Exception_GetSummary(uint32 *ContextLogId, osal_id_t *TaskId, char *ReasonBuf, uint32 ReasonSize);
extern int32 CFE_PSP_Exception_CopyContext(uint32 ContextLogId, void *ContextBuf, uint32 ContextSize);

/*
Expand Down
2 changes: 1 addition & 1 deletion fsw/mcp750-vxworks/src/cfe_psp_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void OS_Application_Startup(void)
int TicksPerSecond;
uint32 reset_type;
uint32 reset_subtype;
uint32 fs_id;
osal_id_t fs_id;
char reset_register;
int32 Status;

Expand Down
8 changes: 4 additions & 4 deletions fsw/pc-linux/src/cfe_psp_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ void OS_Application_Startup(void)
uint32 reset_type;
uint32 reset_subtype;
int32 time_status;
uint32 sys_timebase_id;
uint32 fs_id;
osal_id_t sys_timebase_id;
osal_id_t fs_id;
int opt = 0;
int longIndex = 0;
int32 Status;
Expand Down Expand Up @@ -319,7 +319,7 @@ void OS_Application_Startup(void)
*
* See below for workaround.
*/
sys_timebase_id = 0;
sys_timebase_id = OS_OBJECT_ID_UNDEFINED;
}

/*
Expand Down Expand Up @@ -403,7 +403,7 @@ void OS_Application_Startup(void)
/*
* Backward compatibility for old OSAL.
*/
if (sys_timebase_id == 0 || time_status != OS_SUCCESS)
if (!OS_ObjectIdDefined(sys_timebase_id) || time_status != OS_SUCCESS)
{
OS_printf("CFE_PSP: WARNING - Compatibility mode - using local 1Hz Interrupt\n");
CFE_PSP_SetupLocal1Hz();
Expand Down
4 changes: 2 additions & 2 deletions fsw/pc-rtems/src/cfe_psp_start.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ int CFE_PSP_Setup(void)

void CFE_PSP_SetupSystemTimer(void)
{
uint32 SystemTimebase;
osal_id_t SystemTimebase;
int32 Status;

Status = OS_TimeBaseCreate(&SystemTimebase, "cFS-Master", NULL);
Expand Down Expand Up @@ -235,7 +235,7 @@ void CFE_PSP_Main(void)
{
uint32 reset_type;
uint32 reset_subtype;
uint32 fs_id;
osal_id_t fs_id;
int32 Status;


Expand Down
4 changes: 2 additions & 2 deletions fsw/shared/src/cfe_psp_exceptionstorage.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ uint32 CFE_PSP_Exception_GetCount(void)
* CFE_PSP_Exception_GetSummary
* See description in PSP API
*---------------------------------------------------------------------------*/
int32 CFE_PSP_Exception_GetSummary(uint32 *ContextLogId, uint32 *TaskId, char *ReasonBuf, uint32 ReasonSize)
int32 CFE_PSP_Exception_GetSummary(uint32 *ContextLogId, osal_id_t *TaskId, char *ReasonBuf, uint32 ReasonSize)
{
const CFE_PSP_Exception_LogData_t* Buffer;
uint32 NumStored;
Expand Down Expand Up @@ -187,7 +187,7 @@ int32 CFE_PSP_Exception_GetSummary(uint32 *ContextLogId, uint32 *TaskId, char *R
Status = OS_TaskFindIdBySystemData(TaskId, &Buffer->sys_task_id, sizeof(Buffer->sys_task_id));
if (Status != OS_SUCCESS)
{
*TaskId = 0; /* failed to find a corresponding OSAL ID, so set to zero. */
*TaskId = OS_OBJECT_ID_UNDEFINED; /* failed to find a corresponding OSAL ID, so set to zero. */
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,22 +90,22 @@ void Test_CFE_PSP_Exception_GetSummary(void)
*/
char ReasonBuf[128];
uint32 LogId;
uint32 TaskId;
uint32 TestId;
osal_id_t TaskId;
osal_id_t TestId;

/* Nominal - no exceptions pending should return CFE_PSP_NO_EXCEPTION_DATA */
CFE_PSP_Exception_Reset();
UtAssert_INT32_EQ(CFE_PSP_Exception_GetSummary(&LogId, &TaskId, ReasonBuf, sizeof(ReasonBuf)), CFE_PSP_NO_EXCEPTION_DATA);


/* Set up an entry and then run again */
TestId = 2857;
TestId = OS_ObjectIdFromInteger(2857);
UT_SetDataBuffer(UT_KEY(OS_TaskFindIdBySystemData), &TestId, sizeof(TestId), false);
UtAssert_NOT_NULL(CFE_PSP_Exception_GetNextContextBuffer());
CFE_PSP_Exception_WriteComplete();
UtAssert_INT32_EQ(CFE_PSP_Exception_GetSummary(&LogId, &TaskId, ReasonBuf, sizeof(ReasonBuf)), CFE_PSP_SUCCESS);
UtAssert_NONZERO(LogId);
UtAssert_UINT32_EQ(TaskId, TestId);
UtAssert_UINT32_EQ(OS_ObjectIdToInteger(TaskId), OS_ObjectIdToInteger(TestId));
UtAssert_ZERO(CFE_PSP_Exception_GetCount());

/* Get an entry with failure to obtain task ID */
Expand All @@ -115,7 +115,7 @@ void Test_CFE_PSP_Exception_GetSummary(void)
UtAssert_INT32_EQ(CFE_PSP_Exception_GetSummary(&LogId, &TaskId, ReasonBuf, sizeof(ReasonBuf)), CFE_PSP_SUCCESS);
UT_ClearForceFail(UT_KEY(OS_TaskFindIdBySystemData));
UtAssert_NONZERO(LogId);
UtAssert_ZERO(TaskId);
UtAssert_ZERO(OS_ObjectIdToInteger(TaskId));

UtAssert_NOT_NULL(CFE_PSP_Exception_GetNextContextBuffer());
CFE_PSP_Exception_WriteComplete();
Expand Down
6 changes: 3 additions & 3 deletions ut-stubs/ut_psp_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -699,17 +699,17 @@ uint32 CFE_PSP_Exception_GetCount(void)
return status;
}

int32 CFE_PSP_Exception_GetSummary(uint32 *ContextLogId, uint32 *TaskId, char *ReasonBuf, uint32 ReasonSize)
int32 CFE_PSP_Exception_GetSummary(uint32 *ContextLogId, osal_id_t *TaskId, char *ReasonBuf, uint32 ReasonSize)
{
int32 status;

*ContextLogId = 0;
*TaskId = 0;
*TaskId = OS_OBJECT_ID_UNDEFINED;
*ReasonBuf = 0;

/* allow the testcase to easily set the taskID output, anything more involved needs a hook */
status = UT_DEFAULT_IMPL_ARGS(CFE_PSP_Exception_GetSummary, ContextLogId, TaskId, ReasonBuf, ReasonSize);
if (status == 0 && *TaskId == 0)
if (status == 0 && !OS_ObjectIdDefined(*TaskId))
{
UT_Stub_CopyToLocal(UT_KEY(CFE_PSP_Exception_GetSummary), TaskId, sizeof(*TaskId));
}
Expand Down

0 comments on commit b1e9057

Please sign in to comment.