Subversion Repositories shark

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 pj 1
/*
2
 * Project: S.Ha.R.K.
3
 *
4
 * Coordinators:
5
 *   Giorgio Buttazzo    <giorgio@sssup.it>
6
 *   Paolo Gai           <pj@gandalf.sssup.it>
7
 *
8
 * Authors     :
9
 *   Paolo Gai           <pj@gandalf.sssup.it>
10
 *   Massimiliano Giorgi <massy@gandalf.sssup.it>
11
 *   Luca Abeni          <luca@gandalf.sssup.it>
12
 *   (see the web pages for full authors list)
13
 *
14
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
15
 *
16
 * http://www.sssup.it
17
 * http://retis.sssup.it
18
 * http://shark.sssup.it
19
 */
20
 
21
 
22
/**
23
 ------------
24
 CVS :        $Id: pc.h,v 1.1.1.1 2002-03-29 14:12:51 pj Exp $
25
 
26
 File:        $File$
27
 Revision:    $Revision: 1.1.1.1 $
28
 Last update: $Date: 2002-03-29 14:12:51 $
29
 ------------
30
 
31
 This file contains the Priority Ceiling (PC) Protocol
32
 
33
 Title:
34
   PC (Priority Ceiling protocol)
35
 
36
 Resource Models Accepted:
37
   PC_RES_MODEL
38
     This model is used to tell a PC level the priority of a task.
39
 
40
 Description:
41
   This module implement the Priority Ceiling Protocol.
42
   The priority inheritance is made using the shadow field of the
43
   task descriptor. No difference is made upon the task model of the
44
   tasks that use PC mutexes.
45
 
46
   This module is directly derived from the PI one.
47
 
48
   A PC mutex is created passing the PC_mutexattr structure to mutex_init.
49
 
50
   When a task is created, a priority must be assigned to the task. This
51
   priority is specified using a PC_RES_MODEL resource model.
52
 
53
 Exceptions raised:
54
   XMUTEX_OWNER_KILLED
55
     This exception is raised when a task ends and it owns one or more
56
     mutexes
57
 
58
 Restrictions & special features:
59
   - This module is NOT Posix compliant
60
   - This module can manage any number of PC mutexes.
61
   - If a task ends (because it reaches the end of the body or because it
62
     is killed by someone) and it owns some mutex, an exception is raised.
63
   - if a mutex unlock is called on a mutex not previously
64
     locked or previously locked by another task an exception is raised
65
   - A PC mutex can't be statically allocated.
66
 
67
**/
68
 
69
/*
70
 * Copyright (C) 2000 Paolo Gai
71
 *
72
 * This program is free software; you can redistribute it and/or modify
73
 * it under the terms of the GNU General Public License as published by
74
 * the Free Software Foundation; either version 2 of the License, or
75
 * (at your option) any later version.
76
 *
77
 * This program is distributed in the hope that it will be useful,
78
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
79
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
80
 * GNU General Public License for more details.
81
 *
82
 * You should have received a copy of the GNU General Public License
83
 * along with this program; if not, write to the Free Software
84
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
85
 *
86
 */
87
 
88
 
89
 
90
#ifndef __PC_H__
91
#define __PC_H__
92
 
93
#include <kernel/types.h>
94
#include <kernel/descr.h>
95
 
96
void PC_register_module(void);
97
 
98
/*+ This function gets the ceiling of a PC mutex, and it have to be called
99
    only by a task that owns the mutex.
100
    Returns -1 if the mutex is not a PC mutex, 0 otherwise +*/
101
int PC_get_mutex_ceiling(const mutex_t *mutex, DWORD *ceiling);
102
 
103
/*+ This function sets the ceiling of a PC mutex, and it have to be called
104
    only by a task that owns the mutex.
105
    Returns -1 if the mutex is not a PC mutex, 0 otherwise +*/
106
int PC_set_mutex_ceiling(mutex_t *mutex, DWORD ceiling, DWORD *old_ceiling);
107
 
108
/*+ This function sets the ceiling of a task +*/
109
void PC_set_task_ceiling(RLEVEL r, PID p, DWORD priority);
110
 
111
#endif