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

Subversion Repositories openrisc

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

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

Line No. Rev Author Line
1 30 unneback
/*
2
 *  $Id: sched.c,v 1.2 2001-09-27 11:59:17 chris Exp $
3
 */
4
 
5
#include <assert.h>
6
#include <sched.h>
7
#include <errno.h>
8
 
9
#include <rtems/system.h>
10
#include <rtems/score/tod.h>
11
#include <rtems/score/thread.h>
12
#include <rtems/posix/seterr.h>
13
#include <rtems/posix/priority.h>
14
#include <rtems/posix/time.h>
15
 
16
/*PAGE
17
 *
18
 *  13.3.1 Set Scheduling Parameters, P1003.1b-1993, p. 252
19
 *
20
 */
21
 
22
int sched_setparam(
23
  pid_t                     pid,
24
  const struct sched_param *param
25
)
26
{
27
  set_errno_and_return_minus_one( ENOSYS );
28
}
29
 
30
/*PAGE
31
 *
32
 *  13.3.2 Set Scheduling Parameters, P1003.1b-1993, p. 253
33
 */
34
 
35
int sched_getparam(
36
  pid_t                     pid,
37
  const struct sched_param *param
38
)
39
{
40
  set_errno_and_return_minus_one( ENOSYS );
41
}
42
 
43
/*PAGE
44
 *
45
 *  13.3.3 Set Scheduling Policy and Scheduling Parameters,
46
 *         P1003.1b-1993, p. 254
47
 */
48
 
49
int sched_setscheduler(
50
  pid_t                     pid,
51
  int                       policy,
52
  const struct sched_param *param
53
)
54
{
55
  set_errno_and_return_minus_one( ENOSYS );
56
}
57
 
58
/*PAGE
59
 *
60
 *  13.3.4 Get Scheduling Policy, P1003.1b-1993, p. 256
61
 */
62
 
63
int sched_getscheduler(
64
  pid_t                     pid
65
)
66
{
67
  set_errno_and_return_minus_one( ENOSYS );
68
}
69
 
70
/*PAGE
71
 *
72
 *  13.3.6 Get Scheduling Parameter Limits, P1003.1b-1993, p. 258
73
 */
74
 
75
int sched_get_priority_max(
76
  int  policy
77
)
78
{
79
  switch ( policy ) {
80
    case SCHED_OTHER:
81
    case SCHED_FIFO:
82
    case SCHED_RR:
83
    case SCHED_SPORADIC:
84
      break;
85
 
86
    default:
87
      set_errno_and_return_minus_one( EINVAL );
88
  }
89
 
90
  return POSIX_SCHEDULER_MAXIMUM_PRIORITY;
91
}
92
 
93
/*PAGE
94
 *
95
 *  13.3.6 Get Scheduling Parameter Limits, P1003.1b-1993, p. 258
96
 */
97
 
98
int sched_get_priority_min(
99
  int  policy
100
)
101
{
102
  switch ( policy ) {
103
    case SCHED_OTHER:
104
    case SCHED_FIFO:
105
    case SCHED_RR:
106
    case SCHED_SPORADIC:
107
      break;
108
 
109
    default:
110
      set_errno_and_return_minus_one( EINVAL );
111
  }
112
 
113
  return POSIX_SCHEDULER_MINIMUM_PRIORITY;
114
}
115
 
116
/*PAGE
117
 *
118
 *  13.3.6 Get Scheduling Parameter Limits, P1003.1b-1993, p. 258
119
 */
120
 
121
int sched_rr_get_interval(
122
  pid_t             pid,
123
  struct timespec  *interval
124
)
125
{
126
  /* XXX do we need to support different time quantums per thread */
127
 
128
  /*
129
   *  Only supported for the "calling process" (i.e. this node).
130
   */
131
 
132
  if ( pid && pid != getpid() )
133
    set_errno_and_return_minus_one( ESRCH );
134
 
135
  if ( !interval )
136
    set_errno_and_return_minus_one( EINVAL );
137
 
138
  _POSIX_Interval_to_timespec( _Thread_Ticks_per_timeslice, interval );
139
  return 0;
140
}
141
 
142
/*PAGE
143
 *
144
 *  13.3.5 Yield Processor, P1003.1b-1993, p. 257
145
 */
146
 
147
int sched_yield( void )
148
{
149
  _Thread_Disable_dispatch();
150
    _Thread_Yield_processor();
151
  _Thread_Enable_dispatch();
152
  return 0;
153
}

powered by: WebSVN 2.1.0

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