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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [posix/] [src/] [ptimer.c] - Blame information for rev 532

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
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
 
43
void 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
 
76
int timer_max;
77
timer_alive_t *timer_struct;
78
 
79
 
80
void _POSIX_Timer_Manager_initialization ( int max_timers )
81
{
82
   int index;
83
 
84
   timer_struct = _Workspace_Allocate_or_fatal_error(
85
      max_timers * sizeof(timer_alive_t) );
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
 

powered by: WebSVN 2.1.0

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