source: examples-v2/ticker/low_ticker/init.c @ 10a452f

Last change on this file since 10a452f was 10a452f, checked in by Joel Sherrill <joel@…>, on Oct 5, 2017 at 2:03:29 PM

ticker/low_ticker/init.c: Add include <rtems/bspIo.h>

  • Property mode set to 100644
File size: 2.2 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2007.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 */
9
10#include <stdlib.h>
11
12#include <bsp.h>
13#include <rtems/bspIo.h>
14
15rtems_task Test_task(
16  rtems_task_argument task_index
17)
18{
19  rtems_time_of_day time;
20  rtems_status_code status;
21
22  for ( ; ; ) {
23    status = rtems_clock_get_tod( &time );
24    if ( time.second >= 35 ) {
25      printk( "*** END OF LOW MEMORY CLOCK TICK TEST ***\n" );
26      rtems_shutdown_executive( 0 );
27    }
28    printk( "TA%d %s%02d:%02d:%02d   %02d/%02d/%04d\n",
29      task_index, " - rtems_clock_get_tod - ", 
30      (int) time.hour, (int) time.minute, (int) time.second,
31      (int) time.month, (int) time.day, (int) time.year );
32    status = rtems_task_wake_after(
33      task_index * 5 * rtems_clock_get_ticks_per_second()
34    );
35  }
36}
37
38rtems_task Init(
39  rtems_task_argument argument
40)
41{
42  rtems_status_code status;
43  rtems_time_of_day time;
44  rtems_id          id;
45  int               i;
46
47  printk( "\n\n*** LOW MEMORY CLOCK TICK TEST ***\n" );
48
49  time.year   = 1988;
50  time.month  = 12;
51  time.day    = 31;
52  time.hour   = 9;
53  time.minute = 0;
54  time.second = 0;
55  time.ticks  = 0;
56
57  status = rtems_clock_set( &time );
58
59  for (i=1 ; i<=3 ; i++ ) {
60    status = rtems_task_create(
61      rtems_build_name( 'T', 'A', 0x30+1, ' ' ), 1, 0, RTEMS_DEFAULT_MODES,
62      RTEMS_DEFAULT_ATTRIBUTES, &id
63    );
64    status = rtems_task_start( id, Test_task, i );
65  }
66
67  while( 1 )
68    ;
69}
70
71/**************** START OF CONFIGURATION INFORMATION ****************/
72
73#define CONFIGURE_INIT
74
75#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
76#define CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
77#define CONFIGURE_DISABLE_NEWLIB_REENTRANCY
78#define CONFIGURE_TERMIOS_DISABLED
79#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 0
80#define CONFIGURE_MINIMUM_TASK_STACK_SIZE 512
81#define CONFIGURE_MAXIMUM_PRIORITY 15
82#define CONFIGURE_DISABLE_CLASSIC_API_NOTEPADS
83#define CONFIGURE_IDLE_TASK_BODY Init
84#define CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION
85
86#define CONFIGURE_MAXIMUM_TASKS             3
87
88#include <rtems/confdefs.h>
89
90/****************  END OF CONFIGURATION INFORMATION  ****************/
Note: See TracBrowser for help on using the repository browser.