1 /** 2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. \n 14 * Licensed under the Apache License, Version 2.0 (the "License"); 15 * you may not use this file except in compliance with the License. 16 * You may obtain a copy of the License at 17 * 18 * http://www.apache.org/licenses/LICENSE-2.0 19 * 20 * Unless required by applicable law or agreed to in writing, software 21 * distributed under the License is distributed on an "AS IS" BASIS, 22 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 * See the License for the specific language governing permissions and 24 * limitations under the License. * 25 * Description: Provides the entries for initializing and starting services and features. \n 26 */ 27 #ifndef APP_INIT_H 28 #define APP_INIT_H 29 30 #ifdef __cplusplus 31 #if __cplusplus 32 extern "C" { 33 #endif /* __cplusplus */ 34 #endif /* __cplusplus */ 35 36 /** 37 * @defgroup middleware_utils_app_init Application Initialize 38 * @ingroup middleware_utils 39 * @{ 40 */ 41 42 typedef void (*init_call_t)(void); 43 44 #define USED_ATTR __attribute__((used)) 45 46 #define layer_initcall(func, layer, clayer, priority) \ 47 static const init_call_t USED_ATTR __zinitcall_##layer##_##func \ 48 __attribute__((section(".zinitcall." clayer #priority ".init"))) = (func) 49 50 #define layer_initcall_def(func, layer, clayer) \ 51 layer_initcall(func, layer, clayer, 0) 52 53 /** 54 * @brief Identifies the entry for initializing and starting a system running phase. 55 * 56 * @param func Indicates the entry function for initializing and starting a system running phase. 57 * The type is void (*)(void). 58 */ 59 60 /** 61 * @if Eng 62 * @brief Identifies the entry for initializing and starting a system running phase. 63 * @param [in] func Indicates the entry function for initializing and starting a system running phase. 64 * The type is void (*)(void). 65 * @else 66 * @brief 定义系统初始化和启动的入口。 67 * @param [in] func 系统初始化和启动的入口。类型是:void (*)(void)。 68 * @endif 69 */ 70 #define app_run(func) layer_initcall_def(func, run, "app_run") 71 72 /** 73 * @if Eng 74 * @brief Initialize the APP Manager. 75 * @else 76 * @brief 初始化APP Manager。 77 * @endif 78 */ 79 void app_tasks_init(void); 80 81 /** 82 * @if Eng 83 * @brief Use the chip configure to generate the initialize code. 84 * @else 85 * @brief 使用芯片配置生成的代码进行系统初始化。 86 * @endif 87 */ 88 void system_init(void); 89 90 /** 91 * @} 92 */ 93 94 #ifdef __cplusplus 95 #if __cplusplus 96 } 97 #endif /* __cplusplus */ 98 #endif /* __cplusplus */ 99 100 #endif 101