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

4.104.114.84.95
Last change on this file since dfc6f3dc was dfc6f3dc, checked in by Joel Sherrill <joel.sherrill@…>, on 05/10/07 at 19:31:36

2007-05-10 Joel Sherrill <joel.sherrill@…>

  • ticker/Makefile.am, ticker/init.c, ticker/system.h, ticker/tasks.c: Test needs clock manager. Should use rtems_test_exit() instead of exit().
  • 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 *
[08311cc3]6 *  COPYRIGHT (c) 1989-1999.
[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
[dfc6f3dc]44#if defined(CONFIGURE_INIT)
45int atexit(void (*function)(void)){}
46#endif
[df49c60]47#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
[dfc6f3dc]48#define CONFIGURE_DISABLE_NEWLIB_REENTRANCY
[3a4ae6c]49
[df49c60]50#define CONFIGURE_MAXIMUM_TASKS             4
[3a4ae6c]51
[be1c11ed]52#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
53
[5fe6b21a]54#define CONFIGURE_EXTRA_TASK_STACKS         (3 * RTEMS_MINIMUM_STACK_SIZE)
55
[c8fea7a]56#include <rtems/confdefs.h>
[3a4ae6c]57
[df49c60]58/*
59 *  Handy macros and static inline functions
60 */
61
62/*
63 *  Macro to hide the ugliness of printing the time.
64 */
65
66#define print_time(_s1, _tb, _s2) \
67  do { \
[d66557f]68    printf( "%s%02" PRId32 ":%02" PRId32 ":%02" PRId32 "   %02" PRId32 "/%02" PRId32 "/%04" PRId32 "%s", \
[df49c60]69       _s1, (_tb)->hour, (_tb)->minute, (_tb)->second, \
70       (_tb)->month, (_tb)->day, (_tb)->year, _s2 ); \
71  } while ( 0 )
72
73/*
74 *  Macro to print an task name that is composed of ASCII characters.
75 *
76 */
77
78#define put_name( _name, _crlf ) \
79  do { \
[4c84d7b]80    uint32_t   c0, c1, c2, c3; \
[df49c60]81    \
82    c0 = ((_name) >> 24) & 0xff; \
83    c1 = ((_name) >> 16) & 0xff; \
84    c2 = ((_name) >> 8) & 0xff; \
85    c3 = (_name) & 0xff; \
86    putchar( (char)c0 ); \
87    if ( c1 ) putchar( (char)c1 ); \
88    if ( c2 ) putchar( (char)c2 ); \
89    if ( c3 ) putchar( (char)c3 ); \
90    if ( (_crlf) ) \
91      putchar( '\n' ); \
92  } while (0)
93
94/*
95 *  static inline routine to make obtaining ticks per second easier.
96 */
97
[4c84d7b]98static inline uint32_t   get_ticks_per_second( void )
[df49c60]99{
100  rtems_interval ticks_per_second;
101  (void) rtems_clock_get( RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticks_per_second );  return ticks_per_second;
102}
103
104
105/*
106 *  This allows us to view the "Test_task" instantiations as a set
107 *  of numbered tasks by eliminating the number of application
108 *  tasks created.
109 *
110 *  In reality, this is too complex for the purposes of this
111 *  example.  It would have been easier to pass a task argument. :)
112 *  But it shows how rtems_id's can sometimes be used.
113 */
[3a4ae6c]114
[df49c60]115#define task_number( tid ) \
116  ( rtems_get_index( tid ) - \
117     rtems_configuration_get_rtems_api_configuration()->number_of_initialization_tasks )
[ac7d5ef0]118
119/* end of include file */
Note: See TracBrowser for help on using the repository browser.