# OHOS Init ## **Overview** Provides the entries for initializing and starting services and features. This module provides the entries for initializing services and features during service development. Services and features are initialized in the following sequence: core phase, core system service, core system feature, system startup, system service, system feature, application-layer service, and application-layer feature. **Since:** 1.0 **Version:** 1.0 ## **Summary** ## Files

File Name

Description

ohos_init.h

Provides the entries for initializing and starting services and features.

## Macros

Macro Name and Value

Description

CORE_INIT(func) LAYER_INITCALL_DEF(func, core, "core")

Identifies the entry for initializing and starting a core phase by the priority 2.

CORE_INIT_PRI(func, priority) LAYER_INITCALL(func, core, "core", priority)

Identifies the entry for initializing and starting a core phase by the specified priority.

SYS_SERVICE_INIT(func) LAYER_INITCALL_DEF(func, sys_service, "sys.service")

Identifies the entry for initializing and starting a core system service by the priority 2.

SYS_SERVICE_INIT_PRI(func, priority) LAYER_INITCALL(func, sys_service, "sys.service", priority)

Identifies the entry for initializing and starting a core system service by the specified priority.

SYS_FEATURE_INIT(func) LAYER_INITCALL_DEF(func, sys_feature, "sys.feature")

Identifies the entry for initializing and starting a core system feature by the priority 2.

SYS_FEATURE_INIT_PRI(func, priority) LAYER_INITCALL(func, sys_feature, "sys.feature", priority)

Identifies the entry for initializing and starting a core system feature by the specified priority.

SYS_RUN(func) LAYER_INITCALL_DEF(func, run, "run")

Identifies the entry for initializing and starting a system running phase by the priority 2.

SYS_RUN_PRI(func, priority) LAYER_INITCALL(func, run, "run", priority)

Identifies the entry for initializing and starting a system running phase by the specified priority.

SYSEX_SERVICE_INIT(func) LAYER_INITCALL_DEF(func, app_service, "app.service")

Identifies the entry for initializing and starting a system service by the priority 2.

SYSEX_SERVICE_INIT_PRI(func, priority) LAYER_INITCALL(func, app_service, "app.service", priority)

Identifies the entry for initializing and starting a system service by the specified priority.

SYSEX_FEATURE_INIT(func) LAYER_INITCALL_DEF(func, app_feature, "app.feature")

Identifies the entry for initializing and starting a system feature by the priority 2.

SYSEX_FEATURE_INIT_PRI(func, priority) LAYER_INITCALL(func, app_feature, "app.feature", priority)

Identifies the entry for initializing and starting a system feature by the specified priority.

APP_SERVICE_INIT(func) LAYER_INITCALL_DEF(func, app_service, "app.service")

Identifies the entry for initializing and starting an application-layer service by the priority 2.

APP_SERVICE_INIT_PRI(func, priority) LAYER_INITCALL(func, app_service, "app.service", priority)

Identifies the entry for initializing and starting an application-layer service by the specified priority.

APP_FEATURE_INIT(func) LAYER_INITCALL_DEF(func, app_feature, "app.feature")

Identifies the entry for initializing and starting an application-layer feature by the priority 2.

APP_FEATURE_INIT_PRI(func, priority) LAYER_INITCALL(func, app_feature, "app.feature", priority)

Identifies the entry for initializing and starting an application-layer feature by the specified priority.

## **Details** ## **Macro Definition Documentation** ## APP\_FEATURE\_INIT ``` #define APP_FEATURE_INIT( func)   LAYER_INITCALL_DEF(func, app_feature, "app.feature") ``` **Description:** Identifies the entry for initializing and starting an application-layer feature by the priority 2. This macro is used to identify the entry called at the priority 2 of the application-layer feature phase of the startup process. **Parameters:**

Name

Description

func

Indicates the entry function for initializing and starting an application-layer feature. The type is void (*)(void).

## APP\_FEATURE\_INIT\_PRI ``` #define APP_FEATURE_INIT_PRI( func,  priority )   LAYER_INITCALL(func, app_feature, "app.feature", priority) ``` **Description:** Identifies the entry for initializing and starting an application-layer feature by the specified priority. This macro is used to identify the entry called at the specified priority of the application-layer feature phase of the startup process. **Parameters:**

Name

Description

func

Indicates the entry function for initializing and starting an application-layer feature. The type is void (*)(void).

priority

Indicates the calling priority when starting the application-layer feature. The value range is [0, 5), and the calling sequence is 0, 1, 2, 3, and 4.

## APP\_SERVICE\_INIT ``` #define APP_SERVICE_INIT( func)   LAYER_INITCALL_DEF(func, app_service, "app.service") ``` **Description:** Identifies the entry for initializing and starting an application-layer service by the priority 2. This macro is used to identify the entry called at the priority 2 of the application-layer service phase of the startup process. **Parameters:**

Name

Description

func

Indicates the entry function for initializing and starting an application-layer service. The type is void (*)(void).

## APP\_SERVICE\_INIT\_PRI ``` #define APP_SERVICE_INIT_PRI( func,  priority )   LAYER_INITCALL(func, app_service, "app.service", priority) ``` **Description:** Identifies the entry for initializing and starting an application-layer service by the specified priority. This macro is used to identify the entry called at the specified priority of the application-layer service phase of the startup process. **Parameters:**

Name

Description

func

Indicates the entry function for initializing and starting an application-layer service. The type is void (*)(void).

priority

Indicates the calling priority when starting the application-layer service phase. The value range is [0,5), and the calling sequence is 0, 1, 2, 3, and 4.

## CORE\_INIT ``` #define CORE_INIT( func)   LAYER_INITCALL_DEF(func, core, "core") ``` **Description:** Identifies the entry for initializing and starting a core phase by the priority 2. This macro is used when Samgr is initialized and started. This macro is used to identify the entry called at the priority 2 of the core phase of the startup process. **Parameters:**

Name

Description

func

Indicates the entry function for initializing and starting a core phase. The type is void (*)(void).

## CORE\_INIT\_PRI ``` #define CORE_INIT_PRI( func,  priority )   LAYER_INITCALL(func, core, "core", priority) ``` **Description:** Identifies the entry for initializing and starting a core phase by the specified priority. This macro is used when Samgr is initialized and started. This macro is used to identify the entry called at the specified priority of the core phase of the startup process. **Parameters:**

Name

Description

func

Indicates the entry function for initializing and starting a core phase. The type is void (*)(void).

priority

Indicates the calling priority when starting the core phase. The value range is [0,5), and the calling sequence is 0, 1, 2, 3, and 4.

## SYS\_FEATURE\_INIT ``` #define SYS_FEATURE_INIT( func)   LAYER_INITCALL_DEF(func, sys_feature, "sys.feature") ``` **Description:** Identifies the entry for initializing and starting a core system feature by the priority 2. This macro is used to identify the entry called at the priority 2 in the core system feature phase of the startup process. **Parameters:**

Name

Description

func

Indicates the entry function for initializing and starting a core system service. The type is void (*)(void).

## SYS\_FEATURE\_INIT\_PRI ``` #define SYS_FEATURE_INIT_PRI( func,  priority )   LAYER_INITCALL(func, sys_feature, "sys.feature", priority) ``` **Description:** Identifies the entry for initializing and starting a core system feature by the specified priority. This macro is used to identify the entry called at the specified priority in the core system feature phase of the startup process. **Parameters:**

Name

Description

func

Indicates the entry function for initializing and starting a core system feature. The type is void (*)(void).

priority

Indicates the calling priority when starting the core system feature phase. The value range is [0, 5), and the calling sequence is 0, 1, 2, 3, and 4.

## SYS\_RUN ``` #define SYS_RUN( func)   LAYER_INITCALL_DEF(func, run, "run") ``` **Description:** Identifies the entry for initializing and starting a system running phase by the priority 2. This macro is used to identify the entry called at the priority 2 in the system startup phase of the startup process. **Parameters:**

Name

Description

func

Indicates the entry function for initializing and starting a system running phase. The type is void (*)(void).

## SYS\_RUN\_PRI ``` #define SYS_RUN_PRI( func,  priority )   LAYER_INITCALL(func, run, "run", priority) ``` **Description:** Identifies the entry for initializing and starting a system running phase by the specified priority. This macro is used to identify the entry called at the specified priority in the system startup phase of the startup process. **Parameters:**

Name

Description

func

Indicates the entry function for initializing and starting a system running phase. The type is void (*)(void).

priority

Indicates the calling priority when starting the system startup phase. The value range is [0, 5), and the calling sequence is 0, 1, 2, 3, and 4.

## SYS\_SERVICE\_INIT ``` #define SYS_SERVICE_INIT( func)   LAYER_INITCALL_DEF(func, sys_service, "sys.service") ``` **Description:** Identifies the entry for initializing and starting a core system service by the priority 2. This macro is used to identify the entry called at the priority 2 in the core system service phase of the startup process. **Parameters:**

Name

Description

func

Indicates the entry function for initializing and starting a core system service. The type is void (*)(void).

## SYS\_SERVICE\_INIT\_PRI ``` #define SYS_SERVICE_INIT_PRI( func,  priority )   LAYER_INITCALL(func, sys_service, "sys.service", priority) ``` **Description:** Identifies the entry for initializing and starting a core system service by the specified priority. This macro is used to identify the entry called at the specified priority in the core system service phase of the startup process. **Parameters:**

Name

Description

func

Indicates the entry function for initializing and starting a core system service. The type is void (*)(void).

priority

Indicates the calling priority when starting the core system service in the startup phase. The value range is [0,5), and the calling sequence is 0, 1, 2, 3, and 4.

## SYSEX\_FEATURE\_INIT ``` #define SYSEX_FEATURE_INIT( func)   LAYER_INITCALL_DEF(func, app_feature, "app.feature") ``` **Description:** Identifies the entry for initializing and starting a system feature by the priority 2. This macro is used to identify the entry called at the priority 2 of the system feature phase of the startup process. **Parameters:**

Name

Description

func

Indicates the entry function for initializing and starting a system feature. The type is void (*)(void).

## SYSEX\_FEATURE\_INIT\_PRI ``` #define SYSEX_FEATURE_INIT_PRI( func,  priority )   LAYER_INITCALL(func, app_feature, "app.feature", priority) ``` **Description:** Identifies the entry for initializing and starting a system feature by the specified priority. This macro is used to identify the entry called at the specified priority of the system feature phase of the startup process. **Parameters:**

Name

Description

func

Indicates the entry function for initializing and starting a system feature. The type is void (*)(void).

priority

Indicates the calling priority when starting the system feature phase. The value range is [0,5), and the calling sequence is 0, 1, 2, 3, and 4.

## SYSEX\_SERVICE\_INIT ``` #define SYSEX_SERVICE_INIT( func)   LAYER_INITCALL_DEF(func, app_service, "app.service") ``` **Description:** Identifies the entry for initializing and starting a system service by the priority 2. This macro is used to identify the entry called at the priority 2 in the system service phase of the startup process. **Parameters:**

Name

Description

func

Indicates the entry function for initializing and starting a system service. The type is void (*)(void).

## SYSEX\_SERVICE\_INIT\_PRI ``` #define SYSEX_SERVICE_INIT_PRI( func,  priority )   LAYER_INITCALL(func, app_service, "app.service", priority) ``` **Description:** Identifies the entry for initializing and starting a system service by the specified priority. This macro is used to identify the entry called at the specified priority of the system service phase of the startup process. **Parameters:**

Name

Description

func

Indicates the entry function for initializing and starting a system service. The type is void (*)(void).

priority

Indicates the calling priority when starting the system service phase. The value range is [0,5), and the calling sequence is 0, 1, 2, 3, and 4.