Back to home page

LXR

 
 

    


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

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /**
0004  * @file
0005  *
0006  * @ingroup RtemsBasedefsValBasedefs
0007  *
0008  * @brief Helper file to verify the requirements towards the basedefs.
0009  *
0010  * The specification items in
0011  * (rtems-central/)spec/rtems/basedefs/req/[*] represent
0012  * requirements towards the basedefs in
0013  * (rtems/)cpukit/include/rtems/score/basedefs.h.
0014  * There are automated verification tests generated from
0015  * (rtems-central/)spec/rtems/basedefs/val/[*] and placed
0016  * in (rtems/)testsuites/validation/tc-basedefs-0.c.
0017  *
0018  * Yet, not every test can be placed in the same compilation unit
0019  * (tc-basedefs-0.c). Hence, the code which must be placed
0020  * in an extra compilation unit is put here and this file
0021  * is linked to tc-basedefs-0.c to be accessible from the tests.
0022  */
0023 
0024 /*
0025  * Copyright (C) 2020 embedded brains GmbH & Co. KG
0026  *
0027  * Redistribution and use in source and binary forms, with or without
0028  * modification, are permitted provided that the following conditions
0029  * are met:
0030  * 1. Redistributions of source code must retain the above copyright
0031  *    notice, this list of conditions and the following disclaimer.
0032  * 2. Redistributions in binary form must reproduce the above copyright
0033  *    notice, this list of conditions and the following disclaimer in the
0034  *    documentation and/or other materials provided with the distribution.
0035  *
0036  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0037  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0038  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0039  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0040  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0041  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0042  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0043  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0044  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0045  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0046  * POSSIBILITY OF SUCH DAMAGE.
0047  */
0048 
0049 #ifdef HAVE_CONFIG_H
0050 #include "config.h"
0051 #endif
0052 
0053 #include "tc-basedefs-pendant.h"
0054 
0055 /* For the RTEMS_SYMBOL_NAME tests */
0056 #undef __USER_LABEL_PREFIX__
0057 #define __USER_LABEL_PREFIX__ SyMbOl_
0058 #define SyMbOl_symbol_id prefix_symbol_id
0059 #define SYMBOL_NAME symbol_name
0060 
0061 uintptr_t basedefs_get_global_symbol( void )
0062 {
0063   return (uintptr_t) global_symbol;
0064 }
0065 
0066 int basedefs_use_prefixed_symbol_name( void )
0067 {
0068   const int SyMbOl_symbol_name = 124;
0069   return RTEMS_SYMBOL_NAME( symbol_name );
0070 }
0071 
0072 int basedefs_use_prefixed_upper_symbol_name( void )
0073 {
0074   const int SyMbOl_symbol_name = 125;
0075   return RTEMS_SYMBOL_NAME( SYMBOL_NAME );
0076 }
0077 
0078 int basedefs_use_prefixed_symbol_id( void )
0079 {
0080   const int prefix_symbol_id = 126;
0081   return RTEMS_SYMBOL_NAME( symbol_id );
0082 }
0083 
0084 int basedefs_weak_alias_1_func( int i )
0085 {
0086   return 10 * i;
0087 }
0088 
0089 const volatile int basedefs_weak_1_var = 62;
0090 
0091 int basedefs_weak_1_func( void )
0092 {
0093   return 65;
0094 }
0095 
0096 static RTEMS_ALIGNED( 64 ) int allocated_memory_dummy;
0097 
0098 void *basedefs_malloclike_func( size_t size )
0099 {
0100   return &allocated_memory_dummy;
0101 }
0102 
0103 void *basedefs_alloc_align_func( size_t size, void **p, size_t alignment )
0104 {
0105   *p = &allocated_memory_dummy;
0106   return &allocated_memory_dummy;
0107 }
0108 
0109 void *basedefs_alloc_size_func( size_t size )
0110 {
0111   return &allocated_memory_dummy;
0112 }
0113 
0114 void *basedefs_alloc_size_2_func( size_t size0, size_t size1 )
0115 {
0116   return &allocated_memory_dummy;
0117 }
0118 
0119 void basedefs_free( void *ptr )
0120 {
0121   (void) ptr;
0122 }