Skip to content

Commit cb95655

Browse files
authored
Merge pull request #1100 from nasa/integration-candidate
osal Integration candidate: 2021-07-13
2 parents 5e8f40b + 39677a0 commit cb95655

File tree

9 files changed

+55
-14
lines changed

9 files changed

+55
-14
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ The autogenerated OSAL user's guide can be viewed at <https://github.com/nasa/cF
1212
## Version History
1313

1414

15+
### Development Build: v5.1.0-rc1+dev569
16+
17+
- 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.
18+
- See <https://github.com/nasa/osal/pull/1100> and <https://github.com/nasa/cFS/pull/297>
19+
1520
### Development Build: v5.1.0-rc1+dev564
1621

1722
- Add range to OS_TaskDelay checks

src/os/inc/osapi-timebase.h

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ typedef struct
7373
* be configured to support at least (OS_MAX_TASKS + OS_MAX_TIMEBASES) threads,
7474
* to account for the helper threads associated with time base objects.
7575
*
76+
* @note This configuration API must not be used from the context of a timer callback.
77+
* Timers should only be configured from the context of normal OSAL tasks.
78+
*
7679
* @param[out] timebase_id will be set to the non-zero ID of the newly-created resource @nonnull
7780
* @param[in] timebase_name The name of the time base @nonnull
7881
* @param[in] external_sync A synchronization function for BSP hardware-based timer ticks
@@ -101,6 +104,9 @@ int32 OS_TimeBaseCreate(osal_id_t *timebase_id, const char *timebase_name, OS_Ti
101104
* This function has no effect for time bases that are using
102105
* a BSP-provided external_sync function.
103106
*
107+
* @note This configuration API must not be used from the context of a timer callback.
108+
* Timers should only be configured from the context of normal OSAL tasks.
109+
*
104110
* @param[in] timebase_id The timebase resource to configure
105111
* @param[in] start_time The amount of delay for the first tick, in microseconds.
106112
* @param[in] interval_time The amount of delay between ticks, in microseconds.
@@ -120,6 +126,9 @@ int32 OS_TimeBaseSet(osal_id_t timebase_id, uint32 start_time, uint32 interval_t
120126
* The helper task and any other resources associated with the time base
121127
* abstraction will be freed.
122128
*
129+
* @note This configuration API must not be used from the context of a timer callback.
130+
* Timers should only be configured from the context of normal OSAL tasks.
131+
*
123132
* @param[in] timebase_id The timebase resource to delete
124133
*
125134
* @return Execution status, see @ref OSReturnCodes
@@ -135,6 +144,9 @@ int32 OS_TimeBaseDelete(osal_id_t timebase_id);
135144
*
136145
* Given a time base name, find and output the ID associated with it.
137146
*
147+
* @note This configuration API must not be used from the context of a timer callback.
148+
* Timers should only be configured from the context of normal OSAL tasks.
149+
*
138150
* @param[out] timebase_id will be set to the non-zero ID of the matching resource @nonnull
139151
* @param[in] timebase_name The name of the timebase resource to find @nonnull
140152
*
@@ -155,7 +167,10 @@ int32 OS_TimeBaseGetIdByName(osal_id_t *timebase_id, const char *timebase_name);
155167
* relevant information about the time base resource.
156168
*
157169
* This function will pass back a pointer to structure that contains
158-
* all of the relevant info( name and creator) about the specified timebase.
170+
* all of the relevant info( name and creator) about the specified timebase.
171+
*
172+
* @note This configuration API must not be used from the context of a timer callback.
173+
* Timers should only be configured from the context of normal OSAL tasks.
159174
*
160175
* @param[in] timebase_id The timebase resource ID
161176
* @param[out] timebase_prop Buffer to store timebase properties @nonnull

src/os/inc/osapi-timer.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ typedef struct
6767
* @note clock_accuracy comes from the underlying OS tick value. The nearest integer
6868
* microsecond value is returned, so may not be exact.
6969
*
70+
* @note This configuration API must not be used from the context of a timer callback.
71+
* Timers should only be configured from the context of normal OSAL tasks.
72+
*
7073
* @sa OS_TimerCallback_t
7174
*
7275
* @param[out] timer_id Will be set to the non-zero resource ID of the timer object @nonnull
@@ -109,6 +112,9 @@ int32 OS_TimerCreate(osal_id_t *timer_id, const char *timer_name, uint32 *clock_
109112
* function by the OSAL, and the arg parameter is passed through from the
110113
* callback_arg argument on this call.
111114
*
115+
* @note This configuration API must not be used from the context of a timer callback.
116+
* Timers should only be configured from the context of normal OSAL tasks.
117+
*
112118
* @sa OS_ArgCallback_t
113119
*
114120
* @param[out] timer_id Will be set to the non-zero resource ID of the timer object @nonnull
@@ -149,6 +155,9 @@ int32 OS_TimerAdd(osal_id_t *timer_id, const char *timer_name, osal_id_t timebas
149155
* or interval_msec parameters are less than the accuracy, they will be rounded
150156
* up to the accuracy of the timer.
151157
*
158+
* @note This configuration API must not be used from the context of a timer callback.
159+
* Timers should only be configured from the context of normal OSAL tasks.
160+
*
152161
* @param[in] timer_id The timer ID to operate on
153162
* @param[in] start_time Time in microseconds to the first expiration
154163
* @param[in] interval_time Time in microseconds between subsequent intervals, value
@@ -171,6 +180,9 @@ int32 OS_TimerSet(osal_id_t timer_id, uint32 start_time, uint32 interval_time);
171180
* The application callback associated with the timer will be stopped,
172181
* and the resources freed for future use.
173182
*
183+
* @note This configuration API must not be used from the context of a timer callback.
184+
* Timers should only be configured from the context of normal OSAL tasks.
185+
*
174186
* @param[in] timer_id The timer ID to operate on
175187
*
176188
* @return Execution status, see @ref OSReturnCodes
@@ -187,6 +199,9 @@ int32 OS_TimerDelete(osal_id_t timer_id);
187199
*
188200
* Outputs the ID associated with the given timer, if it exists.
189201
*
202+
* @note This configuration API must not be used from the context of a timer callback.
203+
* Timers should only be configured from the context of normal OSAL tasks.
204+
*
190205
* @param[out] timer_id Will be set to the timer ID corresponding to the name @nonnull
191206
* @param[in] timer_name The timer name to find @nonnull
192207
*
@@ -206,6 +221,9 @@ int32 OS_TimerGetIdByName(osal_id_t *timer_id, const char *timer_name);
206221
* This function takes timer_id, and looks it up in the OS table. It puts all of the
207222
* information known about that timer into a structure pointer to by timer_prop.
208223
*
224+
* @note This configuration API must not be used from the context of a timer callback.
225+
* Timers should only be configured from the context of normal OSAL tasks.
226+
*
209227
* @param[in] timer_id The timer ID to operate on
210228
* @param[out] timer_prop Buffer containing timer properties @nonnull
211229
* - creator: the OS task ID of the task that created this timer

src/os/inc/osapi-version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
/*
3737
* Development Build Macro Definitions
3838
*/
39-
#define OS_BUILD_NUMBER 564
39+
#define OS_BUILD_NUMBER 569
4040
#define OS_BUILD_BASELINE "v5.1.0-rc1"
4141

4242
/*

src/os/posix/build_options.cmake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@
55
##########################################################################
66

77
# this file is a placeholder for POSIX-specific compile tuning
8-
# currently no extra flags/definitions needed
9-
8+
add_definitions(-D_POSIX_OS_)

src/os/rtems/build_options.cmake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@
55
##########################################################################
66

77
# this file is a placeholder for RTEMS-specific compile tuning
8-
# currently no extra flags/definitions needed
9-
8+
add_definitions(-D_RTEMS_OS_)

src/os/vxworks/build_options.cmake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@
55
##########################################################################
66

77
# this file is a placeholder for VxWorks-specific compile tuning
8-
# currently no extra flags/definitions needed
9-
8+
add_definitions(-D_VXWORKS_OS_)

src/tests/time-base-api-test/time-base-api-test.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,20 @@
3535
#include "uttest.h"
3636
#include "utbsp.h"
3737

38-
static OS_timebase_prop_t SyncTimeBaseProp;
38+
OS_timebase_prop_t SyncTimeBaseProp;
3939

40-
static uint32 NumSyncs = 0;
40+
uint32 NumSyncs = 0;
4141

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

6062
++NumSyncs;
6163
OS_TaskDelay(1);

src/unit-tests/ostimer-test/ut_ostimer_test.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,11 @@ void UtTest_Setup(void)
203203
UtTest_Add(UT_os_timergetidbyname_test, UT_os_setup_timergetidbyname_test, NULL, "OS_TimerGetIdByName");
204204
UtTest_Add(UT_os_timergetinfo_test, UT_os_setup_timergetinfo_test, NULL, "OS_TimerGetInfo");
205205
UtTest_Add(UT_os_timerset_test, UT_os_setup_timerset_test, NULL, "OS_TimerSet");
206+
207+
/* the reconfig test only works on POSIX */
208+
#ifdef _POSIX_OS_
206209
UtTest_Add(UT_os_timerreconf_test, NULL, NULL, "TimerReconfig");
210+
#endif
207211
}
208212

209213
/*================================================================================*

0 commit comments

Comments
 (0)