source: rtems/cpukit/score/src/schedulercbs.c @ bf54252

4.115
Last change on this file since bf54252 was bf54252, checked in by Alexandre Devienne <deviennealexandre@…>, on 11/28/12 at 20:14:50

Score misc: Clean up Doxygen #4 (GCI 2012)

This patch is a task from GCI 2012 which improves the Doxygen
comments in the RTEMS source.

http://www.google-melange.com/gci/task/view/google/gci2012/7985215

  • Property mode set to 100644
File size: 1.8 KB
Line 
1/**
2 * @file
3 *
4 * @brief CBS Scheduler Budget Handler
5 * @ingroup ScoreScheduler
6 */
7
8/*
9 *  Copyright (C) 2011 Petr Benes.
10 *  Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/system.h>
22#include <rtems/config.h>
23#include <rtems/score/scheduler.h>
24#include <rtems/score/schedulercbs.h>
25#include <rtems/rtems/signal.h>
26
27Scheduler_CBS_Server **_Scheduler_CBS_Server_list;
28
29void _Scheduler_CBS_Budget_callout(
30  Thread_Control *the_thread
31)
32{
33  Priority_Control          new_priority;
34  Scheduler_CBS_Per_thread *sched_info;
35  Scheduler_CBS_Server_id   server_id;
36
37  /* Put violating task to background until the end of period. */
38  new_priority = the_thread->Start.initial_priority;
39  if ( the_thread->real_priority != new_priority )
40    the_thread->real_priority = new_priority;
41  if ( the_thread->current_priority != new_priority )
42    _Thread_Change_priority(the_thread, new_priority, true);
43
44  /* Invoke callback function if any. */
45  sched_info = (Scheduler_CBS_Per_thread *) the_thread->scheduler_info;
46  if ( sched_info->cbs_server->cbs_budget_overrun ) {
47    _Scheduler_CBS_Get_server_id(
48        sched_info->cbs_server->task_id,
49        &server_id
50    );
51    sched_info->cbs_server->cbs_budget_overrun( server_id );
52  }
53}
54
55int _Scheduler_CBS_Initialize(void)
56{
57  unsigned int i;
58  _Scheduler_CBS_Server_list = (Scheduler_CBS_Server **) _Workspace_Allocate(
59      _Scheduler_CBS_Maximum_servers * sizeof(Scheduler_CBS_Server*) );
60  if ( !_Scheduler_CBS_Server_list )
61    return SCHEDULER_CBS_ERROR_NO_MEMORY;
62  for (i = 0; i<_Scheduler_CBS_Maximum_servers; i++) {
63    _Scheduler_CBS_Server_list[i] = NULL;
64  }
65  return SCHEDULER_CBS_OK;
66}
Note: See TracBrowser for help on using the repository browser.