From c404c2e2e00464fc1a67ad31c03d49ea5e190b16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B7=E9=92=A6=E8=A1=97?= <15390014138@163.com> Date: Wed, 23 Sep 2020 11:20:18 +0800 Subject: [PATCH] =?UTF-8?q?update=20include/hos=5Finit.h.=202=E4=B8=AA?= =?UTF-8?q?=E5=A4=B4=E6=96=87=E4=BB=B6=E5=86=85=E5=AE=B9=E4=B8=80=E8=87=B4?= =?UTF-8?q?=EF=BC=8C=E4=B8=8D=E9=9C=80=E8=A6=81=E9=87=8D=E5=A4=8D=E5=AE=9A?= =?UTF-8?q?=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/hos_init.h | 85 +--------------------------------------------- 1 file changed, 1 insertion(+), 84 deletions(-) diff --git a/include/hos_init.h b/include/hos_init.h index 1f6dee0..77cf2a0 100755 --- a/include/hos_init.h +++ b/include/hos_init.h @@ -1,84 +1 @@ -/* - * Copyright (c) 2020 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OHOS_LAYER_INIT_H -#define OHOS_LAYER_INIT_H -#ifdef __cplusplus -#if __cplusplus -extern "C" { -#endif -#endif -typedef void (*InitCall)(void); - -#define USED_ATTR __attribute__((used)) - -#ifdef LAYER_INIT_SHARED_LIB -#define LAYER_INIT_LEVEL_0 0 -#define LAYER_INIT_LEVEL_1 1 -#define LAYER_INIT_LEVEL_2 2 -#define LAYER_INIT_LEVEL_3 3 -#define LAYER_INIT_LEVEL_4 4 -#define CTOR_VALUE_device 100 -#define CTOR_VALUE_core 110 -#define CTOR_VALUE_sys_service 120 -#define CTOR_VALUE_sys_feature 130 -#define CTOR_VALUE_app_service 140 -#define CTOR_VALUE_app_feature 150 -#define CTOR_VALUE_run 700 -#define LAYER_INITCALL(func, layer, clayer, priority) \ - static __attribute__((constructor(CTOR_VALUE_##layer + LAYER_INIT_LEVEL_##priority))) \ - void BOOT_##layer##priority##func() {func();} -#else -#define LAYER_INITCALL(func, layer, clayer, priority) \ - static const InitCall USED_ATTR __zinitcall_##layer##_##func \ - __attribute__((section(".zinitcall." clayer #priority ".init"))) = func -#endif -// Default priority is 2, priority range is [0, 4] -#define LAYER_INITCALL_DEF(func, layer, clayer) \ - LAYER_INITCALL(func, layer, clayer, 2) - -#define CORE_INIT(func) LAYER_INITCALL_DEF(func, core, "core") -#define CORE_INIT_PRI(func, priority) LAYER_INITCALL(func, core, "core", priority) - - -#define SYS_SERVICE_INIT(func) LAYER_INITCALL_DEF(func, sys_service, "sys.service") -#define SYS_SERVICE_INIT_PRI(func, priority) LAYER_INITCALL(func, sys_service, "sys.service", priority) - - -#define SYS_FEATURE_INIT(func) LAYER_INITCALL_DEF(func, sys_feature, "sys.feature") -#define SYS_FEATURE_INIT_PRI(func, priority) LAYER_INITCALL(func, sys_feature, "sys.feature", priority) - - -#define SYS_RUN(func) LAYER_INITCALL_DEF(func, run, "run") -#define SYS_RUN_PRI(func, priority) LAYER_INITCALL(func, run, "run", priority) - -#define SYSEX_SERVICE_INIT(func) LAYER_INITCALL_DEF(func, app_service, "app.service") -#define SYSEX_SERVICE_INIT_PRI(func, priority) LAYER_INITCALL(func, app_service, "app.service", priority) - -#define SYSEX_FEATURE_INIT(func) LAYER_INITCALL_DEF(func, app_feature, "app.feature") -#define SYSEX_FEATURE_INIT_PRI(func, priority) LAYER_INITCALL(func, app_feature, "app.feature", priority) - -#define APP_SERVICE_INIT(func) LAYER_INITCALL_DEF(func, app_service, "app.service") -#define APP_SERVICE_INIT_PRI(func, priority) LAYER_INITCALL(func, app_service, "app.service", priority) - -#define APP_FEATURE_INIT(func) LAYER_INITCALL_DEF(func, app_feature, "app.feature") -#define APP_FEATURE_INIT_PRI(func, priority) LAYER_INITCALL(func, app_feature, "app.feature", priority) - -#ifdef __cplusplus -#if __cplusplus -} -#endif -#endif -#endif // OHOS_LAYER_INIT_H +#include "ohos_init.h" -- Gitee