Changeset e1598a6 in rtems for cpukit/sapi


Ignore:
Timestamp:
Apr 4, 2014, 8:56:36 AM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
69aa3349
Parents:
dc18190
git-author:
Sebastian Huber <sebastian.huber@…> (04/04/14 08:56:36)
git-committer:
Sebastian Huber <sebastian.huber@…> (04/15/14 06:37:11)
Message:

score: Static scheduler configuration

Do not allocate the scheduler control structures from the workspace.
This is a preparation step for configuration of clustered/partitioned
schedulers on SMP.

Location:
cpukit/sapi
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • cpukit/sapi/Makefile.am

    rdc18190 re1598a6  
    1818include_rtems_HEADERS += include/rtems/rbheap.h
    1919include_rtems_HEADERS += include/rtems/rbtree.h
     20include_rtems_HEADERS += include/rtems/scheduler.h
    2021include_rtems_HEADERS += include/rtems/sptables.h
    2122include_rtems_HEADERS += include/rtems/test.h
  • cpukit/sapi/include/confdefs.h

    rdc18190 re1598a6  
    640640 * An application can define its own scheduling policy by defining
    641641 * CONFIGURE_SCHEDULER_USER and the following:
    642  *    - CONFIGURE_SCHEDULER_ENTRY_POINTS
    643  *    - CONFIGURE_MEMORY_FOR_SCHEDULER - base memory
     642 *    - CONFIGURE_SCHEDULER_CONTEXT
     643 *    - CONFIGURE_SCHEDULER_CONTROLS
    644644 *    - CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER - per task memory
    645645 */
    646 #include <rtems/score/scheduler.h>
    647 
    648 #if !defined(RTEMS_SMP)
    649   #undef CONFIGURE_SCHEDULER_SIMPLE_SMP
    650 #endif
    651646
    652647/* If no scheduler is specified, the priority scheduler is default. */
     
    666661#endif
    667662
     663#include <rtems/scheduler.h>
     664
    668665/*
    669666 * If the Priority Scheduler is selected, then configure for it.
    670667 */
    671668#if defined(CONFIGURE_SCHEDULER_PRIORITY)
    672   #include <rtems/score/schedulerpriority.h>
    673   #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_PRIORITY_ENTRY_POINTS
     669  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
     670    #define CONFIGURE_SCHEDULER_CONTEXT \
     671      RTEMS_SCHEDULER_CONTEXT_PRIORITY( \
     672        dflt, \
     673        CONFIGURE_MAXIMUM_PRIORITY + 1 \
     674      )
     675
     676    #define CONFIGURE_SCHEDULER_CONTROLS \
     677      RTEMS_SCHEDULER_CONTROL_PRIORITY(dflt)
     678  #endif
    674679
    675680  /**
    676681   * This defines the memory used by the priority scheduler.
    677682   */
    678   #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
    679     _Configure_From_workspace( \
    680       sizeof(Scheduler_priority_Control) +  \
    681       ((CONFIGURE_MAXIMUM_PRIORITY) * sizeof(Chain_Control)) ) \
    682   )
    683683  #define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER ( \
    684684    _Configure_From_workspace(sizeof(Scheduler_priority_Per_thread)) )
     
    690690 */
    691691#if defined(CONFIGURE_SCHEDULER_PRIORITY_SMP)
    692   #include <rtems/score/schedulerprioritysmp.h>
    693   #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_PRIORITY_SMP_ENTRY_POINTS
     692  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
     693    #define CONFIGURE_SCHEDULER_CONTEXT \
     694      RTEMS_SCHEDULER_CONTEXT_PRIORITY_SMP( \
     695        dflt, \
     696        CONFIGURE_MAXIMUM_PRIORITY + 1 \
     697      )
     698
     699    #define CONFIGURE_SCHEDULER_CONTROLS \
     700      RTEMS_SCHEDULER_CONTROL_PRIORITY_SMP(dflt)
     701  #endif
    694702
    695703  /**
    696704   * This defines the memory used by the priority scheduler.
    697705   */
    698   #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
    699     _Configure_From_workspace( \
    700       sizeof(Scheduler_priority_SMP_Control) +  \
    701       ((CONFIGURE_MAXIMUM_PRIORITY) * sizeof(Chain_Control)) ) \
    702   )
    703706  #define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER ( \
    704707    _Configure_From_workspace(sizeof(Scheduler_priority_Per_thread)) )
     
    710713 */
    711714#if defined(CONFIGURE_SCHEDULER_PRIORITY_AFFINITY_SMP)
    712   #include <rtems/score/schedulerpriorityaffinitysmp.h>
    713   #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_PRIORITY_AFFINITY_SMP_ENTRY_POINTS
     715  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
     716    #define CONFIGURE_SCHEDULER_CONTEXT \
     717      RTEMS_SCHEDULER_CONTEXT_PRIORITY_AFFINITY_SMP( \
     718        dflt, \
     719        CONFIGURE_MAXIMUM_PRIORITY + 1 \
     720      )
     721
     722    #define CONFIGURE_SCHEDULER_CONTROLS \
     723      RTEMS_SCHEDULER_CONTROL_PRIORITY_AFFINITY_SMP(dflt)
     724  #endif
    714725
    715726  /**
    716727   * This defines the memory used by the priority scheduler.
    717728   */
    718   #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
    719     _Configure_From_workspace( \
    720       sizeof(Scheduler_SMP_Control) +  \
    721       ((CONFIGURE_MAXIMUM_PRIORITY) * sizeof(Chain_Control)) ) \
    722   )
    723729  #define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER ( \
    724730    _Configure_From_workspace(sizeof(Scheduler_priority_Per_thread)) )
     
    729735 */
    730736#if defined(CONFIGURE_SCHEDULER_SIMPLE)
    731   #include <rtems/score/schedulersimple.h>
    732   #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_SIMPLE_ENTRY_POINTS
     737  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
     738    #define CONFIGURE_SCHEDULER_CONTEXT RTEMS_SCHEDULER_CONTEXT_SIMPLE(dflt)
     739
     740    #define CONFIGURE_SCHEDULER_CONTROLS RTEMS_SCHEDULER_CONTROL_SIMPLE(dflt)
     741  #endif
    733742
    734743  /**
    735744   * define the memory used by the simple scheduler
    736745   */
    737   #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
    738     _Configure_From_workspace( sizeof( Scheduler_simple_Control ) ) \
    739   )
    740746  #define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER (0)
    741747#endif
     
    745751 */
    746752#if defined(CONFIGURE_SCHEDULER_SIMPLE_SMP)
    747   #include <rtems/score/schedulersimplesmp.h>
    748   #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_SIMPLE_SMP_ENTRY_POINTS
     753  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
     754    #define CONFIGURE_SCHEDULER_CONTEXT \
     755      RTEMS_SCHEDULER_CONTEXT_SIMPLE_SMP(dflt)
     756
     757    #define CONFIGURE_SCHEDULER_CONTROLS \
     758      RTEMS_SCHEDULER_CONTROL_SIMPLE_SMP(dflt)
     759  #endif
    749760
    750761  /**
     
    753764   * NOTE: This is the same as the Simple Scheduler
    754765   */
    755   #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
    756     _Configure_From_workspace( sizeof( Scheduler_simple_SMP_Control ) ) \
    757   )
    758766  #define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER (0)
    759767#endif
     
    763771 */
    764772#if defined(CONFIGURE_SCHEDULER_EDF)
    765   #include <rtems/score/scheduleredf.h>
    766   #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_EDF_ENTRY_POINTS
     773  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
     774    #define CONFIGURE_SCHEDULER_CONTEXT RTEMS_SCHEDULER_CONTEXT_EDF(dflt)
     775
     776    #define CONFIGURE_SCHEDULER_CONTROLS RTEMS_SCHEDULER_CONTROL_EDF(dflt)
     777  #endif
    767778
    768779  /**
    769780   * define the memory used by the EDF scheduler
    770781   */
    771   #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
    772     _Configure_From_workspace(sizeof(Scheduler_EDF_Control)))
    773782  #define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER ( \
    774783    _Configure_From_workspace(sizeof(Scheduler_EDF_Per_thread)))
     
    779788 */
    780789#if defined(CONFIGURE_SCHEDULER_CBS)
    781   #include <rtems/score/schedulercbs.h>
    782   #define CONFIGURE_SCHEDULER_ENTRY_POINTS SCHEDULER_CBS_ENTRY_POINTS
     790  #if !defined(CONFIGURE_SCHEDULER_CONTROLS)
     791    #define CONFIGURE_SCHEDULER_CONTEXT RTEMS_SCHEDULER_CONTEXT_CBS(dflt)
     792
     793    #define CONFIGURE_SCHEDULER_CONTROLS RTEMS_SCHEDULER_CONTROL_CBS(dflt)
     794  #endif
    783795
    784796  #ifndef CONFIGURE_CBS_MAXIMUM_SERVERS
     
    787799
    788800  #ifdef CONFIGURE_INIT
    789     uint32_t _Scheduler_CBS_Maximum_servers = CONFIGURE_CBS_MAXIMUM_SERVERS;
     801    const uint32_t _Scheduler_CBS_Maximum_servers =
     802      CONFIGURE_CBS_MAXIMUM_SERVERS;
     803
     804    Scheduler_CBS_Server
     805      _Scheduler_CBS_Server_list[ CONFIGURE_CBS_MAXIMUM_SERVERS ];
    790806  #endif
    791807
     
    793809   * define the memory used by the CBS scheduler
    794810   */
    795   #define CONFIGURE_MEMORY_FOR_SCHEDULER ( \
    796     _Configure_From_workspace(sizeof(Scheduler_EDF_Control)) + \
    797       _Configure_From_workspace(CONFIGURE_CBS_MAXIMUM_SERVERS * \
    798         sizeof(Scheduler_CBS_Server *)) + \
    799       CONFIGURE_CBS_MAXIMUM_SERVERS * \
    800         _Configure_From_workspace(sizeof(Scheduler_CBS_Server)))
    801811  #define CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER ( \
    802812    _Configure_From_workspace(sizeof(Scheduler_CBS_Per_thread)))
     
    808818 */
    809819#ifdef CONFIGURE_INIT
    810   Scheduler_Control  _Scheduler = {
    811     NULL,                             /* Scheduler Specific Data Pointer */
    812     CONFIGURE_SCHEDULER_ENTRY_POINTS  /* Scheduler Operations */
     820  CONFIGURE_SCHEDULER_CONTEXT;
     821
     822  const Scheduler_Control _Scheduler_Table[] = {
     823    CONFIGURE_SCHEDULER_CONTROLS
    813824  };
     825
     826  #if defined(RTEMS_SMP)
     827    const size_t _Scheduler_Count =
     828      RTEMS_ARRAY_SIZE( _Scheduler_Table );
     829  #endif
    814830
    815831  #if defined(CONFIGURE_SCHEDULER_EDF)
     
    22082224#define CONFIGURE_MEMORY_FOR_SYSTEM_OVERHEAD \
    22092225  ( CONFIGURE_MEMORY_FOR_IDLE_TASK +                /* IDLE and stack */ \
    2210     CONFIGURE_MEMORY_FOR_SCHEDULER +                /* Scheduler */ \
    22112226    CONFIGURE_INTERRUPT_VECTOR_TABLE +             /* interrupt vectors */ \
    22122227    CONFIGURE_INTERRUPT_STACK_MEMORY +             /* interrupt stack */ \
     
    24762491    #endif
    24772492    #ifdef RTEMS_SMP
    2478       CONFIGURE_SMP_MAXIMUM_PROCESSORS
     2493      CONFIGURE_SMP_MAXIMUM_PROCESSORS,
    24792494    #endif
    24802495  };
     
    25582573    uint32_t INTERRUPT_STACK_MEMORY;
    25592574    uint32_t MEMORY_FOR_IDLE_TASK;
    2560     uint32_t MEMORY_FOR_SCHEDULER;
    25612575    uint32_t MEMORY_PER_TASK_FOR_SCHEDULER;
    25622576
     
    26152629    CONFIGURE_INTERRUPT_STACK_MEMORY,
    26162630    CONFIGURE_MEMORY_FOR_IDLE_TASK,
    2617     CONFIGURE_MEMORY_FOR_SCHEDULER,
    26182631    CONFIGURE_MEMORY_PER_TASK_FOR_SCHEDULER,
    26192632
  • cpukit/sapi/preinstall.am

    rdc18190 re1598a6  
    8585PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/rbtree.h
    8686
     87$(PROJECT_INCLUDE)/rtems/scheduler.h: include/rtems/scheduler.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
     88        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/scheduler.h
     89PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/scheduler.h
     90
    8791$(PROJECT_INCLUDE)/rtems/sptables.h: include/rtems/sptables.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
    8892        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/sptables.h
Note: See TracChangeset for help on using the changeset viewer.