Skip to content

Commit bbb2b7e

Browse files
CYFS3lygstate
authored andcommitted
Add RT_TICK_USING_64BIT Kconfig option for configure sizeof rt_tick_t
Signed-off-by: Yonggang Luo <[email protected]>
1 parent 6778c14 commit bbb2b7e

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

include/rtdef.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,11 @@ extern "C" {
106106
#define RT_UINT64_MAX 0xFFFFFFFFFFFFFFFFULL /**< Maximum number of UINT64 */
107107
#endif /* RT_USING_LIBC */
108108

109+
#ifdef RT_TICK_USING_64BIT
110+
#define RT_TICK_MAX RT_UINT64_MAX /**< Maximum number of tick */
111+
#else
109112
#define RT_TICK_MAX RT_UINT32_MAX /**< Maximum number of tick */
113+
#endif /* RT_TICK_USING_64BIT */
110114

111115
/* maximum value of ipc type */
112116
#define RT_SEM_VALUE_MAX RT_UINT16_MAX /**< Maximum number of semaphore .value */

include/rttypes.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,13 @@ typedef rt_ubase_t rt_uintptr_t; /**< Type for unsigned
8989

9090
typedef rt_base_t rt_err_t; /**< Type for error number */
9191
typedef rt_uint32_t rt_time_t; /**< Type for time stamp */
92+
93+
#ifdef RT_TICK_USING_64BIT
94+
typedef rt_uint64_t rt_tick_t; /**< Type for tick count */
95+
#else
9296
typedef rt_uint32_t rt_tick_t; /**< Type for tick count */
97+
#endif /* RT_TICK_USING_64BIT */
98+
9399
typedef rt_base_t rt_flag_t; /**< Type for flags */
94100
typedef rt_ubase_t rt_dev_t; /**< Type for device */
95101
typedef rt_base_t rt_off_t; /**< Type for offset */

src/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ config RT_TICK_PER_SECOND
116116
help
117117
System's tick frequency, Hz.
118118

119+
config RT_TICK_USING_64BIT
120+
bool "Using 64-bit integer for rt_tick_t"
121+
default n
122+
help
123+
Using long long as tick unit, this is useful when the tick frequency is very high or long running device.
124+
119125
config RT_USING_OVERFLOW_CHECK
120126
bool "Using stack overflow checking"
121127
default y if RT_USING_DEBUG

0 commit comments

Comments
 (0)