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

4.104.114.95
Last change on this file since 8f5b274 was 8f5b274, checked in by Joel Sherrill <joel.sherrill@…>, on 01/29/08 at 21:53:16

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
RevLine 
[ac7d5ef0]1/*  system.h
2 *
3 *  This include file contains information that is included in every
4 *  function in the test set.
5 *
[8f5b274]6 *  COPYRIGHT (c) 1989-2008.
[ac7d5ef0]7 *  On-Line Applications Research Corporation (OAR).
8 *
[98e4ebf5]9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
[3e26377b]11 *  http://www.rtems.com/license/LICENSE.
[ac7d5ef0]12 *
[3235ad9]13 *  $Id$
[ac7d5ef0]14 */
15
[df49c60]16#include <rtems.h>
[d66557f]17#include <inttypes.h>
[dfc6f3dc]18#include "../../support/include/buffer_test_io.h"
[ac7d5ef0]19
[3a4ae6c]20/* functions */
[ac7d5ef0]21
[3a4ae6c]22rtems_task Init(
23  rtems_task_argument argument
24);
[ac7d5ef0]25
[3a4ae6c]26rtems_task Test_task(
27  rtems_task_argument argument
28);
[ac7d5ef0]29
[df49c60]30/* global variables */
31
32/*
33 *  Keep the names and IDs in global variables so another task can use them.
[8f71a36]34 */
[df49c60]35
36extern rtems_id   Task_id[ 4 ];         /* array of task ids */
37extern rtems_name Task_name[ 4 ];       /* array of task names */
38
39
[3a4ae6c]40/* configuration information */
[ac7d5ef0]41
[df49c60]42#include <bsp.h> /* for device driver prototypes */
43
44#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
[dd61160]45#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
[3a4ae6c]46
[df49c60]47#define CONFIGURE_MAXIMUM_TASKS             4
[3a4ae6c]48
[be1c11ed]49#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
50
[5fe6b21a]51#define CONFIGURE_EXTRA_TASK_STACKS         (3 * RTEMS_MINIMUM_STACK_SIZE)
52
[c8fea7a]53#include <rtems/confdefs.h>
[3a4ae6c]54
[df49c60]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 { \
[d66557f]65    printf( "%s%02" PRId32 ":%02" PRId32 ":%02" PRId32 "   %02" PRId32 "/%02" PRId32 "/%04" PRId32 "%s", \
[df49c60]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 { \
[4c84d7b]77    uint32_t   c0, c1, c2, c3; \
[df49c60]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
[4c84d7b]95static inline uint32_t   get_ticks_per_second( void )
[df49c60]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 */
[3a4ae6c]111
[df49c60]112#define task_number( tid ) \
[8f5b274]113  ( rtems_object_id_get_index( tid ) - \
114      rtems_configuration_get_rtems_api_configuration()-> \
115        number_of_initialization_tasks )
[ac7d5ef0]116
117/* end of include file */
Note: See TracBrowser for help on using the repository browser.