Subversion Repositories shark

Rev

Rev 334 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
324 giacomo 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
 *   Trimarchi Michael   <trimarchi@gandalf.sssup.it>
10
 *   (see the web pages for full authors list)
11
 *
12
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
13
 *
14
 * http://www.sssup.it
15
 * http://retis.sssup.it
16
 * http://shark.sssup.it
17
 */
18
 
19
/*
20
 * Copyright (C) 2000 Paolo Gai
21
 *
22
 * This program is free software; you can redistribute it and/or modify
23
 * it under the terms of the GNU General Public License as published by
24
 * the Free Software Foundation; either version 2 of the License, or
25
 * (at your option) any later version.
26
 *
27
 * This program is distributed in the hope that it will be useful,
28
 * but WITHOUT ANY WARR2ANTY; without even the implied waRR2anty of
29
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
30
 * GNU General Public License for more details.
31
 *
32
 * You should have received a copy of the GNU General Public License
33
 * along with this program; if not, write to the Free Software
34
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
35
 *
36
 */
37
 
38
 
39
#include <ll/stdio.h>
40
#include <ll/string.h>
41
#include <kernel/model.h>
42
#include <kernel/descr.h>
43
#include <kernel/var.h>
44
#include <kernel/func.h>
45
#include <kernel/trace.h>
46
#include "mpegstar.h"
47
#include "fsf_server.h"
48
 
49
#define MPEGSTAR_DEBUG
50
 
51
/*+ Status used in the level +*/
52
#define MPEGSTAR_READY   MODULE_STATUS_BASE
53
 
54
/*+ the level redefinition for the Round Robin level +*/
55
typedef struct {
56
  level_des l;          /*+ the standard level descriptor          +*/
57
 
58
  int scheduling_level;
59
 
60
} MPEGSTAR_level_des;
61
 
62
static int MPEGSTAR_public_eligible(LEVEL l, PID p)
63
{
64
  MPEGSTAR_level_des *lev = (MPEGSTAR_level_des *)(level_table[l]);
65
  return level_table[ lev->scheduling_level ]->
66
      private_eligible(lev->scheduling_level,p);
67
 
68
  return 0;
69
}
70
 
71
static int MPEGSTAR_public_create(LEVEL l, PID p, TASK_MODEL *m)
72
{
73
  MPEGSTAR_level_des *lev = (MPEGSTAR_level_des *)(level_table[l]);
74
 
75
  return 0; /* OK */
76
}
77
 
78
static void MPEGSTAR_public_dispatch(LEVEL l, PID p, int nostop)
79
{
80
  MPEGSTAR_level_des *lev = (MPEGSTAR_level_des *)(level_table[l]);
81
 
82
}
83
 
84
static void MPEGSTAR_public_epilogue(LEVEL l, PID p)
85
{
86
  MPEGSTAR_level_des *lev = (MPEGSTAR_level_des *)(level_table[l]);
87
 
88
}
89
 
90
static void MPEGSTAR_public_activate(LEVEL l, PID p)
91
{
92
  MPEGSTAR_level_des *lev = (MPEGSTAR_level_des *)(level_table[l]);
93
 
94
}
95
 
96
static void MPEGSTAR_public_unblock(LEVEL l, PID p)
97
{
98
  MPEGSTAR_level_des *lev = (MPEGSTAR_level_des *)(level_table[l]);
99
 
100
}
101
 
102
static void MPEGSTAR_public_block(LEVEL l, PID p)
103
{  
104
  MPEGSTAR_level_des *lev = (MPEGSTAR_level_des *)(level_table[l]);
105
 
106
}
107
 
108
static int MPEGSTAR_public_message(LEVEL l, PID p, void *m)
109
{
110
  MPEGSTAR_level_des *lev = (MPEGSTAR_level_des *)(level_table[l]);
111
 
112
  switch ((long)(m)) {
113
 
114
    /* Task EndCycle */
115
    case (long)(NULL):
116
 
117
      break;
118
 
119
    /* Task Disable */
120
    case (long)(1):
121
 
122
      break;
123
 
124
    default:
125
 
126
      break;
127
 
128
  }
129
 
130
  return 0;
131
 
132
}
133
 
134
static void MPEGSTAR_public_end(LEVEL l, PID p)
135
{
136
  MPEGSTAR_level_des *lev = (MPEGSTAR_level_des *)(level_table[l]);
137
 
138
}
139
 
140
/* Registration functions */
141
 
142
/*+ Registration function:
143
    TIME slice                the slice for the Round Robin queue +*/
144
LEVEL MPEGSTAR_register_level()
145
{
146
  LEVEL l;            /* the level that we register */
147
  MPEGSTAR_level_des *lev;  /* for readableness only */
148
 
149
  l = level_alloc_descriptor(sizeof(MPEGSTAR_level_des));
150
 
151
  lev = (MPEGSTAR_level_des *)level_table[l];
152
 
153
  lev->l.public_guarantee = NULL;
154
  lev->l.public_create    = MPEGSTAR_public_create;
155
  lev->l.public_end       = MPEGSTAR_public_end;
156
  lev->l.public_dispatch  = MPEGSTAR_public_dispatch;
157
  lev->l.public_epilogue  = MPEGSTAR_public_epilogue;
158
  lev->l.public_activate  = MPEGSTAR_public_activate;
159
  lev->l.public_unblock   = MPEGSTAR_public_unblock;
160
  lev->l.public_block     = MPEGSTAR_public_block;
161
  lev->l.public_message   = MPEGSTAR_public_message;
162
  lev->l.public_eligible  = MPEGSTAR_public_eligible;
163
 
164
  return l;
165
 
166
}