1.11.7. Startup sequence

The startup and initialization sequence is provided with the following hook id’s in the ulHook parameter of the HookFunction() of a component:

static RTS_RESULT CDECL HookFunction(RTS_UI32 ulHook, RTS_UINTPTR ulParam1, RTS_UINTPTR ulParam2)
  • CH_INIT_SYSTEM / CH_INIT_SYSTEM2:
    Hooks reserved for the system components for initialization! A standard component can ignore these hooks.
  • CH_INIT:
    Init your own component local variables.
  • CH_INIT2:
    You can call other component interface functions.
    An event provider must create here its event object!
  • CH_INIT3:
    Further initialization operations.
    An event consumer can open here the existing event and register its callback routine
  • CH_INIT_SYSTEM_TASKS:
    At this hook the system components start their tasks. A standard component can ignore this hook.
  • CH_INIT_TASKS:
    At this hook you can start tasks. In this hook your component must be aware of multitasking calls!
  • CH_INIT_COMM:
    Here the communication servers are started and open the runtime from outside.
  • CH_INIT_FINISHED:
    Final call to signalize all components, that the runtime system startup has finished.

The same in the opposite direction for the shutdown sequence, which is explained in the following chapter.

1.11.8. Shutdown sequence

A dedicated shutdown sequence is not available on most controllers! This is because the power is immediately switched off and there mostly no uninterruptible power supply (UPS) available.

But on systems with a dedicated shutdown behaviour, the runtime system has the possibility to handle this sequence in the reverse order as the startup sequence.

  • CH_EXIT_COMM:
    Here the communication servers are stopped.
  • CH_EXIT_TASKS:
    At this hook you have to exit/stop your tasks.
  • CH_EXIT_SYSTEM_TASKS:
    At this hook the system components stopped their tasks.
  • CH_EXIT3:
    First deinitialization operations.
    An event consumer can close here the existing event and unregister its callback routine
  • CH_EXIT2:
    Second deinitialization operations.
    An event provider must delete here its event object!
  • CH_EXIT:
    Release your own component local variables.
  • CH_EXIT_SYSTEM / CH_EXIT_SYSTEM2:
    Hooks reserved for the system components! A standard component can ignore these hooks.