los_context.h 3.7 KB
Newer Older
W
wenjun 已提交
1
/*
M
mamingshuai 已提交
2 3
 * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
W
wenjun 已提交
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, this list of
 *    conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
 *    of conditions and the following disclaimer in the documentation and/or other materials
 *    provided with the distribution.
 *
 * 3. Neither the name of the copyright holder nor the names of its contributors may be used
 *    to endorse or promote products derived from this software without specific prior written
 *    permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

/**
33
 * @defgroup los_context hardware
W
wenjun 已提交
34 35 36
 * @ingroup kernel
 */

37 38
#ifndef _LOS_CONTEXT_H
#define _LOS_CONTEXT_H
W
wenjun 已提交
39

C
Caoruihong 已提交
40 41
#include "los_compiler.h"

W
wenjun 已提交
42 43 44 45 46 47
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif /* __cplusplus */
#endif /* __cplusplus */

48 49
/**
 * @ingroup  los_context
W
wenjun 已提交
50 51 52 53 54 55 56 57 58 59 60 61 62 63
 * @brief: Task stack initialization.
 *
 * @par Description:
 * This API is used to initialize the task stack.
 *
 * @attention:
 * <ul><li>None.</li></ul>
 *
 * @param  taskID     [IN] Type#UINT32: TaskID.
 * @param  stackSize  [IN] Type#UINT32: Total size of the stack.
 * @param  topStack   [IN] Type#VOID *: Top of task's stack.
 *
 * @retval: context Type#TaskContext *.
 * @par Dependency:
64
 * <ul><li>los_context.h: the header file that contains the API declaration.</li></ul>
W
wenjun 已提交
65 66
 * @see None.
 */
C
Caoruihong 已提交
67
extern VOID *HalTskStackInit(UINT32 taskID, UINT32 stackSize, VOID *topStack);
68

W
wenjun 已提交
69
/**
70
 * @ingroup  los_context
C
Caoruihong 已提交
71
 * @brief: Function to sys exit.
W
wenjun 已提交
72 73
 *
 * @par Description:
C
Caoruihong 已提交
74
 * This API is used to sys exit.
W
wenjun 已提交
75 76 77 78 79 80 81 82
 *
 * @attention:
 * <ul><li>None.</li></ul>
 *
 * @param  None.
 *
 * @retval: None.
 * @par Dependency:
83
 * <ul><li>los_context.h: the header file that contains the API declaration.</li></ul>
W
wenjun 已提交
84 85
 * @see None.
 */
C
Caoruihong 已提交
86
LITE_OS_SEC_TEXT_MINOR NORETURN VOID HalSysExit(VOID);
W
wenjun 已提交
87

88
/**
C
Caoruihong 已提交
89 90
 * @ingroup  los_context
 * @brief: Task scheduling Function.
W
wenjun 已提交
91 92
 *
 * @par Description:
C
Caoruihong 已提交
93
 * This API is used to scheduling task.
W
wenjun 已提交
94 95 96 97 98 99 100 101
 *
 * @attention:
 * <ul><li>None.</li></ul>
 *
 * @param  None.
 *
 * @retval: None.
 * @par Dependency:
C
Caoruihong 已提交
102
 * <ul><li>los_context.h: the header file that contains the API declaration.</li></ul>
W
wenjun 已提交
103 104
 * @see None.
 */
C
Caoruihong 已提交
105 106 107 108 109 110 111 112 113 114 115 116 117 118
extern VOID HalTaskSchedule(VOID);

typedef VOID (*OS_TICK_HANDLER)(VOID);
UINT32 HalStartSchedule(OS_TICK_HANDLER handler);

UINTPTR HalIntLock(VOID);
#define LOS_IntLock HalIntLock

VOID HalIntRestore(UINTPTR intSave);
#define LOS_IntRestore HalIntRestore

UINTPTR HalIntUnLock(VOID);
#define LOS_IntUnLock HalIntUnLock

W
wenjun 已提交
119 120 121 122 123 124
#ifdef __cplusplus
#if __cplusplus
}
#endif /* __cplusplus */
#endif /* __cplusplus */

125
#endif /* _LOS_CONTEXT_H */