diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-05-11 17:27:20 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-05-12 21:25:37 +0200 |
commit | 523867de9d274d2bdc29ce649d764b42a9167c0e (patch) | |
tree | 88d38e4054d3c24eaa9bbd5327faed8bffe406f8 /cpukit/include/rtems/rtems | |
parent | rtems: Document rtems_task_set_scheduler() errors (diff) | |
download | rtems-523867de9d274d2bdc29ce649d764b42a9167c0e.tar.bz2 |
rtems: Constify rtems_task_wake_when()
Add a parameter to _TOD_Validate() to disable the validation of the
ticks member.
There are two reasons for this change. Firstly, in
rtems_task_wake_when() was a double check for time_buffer == NULL (one
in rtems_task_wake_when() and one in _TOD_Validate()). Secondly, the
ticks member is ignored by rtems_task_wake_when(). This was done with a
write of zero to the ticks member and thus a modification of the
user-provided structure. Now the structure is no longer modified.
Using a mask parameter is quite efficient. You just have to load an
immediate value and there are no additional branches in _TOD_Validate().
Close #4406.
Diffstat (limited to '')
-rw-r--r-- | cpukit/include/rtems/rtems/clockimpl.h | 25 | ||||
-rw-r--r-- | cpukit/include/rtems/rtems/tasks.h | 2 |
2 files changed, 21 insertions, 6 deletions
diff --git a/cpukit/include/rtems/rtems/clockimpl.h b/cpukit/include/rtems/rtems/clockimpl.h index 8ec4f0f6e3..404b8234ee 100644 --- a/cpukit/include/rtems/rtems/clockimpl.h +++ b/cpukit/include/rtems/rtems/clockimpl.h @@ -35,19 +35,34 @@ extern "C" { */ /** - * @brief TOD Validate + * @brief Using this constant for the ticks mask disables the validation of the + * ticks member in _TOD_Validate(). + */ +#define TOD_DISABLE_TICKS_VALIDATION 0 + +/** + * @brief Using this constant for the ticks mask enables the validation of the + * ticks member in _TOD_Validate(). + */ +#define TOD_ENABLE_TICKS_VALIDATION UINT32_MAX + +/** + * @brief Validates the time of day. * - * This support function tests whether @a the_tod references - * a valid time of day. + * @param the_tod is the reference to the time of day structure to validate or + * NULL. * - * @param the_tod A reference to the time of day structure to validate. + * @param ticks_mask is the mask for the ticks member of the time of day. Use + * #TOD_ENABLE_TICKS_VALIDATION to validate the ticks member. Use + * #TOD_DISABLE_TICKS_VALIDATION to skip the validation of the ticks member. * * @retval RTEMS_SUCCESSFUL @a the_tod references a valid time of day. * @retval RTEMS_INVALID_CLOCK @a the_tod references an invalid time of day. * @retval RTEMS_INVALID_ADDRESS @a the_tod reference is @c NULL. */ rtems_status_code _TOD_Validate( - const rtems_time_of_day *the_tod + const rtems_time_of_day *the_tod, + uint32_t ticks_mask ); /** diff --git a/cpukit/include/rtems/rtems/tasks.h b/cpukit/include/rtems/rtems/tasks.h index be95768d4a..8b5912bcf9 100644 --- a/cpukit/include/rtems/rtems/tasks.h +++ b/cpukit/include/rtems/rtems/tasks.h @@ -2071,7 +2071,7 @@ rtems_status_code rtems_task_wake_after( rtems_interval ticks ); * occur. * @endparblock */ -rtems_status_code rtems_task_wake_when( rtems_time_of_day *time_buffer ); +rtems_status_code rtems_task_wake_when( const rtems_time_of_day *time_buffer ); /* Generated from spec:/rtems/task/if/get-scheduler */ |