Changeset 4fc370e in rtems


Ignore:
Timestamp:
Jun 5, 2013, 10:08:23 AM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
c398c66
Parents:
4f5baff
git-author:
Sebastian Huber <sebastian.huber@…> (06/05/13 10:08:23)
git-committer:
Sebastian Huber <sebastian.huber@…> (06/07/13 15:02:26)
Message:

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.

Location:
cpukit/score
Files:
1 added
24 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/Makefile.am

    r4f5baff r4fc370e  
    4545include_rtems_score_HEADERS += include/rtems/score/sysstate.h
    4646include_rtems_score_HEADERS += include/rtems/score/thread.h
     47include_rtems_score_HEADERS += include/rtems/score/threaddispatch.h
    4748include_rtems_score_HEADERS += include/rtems/score/threadq.h
    4849include_rtems_score_HEADERS += include/rtems/score/threadsync.h
  • cpukit/score/include/rtems/score/thread.h

    r4f5baff r4fc370e  
    4949#if defined(RTEMS_POSIX_API)
    5050  #define RTEMS_SCORE_THREAD_ENABLE_USER_PROVIDED_STACK_VIA_API
    51 #endif
    52 
    53 #if defined(RTEMS_SMP) || \
    54     defined(RTEMS_HEAVY_STACK_DEBUG) || \
    55     defined(RTEMS_HEAVY_MALLOC_DEBUG)
    56   #define __THREAD_DO_NOT_INLINE_DISABLE_DISPATCH__
    57 #endif
    58 
    59 #if defined(RTEMS_SMP) || \
    60    (CPU_INLINE_ENABLE_DISPATCH == FALSE) || \
    61    (__RTEMS_DO_NOT_INLINE_THREAD_ENABLE_DISPATCH__ == 1)
    62   #define __THREAD_DO_NOT_INLINE_ENABLE_DISPATCH__
    6351#endif
    6452
     
    464452
    465453/**
    466  *  The following declares the dispatch critical section nesting
    467  *  counter which is used to prevent context switches at inopportune
    468  *  moments.
    469  */
    470 SCORE_EXTERN volatile uint32_t   _Thread_Dispatch_disable_level;
    471 
    472 #if defined(RTEMS_SMP)
    473   typedef struct {
    474     SMP_lock_Control lock;
    475     int owner_cpu;
    476     int nest_level;
    477   } Thread_Dispatch_disable_level_lock_control;
    478 
    479   /**
    480    * The following declares the smp spinlock to be used to control
    481    * the dispatch critical section accesses across cpus.
    482    */
    483   SCORE_EXTERN Thread_Dispatch_disable_level_lock_control
    484     _Thread_Dispatch_disable_level_lock;
    485 #endif
    486 
    487 /**
    488454 *  The following holds how many user extensions are in the system.  This
    489455 *  is used to determine how many user extension data areas to allocate
     
    541507 */
    542508void _Thread_Start_multitasking( void );
    543 
    544 /**
    545  *  @brief Dispatch thread.
    546  *
    547  *  This routine is responsible for transferring control of the
    548  *  processor from the executing thread to the heir thread. Once the
    549  *  heir is running an attempt is made to dispatch any ASRs.
    550  *  As part of this process, it is responsible for the following actions:
    551  *     + saving the context of the executing thread
    552  *     + restoring the context of the heir thread
    553  *     + dispatching any signals for the resulting executing thread
    554 
    555  *  ALTERNATE ENTRY POINTS:
    556  *    void _Thread_Enable_dispatch();
    557  *
    558  *  - INTERRUPT LATENCY:
    559  *    + dispatch thread
    560  *    + no dispatch thread
    561  */
    562 void _Thread_Dispatch( void );
    563509
    564510/**
     
    904850  ISR_Level                         level
    905851);
    906 #if defined(RTEMS_SMP)
    907 
    908   /**
    909    *  @brief Initializes the thread dispatching subsystem.
    910    *
    911    *  This routine initializes the thread dispatching subsystem.
    912    */
    913   void _Thread_Dispatch_initialization(void);
    914 
    915   /**
    916    *  @brief Checks if thread dispatch says that we are in a critical section.
    917    *
    918    * This routine returns true if thread dispatch indicates
    919    * that we are in a critical section.
    920    */
    921   bool _Thread_Dispatch_in_critical_section(void);
    922 
    923   /**
    924    *  @brief Returns value of the the thread dispatch level.
    925    *
    926    * This routine returns value of the the thread dispatch level.
    927    */
    928   uint32_t _Thread_Dispatch_get_disable_level(void);
    929 
    930   /**
    931    *  @brief Sets thread dispatch level to the value passed in.
    932    *
    933    * This routine sets thread dispatch level to the
    934    * value passed in.
    935    */
    936   uint32_t _Thread_Dispatch_set_disable_level(uint32_t value);
    937 
    938   /**
    939    *  @brief Increments the thread dispatch level.
    940    *
    941    * This rountine increments the thread dispatch level
    942    */
    943   uint32_t _Thread_Dispatch_increment_disable_level(void);
    944 
    945   /**
    946    *  @brief Decrements the thread dispatch level.
    947    *
    948    * This routine decrements the thread dispatch level.
    949    */
    950   uint32_t _Thread_Dispatch_decrement_disable_level(void);
    951 
    952 #else
    953   /*
    954    * The _Thread_Dispatch_... functions are in thread.inl
    955    */
    956 #endif
    957852
    958853#ifndef __RTEMS_APPLICATION__
  • cpukit/score/inline/rtems/score/coremutex.inl

    r4f5baff r4fc370e  
    2323#ifndef _RTEMS_SCORE_COREMUTEX_INL
    2424#define _RTEMS_SCORE_COREMUTEX_INL
     25
     26#include <rtems/score/threaddispatch.h>
    2527
    2628/**
  • cpukit/score/inline/rtems/score/coresem.inl

    r4f5baff r4fc370e  
    3030
    3131#include <rtems/score/thread.h>
     32#include <rtems/score/threaddispatch.h>
    3233#include <rtems/score/threadq.h>
    3334
  • cpukit/score/inline/rtems/score/object.inl

    r4f5baff r4fc370e  
    2323#ifndef _RTEMS_SCORE_OBJECT_INL
    2424#define _RTEMS_SCORE_OBJECT_INL
     25
     26#include <rtems/score/threaddispatch.h>
    2527
    2628/**
  • cpukit/score/inline/rtems/score/thread.inl

    r4f5baff r4fc370e  
    3232/**@{**/
    3333
    34 #if defined(RTEMS_SMP)
    35 
    36   /*
    37    * The _Thread_Dispatch_... functions are prototyped in thread.h.
    38    */
    39 
    40 #else
    41 
    42   /**
    43  * @brief _Thread_Dispatch_in_critical_section
    44    *
    45    * This routine returns true if thread dispatch indicates
    46    * that we are in a critical section.
    47    */
    48   RTEMS_INLINE_ROUTINE bool _Thread_Dispatch_in_critical_section(void)
    49   {
    50      if (  _Thread_Dispatch_disable_level == 0 )
    51       return false;
    52 
    53      return true;
    54   }
    55 
    56   /**
    57    * @brief Get thread dispatch disable level.
    58    *
    59    * This routine returns value of the the thread dispatch level.
    60    */
    61   RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_get_disable_level(void)
    62   {
    63     return _Thread_Dispatch_disable_level;
    64   }
    65 
    66   /**
    67    * @brief Set thread dispatch disable level.
    68    *
    69    * This routine sets thread dispatch level to the
    70    * value passed in.
    71    */
    72   RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_set_disable_level(uint32_t value)
    73   {
    74     _Thread_Dispatch_disable_level = value;
    75     return value;
    76   }
    77 
    78   /**
    79    * @brief Increase thread dispatch disable level.
    80    *
    81    * This rountine increments the thread dispatch level
    82    */
    83   RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_increment_disable_level(void)
    84   {
    85     uint32_t level = _Thread_Dispatch_disable_level;
    86 
    87     ++level;
    88     _Thread_Dispatch_disable_level = level;
    89 
    90     return level;
    91   }
    92 
    93   /**
    94    * @brief Decrease thread dispatch disable level.
    95    *
    96    * This routine decrements the thread dispatch level.
    97    */
    98   RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_decrement_disable_level(void)
    99   {
    100     uint32_t level = _Thread_Dispatch_disable_level;
    101 
    102     --level;
    103     _Thread_Dispatch_disable_level = level;
    104 
    105     return level;
    106   }
    107 
    108   /**
    109    * @brief Thread dispatch initialization.
    110    *
    111    * This routine initializes the thread dispatching subsystem.
    112    */
    113   RTEMS_INLINE_ROUTINE void _Thread_Dispatch_initialization( void )
    114   {
    115     _Thread_Dispatch_set_disable_level( 1 );
    116   }
    117 
    118 #endif
    11934
    12035/**
     
    238153
    239154/**
    240  * This routine prevents dispatching.
    241  */
    242 
    243 #if defined ( __THREAD_DO_NOT_INLINE_DISABLE_DISPATCH__ )
    244 void _Thread_Disable_dispatch( void );
    245 #else
    246 RTEMS_INLINE_ROUTINE void _Thread_Disable_dispatch( void )
    247 {
    248   _Thread_Dispatch_increment_disable_level();
    249   RTEMS_COMPILER_MEMORY_BARRIER();
    250 }
    251 #endif
    252 
    253 /**
    254  * This routine allows dispatching to occur again.  If this is
    255  * the outer most dispatching critical section, then a dispatching
    256  * operation will be performed and, if necessary, control of the
    257  * processor will be transferred to the heir thread.
    258  */
    259 
    260 #if defined ( __THREAD_DO_NOT_INLINE_ENABLE_DISPATCH__ )
    261   void _Thread_Enable_dispatch( void );
    262 #else
    263   /* inlining of enable dispatching must be true */
    264   RTEMS_INLINE_ROUTINE void _Thread_Enable_dispatch( void )
    265   {
    266     RTEMS_COMPILER_MEMORY_BARRIER();
    267     if ( _Thread_Dispatch_decrement_disable_level() == 0 )
    268       _Thread_Dispatch();
    269   }
    270 #endif
    271 
    272 /**
    273  * This routine allows dispatching to occur again.  However,
    274  * no dispatching operation is performed even if this is the outer
    275  * most dispatching critical section.
    276  */
    277 
    278 RTEMS_INLINE_ROUTINE void _Thread_Unnest_dispatch( void )
    279 {
    280   RTEMS_COMPILER_MEMORY_BARRIER();
    281   _Thread_Dispatch_decrement_disable_level();
    282 }
    283 
    284 /**
    285  * This function returns true if dispatching is disabled, and false
    286  * otherwise.
    287  */
    288 
    289 RTEMS_INLINE_ROUTINE bool _Thread_Is_dispatching_enabled( void )
    290 {
    291   return  ( _Thread_Dispatch_in_critical_section() == false );
    292 }
    293 
    294 /**
    295155 * This function returns true if dispatching is disabled, and false
    296156 * otherwise.
  • cpukit/score/preinstall.am

    r4f5baff r4fc370e  
    160160PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/thread.h
    161161
     162$(PROJECT_INCLUDE)/rtems/score/threaddispatch.h: include/rtems/score/threaddispatch.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
     163        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/threaddispatch.h
     164PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/threaddispatch.h
     165
    162166$(PROJECT_INCLUDE)/rtems/score/threadq.h: include/rtems/score/threadq.h $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
    163167        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/threadq.h
  • cpukit/score/src/corerwlocktimeout.c

    r4f5baff r4fc370e  
    2121#include <rtems/system.h>
    2222#include <rtems/score/corerwlock.h>
    23 #include <rtems/score/corerwlock.h>
     23#include <rtems/score/threaddispatch.h>
    2424
    2525void _CORE_RWLock_Timeout(
  • cpukit/score/src/corespinlockwait.c

    r4f5baff r4fc370e  
    2323#include <rtems/score/states.h>
    2424#include <rtems/score/thread.h>
     25#include <rtems/score/threaddispatch.h>
    2526#include <rtems/score/watchdog.h>
    2627
  • cpukit/score/src/coretodset.c

    r4f5baff r4fc370e  
    2222#include <rtems/score/object.h>
    2323#include <rtems/score/thread.h>
     24#include <rtems/score/threaddispatch.h>
    2425#include <rtems/score/timestamp.h>
    2526#include <rtems/score/tod.h>
  • cpukit/score/src/isrsmp.c

    r4f5baff r4fc370e  
    2222#include <rtems/score/isr.h>
    2323#include <rtems/score/thread.h>
     24#include <rtems/score/threaddispatch.h>
    2425#include <rtems/score/smp.h>
    2526
  • cpukit/score/src/schedulercbsattachthread.c

    r4f5baff r4fc370e  
    2323#include <rtems/score/scheduler.h>
    2424#include <rtems/score/schedulercbs.h>
     25#include <rtems/score/threaddispatch.h>
    2526#include <rtems/rtems/object.h>
    2627
  • cpukit/score/src/schedulercbsdetachthread.c

    r4f5baff r4fc370e  
    2424#include <rtems/score/scheduler.h>
    2525#include <rtems/score/schedulercbs.h>
     26#include <rtems/score/threaddispatch.h>
    2627
    2728int _Scheduler_CBS_Detach_thread (
  • cpukit/score/src/schedulercbsgetexecutiontime.c

    r4f5baff r4fc370e  
    2424#include <rtems/score/scheduler.h>
    2525#include <rtems/score/schedulercbs.h>
     26#include <rtems/score/threaddispatch.h>
    2627
    2728int _Scheduler_CBS_Get_execution_time (
  • cpukit/score/src/schedulercbsgetremainingbudget.c

    r4f5baff r4fc370e  
    2323#include <rtems/score/scheduler.h>
    2424#include <rtems/score/schedulercbs.h>
     25#include <rtems/score/threaddispatch.h>
    2526
    2627int _Scheduler_CBS_Get_remaining_budget (
  • cpukit/score/src/smp.c

    r4f5baff r4fc370e  
    2323#include <rtems/score/smp.h>
    2424#include <rtems/score/thread.h>
     25#include <rtems/score/threaddispatch.h>
    2526
    2627#if defined(RTEMS_DEBUG)
  • cpukit/score/src/threadclose.c

    r4f5baff r4fc370e  
    3030#include <rtems/score/sysstate.h>
    3131#include <rtems/score/thread.h>
     32#include <rtems/score/threaddispatch.h>
    3233#include <rtems/score/threadq.h>
    3334#include <rtems/score/userextimpl.h>
  • cpukit/score/src/threaddelayended.c

    r4f5baff r4fc370e  
    2929#include <rtems/score/sysstate.h>
    3030#include <rtems/score/thread.h>
     31#include <rtems/score/threaddispatch.h>
    3132#include <rtems/score/threadq.h>
    3233#include <rtems/score/wkspace.h>
  • cpukit/score/src/threaddisabledispatch.c

    r4f5baff r4fc370e  
    2323#include <rtems/system.h>
    2424#include <rtems/score/thread.h>
     25#include <rtems/score/threaddispatch.h>
    2526
    2627#if defined ( __THREAD_DO_NOT_INLINE_DISABLE_DISPATCH__ )
  • cpukit/score/src/threaddispatch.c

    r4f5baff r4fc370e  
    2929#include <rtems/score/sysstate.h>
    3030#include <rtems/score/thread.h>
     31#include <rtems/score/threaddispatch.h>
    3132#include <rtems/score/threadq.h>
    3233#include <rtems/score/userextimpl.h>
  • cpukit/score/src/threaddispatchdisablelevel.c

    r4f5baff r4fc370e  
    2525#include <rtems/score/states.h>
    2626#include <rtems/score/sysstate.h>
    27 #include <rtems/score/thread.h>
     27#include <rtems/score/threaddispatch.h>
    2828
    2929#define NO_OWNER_CPU (-1)
  • cpukit/score/src/threadget.c

    r4f5baff r4fc370e  
    3030#include <rtems/score/sysstate.h>
    3131#include <rtems/score/thread.h>
     32#include <rtems/score/threaddispatch.h>
    3233#include <rtems/score/threadq.h>
    3334
  • cpukit/score/src/threadhandler.c

    r4f5baff r4fc370e  
    2929#include <rtems/score/sysstate.h>
    3030#include <rtems/score/thread.h>
     31#include <rtems/score/threaddispatch.h>
    3132#include <rtems/score/threadq.h>
    3233#include <rtems/score/userextimpl.h>
  • cpukit/score/src/threadqtimeout.c

    r4f5baff r4fc370e  
    2525#include <rtems/score/states.h>
    2626#include <rtems/score/thread.h>
     27#include <rtems/score/threaddispatch.h>
    2728#include <rtems/score/threadq.h>
    2829#include <rtems/score/tqdata.h>
Note: See TracChangeset for help on using the changeset viewer.