OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [tests/] [samples/] [ticker/] [system.h] - Blame information for rev 607

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*  system.h
2
 *
3
 *  This include file contains information that is included in every
4
 *  function in the test set.
5
 *
6
 *  COPYRIGHT (c) 1989-1999.
7
 *  On-Line Applications Research Corporation (OAR).
8
 *
9
 *  The license and distribution terms for this file may be
10
 *  found in the file LICENSE in this distribution or at
11
 *  http://www.OARcorp.com/rtems/license.html.
12
 *
13
 *  $Id: system.h,v 1.2 2001-09-27 12:02:29 chris Exp $
14
 */
15
 
16
#include <rtems.h>
17
 
18
/* functions */
19
 
20
rtems_task Init(
21
  rtems_task_argument argument
22
);
23
 
24
rtems_task Test_task(
25
  rtems_task_argument argument
26
);
27
 
28
/* global variables */
29
 
30
/*
31
 *  Keep the names and IDs in global variables so another task can use them.
32
 */
33
 
34
extern rtems_id   Task_id[ 4 ];         /* array of task ids */
35
extern rtems_name Task_name[ 4 ];       /* array of task names */
36
 
37
 
38
/* configuration information */
39
 
40
#include <bsp.h> /* for device driver prototypes */
41
 
42
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
43
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
44
 
45
#define CONFIGURE_MAXIMUM_TASKS             4
46
 
47
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
48
 
49
#define CONFIGURE_EXTRA_TASK_STACKS         (3 * RTEMS_MINIMUM_STACK_SIZE)
50
 
51
#include <confdefs.h>
52
 
53
/*
54
 *  Handy macros and static inline functions
55
 */
56
 
57
/*
58
 *  Macro to hide the ugliness of printing the time.
59
 */
60
 
61
#define print_time(_s1, _tb, _s2) \
62
  do { \
63
    printf( "%s%02d:%02d:%02d   %02d/%02d/%04d%s", \
64
       _s1, (_tb)->hour, (_tb)->minute, (_tb)->second, \
65
       (_tb)->month, (_tb)->day, (_tb)->year, _s2 ); \
66
    fflush(stdout); \
67
  } while ( 0 )
68
 
69
/*
70
 *  Macro to print an task name that is composed of ASCII characters.
71
 *
72
 */
73
 
74
#define put_name( _name, _crlf ) \
75
  do { \
76
    rtems_unsigned32 c0, c1, c2, c3; \
77
    \
78
    c0 = ((_name) >> 24) & 0xff; \
79
    c1 = ((_name) >> 16) & 0xff; \
80
    c2 = ((_name) >> 8) & 0xff; \
81
    c3 = (_name) & 0xff; \
82
    putchar( (char)c0 ); \
83
    if ( c1 ) putchar( (char)c1 ); \
84
    if ( c2 ) putchar( (char)c2 ); \
85
    if ( c3 ) putchar( (char)c3 ); \
86
    if ( (_crlf) ) \
87
      putchar( '\n' ); \
88
  } while (0)
89
 
90
/*
91
 *  static inline routine to make obtaining ticks per second easier.
92
 */
93
 
94
static inline rtems_unsigned32 get_ticks_per_second( void )
95
{
96
  rtems_interval ticks_per_second;
97
  (void) rtems_clock_get( RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticks_per_second );  return ticks_per_second;
98
}
99
 
100
 
101
/*
102
 *  This allows us to view the "Test_task" instantiations as a set
103
 *  of numbered tasks by eliminating the number of application
104
 *  tasks created.
105
 *
106
 *  In reality, this is too complex for the purposes of this
107
 *  example.  It would have been easier to pass a task argument. :)
108
 *  But it shows how rtems_id's can sometimes be used.
109
 */
110
 
111
#define task_number( tid ) \
112
  ( rtems_get_index( tid ) - \
113
     rtems_configuration_get_rtems_api_configuration()->number_of_initialization_tasks )
114
 
115
/* end of include file */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.