source: rtems/cpukit/score/src/isrsmp.c @ 4fc370e

4.115
Last change on this file since 4fc370e was 4fc370e, checked in by Sebastian Huber <sebastian.huber@…>, on 06/05/13 at 10:08:23

score: Move thread dispatch content to new file

Move thread dispatch declarations and inline functions to new header
<rtems/score/threaddispatch.h> to make it independent of the
Thread_Control structure. This avoids a cyclic dependency in case
thread dispatch functions are used for the object implementation.

  • Property mode set to 100644
File size: 1.9 KB
RevLine 
[e655f7e]1/**
2 *  @file
[dad36c52]3 *
[e655f7e]4 *  @brief Initialize, Disable, Enable, Flash, Enter, Exit ISR Implementation
5 *  @ingroup ScoreISR
6 */
7
8/*
[dad36c52]9 *  COPYRIGHT (c) 1989-2011.
10 *  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/score/isr.h>
23#include <rtems/score/thread.h>
[4fc370e]24#include <rtems/score/threaddispatch.h>
[dad36c52]25#include <rtems/score/smp.h>
26
27void _ISR_SMP_Initialize(void)
28{
29}
30
31ISR_Level _ISR_SMP_Disable(void)
32{
33  ISR_Level level;
34
35  _ISR_Disable_on_this_core( level );
36  return level;
37}
38
39void _ISR_SMP_Enable(ISR_Level level)
40{
41  _ISR_Enable_on_this_core( level );
42}
43
44void _ISR_SMP_Flash(ISR_Level level)
45{
46  ISR_Level ignored;
47
48  _ISR_SMP_Enable( level );
49  ignored = _ISR_SMP_Disable();
50}
51
52int _ISR_SMP_Enter(void)
53{
54  uint32_t isr_nest_level;
55  ISR_Level level;
56
57  _ISR_Disable_on_this_core( level );
58
59  isr_nest_level = _ISR_Nest_level++;
60
61  _Thread_Disable_dispatch();
62
63  return isr_nest_level;
64}
65
66int _ISR_SMP_Exit(void)
67{
68  ISR_Level level;
69  int       retval;
70
71  retval = 0;
72
73  _ISR_Disable_on_this_core( level );
74
75  _ISR_Nest_level--;
76
77  if ( _ISR_Nest_level == 0 ) {
78    if ( _Thread_Dispatch_necessary ) {
79      if ( _Thread_Dispatch_get_disable_level() == 1 ) {
80        retval = 1;
81      }
82    }
83  }
84
85  /*
86   *  SPARC has special support to avoid some nasty recursive type behaviour.
87   *  When dispatching in a thread and we want to return to it then it needs
88   *  to finish.
89   */
90  #if defined(__sparc__)
91    if ( _CPU_ISR_Dispatch_disable )
92      retval = 0;
93  #endif
94
95  _ISR_Enable_on_this_core( level );
96
97  _Thread_Dispatch_decrement_disable_level();
98
99   if ( retval == 0 )
100    _SMP_Request_other_cores_to_dispatch();
101
102  return retval;
103}
Note: See TracBrowser for help on using the repository browser.