1 | /* SPDX-License-Identifier: BSD-2-Clause */ |
---|
2 | |
---|
3 | /** |
---|
4 | * @file |
---|
5 | * |
---|
6 | * @ingroup RTEMSAPIBSD |
---|
7 | * |
---|
8 | * @brief BSD Compatibility API |
---|
9 | */ |
---|
10 | |
---|
11 | /* |
---|
12 | * Copyright (c) 2015 embedded brains GmbH. All rights reserved. |
---|
13 | * |
---|
14 | * Redistribution and use in source and binary forms, with or without |
---|
15 | * modification, are permitted provided that the following conditions |
---|
16 | * are met: |
---|
17 | * 1. Redistributions of source code must retain the above copyright |
---|
18 | * notice, this list of conditions and the following disclaimer. |
---|
19 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
20 | * notice, this list of conditions and the following disclaimer in the |
---|
21 | * documentation and/or other materials provided with the distribution. |
---|
22 | * |
---|
23 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
24 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
25 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
26 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
---|
27 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
28 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
29 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
30 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
31 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
32 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
33 | * POSSIBILITY OF SUCH DAMAGE. |
---|
34 | */ |
---|
35 | |
---|
36 | #ifndef _RTEMS_BSD_H |
---|
37 | #define _RTEMS_BSD_H |
---|
38 | |
---|
39 | #include <rtems/score/timecounter.h> |
---|
40 | #include <rtems/score/basedefs.h> |
---|
41 | |
---|
42 | #ifdef __cplusplus |
---|
43 | extern "C" { |
---|
44 | #endif /* __cplusplus */ |
---|
45 | |
---|
46 | /** |
---|
47 | * @defgroup RTEMSAPIBSD BSD Compatibility Support |
---|
48 | * |
---|
49 | * @ingroup RTEMSAPI |
---|
50 | * |
---|
51 | * @{ |
---|
52 | */ |
---|
53 | |
---|
54 | /** |
---|
55 | * @copydoc _Timecounter_Bintime() |
---|
56 | */ |
---|
57 | static inline void rtems_bsd_bintime( struct bintime *bt ) |
---|
58 | { |
---|
59 | _Timecounter_Bintime( bt ); |
---|
60 | } |
---|
61 | |
---|
62 | /** |
---|
63 | * @copydoc _Timecounter_Nanotime() |
---|
64 | */ |
---|
65 | static inline void rtems_bsd_nanotime( struct timespec *ts ) |
---|
66 | { |
---|
67 | _Timecounter_Nanotime( ts ); |
---|
68 | } |
---|
69 | |
---|
70 | /** |
---|
71 | * @copydoc _Timecounter_Microtime() |
---|
72 | */ |
---|
73 | static inline void rtems_bsd_microtime( struct timeval *tv ) |
---|
74 | { |
---|
75 | _Timecounter_Microtime( tv ); |
---|
76 | } |
---|
77 | |
---|
78 | /** |
---|
79 | * @copydoc _Timecounter_Binuptime() |
---|
80 | */ |
---|
81 | static inline void rtems_bsd_binuptime( struct bintime *bt ) |
---|
82 | { |
---|
83 | _Timecounter_Binuptime( bt ); |
---|
84 | } |
---|
85 | |
---|
86 | /** |
---|
87 | * @copydoc _Timecounter_Nanouptime() |
---|
88 | */ |
---|
89 | static inline void rtems_bsd_nanouptime( struct timespec *ts ) |
---|
90 | { |
---|
91 | _Timecounter_Nanouptime( ts ); |
---|
92 | } |
---|
93 | |
---|
94 | /** |
---|
95 | * @copydoc _Timecounter_Microtime() |
---|
96 | */ |
---|
97 | static inline void rtems_bsd_microuptime( struct timeval *tv ) |
---|
98 | { |
---|
99 | _Timecounter_Microuptime( tv ); |
---|
100 | } |
---|
101 | |
---|
102 | /** |
---|
103 | * @copydoc _Timecounter_Getbintime() |
---|
104 | */ |
---|
105 | static inline void rtems_bsd_getbintime( struct bintime *bt ) |
---|
106 | { |
---|
107 | _Timecounter_Getbintime( bt ); |
---|
108 | } |
---|
109 | |
---|
110 | /** |
---|
111 | * @copydoc _Timecounter_Getnanotime() |
---|
112 | */ |
---|
113 | static inline void rtems_bsd_getnanotime( struct timespec *ts ) |
---|
114 | { |
---|
115 | _Timecounter_Getnanotime( ts ); |
---|
116 | } |
---|
117 | |
---|
118 | /** |
---|
119 | * @copydoc _Timecounter_Getmicrotime() |
---|
120 | */ |
---|
121 | static inline void rtems_bsd_getmicrotime( struct timeval *tv ) |
---|
122 | { |
---|
123 | _Timecounter_Getmicrotime( tv ); |
---|
124 | } |
---|
125 | |
---|
126 | /** |
---|
127 | * @copydoc _Timecounter_Getbinuptime() |
---|
128 | */ |
---|
129 | static inline void rtems_bsd_getbinuptime( struct bintime *bt ) |
---|
130 | { |
---|
131 | _Timecounter_Getbinuptime( bt ); |
---|
132 | } |
---|
133 | |
---|
134 | /** |
---|
135 | * @copydoc _Timecounter_Getnanouptime() |
---|
136 | */ |
---|
137 | static inline void rtems_bsd_getnanouptime( struct timespec *ts ) |
---|
138 | { |
---|
139 | _Timecounter_Getnanouptime( ts ); |
---|
140 | } |
---|
141 | |
---|
142 | /** |
---|
143 | * @copydoc _Timecounter_Getmicrouptime() |
---|
144 | */ |
---|
145 | static inline void rtems_bsd_getmicrouptime( struct timeval *tv ) |
---|
146 | { |
---|
147 | _Timecounter_Getmicrouptime( tv ); |
---|
148 | } |
---|
149 | |
---|
150 | /** @} */ |
---|
151 | |
---|
152 | #ifdef __cplusplus |
---|
153 | } |
---|
154 | #endif /* __cplusplus */ |
---|
155 | |
---|
156 | #endif /* _RTEMS_BSD_H */ |
---|