RTEMS
support.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 
11 /*
12  * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
13  * Copyright (C) 1988, 2008 On-Line Applications Research Corporation (OAR)
14  *
15  * Redistribution and use in source and binary forms, with or without
16  * modification, are permitted provided that the following conditions
17  * are met:
18  * 1. Redistributions of source code must retain the above copyright
19  * notice, this list of conditions and the following disclaimer.
20  * 2. Redistributions in binary form must reproduce the above copyright
21  * notice, this list of conditions and the following disclaimer in the
22  * documentation and/or other materials provided with the distribution.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
28  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  */
36 
37 /*
38  * Do not manually edit this file. It is part of the RTEMS quality process
39  * and was automatically generated.
40  *
41  * If you find something that needs to be fixed or worded better please
42  * post a report to an RTEMS mailing list or raise a bug report:
43  *
44  * https://docs.rtems.org/branches/master/user/support/bugs.html
45  *
46  * For information on updating and regenerating please refer to:
47  *
48  * https://docs.rtems.org/branches/master/eng/req/howto.html
49  */
50 
51 /* Generated from spec:/rtems/support/if/header */
52 
53 #ifndef _RTEMS_RTEMS_SUPPORT_H
54 #define _RTEMS_RTEMS_SUPPORT_H
55 
56 #include <stdbool.h>
57 #include <stddef.h>
58 #include <stdint.h>
59 #include <rtems/config.h>
60 #include <rtems/rtems/status.h>
61 #include <rtems/rtems/types.h>
62 #include <rtems/score/heapinfo.h>
63 
64 #ifdef __cplusplus
65 extern "C" {
66 #endif
67 
68 /* Generated from spec:/rtems/support/if/group */
69 
78 /* Generated from spec:/rtems/support/if/milliseconds-to-microseconds */
79 
91 #define RTEMS_MILLISECONDS_TO_MICROSECONDS( _ms ) ( ( _ms ) * 1000UL )
92 
93 /* Generated from spec:/rtems/support/if/microseconds-to-ticks */
94 
109 #define RTEMS_MICROSECONDS_TO_TICKS( _us ) \
110  ( ( _us ) / rtems_configuration_get_microseconds_per_tick() )
111 
112 /* Generated from spec:/rtems/support/if/is-name-valid */
113 
126 static inline bool rtems_is_name_valid( rtems_status_code name )
127 {
128  return name != 0;
129 }
130 
131 /* Generated from spec:/rtems/support/if/milliseconds-to-ticks */
132 
147 #define RTEMS_MILLISECONDS_TO_TICKS( _ms ) \
148  RTEMS_MICROSECONDS_TO_TICKS( RTEMS_MILLISECONDS_TO_MICROSECONDS( _ms ) )
149 
150 /* Generated from spec:/rtems/support/if/name-to-characters */
151 
167 static inline void rtems_name_to_characters(
168  rtems_name name,
169  char *c1,
170  char *c2,
171  char *c3,
172  char *c4
173 )
174 {
175  *c1 = (char) ( name >> 24 );
176  *c2 = (char) ( name >> 16 );
177  *c3 = (char) ( name >> 8 );
178  *c4 = (char) name;
179 }
180 
181 /* Generated from spec:/rtems/support/if/workspace-allocate */
182 
192 bool rtems_workspace_allocate( size_t bytes, void **pointer );
193 
194 /* Generated from spec:/rtems/support/if/workspace-free */
195 
203 bool rtems_workspace_free( void *pointer );
204 
205 /* Generated from spec:/rtems/support/if/workspace-get-information */
206 
215 
216 /* Generated from spec:/rtems/support/if/workspace-greedy-allocate */
217 
228  const uintptr_t *block_sizes,
229  size_t block_count
230 );
231 
232 /* Generated from spec:/rtems/support/if/workspace-greedy-allocate-all-except-largest */
233 
242  uintptr_t *allocatable_size
243 );
244 
245 /* Generated from spec:/rtems/support/if/workspace-greedy-free */
246 
254 void rtems_workspace_greedy_free( void *opaque );
255 
256 #ifdef __cplusplus
257 }
258 #endif
259 
260 #endif /* _RTEMS_RTEMS_SUPPORT_H */
This header file defines types provided by the Classic API.
bool rtems_workspace_free(void *pointer)
%
void * rtems_workspace_greedy_allocate(const uintptr_t *block_sizes, size_t block_count)
%
uint32_t rtems_name
This type is used to represent a Classic API object name.
Definition: types.h:227
static bool rtems_is_name_valid(rtems_status_code name)
Returns true, if the specified object name is valid, otherwise returns false.
Definition: support.h:126
Information block returned by _Heap_Get_information().
Definition: heapinfo.h:145
This header file defines the status codes and support functions of the Classic API.
static void rtems_name_to_characters(rtems_name name, char *c1, char *c2, char *c3, char *c4)
Breaks the object name into the four component characters.
Definition: support.h:167
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:82
void rtems_workspace_greedy_free(void *opaque)
%
bool rtems_workspace_allocate(size_t bytes, void **pointer)
%
Heap Handler Information API.
void * rtems_workspace_greedy_allocate_all_except_largest(uintptr_t *allocatable_size)
%
bool rtems_workspace_get_information(Heap_Information_block *the_info)
%