10d163575Sopenharmony_ci/* 20d163575Sopenharmony_ci * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. 30d163575Sopenharmony_ci * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. 40d163575Sopenharmony_ci * 50d163575Sopenharmony_ci * Redistribution and use in source and binary forms, with or without modification, 60d163575Sopenharmony_ci * are permitted provided that the following conditions are met: 70d163575Sopenharmony_ci * 80d163575Sopenharmony_ci * 1. Redistributions of source code must retain the above copyright notice, this list of 90d163575Sopenharmony_ci * conditions and the following disclaimer. 100d163575Sopenharmony_ci * 110d163575Sopenharmony_ci * 2. Redistributions in binary form must reproduce the above copyright notice, this list 120d163575Sopenharmony_ci * of conditions and the following disclaimer in the documentation and/or other materials 130d163575Sopenharmony_ci * provided with the distribution. 140d163575Sopenharmony_ci * 150d163575Sopenharmony_ci * 3. Neither the name of the copyright holder nor the names of its contributors may be used 160d163575Sopenharmony_ci * to endorse or promote products derived from this software without specific prior written 170d163575Sopenharmony_ci * permission. 180d163575Sopenharmony_ci * 190d163575Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 200d163575Sopenharmony_ci * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 210d163575Sopenharmony_ci * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 220d163575Sopenharmony_ci * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 230d163575Sopenharmony_ci * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 240d163575Sopenharmony_ci * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 250d163575Sopenharmony_ci * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 260d163575Sopenharmony_ci * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 270d163575Sopenharmony_ci * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 280d163575Sopenharmony_ci * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 290d163575Sopenharmony_ci * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 300d163575Sopenharmony_ci */ 310d163575Sopenharmony_ci 320d163575Sopenharmony_ci#ifndef __LOS_DEV_QUICKSTART_H__ 330d163575Sopenharmony_ci#define __LOS_DEV_QUICKSTART_H__ 340d163575Sopenharmony_ci 350d163575Sopenharmony_ci#include "los_typedef.h" 360d163575Sopenharmony_ci#include "sys/ioctl.h" 370d163575Sopenharmony_ci 380d163575Sopenharmony_ci#ifdef __cplusplus 390d163575Sopenharmony_ci#if __cplusplus 400d163575Sopenharmony_ciextern "C" { 410d163575Sopenharmony_ci#endif /* __cplusplus */ 420d163575Sopenharmony_ci#endif /* __cplusplus */ 430d163575Sopenharmony_ci 440d163575Sopenharmony_citypedef enum { 450d163575Sopenharmony_ci QS_STAGE1 = 1, /* 1: start from stage1, 0 is already called in kernel process */ 460d163575Sopenharmony_ci QS_STAGE2, /* system init stage No 2 */ 470d163575Sopenharmony_ci QS_STAGE3, /* system init stage No 3 */ 480d163575Sopenharmony_ci QS_STAGE_LIMIT 490d163575Sopenharmony_ci} QuickstartStage; 500d163575Sopenharmony_ci 510d163575Sopenharmony_citypedef enum { 520d163575Sopenharmony_ci QS_NOTIFY = QS_STAGE_LIMIT, /* quickstart notify */ 530d163575Sopenharmony_ci QS_LISTEN, /* quickstart listen */ 540d163575Sopenharmony_ci QS_CTL_LIMIT 550d163575Sopenharmony_ci} QuickstartConctrl; 560d163575Sopenharmony_ci 570d163575Sopenharmony_citypedef struct { 580d163575Sopenharmony_ci unsigned int events; 590d163575Sopenharmony_ci unsigned int wait; 600d163575Sopenharmony_ci} QuickstartListenArgs; 610d163575Sopenharmony_ci 620d163575Sopenharmony_ci#define QUICKSTART_IOC_MAGIC 'T' 630d163575Sopenharmony_ci#define QUICKSTART_NOTIFY _IO(QUICKSTART_IOC_MAGIC, QS_NOTIFY) 640d163575Sopenharmony_ci#define QUICKSTART_LISTEN _IOR(QUICKSTART_IOC_MAGIC, QS_LISTEN, QuickstartListenArgs) 650d163575Sopenharmony_ci#define QUICKSTART_STAGE(x) _IO(QUICKSTART_IOC_MAGIC, (x)) 660d163575Sopenharmony_ci 670d163575Sopenharmony_ci#define QUICKSTART_NODE "/dev/quickstart" 680d163575Sopenharmony_ci 690d163575Sopenharmony_ci#define QS_STAGE_CNT (QS_STAGE_LIMIT - QS_STAGE1) 700d163575Sopenharmony_ci 710d163575Sopenharmony_citypedef void (*SysteminitHook)(void); 720d163575Sopenharmony_ci 730d163575Sopenharmony_citypedef struct { 740d163575Sopenharmony_ci SysteminitHook func[QS_STAGE_CNT]; 750d163575Sopenharmony_ci} LosSysteminitHook; 760d163575Sopenharmony_ci 770d163575Sopenharmony_ciextern void QuickstartHookRegister(LosSysteminitHook hooks); 780d163575Sopenharmony_ci 790d163575Sopenharmony_ciextern int QuickstartDevRegister(void); 800d163575Sopenharmony_ci 810d163575Sopenharmony_ci#ifdef __cplusplus 820d163575Sopenharmony_ci#if __cplusplus 830d163575Sopenharmony_ci} 840d163575Sopenharmony_ci#endif /* __cplusplus */ 850d163575Sopenharmony_ci#endif /* __cplusplus */ 860d163575Sopenharmony_ci 870d163575Sopenharmony_ci#endif 88