source: rtems/testsuites/support/include/tmacros.h @ 4b374f36

4.104.114.84.95
Last change on this file since 4b374f36 was 4b374f36, checked in by Joel Sherrill <joel.sherrill@…>, on 08/17/95 at 19:36:43

maximum number of messages removed and include statement cleanup

  • Property mode set to 100644
File size: 3.0 KB
Line 
1/*  tmacros.h
2 *
3 *  This include file contains macros which are useful in the RTEMS
4 *  test suites.
5 *
6 *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
7 *  On-Line Applications Research Corporation (OAR).
8 *  All rights assigned to U.S. Government, 1994.
9 *
10 *  This material may be reproduced by or for the U.S. Government pursuant
11 *  to the copyright license under the clause at DFARS 252.227-7013.  This
12 *  notice must appear in all copies of this file and its derivatives.
13 *
14 *  tmacros.h,v 1.2 1995/05/31 17:00:10 joel Exp
15 */
16
17#ifndef __TMACROS_h
18#define __TMACROS_h
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24#include <rtems.h>
25#include <bsp.h>
26
27#include <stdio.h>
28#include <stdlib.h>
29#include <libcsupport.h>
30
31#define FOREVER 1                  /* infinite loop */
32
33#define directive_failed( dirstat, failmsg )  \
34    fatal_directive_status( dirstat, RTEMS_SUCCESSFUL, failmsg )
35
36#define fatal_directive_status( stat, desired, msg ) \
37     { \
38       if ( (stat) != (desired) ) { \
39         printf( "\n%s FAILED -- expected (%d) got (%d)\n", \
40                 (msg), (desired), (stat) ); \
41         exit( stat ); \
42       } \
43     }
44
45#define sprint_time(str,s1,tb,s2) \
46    sprintf( (str), "%s%02d:%02d:%02d   %02d/%02d/%04d%s", \
47       s1, (tb)->hour, (tb)->minute, (tb)->second, \
48       (tb)->month, (tb)->day, (tb)->year, s2 );
49
50#define print_time(s1,tb,s2) \
51    printf( "%s%02d:%02d:%02d   %02d/%02d/%04d%s", \
52       s1, (tb)->hour, (tb)->minute, (tb)->second, \
53       (tb)->month, (tb)->day, (tb)->year, s2 );
54
55#define put_dot( c ) putchar( c ); fflush( stdout )
56
57#define new_line  puts( "" )
58
59#define puts_nocr printf
60
61#define pause() \
62  do { \
63    char buffer[ 80 ]; \
64    printf( "<pause>" ); fflush( stdout ); \
65    gets( buffer ); \
66    puts( "" ); \
67  } while ( 0 )
68
69#define pause_and_screen_number( _screen ) \
70  do { \
71    char buffer[ 80 ]; \
72    printf( "<pause - screen %d>", (_screen) ); fflush( stdout ); \
73    gets( buffer ); \
74    puts( "" ); \
75  } while ( 0 )
76
77#define put_name( name, crlf ) \
78{ rtems_unsigned32 c0, c1, c2, c3; \
79  c0 = (name >> 24) & 0xff; \
80  c1 = (name >> 16) & 0xff; \
81  c2 = (name >> 8) & 0xff; \
82  c3 = name & 0xff; \
83  putchar( (char)c0 ); \
84  if ( c1 ) putchar( (char)c1 ); \
85  if ( c2 ) putchar( (char)c2 ); \
86  if ( c3 ) putchar( (char)c3 ); \
87  if ( crlf ) \
88    putchar( '\n' ); \
89}
90
91#define put_buffer( _buffer )  XYZ( _buffer )
92
93#define build_time( TB, MON, DAY, YR, HR, MIN, SEC, TK ) \
94  { (TB)->year   = YR;  \
95    (TB)->month  = MON; \
96    (TB)->day    = DAY; \
97    (TB)->hour   = HR;  \
98    (TB)->minute = MIN; \
99    (TB)->second = SEC; \
100    (TB)->ticks  = TK; }
101
102#define task_number( tid ) \
103  ( rtems_get_index( tid ) - BSP_Configuration.number_of_initialization_tasks )
104
105static inline rtems_unsigned32 get_ticks_per_second( void )
106{
107  rtems_interval ticks_per_second;
108  (void) rtems_clock_get( RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticks_per_second );
109  return ticks_per_second;
110}
111
112#define TICKS_PER_SECOND get_ticks_per_second()
113
114#ifdef __cplusplus
115}
116#endif
117
118#endif
Note: See TracBrowser for help on using the repository browser.