Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:22

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /**
0004  * @file
0005  *
0006  * @ingroup RTEMSImplClassic
0007  *
0008  * @brief This source file contains the implementation of
0009  *   rtems_configuration_get_maximum_barriers(),
0010  *   rtems_configuration_get_maximum_extensions(),
0011  *   rtems_configuration_get_maximum_message_queues(),
0012  *   rtems_configuration_get_maximum_partitions(),
0013  *   rtems_configuration_get_maximum_periods(),
0014  *   rtems_configuration_get_maximum_ports(),
0015  *   rtems_configuration_get_maximum_regions(),
0016  *   rtems_configuration_get_maximum_semaphores(),
0017  *   rtems_configuration_get_maximum_tasks(), and
0018  *   rtems_configuration_get_maximum_timers().
0019  */
0020 
0021 /*
0022  * Copyright (C) 2018 embedded brains GmbH & Co. KG
0023  *
0024  * Redistribution and use in source and binary forms, with or without
0025  * modification, are permitted provided that the following conditions
0026  * are met:
0027  * 1. Redistributions of source code must retain the above copyright
0028  *    notice, this list of conditions and the following disclaimer.
0029  * 2. Redistributions in binary form must reproduce the above copyright
0030  *    notice, this list of conditions and the following disclaimer in the
0031  *    documentation and/or other materials provided with the distribution.
0032  *
0033  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0034  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0035  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0036  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0037  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0038  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0039  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0040  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0041  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0042  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0043  * POSSIBILITY OF SUCH DAMAGE.
0044  */
0045 
0046 #ifdef HAVE_CONFIG_H
0047 #include "config.h"
0048 #endif
0049 
0050 #include <rtems/config.h>
0051 #include <rtems/extensionimpl.h>
0052 #include <rtems/rtems/barrierimpl.h>
0053 #include <rtems/rtems/dpmemimpl.h>
0054 #include <rtems/rtems/messageimpl.h>
0055 #include <rtems/rtems/partimpl.h>
0056 #include <rtems/rtems/ratemonimpl.h>
0057 #include <rtems/rtems/regionimpl.h>
0058 #include <rtems/rtems/semimpl.h>
0059 #include <rtems/rtems/tasksimpl.h>
0060 #include <rtems/rtems/timerimpl.h>
0061 #include <rtems/score/objectimpl.h>
0062 
0063 static uint32_t get_config_max( const Objects_Information *info )
0064 {
0065     if ( _Objects_Is_auto_extend( info ) ) {
0066         return info->objects_per_block | RTEMS_UNLIMITED_OBJECTS;
0067     }
0068 
0069     return _Objects_Get_maximum_index( info );
0070 }
0071 
0072 uint32_t rtems_configuration_get_maximum_barriers( void )
0073 {
0074     return get_config_max( &_Barrier_Information );
0075 }
0076 
0077 uint32_t rtems_configuration_get_maximum_extensions( void )
0078 {
0079     return get_config_max( &_Extension_Information );
0080 }
0081 
0082 uint32_t rtems_configuration_get_maximum_message_queues( void )
0083 {
0084     return get_config_max( &_Message_queue_Information );
0085 }
0086 
0087 uint32_t rtems_configuration_get_maximum_partitions( void )
0088 {
0089     return get_config_max( &_Partition_Information );
0090 }
0091 
0092 uint32_t rtems_configuration_get_maximum_periods( void )
0093 {
0094     return get_config_max( &_Rate_monotonic_Information );
0095 }
0096 
0097 uint32_t rtems_configuration_get_maximum_ports( void )
0098 {
0099     return get_config_max( &_Dual_ported_memory_Information );
0100 }
0101 
0102 uint32_t rtems_configuration_get_maximum_regions( void )
0103 {
0104     return get_config_max( &_Region_Information );
0105 }
0106 
0107 uint32_t rtems_configuration_get_maximum_semaphores( void )
0108 {
0109     return get_config_max( &_Semaphore_Information );
0110 }
0111 
0112 uint32_t rtems_configuration_get_maximum_timers( void )
0113 {
0114     return get_config_max( &_Timer_Information );
0115 }
0116 
0117 uint32_t rtems_configuration_get_maximum_tasks( void )
0118 {
0119     return get_config_max( &_RTEMS_tasks_Information.Objects );
0120 }