source: rtems/c/src/tests/support/include/tmacros.h @ 11290355

4.104.114.84.95
Last change on this file since 11290355 was 11290355, checked in by Joel Sherrill <joel.sherrill@…>, on 09/29/95 at 17:19:16

all targets compile .. tony's patches in place

  • 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 *  $Id$
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
30#define FOREVER 1                  /* infinite loop */
31
32#ifdef TEST_INIT
33#define TEST_EXTERN
34#define CONFIGURE_INIT
35#else
36#define TEST_EXTERN extern
37#endif
38
39#define directive_failed( dirstat, failmsg )  \
40    fatal_directive_status( dirstat, RTEMS_SUCCESSFUL, failmsg )
41
42#define fatal_directive_status( stat, desired, msg ) \
43     { \
44       if ( (stat) != (desired) ) { \
45         printf( "\n%s FAILED -- expected (%d) got (%d)\n", \
46                 (msg), (desired), (stat) ); \
47         exit( stat ); \
48       } \
49     }
50
51#define sprint_time(str,s1,tb,s2) \
52    sprintf( (str), "%s%02d:%02d:%02d   %02d/%02d/%04d%s", \
53       s1, (tb)->hour, (tb)->minute, (tb)->second, \
54       (tb)->month, (tb)->day, (tb)->year, s2 );
55
56#define print_time(s1,tb,s2) \
57    printf( "%s%02d:%02d:%02d   %02d/%02d/%04d%s", \
58       s1, (tb)->hour, (tb)->minute, (tb)->second, \
59       (tb)->month, (tb)->day, (tb)->year, s2 );
60
61#define put_dot( c ) putchar( c ); fflush( stdout )
62
63#define new_line  puts( "" )
64
65#define puts_nocr printf
66
67#define pause() \
68  do { \
69    char buffer[ 80 ]; \
70    printf( "<pause>" ); fflush( stdout ); \
71    gets( buffer ); \
72    puts( "" ); \
73  } while ( 0 )
74
75#define pause_and_screen_number( _screen ) \
76  do { \
77    char buffer[ 80 ]; \
78    printf( "<pause - screen %d>", (_screen) ); fflush( stdout ); \
79    gets( buffer ); \
80    puts( "" ); \
81  } while ( 0 )
82
83#define put_name( name, crlf ) \
84{ rtems_unsigned32 c0, c1, c2, c3; \
85  c0 = (name >> 24) & 0xff; \
86  c1 = (name >> 16) & 0xff; \
87  c2 = (name >> 8) & 0xff; \
88  c3 = name & 0xff; \
89  putchar( (char)c0 ); \
90  if ( c1 ) putchar( (char)c1 ); \
91  if ( c2 ) putchar( (char)c2 ); \
92  if ( c3 ) putchar( (char)c3 ); \
93  if ( crlf ) \
94    putchar( '\n' ); \
95}
96
97#define build_time( TB, MON, DAY, YR, HR, MIN, SEC, TK ) \
98  { (TB)->year   = YR;  \
99    (TB)->month  = MON; \
100    (TB)->day    = DAY; \
101    (TB)->hour   = HR;  \
102    (TB)->minute = MIN; \
103    (TB)->second = SEC; \
104    (TB)->ticks  = TK; }
105
106#define task_number( tid ) \
107  ( rtems_get_index( tid ) - BSP_Configuration.number_of_initialization_tasks )
108
109static inline rtems_unsigned32 get_ticks_per_second( void )
110{
111  rtems_interval ticks_per_second;
112  (void) rtems_clock_get( RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticks_per_second );
113  return ticks_per_second;
114}
115
116#define TICKS_PER_SECOND get_ticks_per_second()
117
118#ifdef __cplusplus
119}
120#endif
121
122#endif
Note: See TracBrowser for help on using the repository browser.