Back to home page

LXR

 
 

    


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

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /*
0004  *  This include file contains the CPU dependent implementation
0005  *  of the following routines needed to test RTEMS floating
0006  *  point support:
0007  *           INTEGER_load( &context )
0008  *           INTEGER_check( &context )
0009  *
0010  *  INTEGER_load   - loads the specified floating point context
0011  *  INTEGER_check  - checks the specified floating point context
0012  *
0013  *  NOTE:  These routines are VERY CPU dependent and are thus
0014  *         located in in the CPU dependent include file
0015  *         inttest.h.  These routines form the core of the
0016  *         floating point context switch test.
0017  *
0018  *  COPYRIGHT (c) 1989-2011.
0019  *  On-Line Applications Research Corporation (OAR).
0020  *
0021  * Redistribution and use in source and binary forms, with or without
0022  * modification, are permitted provided that the following conditions
0023  * are met:
0024  * 1. Redistributions of source code must retain the above copyright
0025  *    notice, this list of conditions and the following disclaimer.
0026  * 2. Redistributions in binary form must reproduce the above copyright
0027  *    notice, this list of conditions and the following disclaimer in the
0028  *    documentation and/or other materials provided with the distribution.
0029  *
0030  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0031  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0032  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0033  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0034  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0035  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0036  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0037  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0038  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0039  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0040  * POSSIBILITY OF SUCH DAMAGE.
0041  */
0042 
0043 
0044 #ifndef __INTEGER_TEST_h
0045 #define __INTEGER_TEST_h
0046 
0047 #include <stdio.h>
0048 #define REG_VARIABLE uint32_t
0049 
0050 #define INTEGER_DECLARE \
0051     REG_VARIABLE int01 = 1; \
0052     REG_VARIABLE int02 = 2; \
0053     REG_VARIABLE int03 = 3; \
0054     REG_VARIABLE int04 = 4; \
0055     REG_VARIABLE int05 = 5; \
0056     REG_VARIABLE int06 = 6; \
0057     REG_VARIABLE int07 = 7; \
0058     REG_VARIABLE int08 = 8; \
0059     REG_VARIABLE int09 = 9; \
0060     REG_VARIABLE int10 = 10; \
0061     REG_VARIABLE int11 = 11; \
0062     REG_VARIABLE int12 = 12; \
0063     REG_VARIABLE int13 = 13; \
0064     REG_VARIABLE int14 = 14; \
0065     REG_VARIABLE int15 = 15; \
0066     REG_VARIABLE int16 = 16; \
0067     REG_VARIABLE int17 = 17; \
0068     REG_VARIABLE int18 = 18; \
0069     REG_VARIABLE int19 = 19; \
0070     REG_VARIABLE int20 = 20; \
0071     REG_VARIABLE int21 = 21; \
0072     REG_VARIABLE int22 = 22; \
0073     REG_VARIABLE int23 = 23; \
0074     REG_VARIABLE int24 = 24; \
0075     REG_VARIABLE int25 = 25; \
0076     REG_VARIABLE int26 = 26; \
0077     REG_VARIABLE int27 = 27; \
0078     REG_VARIABLE int28 = 28; \
0079     REG_VARIABLE int29 = 29; \
0080     REG_VARIABLE int30 = 30; \
0081     REG_VARIABLE int31 = 31; \
0082     REG_VARIABLE int32 = 32
0083 
0084 #define INTEGER_LOAD( _factor ) \
0085   do {                \
0086     int01  += _factor; \
0087     int02  += _factor; \
0088     int03  += _factor; \
0089     int04  += _factor; \
0090     int05  += _factor; \
0091     int06  += _factor; \
0092     int07  += _factor; \
0093     int08  += _factor; \
0094     int09  += _factor; \
0095     int10  += _factor; \
0096     int11  += _factor; \
0097     int12  += _factor; \
0098     int13  += _factor; \
0099     int14  += _factor; \
0100     int15  += _factor; \
0101     int16  += _factor; \
0102     int17  += _factor; \
0103     int18  += _factor; \
0104     int19  += _factor; \
0105     int20  += _factor; \
0106     int21  += _factor; \
0107     int22  += _factor; \
0108     int23  += _factor; \
0109     int24  += _factor; \
0110     int25  += _factor; \
0111     int26  += _factor; \
0112     int27  += _factor; \
0113     int28  += _factor; \
0114     int29  += _factor; \
0115     int30  += _factor; \
0116     int31  += _factor; \
0117     int32  += _factor; \
0118   } while (0)
0119 
0120 #define INTEGER_CHECK_ONE( _v, _base, _factor ) \
0121   if ( (_v) != ((_base) + (_factor)) )  { \
0122     printf( \
0123       "%" PRIu32 ": " #_v " wrong -- (0x%" PRIx32 " not 0x%" PRIx32 ")\n", \
0124       task_index, \
0125       (_v), \
0126       (_base + _factor) \
0127     ); \
0128   }
0129 
0130 
0131 #define INTEGER_CHECK( _factor ) \
0132     do { \
0133       INTEGER_CHECK_ONE( int01,  1, (_factor) ); \
0134       INTEGER_CHECK_ONE( int02,  2, (_factor) ); \
0135       INTEGER_CHECK_ONE( int03,  3, (_factor) ); \
0136       INTEGER_CHECK_ONE( int04,  4, (_factor) ); \
0137       INTEGER_CHECK_ONE( int05,  5, (_factor) ); \
0138       INTEGER_CHECK_ONE( int06,  6, (_factor) ); \
0139       INTEGER_CHECK_ONE( int07,  7, (_factor) ); \
0140       INTEGER_CHECK_ONE( int08,  8, (_factor) ); \
0141       INTEGER_CHECK_ONE( int09,  9, (_factor) ); \
0142       INTEGER_CHECK_ONE( int10, 10, (_factor) ); \
0143       INTEGER_CHECK_ONE( int11, 11, (_factor) ); \
0144       INTEGER_CHECK_ONE( int12, 12, (_factor) ); \
0145       INTEGER_CHECK_ONE( int13, 13, (_factor) ); \
0146       INTEGER_CHECK_ONE( int14, 14, (_factor) ); \
0147       INTEGER_CHECK_ONE( int15, 15, (_factor) ); \
0148       INTEGER_CHECK_ONE( int16, 16, (_factor) ); \
0149       INTEGER_CHECK_ONE( int17, 17, (_factor) ); \
0150       INTEGER_CHECK_ONE( int18, 18, (_factor) ); \
0151       INTEGER_CHECK_ONE( int19, 19, (_factor) ); \
0152       INTEGER_CHECK_ONE( int20, 20, (_factor) ); \
0153       INTEGER_CHECK_ONE( int21, 21, (_factor) ); \
0154       INTEGER_CHECK_ONE( int22, 22, (_factor) ); \
0155       INTEGER_CHECK_ONE( int23, 23, (_factor) ); \
0156       INTEGER_CHECK_ONE( int24, 24, (_factor) ); \
0157       INTEGER_CHECK_ONE( int25, 25, (_factor) ); \
0158       INTEGER_CHECK_ONE( int26, 26, (_factor) ); \
0159       INTEGER_CHECK_ONE( int27, 27, (_factor) ); \
0160       INTEGER_CHECK_ONE( int28, 28, (_factor) ); \
0161       INTEGER_CHECK_ONE( int29, 29, (_factor) ); \
0162       INTEGER_CHECK_ONE( int30, 30, (_factor) ); \
0163       INTEGER_CHECK_ONE( int31, 31, (_factor) ); \
0164       INTEGER_CHECK_ONE( int32, 32, (_factor) ); \
0165     } while (0)
0166 
0167 #endif