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

4.115
Last change on this file since f068384e was f068384e, checked in by Sebastian Huber <sebastian.huber@…>, on 07/24/13 at 10:03:31

score: Create schedulerpriority impl header

Move implementation specific parts of schedulerpriority.h and
schedulerpriority.inl into new header file schedulerpriorityimpl.h. The
schedulerpriority.h contains now only the application visible API.

Add missing includes. Remove superfluous includes.

Move declaration of _Priority_Bit_map to prioritybitmap.inl since this
variable is used only here.

Remove second declaration of _Priority_Major_bit_map.

  • 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/score/schedulercbs.h>
22#include <rtems/score/thread.h>
23#include <rtems/score/wkspace.h>
24
25Scheduler_CBS_Server **_Scheduler_CBS_Server_list;
26
27void _Scheduler_CBS_Budget_callout(
28  Thread_Control *the_thread
29)
30{
31  Priority_Control          new_priority;
32  Scheduler_CBS_Per_thread *sched_info;
33  Scheduler_CBS_Server_id   server_id;
34
35  /* Put violating task to background until the end of period. */
36  new_priority = the_thread->Start.initial_priority;
37  if ( the_thread->real_priority != new_priority )
38    the_thread->real_priority = new_priority;
39  if ( the_thread->current_priority != new_priority )
40    _Thread_Change_priority(the_thread, new_priority, true);
41
42  /* Invoke callback function if any. */
43  sched_info = (Scheduler_CBS_Per_thread *) the_thread->scheduler_info;
44  if ( sched_info->cbs_server->cbs_budget_overrun ) {
45    _Scheduler_CBS_Get_server_id(
46        sched_info->cbs_server->task_id,
47        &server_id
48    );
49    sched_info->cbs_server->cbs_budget_overrun( server_id );
50  }
51}
52
53int _Scheduler_CBS_Initialize(void)
54{
55  unsigned int i;
56  _Scheduler_CBS_Server_list = (Scheduler_CBS_Server **) _Workspace_Allocate(
57      _Scheduler_CBS_Maximum_servers * sizeof(Scheduler_CBS_Server*) );
58  if ( !_Scheduler_CBS_Server_list )
59    return SCHEDULER_CBS_ERROR_NO_MEMORY;
60  for (i = 0; i<_Scheduler_CBS_Maximum_servers; i++) {
61    _Scheduler_CBS_Server_list[i] = NULL;
62  }
63  return SCHEDULER_CBS_OK;
64}
Note: See TracBrowser for help on using the repository browser.