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. 14 */ 15 /** 16 * @defgroup jiffies Jiffies 17 * @ingroup linux 18 */ 19 20 #ifndef _LINUX_JIFFIES_H 21 #define _LINUX_JIFFIES_H 22 23 #include "los_sys.h" 24 25 #ifdef __cplusplus 26 extern "C" { 27 #endif /* __cplusplus */ 28 29 #define MAX_JIFFY_OFFSET ((LONG_MAX >> 1) - 1) 30 31 /** 32 * @ingroup jiffies 33 * @brief It is same with #LOS_TickCountGet. 34 */ 35 extern unsigned long long get_jiffies_64(void); 36 37 /** 38 * @ingroup jiffies 39 * @brief It is same with #LOS_Tick2MS. 40 * 41 * @attention 42 * <ul> 43 * <li>This API is not fully compatible with linux.</li> 44 * <li>The calculation result is rounded down.</li> 45 * </ul> 46 */ 47 extern unsigned int jiffies_to_msecs(const unsigned long j); 48 49 /** 50 * @ingroup jiffies 51 * @brief Convert milliseconds to jiffies. 52 * 53 * @par Description: 54 * This API is used to convert milliseconds to jiffies. 55 * @attention 56 * <ul> 57 * <li>This API is not fully compatible with linux.</li> 58 * <li>IF (HZ > OS_SYS_MS_PER_SECOND) || (OS_SYS_MS_PER_SECOND % HZ), #ENOSUPP will be returned.</li> 59 * </ul> 60 * 61 * @param m [IN] The milliseconds need to be converted to jiffies. 62 * 63 * @retval #unsigned long Number of jiffies obtained through the conversion. 64 * @par Dependency: 65 * <ul> 66 * <li>jiffies.h: the header file that contains the API declaration.</li> 67 * </ul> 68 * @see None. 69 */ 70 extern unsigned long msecs_to_jiffies(const unsigned int m); 71 72 #ifdef __cplusplus 73 } 74 #endif /* __cplusplus */ 75 76 #endif /* _LINUX_JIFFIES_H */ 77