|
1 | 1 | /* |
2 | | - * Copyright (c) 2006-2023, RT-Thread Development Team |
| 2 | + * Copyright (c) 2006-2025, RT-Thread Development Team |
3 | 3 | * |
4 | 4 | * SPDX-License-Identifier: Apache-2.0 |
5 | 5 | * |
6 | 6 | * Change Logs: |
7 | 7 | * Date Author Notes |
8 | 8 | * 2023-07-10 xqyjlj The first version. |
9 | 9 | * 2024-04-26 Shell Improve ipc performance |
| 10 | + * 2025-01-01 RT-Thread Compatibility layer for unified clock_time |
10 | 11 | */ |
11 | 12 |
|
12 | 13 | #ifndef __KTIME_H__ |
|
18 | 19 |
|
19 | 20 | #include "rtthread.h" |
20 | 21 |
|
| 22 | +/* |
| 23 | + * COMPATIBILITY LAYER: |
| 24 | + * When RT_USING_CLOCK_TIME is enabled, this header redirects to the |
| 25 | + * unified clock_time subsystem. All rt_ktime_* APIs are mapped to |
| 26 | + * rt_clock_* APIs via macros defined in clock_time.h. |
| 27 | + * |
| 28 | + * When RT_USING_CLOCK_TIME is not enabled, the original ktime |
| 29 | + * implementation is used. |
| 30 | + */ |
| 31 | + |
| 32 | +#ifdef RT_USING_CLOCK_TIME |
| 33 | + |
| 34 | +/* Include the unified clock_time header which provides all APIs */ |
| 35 | +#include <drivers/clock_time.h> |
| 36 | + |
| 37 | +/* All rt_ktime_* APIs are already defined as macros in clock_time.h */ |
| 38 | +/* No additional definitions needed here */ |
| 39 | + |
| 40 | +#else /* !RT_USING_CLOCK_TIME - Original ktime implementation */ |
| 41 | + |
21 | 42 | #define RT_KTIME_RESMUL (1000000ULL) |
22 | 43 |
|
23 | 44 | struct rt_ktime_hrtimer |
@@ -166,4 +187,6 @@ rt_err_t rt_ktime_hrtimer_udelay(struct rt_ktime_hrtimer *timer, unsigned long u |
166 | 187 | */ |
167 | 188 | rt_err_t rt_ktime_hrtimer_mdelay(struct rt_ktime_hrtimer *timer, unsigned long ms); |
168 | 189 |
|
169 | | -#endif |
| 190 | +#endif /* !RT_USING_CLOCK_TIME */ |
| 191 | + |
| 192 | +#endif /* __KTIME_H__ */ |
0 commit comments