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_SYS_PRI_H 33 #define _LOS_SYS_PRI_H 34 35 #include "los_sys.h" 36 #include "los_base_pri.h" 37 38 #ifdef __cplusplus 39 #if __cplusplus 40 extern "C" { 41 #endif /* __cplusplus */ 42 #endif /* __cplusplus */ 43 44 /** 45 * @ingroup los_sys 46 * Number of milliseconds in one second. 47 */ 48 #define OS_SYS_MS_PER_SECOND 1000 49 50 /** 51 * @ingroup los_sys 52 * Number of microseconds in one second. 53 */ 54 #define OS_SYS_US_PER_SECOND 1000000 55 56 /** 57 * @ingroup los_sys 58 * Number of nanoseconds in one second. 59 */ 60 #define OS_SYS_NS_PER_SECOND 1000000000 61 62 /** 63 * @ingroup los_sys 64 * Number of microseconds in one milliseconds. 65 */ 66 #define OS_SYS_US_PER_MS 1000 67 68 /** 69 * @ingroup los_sys 70 * Number of nanoseconds in one milliseconds. 71 */ 72 #define OS_SYS_NS_PER_MS 1000000 73 74 /** 75 * @ingroup los_sys 76 * Number of nanoseconds in one microsecond. 77 */ 78 #define OS_SYS_NS_PER_US 1000 79 80 /** 81 * @ingroup los_sys 82 * Number of cycle in one tick. 83 */ 84 #define OS_CYCLE_PER_TICK (OS_SYS_CLOCK / LOSCFG_BASE_CORE_TICK_PER_SECOND) 85 86 /** 87 * @ingroup los_sys 88 * Number of nanoseconds in one cycle. 89 */ 90 #define OS_NS_PER_CYCLE (OS_SYS_NS_PER_SECOND / OS_SYS_CLOCK) 91 92 /** 93 * @ingroup los_sys 94 * Number of microseconds in one tick. 95 */ 96 #define OS_US_PER_TICK (OS_SYS_US_PER_SECOND / LOSCFG_BASE_CORE_TICK_PER_SECOND) 97 98 /** 99 * @ingroup los_sys 100 * Number of nanoseconds in one tick. 101 */ 102 #define OS_NS_PER_TICK (OS_SYS_NS_PER_SECOND / LOSCFG_BASE_CORE_TICK_PER_SECOND) 103 104 /** 105 * @ingroup los_sys 106 * The maximum length of name. 107 */ 108 #define OS_SYS_APPVER_NAME_MAX 64 109 110 /** 111 * @ingroup los_sys 112 * The magic word. 113 */ 114 #define OS_SYS_MAGIC_WORD 0xAAAAAAAA 115 116 /** 117 * @ingroup los_sys 118 * The initialization value of stack space. 119 */ 120 #define OS_SYS_EMPTY_STACK 0xCACACACA 121 122 /** 123 * @ingroup los_sys 124 * Convert nanoseconds to Ticks. 125 */ 126 extern UINT32 OsNS2Tick(UINT64 nanoseconds); 127 128 #ifdef __cplusplus 129 #if __cplusplus 130 } 131 #endif /* __cplusplus */ 132 #endif /* __cplusplus */ 133 134 #endif /* _LOS_SYS_PRI_H */ 135