source: rtems/cpukit/posix/src/ptimer.c @ 0ff3df03

4.104.114.84.9
Last change on this file since 0ff3df03 was 0ff3df03, checked in by Ralf Corsepius <ralf.corsepius@…>, on Dec 10, 2004 at 4:17:50 AM

2004-12-10 Ralf Corsepius <ralf.corsepius@…>

  • posix/include/aio.h, posix/include/devctl.h, posix/include/intr.h, posix/include/mqueue.h, posix/include/sched.h, posix/include/semaphore.h, posix/src/ptimer.c, posix/src/ptimer1.c: Include <unistd.h> instead of <sys/features.h> to pick up _POSIX_* defines (Mandated by POSIX).
  • Property mode set to 100644
File size: 2.3 KB
Line 
1/*
2 *  ptimer.c,v 1.1 1996/06/03 16:29:58 joel Exp
3 */
4
5#if HAVE_CONFIG_H
6#include "config.h"
7#endif
8
9#include <assert.h>
10#include <time.h>
11#include <errno.h>
12
13#include <rtems/system.h>
14#include <rtems/score/isr.h>
15#include <rtems/score/thread.h>
16#include <rtems/score/tod.h>
17
18#include <rtems/posix/time.h>
19
20/************************************/
21/* These includes are now necessary */
22/************************************/
23
24#include <unistd.h>
25#include <rtems/rtems/status.h>
26#include <rtems/rtems/types.h>
27#include <rtems/rtems/timer.h>
28#include <rtems/rtems/clock.h>
29#include <rtems/posix/psignal.h>
30#include <rtems/score/wkspace.h>
31#include <pthread.h>
32#include <stdio.h>
33#include <signal.h>
34
35/*****************************/
36/* End of necessary includes */
37/*****************************/
38
39#include <rtems/posix/timer.h>
40
41/* ***************************************************************************
42 * TIMER_INITIALIZE_S
43 *
44 *  Description: Initialize the data of a timer
45 * ***************************************************************************/
46
47void TIMER_INITIALIZE_S ( int timer_pos )
48{
49
50   /*
51    * Indicates that the position in the table is free
52    */
53
54    timer_struct[timer_pos].state = STATE_FREE_C;
55
56   /*
57    * The initial data of timing are set with null value
58    */
59
60    timer_struct[timer_pos].timer_data.it_value.tv_sec     = 0;
61    timer_struct[timer_pos].timer_data.it_value.tv_nsec    = 0;
62    timer_struct[timer_pos].timer_data.it_interval.tv_sec  = 0;
63    timer_struct[timer_pos].timer_data.it_interval.tv_nsec = 0;
64
65   /*
66    * The count of expirations is 0
67    */
68
69    timer_struct[timer_pos].overrun = 0;
70
71}
72
73/* ***************************************************************************
74 * _POSIX_Timer_Manager_initialization
75 *
76 *  Description: Initialize the internal structure in which the data of all
77 *               the timers are stored
78 * ***************************************************************************/
79
80int timer_max;
81POSIX_Timer_Control *timer_struct;
82
83
84void _POSIX_Timer_Manager_initialization ( int max_timers )
85{
86   int index;
87
88   timer_struct = _Workspace_Allocate_or_fatal_error(
89      max_timers * sizeof(POSIX_Timer_Control) );
90
91   /*
92    *  Initialize all the timers
93    */
94
95   timer_max = max_timers;
96
97   for (index=0; index<max_timers; index++)
98     TIMER_INITIALIZE_S( index );
99
100   timer_max = max_timers;
101}
Note: See TracBrowser for help on using the repository browser.