Skip to content

Commit

Permalink
Merge pull request #1100 from nasa/integration-candidate
Browse files Browse the repository at this point in the history
osal Integration candidate: 2021-07-13
  • Loading branch information
astrogeco authored Jul 13, 2021
2 parents 5e8f40b + 39677a0 commit cb95655
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 14 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ The autogenerated OSAL user's guide can be viewed at <https://github.com/nasa/cF
## Version History


### Development Build: v5.1.0-rc1+dev569

- Skip these "timer reconfig" unit tests on non-POSIX platforms. Add documentation clearly indicating that the API must not be called from a timer context.
- See <https://github.com/nasa/osal/pull/1100> and <https://github.com/nasa/cFS/pull/297>

### Development Build: v5.1.0-rc1+dev564

- Add range to OS_TaskDelay checks
Expand Down
17 changes: 16 additions & 1 deletion src/os/inc/osapi-timebase.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ typedef struct
* be configured to support at least (OS_MAX_TASKS + OS_MAX_TIMEBASES) threads,
* to account for the helper threads associated with time base objects.
*
* @note This configuration API must not be used from the context of a timer callback.
* Timers should only be configured from the context of normal OSAL tasks.
*
* @param[out] timebase_id will be set to the non-zero ID of the newly-created resource @nonnull
* @param[in] timebase_name The name of the time base @nonnull
* @param[in] external_sync A synchronization function for BSP hardware-based timer ticks
Expand Down Expand Up @@ -101,6 +104,9 @@ int32 OS_TimeBaseCreate(osal_id_t *timebase_id, const char *timebase_name, OS_Ti
* This function has no effect for time bases that are using
* a BSP-provided external_sync function.
*
* @note This configuration API must not be used from the context of a timer callback.
* Timers should only be configured from the context of normal OSAL tasks.
*
* @param[in] timebase_id The timebase resource to configure
* @param[in] start_time The amount of delay for the first tick, in microseconds.
* @param[in] interval_time The amount of delay between ticks, in microseconds.
Expand All @@ -120,6 +126,9 @@ int32 OS_TimeBaseSet(osal_id_t timebase_id, uint32 start_time, uint32 interval_t
* The helper task and any other resources associated with the time base
* abstraction will be freed.
*
* @note This configuration API must not be used from the context of a timer callback.
* Timers should only be configured from the context of normal OSAL tasks.
*
* @param[in] timebase_id The timebase resource to delete
*
* @return Execution status, see @ref OSReturnCodes
Expand All @@ -135,6 +144,9 @@ int32 OS_TimeBaseDelete(osal_id_t timebase_id);
*
* Given a time base name, find and output the ID associated with it.
*
* @note This configuration API must not be used from the context of a timer callback.
* Timers should only be configured from the context of normal OSAL tasks.
*
* @param[out] timebase_id will be set to the non-zero ID of the matching resource @nonnull
* @param[in] timebase_name The name of the timebase resource to find @nonnull
*
Expand All @@ -155,7 +167,10 @@ int32 OS_TimeBaseGetIdByName(osal_id_t *timebase_id, const char *timebase_name);
* relevant information about the time base resource.
*
* This function will pass back a pointer to structure that contains
* all of the relevant info( name and creator) about the specified timebase.
* all of the relevant info( name and creator) about the specified timebase.
*
* @note This configuration API must not be used from the context of a timer callback.
* Timers should only be configured from the context of normal OSAL tasks.
*
* @param[in] timebase_id The timebase resource ID
* @param[out] timebase_prop Buffer to store timebase properties @nonnull
Expand Down
18 changes: 18 additions & 0 deletions src/os/inc/osapi-timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ typedef struct
* @note clock_accuracy comes from the underlying OS tick value. The nearest integer
* microsecond value is returned, so may not be exact.
*
* @note This configuration API must not be used from the context of a timer callback.
* Timers should only be configured from the context of normal OSAL tasks.
*
* @sa OS_TimerCallback_t
*
* @param[out] timer_id Will be set to the non-zero resource ID of the timer object @nonnull
Expand Down Expand Up @@ -109,6 +112,9 @@ int32 OS_TimerCreate(osal_id_t *timer_id, const char *timer_name, uint32 *clock_
* function by the OSAL, and the arg parameter is passed through from the
* callback_arg argument on this call.
*
* @note This configuration API must not be used from the context of a timer callback.
* Timers should only be configured from the context of normal OSAL tasks.
*
* @sa OS_ArgCallback_t
*
* @param[out] timer_id Will be set to the non-zero resource ID of the timer object @nonnull
Expand Down Expand Up @@ -149,6 +155,9 @@ int32 OS_TimerAdd(osal_id_t *timer_id, const char *timer_name, osal_id_t timebas
* or interval_msec parameters are less than the accuracy, they will be rounded
* up to the accuracy of the timer.
*
* @note This configuration API must not be used from the context of a timer callback.
* Timers should only be configured from the context of normal OSAL tasks.
*
* @param[in] timer_id The timer ID to operate on
* @param[in] start_time Time in microseconds to the first expiration
* @param[in] interval_time Time in microseconds between subsequent intervals, value
Expand All @@ -171,6 +180,9 @@ int32 OS_TimerSet(osal_id_t timer_id, uint32 start_time, uint32 interval_time);
* The application callback associated with the timer will be stopped,
* and the resources freed for future use.
*
* @note This configuration API must not be used from the context of a timer callback.
* Timers should only be configured from the context of normal OSAL tasks.
*
* @param[in] timer_id The timer ID to operate on
*
* @return Execution status, see @ref OSReturnCodes
Expand All @@ -187,6 +199,9 @@ int32 OS_TimerDelete(osal_id_t timer_id);
*
* Outputs the ID associated with the given timer, if it exists.
*
* @note This configuration API must not be used from the context of a timer callback.
* Timers should only be configured from the context of normal OSAL tasks.
*
* @param[out] timer_id Will be set to the timer ID corresponding to the name @nonnull
* @param[in] timer_name The timer name to find @nonnull
*
Expand All @@ -206,6 +221,9 @@ int32 OS_TimerGetIdByName(osal_id_t *timer_id, const char *timer_name);
* This function takes timer_id, and looks it up in the OS table. It puts all of the
* information known about that timer into a structure pointer to by timer_prop.
*
* @note This configuration API must not be used from the context of a timer callback.
* Timers should only be configured from the context of normal OSAL tasks.
*
* @param[in] timer_id The timer ID to operate on
* @param[out] timer_prop Buffer containing timer properties @nonnull
* - creator: the OS task ID of the task that created this timer
Expand Down
2 changes: 1 addition & 1 deletion src/os/inc/osapi-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
/*
* Development Build Macro Definitions
*/
#define OS_BUILD_NUMBER 564
#define OS_BUILD_NUMBER 569
#define OS_BUILD_BASELINE "v5.1.0-rc1"

/*
Expand Down
3 changes: 1 addition & 2 deletions src/os/posix/build_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
##########################################################################

# this file is a placeholder for POSIX-specific compile tuning
# currently no extra flags/definitions needed

add_definitions(-D_POSIX_OS_)
3 changes: 1 addition & 2 deletions src/os/rtems/build_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
##########################################################################

# this file is a placeholder for RTEMS-specific compile tuning
# currently no extra flags/definitions needed

add_definitions(-D_RTEMS_OS_)
3 changes: 1 addition & 2 deletions src/os/vxworks/build_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
##########################################################################

# this file is a placeholder for VxWorks-specific compile tuning
# currently no extra flags/definitions needed

add_definitions(-D_VXWORKS_OS_)
14 changes: 8 additions & 6 deletions src/tests/time-base-api-test/time-base-api-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,20 @@
#include "uttest.h"
#include "utbsp.h"

static OS_timebase_prop_t SyncTimeBaseProp;
OS_timebase_prop_t SyncTimeBaseProp;

static uint32 NumSyncs = 0;
uint32 NumSyncs = 0;

static uint32 UT_TimerSync(osal_id_t timer_id)
{
/*
* Calls to time base configuration from the context of a sync function
* should be rejected with OS_ERR_INCORRECT_OBJ_STATE. However because
* UtAssert is not fully thread-safe, this does not assert here, it just
* calls the various functions on the first time through and stores the
* result, which is checked/asserted in the main task.
* should be rejected with OS_ERR_INCORRECT_OBJ_STATE. Note that only the
* POSIX provides the mechanism for this error check to actually work - On
* other platforms the error checking may not be possible, depending on how
* OS_TaskGetId_Impl() responds when called from a non-OSAL task.
*/
#ifdef _POSIX_OS_
if (NumSyncs == 0)
{
UtAssert_INT32_EQ(OS_TimeBaseCreate(&timer_id, "sync", 0), OS_ERR_INCORRECT_OBJ_STATE);
Expand All @@ -56,6 +57,7 @@ static uint32 UT_TimerSync(osal_id_t timer_id)
UtAssert_INT32_EQ(OS_TimeBaseGetIdByName(&timer_id, "TimeBaseC"), OS_ERR_INCORRECT_OBJ_STATE);
UtAssert_INT32_EQ(OS_TimeBaseGetInfo(timer_id, &SyncTimeBaseProp), OS_ERR_INCORRECT_OBJ_STATE);
}
#endif

++NumSyncs;
OS_TaskDelay(1);
Expand Down
4 changes: 4 additions & 0 deletions src/unit-tests/ostimer-test/ut_ostimer_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,11 @@ void UtTest_Setup(void)
UtTest_Add(UT_os_timergetidbyname_test, UT_os_setup_timergetidbyname_test, NULL, "OS_TimerGetIdByName");
UtTest_Add(UT_os_timergetinfo_test, UT_os_setup_timergetinfo_test, NULL, "OS_TimerGetInfo");
UtTest_Add(UT_os_timerset_test, UT_os_setup_timerset_test, NULL, "OS_TimerSet");

/* the reconfig test only works on POSIX */
#ifdef _POSIX_OS_
UtTest_Add(UT_os_timerreconf_test, NULL, NULL, "TimerReconfig");
#endif
}

/*================================================================================*
Expand Down

0 comments on commit cb95655

Please sign in to comment.