Back to home page

LXR

 
 

    


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

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /*  Init
0004  *
0005  *  This routine is the initialization and test routine for
0006  *  this test program.  It attempts to create more global
0007  *  objects than are configured (zero should be configured).
0008  *  This routine is the initialization task for this test program.
0009  *  It is a user initialization task and has the responsibility for creating
0010  *  and starting the tasks that make up the test.  If the time of day
0011  *  clock is required for the test, it should also be set to a known
0012  *  value by this function.
0013  *
0014  *  Input parameters:
0015  *    argument - task argument
0016  *
0017  *  Output parameters:  NONE
0018  *
0019  *  COPYRIGHT (c) 1989-1999.
0020  *  On-Line Applications Research Corporation (OAR).
0021  *
0022  * Redistribution and use in source and binary forms, with or without
0023  * modification, are permitted provided that the following conditions
0024  * are met:
0025  * 1. Redistributions of source code must retain the above copyright
0026  *    notice, this list of conditions and the following disclaimer.
0027  * 2. Redistributions in binary form must reproduce the above copyright
0028  *    notice, this list of conditions and the following disclaimer in the
0029  *    documentation and/or other materials provided with the distribution.
0030  *
0031  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0032  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0033  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0034  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0035  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0036  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0037  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0038  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0039  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0040  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0041  * POSSIBILITY OF SUCH DAMAGE.
0042  */
0043 
0044 #ifdef HAVE_CONFIG_H
0045 #include "config.h"
0046 #endif
0047 
0048 #define CONFIGURE_INIT
0049 #include "system.h"
0050 
0051 uint8_t   my_partition[0x30000] CPU_STRUCTURE_ALIGNMENT;
0052 
0053 rtems_task Init(
0054   rtems_task_argument argument
0055 )
0056 {
0057   rtems_id          junk_id;
0058   rtems_status_code status;
0059 
0060   printf(
0061     "\n\n*** TEST 11 -- NODE %" PRIu32 " ***\n",
0062     rtems_object_get_local_node()
0063   );
0064 
0065   Task_name[ 1 ] = rtems_build_name( '1', '1', '1', ' ' );
0066   Task_name[ 2 ] = rtems_build_name( '2', '2', '2', ' ' );
0067 
0068   Queue_name[ 1 ] = rtems_build_name( 'M', 'S', 'G', ' ' );
0069 
0070   Semaphore_name[ 1 ] = rtems_build_name( 'S', 'E', 'M', ' ' );
0071 
0072   if ( rtems_object_get_local_node() == 1 ) {
0073     puts( "Attempting to create Test_task (Global)" );
0074     status = rtems_task_create(
0075       Task_name[ 1 ],
0076       1,
0077       RTEMS_MINIMUM_STACK_SIZE,
0078       RTEMS_DEFAULT_MODES,
0079       RTEMS_GLOBAL,
0080       &junk_id
0081     );
0082     fatal_directive_status( status, RTEMS_TOO_MANY, "rtems_task_create" );
0083     puts( "rtems_task_create correctly returned RTEMS_TOO_MANY" );
0084 
0085     puts( "Attempting to create Message Queue (Global)" );
0086     status = rtems_message_queue_create(
0087       Queue_name[ 1 ],
0088       3,
0089       16,
0090       RTEMS_GLOBAL,
0091       &junk_id
0092     );
0093     fatal_directive_status(
0094       status,
0095       RTEMS_TOO_MANY,
0096       "rtems_message_queue_create"
0097     );
0098     puts( "rtems_message_queue_create correctly returned RTEMS_TOO_MANY" );
0099 
0100     puts( "Attempting to create Semaphore (Global)" );
0101     status = rtems_semaphore_create(
0102       Semaphore_name[ 1 ],
0103       1,
0104       RTEMS_GLOBAL,
0105       RTEMS_NO_PRIORITY,
0106       &junk_id
0107     );
0108     fatal_directive_status( status, RTEMS_TOO_MANY, "rtems_semaphore_create" );
0109     puts( "rtems_semaphore_create correctly returned RTEMS_TOO_MANY" );
0110 
0111     puts( "Attempting to create Partition (Global)" );
0112     status = rtems_partition_create(
0113       1,
0114       (uint8_t   *) my_partition,
0115       128,
0116       64,
0117       RTEMS_GLOBAL,
0118       &junk_id
0119     );
0120     fatal_directive_status( status, RTEMS_TOO_MANY, "rtems_partition_create" );
0121     puts( "rtems_partition_create correctly returned RTEMS_TOO_MANY" );
0122   }
0123   puts( "*** END OF TEST 11 ***" );
0124   rtems_test_exit( 0 );
0125 }