source: rtems/testsuites/samples/ticker/system.h @ f6ef96c2

4.104.11
Last change on this file since f6ef96c2 was f6ef96c2, checked in by Joel Sherrill <joel.sherrill@…>, on Aug 10, 2009 at 4:05:17 PM

2009-08-10 Joel Sherrill <joel.sherrill@…>

  • fileio/system.h, ticker/system.h, ticker/ticker.scn: Convert calls to legacy routine rtems_clock_get( RTEMS_CLOCK_GET_xxx, ..) to rtems_clock_get_xxx().
  • Property mode set to 100644
File size: 2.8 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  return rtems_clock_get_ticks_per_second();
98}
99
100/*
101 *  This allows us to view the "Test_task" instantiations as a set
102 *  of numbered tasks by eliminating the number of application
103 *  tasks created.
104 *
105 *  In reality, this is too complex for the purposes of this
106 *  example.  It would have been easier to pass a task argument. :)
107 *  But it shows how rtems_id's can sometimes be used.
108 */
109
110#define task_number( tid ) \
111  ( rtems_object_id_get_index( tid ) - \
112      rtems_configuration_get_rtems_api_configuration()-> \
113        number_of_initialization_tasks )
114
115/* end of include file */
Note: See TracBrowser for help on using the repository browser.