Back to home page

LXR

 
 

    


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

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /*  Task_1
0004  *
0005  *  This routine serves as a test task.  It tests the partition manager.
0006  *
0007  *  Input parameters:
0008  *    argument - task argument
0009  *
0010  *  Output parameters:  NONE
0011  *
0012  *  COPYRIGHT (c) 1989-1999.
0013  *  On-Line Applications Research Corporation (OAR).
0014  *
0015  * Redistribution and use in source and binary forms, with or without
0016  * modification, are permitted provided that the following conditions
0017  * are met:
0018  * 1. Redistributions of source code must retain the above copyright
0019  *    notice, this list of conditions and the following disclaimer.
0020  * 2. Redistributions in binary form must reproduce the above copyright
0021  *    notice, this list of conditions and the following disclaimer in the
0022  *    documentation and/or other materials provided with the distribution.
0023  *
0024  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0025  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0026  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0027  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0028  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0029  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0030  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0031  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0032  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0033  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0034  * POSSIBILITY OF SUCH DAMAGE.
0035  */
0036 
0037 #ifdef HAVE_CONFIG_H
0038 #include "config.h"
0039 #endif
0040 
0041 #include "system.h"
0042 
0043 rtems_task Task_1(
0044   rtems_task_argument argument
0045 )
0046 {
0047   rtems_id           ptid_1;
0048   rtems_id           ptid_2;
0049   void              *buffer_address_1;
0050   void              *buffer_address_2;
0051   void              *buffer_address_3;
0052   void              *buffer_address_4;
0053   rtems_status_code  status;
0054 
0055   puts_nocr( "TA1 - rtems_partition_ident - partition 1 id = " );
0056   status = rtems_partition_ident(
0057     Partition_name[ 1 ],
0058     RTEMS_SEARCH_ALL_NODES,
0059     &ptid_1
0060   );
0061   directive_failed( status, "rtems_partition_ident of PT1" );
0062   printf( "%08" PRIxrtems_id "\n", ptid_1 );
0063 
0064   puts_nocr( "TA1 - rtems_partition_ident - partition 2 id = " );
0065   status = rtems_partition_ident(
0066     Partition_name[ 2 ],
0067     RTEMS_SEARCH_ALL_NODES,
0068     &ptid_2
0069   );
0070   directive_failed( status, "rtems_partition_ident of PT2" );
0071   printf( "%08" PRIxrtems_id "\n", ptid_2 );
0072 
0073   puts_nocr(
0074     "TA1 - rtems_partition_get_buffer - buffer 1 from partition 1  - "
0075   );
0076   status = rtems_partition_get_buffer( ptid_1, &buffer_address_1 );
0077   directive_failed( status, "rtems_partition_get_buffer" );
0078   Put_address_from_area_1( buffer_address_1 );
0079   new_line;
0080 
0081   puts_nocr(
0082     "TA1 - rtems_partition_get_buffer - buffer 2 from partition 1  - "
0083   );
0084   status = rtems_partition_get_buffer( ptid_1, &buffer_address_2 );
0085   directive_failed( status, "rtems_partition_get_buffer" );
0086   Put_address_from_area_1( buffer_address_2 );
0087   new_line;
0088 
0089   puts_nocr(
0090     "TA1 - rtems_partition_get_buffer - buffer 1 from partition 2  - "
0091   );
0092   status = rtems_partition_get_buffer( ptid_2, &buffer_address_3 );
0093   directive_failed( status, "rtems_partition_get_buffer" );
0094   Put_address_from_area_2( buffer_address_3 );
0095   new_line;
0096 
0097   puts_nocr(
0098     "TA1 - rtems_partition_get_buffer - buffer 2 from partition 2  - "
0099   );
0100   status = rtems_partition_get_buffer( ptid_2, &buffer_address_4 );
0101   directive_failed( status, "rtems_partition_get_buffer" );
0102   Put_address_from_area_2( buffer_address_4 );
0103   new_line;
0104 
0105   puts_nocr(
0106     "TA1 - rtems_partition_return_buffer - buffer 1 to partition 1 - "
0107   );
0108   Put_address_from_area_1( buffer_address_1 );
0109   new_line;
0110   status = rtems_partition_return_buffer( ptid_1, buffer_address_1 );
0111   directive_failed( status, "rtems_partition_return_buffer" );
0112 
0113   puts_nocr(
0114     "TA1 - rtems_partition_return_buffer - buffer 2 to partition 1 - "
0115   );
0116   Put_address_from_area_1( buffer_address_2 );
0117   new_line;
0118   status = rtems_partition_return_buffer( ptid_1, buffer_address_2 );
0119   directive_failed( status, "rtems_partition_return_buffer" );
0120 
0121   puts_nocr(
0122     "TA1 - rtems_partition_return_buffer - buffer 1 to partition 2 - "
0123   );
0124   Put_address_from_area_2( buffer_address_3 );
0125   new_line;
0126   status = rtems_partition_return_buffer( ptid_2, buffer_address_3 );
0127   directive_failed( status, "rtems_partition_return_buffer" );
0128 
0129   puts_nocr(
0130     "TA1 - rtems_partition_return_buffer - buffer 2 to partition 2 - "
0131   );
0132   Put_address_from_area_2( buffer_address_4 );
0133   new_line;
0134   status = rtems_partition_return_buffer( ptid_2, buffer_address_4 );
0135   directive_failed( status, "rtems_partition_return_buffer" );
0136 
0137   puts( "TA1 - rtems_partition_delete - delete partition 1"
0138   );
0139   status = rtems_partition_delete( ptid_1 );
0140   directive_failed( status, "rtems_partition_delete" );
0141 
0142   puts( "TA1 - rtems_partition_delete - delete partition 2"
0143   );
0144   status = rtems_partition_delete( ptid_2 );
0145   directive_failed( status, "rtems_partition_delete" );
0146 
0147   TEST_END();
0148   rtems_test_exit( 0 );
0149 }