1 /* 2 * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. 3 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without modification, 6 * are permitted provided that the following conditions are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright notice, this list of 9 * conditions and the following disclaimer. 10 * 11 * 2. Redistributions in binary form must reproduce the above copyright notice, this list 12 * of conditions and the following disclaimer in the documentation and/or other materials 13 * provided with the distribution. 14 * 15 * 3. Neither the name of the copyright holder nor the names of its contributors may be used 16 * to endorse or promote products derived from this software without specific prior written 17 * permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 21 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 26 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 28 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 29 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 */ 31 32 #ifndef _LOS_INIT_H 33 #define _LOS_INIT_H 34 35 #include "los_init_info.h" 36 37 /** 38 * Kernel Module Init Level 39 */ 40 #define LOS_INIT_LEVEL_EARLIEST 0 41 #define LOS_INIT_LEVEL_ARCH_EARLY 1 42 #define LOS_INIT_LEVEL_PLATFORM_EARLY 2 43 #define LOS_INIT_LEVEL_KMOD_PREVM 3 44 #define LOS_INIT_LEVEL_VM_COMPLETE 4 45 #define LOS_INIT_LEVEL_ARCH 5 46 #define LOS_INIT_LEVEL_PLATFORM 6 47 #define LOS_INIT_LEVEL_KMOD_BASIC 7 48 #define LOS_INIT_LEVEL_KMOD_EXTENDED 8 49 #define LOS_INIT_LEVEL_KMOD_TASK 9 50 #define LOS_INIT_LEVEL_FINISH 10 51 52 /** 53 * @ingroup los_init 54 * @brief Register a startup module to the startup process. 55 * 56 * @par Description: 57 * This API is used to register a startup module to the startup process. 58 * 59 * @attention 60 * <ul> 61 * <li>Register a new module in the boot process of the kernel as part of the kernel capability component.</li> 62 * <li>In the startup framework, within the same _level, the startup sequence is sorted by 63 * the registered function name </li> 64 * <li>If the registration is not accompanied by the startup process after calling this interface, 65 * try to add -u_hook to liteos_tables_ldflags.mk </li> 66 * </ul> 67 * 68 * @param _hook [IN] Type #UINT32 (*)(VOID) Register function. 69 * @param _level [IN] Type #UINT32 Init level in the kernel. 70 * 71 * @retval None 72 * @par Dependency: 73 * <ul><li>los_init.h: the header file that contains the API declaration.</li></ul> 74 * @see 75 */ 76 #define LOS_MODULE_INIT(_hook, _level) OS_INIT_HOOK_REG(kernel, _hook, _level) 77 78 #endif /* _LOS_INIT_H */ 79