Changes between Version 14 and Version 15 of Developer/Projects/SequencedInitialization


Ignore:
Timestamp:
Jun 8, 2010, 8:09:46 PM (9 years ago)
Author:
Wenjie1984
Comment:

/* The rule of sort order */

Legend:

Unmodified
Added
Removed
Modified
  • Developer/Projects/SequencedInitialization

    v14 v15  
    165165domains are {subsystem, order, index}. Every domain is an key word to sort.
    166166
    167 Defined API:
     167Sort order API:
    168168 /*the first domain is subsystem*/
    169169 #define SI_SUB_RTEMS_API 0001
    170 
    171170 /*the second domain is order like before,nomal,after*/
    172171 #define ORDER_BEFORE    0
     
    189188 #define RTEMS_SYSINIT_MAKE_ORDER(a, b, c) #a#b#c
    190189
    191  
    192  typedef void (*rtems_sysinit_function)(rtems_sysinit_state state);
     190Sequenced Initialization API:
     191 /*The type of handler invoked when constructing*/
     192 typedef void ( *sysinit_handler )( void );
     193 /*The core constructe of sysinit*/
     194 typedef struct sysinit_core {
     195  uint8_t order;
     196  /*The handler invoked when constructing*/
     197  sysinit_handler handler;
     198 } sysinit_core;
     199 #define RTEMS_SYSINIT_CORE(order, handler) \
     200  sysinit_core rtems_sysinit_ ## handler ## _core = { \
     201  order, \
     202  handler, \
     203  };
     204 #define RTEMS_SYSINIT_REF(subsystem, index, order, handler) \
     205  extern sysinit_core rtems_sysinit_ ## handler ## _core; \
     206  void const * const rtems_sysinit_ ## handler ## subsystem ## index ## order ## _ref \
     207  __attribute__((section(".rtems.sysinit." RTEMS_SYSINIT_MAKE_ORDER(subsystem, index, order))))\
     208  __attribute__((used)) \
     209  __attribute__((weak)) \
     210  = &rtems_sysinit_ ## handler ## _core;