OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rtems-20020807/] [cpukit/] [posix/] [src/] [ptimer.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1026 ivang
/*
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 <sys/features.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
 
47
void 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
 
80
int timer_max;
81
POSIX_Timer_Control *timer_struct;
82
 
83
 
84
void _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
}
102
 

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.