source: network-demos/ntp/init.c @ 3ba2f22

4.11network-demos-4-10-branchnetwork-demos-4-6-branchnetwork-demos-4-7-branchnetwork-demos-4-8-branchnetwork-demos-4-9-branch
Last change on this file since 3ba2f22 was 7054195, checked in by Joel Sherrill <joel.sherrill@…>, on 12/14/99 at 13:23:56

Changed CONFIGURATION_MICROSECONDS_PER_TICK definition to a more reasonable
value.

  • Property mode set to 100644
File size: 2.3 KB
Line 
1/*
2 * RTEMS configuration/initialization
3 *
4 * This program may be distributed and used for any purpose.
5 * I ask only that you:
6 *      1. Leave this author information intact.
7 *      2. Document any changes you make.
8 *
9 * W. Eric Norum
10 * Saskatchewan Accelerator Laboratory
11 * University of Saskatchewan
12 * Saskatoon, Saskatchewan, CANADA
13 * eric@skatter.usask.ca
14 *
15 *  $Id$
16 */
17
18#include <bsp.h>
19
20#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
21#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
22#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
23
24#define CONFIGURE_EXECUTIVE_RAM_SIZE    (512*1024)
25#define CONFIGURE_MAXIMUM_SEMAPHORES    20
26#define CONFIGURE_MAXIMUM_TASKS         20
27
28#define CONFIGURE_MICROSECONDS_PER_TICK 10000
29
30#define CONFIGURE_INIT_TASK_STACK_SIZE  (10*1024)
31#define CONFIGURE_INIT_TASK_PRIORITY    120
32#define CONFIGURE_INIT_TASK_INITIAL_MODES (RTEMS_PREEMPT | \
33                                           RTEMS_NO_TIMESLICE | \
34                                           RTEMS_NO_ASR | \
35                                           RTEMS_INTERRUPT_LEVEL(0))
36
37#define CONFIGURE_INIT
38rtems_task Init (rtems_task_argument argument);
39
40#include <confdefs.h>
41
42#include <stdio.h>
43#include <rtems/rtems_bsdnet.h>
44#include <rtems/error.h>
45#include "../networkconfig.h"
46
47/*
48 * RTEMS Startup Task
49 */
50rtems_task
51Init (rtems_task_argument ignored)
52{
53        rtems_status_code sc;
54        rtems_time_of_day now;
55        rtems_interval ticksPerSecond;
56        int rtems_bsdnet_synchronize_ntp (int interval, rtems_task_priority priority);
57
58        printf ("****************** NTP TEST ***************\n");
59        rtems_clock_get (RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticksPerSecond);
60        sc = rtems_clock_get (RTEMS_CLOCK_GET_TOD, &now);
61        if (sc == RTEMS_SUCCESSFUL)
62                printf ("Got time of day -- should have failed!\n");
63        else if (sc != RTEMS_NOT_DEFINED)
64                printf ("Failed to get time of day: %s\n", rtems_status_text (sc));
65        rtems_bsdnet_initialize_network ();
66        rtems_bsdnet_synchronize_ntp (0, 0);
67        sc = rtems_clock_get (RTEMS_CLOCK_GET_TOD, &now);
68        if (sc != RTEMS_SUCCESSFUL)
69                printf ("Failed to get time of day: %s\n", rtems_status_text (sc));
70        printf ("The time is **** %.4d-%.2d-%.2d %.2d:%.2d:%.2d.%.3d (%d) ****\n",
71                                now.year,
72                                now.month,
73                                now.day,
74                                now.hour,
75                                now.minute,
76                                now.second,
77                                (now.ticks * 1000) / ticksPerSecond,
78                                now.ticks);
79        exit (0);
80}
Note: See TracBrowser for help on using the repository browser.