Changeset 45a34953 in rtems


Ignore:
Timestamp:
May 14, 2021, 6:09:34 AM (4 weeks ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
bc29c7c
Parents:
523867d
Message:

rtems: Add TOD_Ticks_validation

Replace defines with an enum.

Update #4406.

Location:
cpukit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/include/rtems/rtems/clockimpl.h

    r523867d r45a34953  
    3636
    3737/**
    38  * @brief Using this constant for the ticks mask disables the validation of the
    39  *   ticks member in _TOD_Validate().
     38 * @brief The enumerators of this type determine if the ticks member is
     39 *   validated in _TOD_Validate().
    4040 */
    41 #define TOD_DISABLE_TICKS_VALIDATION 0
     41typedef enum {
     42  /**
     43   * @brief Use this option to disable the validation of the ticks member in
     44   *   _TOD_Validate().
     45   */
     46  TOD_DISABLE_TICKS_VALIDATION = 0,
    4247
    43 /**
    44  * @brief Using this constant for the ticks mask enables the validation of the
    45  *   ticks member in _TOD_Validate().
    46  */
    47 #define TOD_ENABLE_TICKS_VALIDATION UINT32_MAX
     48  /**
     49   * @brief Use this option to enable the validation of the ticks member in
     50   *   _TOD_Validate().
     51   */
     52  TOD_ENABLE_TICKS_VALIDATION = -1
     53} TOD_Ticks_validation;
    4854
    4955/**
     
    5359 *   NULL.
    5460 *
    55  * @param ticks_mask is the mask for the ticks member of the time of day.  Use
    56  *   #TOD_ENABLE_TICKS_VALIDATION to validate the ticks member.  Use
    57  *   #TOD_DISABLE_TICKS_VALIDATION to skip the validation of the ticks member.
     61 * @param ticks_validation indicates if the ticks member of the time of day
     62 *   should be validated.  Use #TOD_ENABLE_TICKS_VALIDATION to validate the
     63 *   ticks member.  Use #TOD_DISABLE_TICKS_VALIDATION to skip the validation of
     64 *   the ticks member.
    5865 *
    5966 * @retval RTEMS_SUCCESSFUL @a the_tod references a valid time of day.
     
    6370rtems_status_code _TOD_Validate(
    6471  const rtems_time_of_day *the_tod,
    65   uint32_t                 ticks_mask
     72  TOD_Ticks_validation     ticks_validation
    6673);
    6774
  • cpukit/rtems/src/clocktodvalidate.c

    r523867d r45a34953  
    3838rtems_status_code _TOD_Validate(
    3939  const rtems_time_of_day *the_tod,
    40   uint32_t                 ticks_mask
     40  TOD_Ticks_validation     ticks_validation
    4141)
    4242{
    43   uint32_t   days_in_month;
    44   uint32_t   ticks_per_second;
     43  uint32_t days_in_month;
     44  uint32_t ticks_per_second;
     45  uint32_t ticks_mask;
    4546
    4647  if ( the_tod == NULL ) {
     
    4950
    5051  ticks_per_second = rtems_clock_get_ticks_per_second();
     52  ticks_mask = (uint32_t) ticks_validation;
    5153
    5254  if ( ( ( the_tod->ticks & ticks_mask ) >= ticks_per_second ) ||
Note: See TracChangeset for help on using the changeset viewer.