source: rtems/cpukit/posix/src/ptimer.c @ 188c82b

4.104.114.84.95
Last change on this file since 188c82b was 939e29d, checked in by Joel Sherrill <joel.sherrill@…>, on 08/15/00 at 13:19:57

2000-08-15 Joel Sherrill <joel@…>

  • src/ptimer1.c: Removed unused routine PRINT_ERRNO_S.
  • src/ptimer1.c: Removed unnecessary routine COPY_ITIMERSPEC_S and used structure copy instead.
  • src/ptimer1.c: Renamed timer_alive_t to POSIX_Timer_Control.
  • include/rtems/posix/timer.h: Ditto.
  • 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#include <assert.h>
6#include <time.h>
7#include <errno.h>
8
9#include <rtems/system.h>
10#include <rtems/score/isr.h>
11#include <rtems/score/thread.h>
12#include <rtems/score/tod.h>
13
14#include <rtems/posix/time.h>
15
16/************************************/
17/* These includes are now necessary */
18/************************************/
19
20#include <sys/features.h>
21#include <rtems/rtems/status.h>
22#include <rtems/rtems/types.h>
23#include <rtems/rtems/timer.h>
24#include <rtems/rtems/clock.h>
25#include <rtems/posix/psignal.h>
26#include <rtems/score/wkspace.h>
27#include <pthread.h>
28#include <stdio.h>
29#include <signal.h>
30
31/*****************************/
32/* End of necessary includes */
33/*****************************/
34
35#include <rtems/posix/timer.h>
36
37/* ***************************************************************************
38 * TIMER_INITIALIZE_S
39 *
40 *  Description: Initialize the data of a timer
41 * ***************************************************************************/
42
43void TIMER_INITIALIZE_S ( int timer_pos )
44{
45
46   /*
47    * Indicates that the position in the table is free
48    */
49
50    timer_struct[timer_pos].state = STATE_FREE_C;
51
52   /*
53    * The initial data of timing are set with null value
54    */
55
56    timer_struct[timer_pos].timer_data.it_value.tv_sec     = 0;
57    timer_struct[timer_pos].timer_data.it_value.tv_nsec    = 0;
58    timer_struct[timer_pos].timer_data.it_interval.tv_sec  = 0;
59    timer_struct[timer_pos].timer_data.it_interval.tv_nsec = 0;
60
61   /*
62    * The count of expirations is 0
63    */
64
65    timer_struct[timer_pos].overrun = 0;
66
67}
68
69/* ***************************************************************************
70 * _POSIX_Timer_Manager_initialization
71 *
72 *  Description: Initialize the internal structure in which the data of all
73 *               the timers are stored
74 * ***************************************************************************/
75
76int timer_max;
77POSIX_Timer_Control *timer_struct;
78
79
80void _POSIX_Timer_Manager_initialization ( int max_timers )
81{
82   int index;
83
84   timer_struct = _Workspace_Allocate_or_fatal_error(
85      max_timers * sizeof(POSIX_Timer_Control) );
86
87   /*
88    *  Initialize all the timers
89    */
90
91   timer_max = max_timers;
92
93   for (index=0; index<max_timers; index++)
94     TIMER_INITIALIZE_S( index );
95
96   timer_max = max_timers;
97}
98
Note: See TracBrowser for help on using the repository browser.