source: rtems/testsuites/samples/ticker/system.h @ 8f5b274

4.104.114.9
Last change on this file since 8f5b274 was 8f5b274, checked in by Joel Sherrill <joel.sherrill@…>, on Jan 29, 2008 at 9:53:16 PM

2008-01-29 Joel Sherrill <joel.sherrill@…>

  • fileio/system.h, ticker/system.h: Add new Object Services collection. This changed the name of a few previously public but undocumented services and added a some new services.
  • Property mode set to 100644
File size: 2.9 KB
Line 
1/*  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-2008.
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.rtems.com/license/LICENSE.
12 *
13 *  $Id$
14 */
15
16#include <rtems.h>
17#include <inttypes.h>
18#include "../../support/include/buffer_test_io.h"
19
20/* functions */
21
22rtems_task Init(
23  rtems_task_argument argument
24);
25
26rtems_task Test_task(
27  rtems_task_argument argument
28);
29
30/* global variables */
31
32/*
33 *  Keep the names and IDs in global variables so another task can use them.
34 */
35
36extern rtems_id   Task_id[ 4 ];         /* array of task ids */
37extern rtems_name Task_name[ 4 ];       /* array of task names */
38
39
40/* configuration information */
41
42#include <bsp.h> /* for device driver prototypes */
43
44#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
45#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
46
47#define CONFIGURE_MAXIMUM_TASKS             4
48
49#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
50
51#define CONFIGURE_EXTRA_TASK_STACKS         (3 * RTEMS_MINIMUM_STACK_SIZE)
52
53#include <rtems/confdefs.h>
54
55/*
56 *  Handy macros and static inline functions
57 */
58
59/*
60 *  Macro to hide the ugliness of printing the time.
61 */
62
63#define print_time(_s1, _tb, _s2) \
64  do { \
65    printf( "%s%02" PRId32 ":%02" PRId32 ":%02" PRId32 "   %02" PRId32 "/%02" PRId32 "/%04" PRId32 "%s", \
66       _s1, (_tb)->hour, (_tb)->minute, (_tb)->second, \
67       (_tb)->month, (_tb)->day, (_tb)->year, _s2 ); \
68  } while ( 0 )
69
70/*
71 *  Macro to print an task name that is composed of ASCII characters.
72 *
73 */
74
75#define put_name( _name, _crlf ) \
76  do { \
77    uint32_t   c0, c1, c2, c3; \
78    \
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  } while (0)
90
91/*
92 *  static inline routine to make obtaining ticks per second easier.
93 */
94
95static inline uint32_t   get_ticks_per_second( void )
96{
97  rtems_interval ticks_per_second;
98  (void) rtems_clock_get( RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticks_per_second );  return ticks_per_second;
99}
100
101
102/*
103 *  This allows us to view the "Test_task" instantiations as a set
104 *  of numbered tasks by eliminating the number of application
105 *  tasks created.
106 *
107 *  In reality, this is too complex for the purposes of this
108 *  example.  It would have been easier to pass a task argument. :)
109 *  But it shows how rtems_id's can sometimes be used.
110 */
111
112#define task_number( tid ) \
113  ( rtems_object_id_get_index( tid ) - \
114      rtems_configuration_get_rtems_api_configuration()-> \
115        number_of_initialization_tasks )
116
117/* end of include file */
Note: See TracBrowser for help on using the repository browser.