summaryrefslogtreecommitdiffstats
path: root/spec/rtems/clock/if/tick-before.yml
blob: b980ea0fc7ce63c1d06b63c2a1b41ed8173b9b0d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
brief: |
  Indicates if the current ${/glossary/clock-tick:/term} counter is before the
  ticks.
copyrights:
- Copyright (C) 2014, 2021 embedded brains GmbH (http://www.embedded-brains.de)
definition:
  default:
    attributes: null
    body: |
      return (${/c/if/int32_t:/name}) ( ${.:/params[0]/name} - ${/score/watchdog/if/ticks-since-boot:/name} ) > 0;
    params:
    - ${../../type/if/interval:/name} ${.:/params[0]/name}
    return: ${/c/if/bool:/name}
  variants: []
description: null
enabled-by: true
index-entries: []
interface-type: function
links:
- role: interface-placement
  uid: header
- role: interface-ingroup
  uid: group
- role: constraint
  uid: /constraint/directive-not-pre-qualified
- role: constraint
  uid: /constraint/directive-ctx-any
- role: constraint
  uid: /constraint/directive-no-preempt
- role: constraint
  uid: /constraint/clock-driver
name: rtems_clock_tick_before
notes: |
  This directive can be used to write busy loops with a timeout.

  .. code-block:: c
      :linenos:

      status busy( void )
      {
        rtems_interval timeout;

        timeout = rtems_clock_tick_later_usec( 10000 );

        do {
          if ( ok() ) {
            return success;
          }
        } while ( rtems_clock_tick_before( timeout ) );

        return timeout;
      }
params:
- description: |
    is the ticks value to check.
  dir: null
  name: ticks
return:
  return: |
    Returns true, if current ${/glossary/clock-tick:/term} counter indicates a
    time before the time in ticks, otherwise returns false.
  return-values: []
type: interface