1 | /* SPDX-License-Identifier: BSD-2-Clause */ |
---|
2 | |
---|
3 | /** |
---|
4 | * @file |
---|
5 | * |
---|
6 | * @ingroup RTEMSImplClassic |
---|
7 | * |
---|
8 | * @brief This source file contains the implementation of |
---|
9 | * rtems_configuration_get_maximum_barriers(), |
---|
10 | * rtems_configuration_get_maximum_extensions(), |
---|
11 | * rtems_configuration_get_maximum_message_queues(), |
---|
12 | * rtems_configuration_get_maximum_partitions(), |
---|
13 | * rtems_configuration_get_maximum_periods(), |
---|
14 | * rtems_configuration_get_maximum_ports(), |
---|
15 | * rtems_configuration_get_maximum_regions(), |
---|
16 | * rtems_configuration_get_maximum_semaphores(), |
---|
17 | * rtems_configuration_get_maximum_tasks(), and |
---|
18 | * rtems_configuration_get_maximum_timers(). |
---|
19 | */ |
---|
20 | |
---|
21 | /* |
---|
22 | * Copyright (C) 2018 embedded brains GmbH & Co. KG |
---|
23 | * |
---|
24 | * Redistribution and use in source and binary forms, with or without |
---|
25 | * modification, are permitted provided that the following conditions |
---|
26 | * are met: |
---|
27 | * 1. Redistributions of source code must retain the above copyright |
---|
28 | * notice, this list of conditions and the following disclaimer. |
---|
29 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
30 | * notice, this list of conditions and the following disclaimer in the |
---|
31 | * documentation and/or other materials provided with the distribution. |
---|
32 | * |
---|
33 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
34 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
35 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
36 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
---|
37 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
38 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
39 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
40 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
41 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
42 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
43 | * POSSIBILITY OF SUCH DAMAGE. |
---|
44 | */ |
---|
45 | |
---|
46 | #ifdef HAVE_CONFIG_H |
---|
47 | #include "config.h" |
---|
48 | #endif |
---|
49 | |
---|
50 | #include <rtems/config.h> |
---|
51 | #include <rtems/extensionimpl.h> |
---|
52 | #include <rtems/rtems/barrierimpl.h> |
---|
53 | #include <rtems/rtems/dpmemimpl.h> |
---|
54 | #include <rtems/rtems/messageimpl.h> |
---|
55 | #include <rtems/rtems/partimpl.h> |
---|
56 | #include <rtems/rtems/ratemonimpl.h> |
---|
57 | #include <rtems/rtems/regionimpl.h> |
---|
58 | #include <rtems/rtems/semimpl.h> |
---|
59 | #include <rtems/rtems/tasksimpl.h> |
---|
60 | #include <rtems/rtems/timerimpl.h> |
---|
61 | #include <rtems/score/objectimpl.h> |
---|
62 | |
---|
63 | static uint32_t get_config_max( const Objects_Information *info ) |
---|
64 | { |
---|
65 | if ( _Objects_Is_auto_extend( info ) ) { |
---|
66 | return info->objects_per_block | RTEMS_UNLIMITED_OBJECTS; |
---|
67 | } |
---|
68 | |
---|
69 | return _Objects_Get_maximum_index( info ); |
---|
70 | } |
---|
71 | |
---|
72 | uint32_t rtems_configuration_get_maximum_barriers( void ) |
---|
73 | { |
---|
74 | return get_config_max( &_Barrier_Information ); |
---|
75 | } |
---|
76 | |
---|
77 | uint32_t rtems_configuration_get_maximum_extensions( void ) |
---|
78 | { |
---|
79 | return get_config_max( &_Extension_Information ); |
---|
80 | } |
---|
81 | |
---|
82 | uint32_t rtems_configuration_get_maximum_message_queues( void ) |
---|
83 | { |
---|
84 | return get_config_max( &_Message_queue_Information ); |
---|
85 | } |
---|
86 | |
---|
87 | uint32_t rtems_configuration_get_maximum_partitions( void ) |
---|
88 | { |
---|
89 | return get_config_max( &_Partition_Information ); |
---|
90 | } |
---|
91 | |
---|
92 | uint32_t rtems_configuration_get_maximum_periods( void ) |
---|
93 | { |
---|
94 | return get_config_max( &_Rate_monotonic_Information ); |
---|
95 | } |
---|
96 | |
---|
97 | uint32_t rtems_configuration_get_maximum_ports( void ) |
---|
98 | { |
---|
99 | return get_config_max( &_Dual_ported_memory_Information ); |
---|
100 | } |
---|
101 | |
---|
102 | uint32_t rtems_configuration_get_maximum_regions( void ) |
---|
103 | { |
---|
104 | return get_config_max( &_Region_Information ); |
---|
105 | } |
---|
106 | |
---|
107 | uint32_t rtems_configuration_get_maximum_semaphores( void ) |
---|
108 | { |
---|
109 | return get_config_max( &_Semaphore_Information ); |
---|
110 | } |
---|
111 | |
---|
112 | uint32_t rtems_configuration_get_maximum_timers( void ) |
---|
113 | { |
---|
114 | return get_config_max( &_Timer_Information ); |
---|
115 | } |
---|
116 | |
---|
117 | uint32_t rtems_configuration_get_maximum_tasks( void ) |
---|
118 | { |
---|
119 | return get_config_max( &_RTEMS_tasks_Information.Objects ); |
---|
120 | } |
---|