Skip to content

Commit

Permalink
Fix nasa#1432, RTEMS semaphore return bugs and functional test update
Browse files Browse the repository at this point in the history
  • Loading branch information
skliper committed Dec 29, 2023
1 parent 1a8823f commit 4a51d37
Show file tree
Hide file tree
Showing 6 changed files with 335 additions and 373 deletions.
1 change: 1 addition & 0 deletions src/os/inc/osapi-binsem.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ int32 OS_BinSemGetIdByName(osal_id_t *sem_id, const char *sem_name);
* @retval #OS_SUCCESS @copybrief OS_SUCCESS
* @retval #OS_ERR_INVALID_ID if the id passed in is not a valid semaphore
* @retval #OS_INVALID_POINTER if the bin_prop pointer is null
* @retval #OS_ERR_NOT_IMPLEMENTED @copybrief OS_ERR_NOT_IMPLEMENTED
*/
int32 OS_BinSemGetInfo(osal_id_t sem_id, OS_bin_sem_prop_t *bin_prop);

Expand Down
1 change: 1 addition & 0 deletions src/os/inc/osapi-countsem.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ int32 OS_CountSemGetIdByName(osal_id_t *sem_id, const char *sem_name);
* @retval #OS_SUCCESS @copybrief OS_SUCCESS
* @retval #OS_ERR_INVALID_ID if the id passed in is not a valid semaphore
* @retval #OS_INVALID_POINTER if the count_prop pointer is null
* @retval #OS_ERR_NOT_IMPLEMENTED @copybrief OS_ERR_NOT_IMPLEMENTED
*/
int32 OS_CountSemGetInfo(osal_id_t sem_id, OS_count_sem_prop_t *count_prop);

Expand Down
4 changes: 2 additions & 2 deletions src/os/rtems/src/os-impl-binsem.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ int32 OS_BinSemTimedWait_Impl(const OS_object_token_t *token, uint32 msecs)

status = rtems_semaphore_obtain(impl->id, option_set, TimeInTicks);

if (status == RTEMS_TIMEOUT)
if (status == RTEMS_TIMEOUT || (option_set == RTEMS_NO_WAIT && status == RTEMS_UNSATISFIED))
{
return OS_SEM_TIMEOUT;
}
Expand All @@ -275,5 +275,5 @@ int32 OS_BinSemTimedWait_Impl(const OS_object_token_t *token, uint32 msecs)
int32 OS_BinSemGetInfo_Impl(const OS_object_token_t *token, OS_bin_sem_prop_t *bin_prop)
{
/* RTEMS has no API for obtaining the current value of a semaphore */
return OS_SUCCESS;
return OS_ERR_NOT_IMPLEMENTED;
}
4 changes: 2 additions & 2 deletions src/os/rtems/src/os-impl-countsem.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ int32 OS_CountSemTimedWait_Impl(const OS_object_token_t *token, uint32 msecs)

status = rtems_semaphore_obtain(impl->id, option_set, TimeInTicks);

if (status == RTEMS_TIMEOUT)
if (status == RTEMS_TIMEOUT || (option_set == RTEMS_NO_WAIT && status == RTEMS_UNSATISFIED))
{
return OS_SEM_TIMEOUT;
}
Expand All @@ -239,5 +239,5 @@ int32 OS_CountSemTimedWait_Impl(const OS_object_token_t *token, uint32 msecs)
int32 OS_CountSemGetInfo_Impl(const OS_object_token_t *token, OS_count_sem_prop_t *count_prop)
{
/* RTEMS does not provide an API to get the value */
return OS_SUCCESS;
return OS_ERR_NOT_IMPLEMENTED;
}
Loading

0 comments on commit 4a51d37

Please sign in to comment.