WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
ed30404
[components][clock_time] Refactor time subsystem around clock_time
BernardXiong Dec 31, 2025
a793b25
[components][clock_time] Use BSP-provided clock timer frequency on ri…
BernardXiong Dec 31, 2025
a9b3c98
[risc-v] Use runtime clock timer frequency for tick and delays
BernardXiong Dec 31, 2025
fa72f36
[bsp] Add clock timer frequency hooks for riscv64 boards
BernardXiong Dec 31, 2025
ae7a98c
[bsp] Update Renesas RA driver doc clock_timer link
BernardXiong Dec 31, 2025
b8d202a
[bsp] Sync zynqmp-r5-axu4ev rtconfig after config refresh
BernardXiong Dec 31, 2025
e908b9b
[bsp][rk3500] Update rk3500 clock configuration
BernardXiong Dec 31, 2025
933044c
[bsp][hpmicro] Add rt_hw_us_delay hook and update board delays
BernardXiong Dec 31, 2025
74b4f88
[bsp][stm32l496-st-nucleo] enable clock_time for hwtimer sample in ci
BernardXiong Jan 1, 2026
c2a396f
[bsp][hpmicro] Fix rtconfig include scope for hpm6750evk
BernardXiong Jan 2, 2026
887ab31
[bsp][raspi3] select clock time for systimer
BernardXiong Jan 2, 2026
90f96de
[bsp][hpm5300evk] Trim trailing blank line
BernardXiong Jan 2, 2026
73f0c4f
[bsp][hpm5301evklite] Trim trailing blank line
BernardXiong Jan 2, 2026
ab3557e
[bsp][hpm5e00evk] Trim trailing blank line
BernardXiong Jan 2, 2026
16fbd4a
[bsp][hpm6200evk] Trim trailing blank line
BernardXiong Jan 2, 2026
62440fa
[bsp][hpm6300evk] Trim trailing blank line
BernardXiong Jan 2, 2026
e0c17e5
[bsp][hpm6750evk] Trim trailing blank line
BernardXiong Jan 2, 2026
7a02743
[bsp][hpm6750evk2] Trim trailing blank line
BernardXiong Jan 2, 2026
53558e0
[bsp][hpm6750evkmini] Trim trailing blank line
BernardXiong Jan 2, 2026
8910340
[bsp][hpm6800evk] Trim trailing blank line
BernardXiong Jan 2, 2026
886ec9a
[bsp][hpm6e00evk] Trim trailing blank line
BernardXiong Jan 2, 2026
b3281ab
[bsp][nxp] switch lpc178x to gcc and remove mcx timer source
BernardXiong Jan 2, 2026
52da827
[bsp][stm32] fix the CONFIG_RT_USING_CLOCK_TIME issue.
BernardXiong Jan 2, 2026
783f31b
[docs][clock_time] add clock time documentation
BernardXiong Jan 2, 2026
57cadb6
[docs][clock_time] Update clock time subsystem documentation
BernardXiong Jan 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion bsp/ESP32_C3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Each peripheral supporting condition for this BSP is as follows:
| WIFI | Partial support | There are currently some problems, such as `rt_mq_recive` cannot be used in ISR, etc. |
| BLE | Partially supported | There are currently some problems, such as `NimBLE` running errors after starting for a while |
| GDBStub | Support | You can use the GDB provided by ESP-IDF by turning on the `BSP_ENABLE_GDBSTUB` switch, which will enter GDB mode after a chip error |
| HWTIMER | Support |
| CLOCK_TIMER | Support |
Note:

1. WIFI and BLE cannot be enabled at the same time. When using the BLE driver, be sure to turn off the `RT_USING_WIFI` and `LWIP` switches in `menuconfig`. In addition, due to limited capabilities and lack of debugging equipment, there are problems with WIFI and BLE driver operation. If it can be solved, please contact [[email protected]](mailto:[email protected]).
Expand Down
2 changes: 1 addition & 1 deletion bsp/ESP32_C3/README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
| WIFI | 部分支持 | 目前存在一些问题,例如不能在ISR中使用`rt_mq_recive`等 |
| BLE | 部分支持 | 目前存在一些问题,例如`NimBLE`启动一段时间后运行错误 |
| GDBStub | 支持 | 通过开启`BSP_ENABLE_GDBSTUB`开关即可使用ESP-IDF所提供的GDB,其会在芯片出错后进入GDB模式 |
| HWTIMER | 支持 |
| CLOCK_TIMER | 支持 |
注:

1、WIFI和BLE不能同时启用,在使用BLE驱动时注意在`menuconfig`中关闭`RT_USING_WIFI`和`LWIP`开关。另外由于能力有限且缺乏调试设备,WIFI和BLE驱动运行都有问题,如果可以解决联系[[email protected]](mailto:[email protected])。
Expand Down
10 changes: 5 additions & 5 deletions bsp/ESP32_C3/drivers/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ menu "On-chip Peripheral Drivers"
bool "Enable BLE"
default n

menuconfig BSP_USING_HWTIMER
bool "Enable HWTIMER"
select RT_USING_HWTIMER
menuconfig BSP_USING_CLOCK_TIMER
bool "Enable CLOCK_TIMER"
select RT_USING_CLOCK_TIME
default n
if BSP_USING_HWTIMER
if BSP_USING_CLOCK_TIMER
config BSP_USING_TIMER0
bool "Enable HWTIMER0"
bool "Enable CLOCK_TIMER0"
default n
endif

Expand Down
4 changes: 2 additions & 2 deletions bsp/ESP32_C3/drivers/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ if GetDepend('BSP_USING_SW_I2C'):
if GetDepend('BSP_USING_PWM'):
src += ['drv_pwm.c']

if GetDepend('BSP_USING_HWTIMER'):
src += ['drv_hwtimer.c']
if GetDepend('BSP_USING_CLOCK_TIMER'):
src += ['drv_timer.c']

if GetDepend('BSP_USING_WIFI'):
src += ['drv_wifi.c']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,34 @@
* 2023-11-15 BetMul first version
*/

#include "drv_hwtimer.h"
#include "drv_timer.h"

#include <rtthread.h>
#include <rtdevice.h>
#include "driver/gptimer.h"
#include "sdkconfig.h"

#ifdef RT_USING_HWTIMER
#ifdef RT_USING_CLOCK_TIME

/**
* handle interrupt for hwtimer.
* handle interrupt for clock_timer.
*/
static bool mcu_hwtimer_intr_handler(gptimer_handle_t gptimer, const gptimer_alarm_event_data_t *edata, void *user_ctx)
static bool mcu_clock_timer_intr_handler(gptimer_handle_t gptimer, const gptimer_alarm_event_data_t *edata, void *user_ctx)
{
rt_interrupt_enter();

rt_hwtimer_t *hwtimer = (rt_hwtimer_t *)user_ctx;
rt_device_hwtimer_isr(hwtimer);
rt_clock_timer_t *clock_timer = (rt_clock_timer_t *)user_ctx;
rt_clock_timer_isr(clock_timer);

rt_interrupt_leave();

return 0;
}

/**
* init the hwtimer
* init the clock_timer
*/
static void mcu_hwtimer_init(rt_hwtimer_t *timer, rt_uint32_t state)
static void mcu_clock_timer_init(rt_clock_timer_t *timer, rt_uint32_t state)
{
gptimer_handle_t gptimer = (gptimer_handle_t)timer->parent.user_data;

Expand All @@ -44,15 +44,15 @@ static void mcu_hwtimer_init(rt_hwtimer_t *timer, rt_uint32_t state)
}

/**
* start the hwtimer, change status into running
* start the clock_timer, change status into running
*/
static rt_err_t mcu_hwtimer_start(rt_hwtimer_t *timer, rt_uint32_t cnt, rt_hwtimer_mode_t mode)
static rt_err_t mcu_clock_timer_start(rt_clock_timer_t *timer, rt_uint32_t cnt, rt_clock_timer_mode_t mode)
{
gptimer_handle_t gptimer = (gptimer_handle_t)timer->parent.user_data;
gptimer_alarm_config_t alarm_config = {
.alarm_count = cnt,
};
if (mode == HWTIMER_MODE_ONESHOT)
if (mode == CLOCK_TIMER_MODE_ONESHOT)
{

}
Expand All @@ -68,9 +68,9 @@ static rt_err_t mcu_hwtimer_start(rt_hwtimer_t *timer, rt_uint32_t cnt, rt_hwtim
}

/**
* stop the hwtimer, change the status from running into enable
* stop the clock_timer, change the status from running into enable
*/
static void mcu_hwtimer_stop(rt_hwtimer_t *timer)
static void mcu_clock_timer_stop(rt_clock_timer_t *timer)
{
gptimer_handle_t gptimer = (gptimer_handle_t)timer->parent.user_data;

Expand All @@ -80,7 +80,7 @@ static void mcu_hwtimer_stop(rt_hwtimer_t *timer)
/**
* get count
*/
static rt_uint32_t mcu_hwtimer_count_get(rt_hwtimer_t *timer)
static rt_uint32_t mcu_clock_timer_count_get(rt_clock_timer_t *timer)
{
gptimer_handle_t gptimer = (gptimer_handle_t)timer->parent.user_data;
// get count number
Expand All @@ -90,53 +90,53 @@ static rt_uint32_t mcu_hwtimer_count_get(rt_hwtimer_t *timer)
}

/**
* control the hwtimer
* control the clock_timer
*/
static rt_err_t mcu_hwtimer_control(rt_hwtimer_t *timer, rt_uint32_t cmd, void *args)
static rt_err_t mcu_clock_timer_control(rt_clock_timer_t *timer, rt_uint32_t cmd, void *args)
{

rt_err_t err = RT_EOK;

switch (cmd)
{
case HWTIMER_CTRL_FREQ_SET:
case CLOCK_TIMER_CTRL_FREQ_SET:
err = -RT_ERROR;
break;

case HWTIMER_CTRL_INFO_GET:
case CLOCK_TIMER_CTRL_INFO_GET:
err = -RT_ERROR;
break;

case HWTIMER_CTRL_MODE_SET:
case CLOCK_TIMER_CTRL_MODE_SET:
timer->mode = *(rt_uint32_t *)args;
break;

case HWTIMER_CTRL_STOP:
mcu_hwtimer_stop(timer);
case CLOCK_TIMER_CTRL_STOP:
mcu_clock_timer_stop(timer);
break;
}

return err;
}

static struct rt_hwtimer_device _hwtimer;
static const struct rt_hwtimer_ops _hwtimer_ops =
static struct rt_clock_timer_device _clock_timer;
static const struct rt_clock_timer_ops _clock_timer_ops =
{
.init = mcu_hwtimer_init,
.start = mcu_hwtimer_start,
.stop = mcu_hwtimer_stop,
.count_get = mcu_hwtimer_count_get,
.control = mcu_hwtimer_control};
.init = mcu_clock_timer_init,
.start = mcu_clock_timer_start,
.stop = mcu_clock_timer_stop,
.count_get = mcu_clock_timer_count_get,
.control = mcu_clock_timer_control};

static const struct rt_hwtimer_info _hwtimer_info =
static const struct rt_clock_timer_info _clock_timer_info =
{
// TODO:what is the true max and min?
.maxfreq = 1000000UL,
.minfreq = 1000000UL,
.maxcnt = 0xFFFF,
.cntmode = HWTIMER_MODE_ONESHOT};
.cntmode = CLOCK_TIMER_MODE_ONESHOT};

int rt_hw_hwtimer_init(void)
int rt_hw_clock_timer_init(void)
{

char *name = "timer0";
Expand All @@ -149,18 +149,18 @@ int rt_hw_hwtimer_init(void)
};

gptimer_event_callbacks_t cbs = {
.on_alarm = mcu_hwtimer_intr_handler,
.on_alarm = mcu_clock_timer_intr_handler,
};

ESP_ERROR_CHECK(gptimer_new_timer(&timer_config, &gptimer));
ESP_ERROR_CHECK(gptimer_register_event_callbacks(gptimer, &cbs, &_hwtimer));
ESP_ERROR_CHECK(gptimer_register_event_callbacks(gptimer, &cbs, &_clock_timer));

_hwtimer.info = &_hwtimer_info;
_hwtimer.ops = &_hwtimer_ops;
_clock_timer.info = &_clock_timer_info;
_clock_timer.ops = &_clock_timer_ops;

return rt_device_hwtimer_register(&_hwtimer, name, (void *)gptimer);
return rt_clock_timer_register(&_clock_timer, name, (void *)gptimer);

}

INIT_DEVICE_EXPORT(rt_hw_hwtimer_init);
#endif /* RT_USING_HWTIMER */
INIT_DEVICE_EXPORT(rt_hw_clock_timer_init);
#endif /* RT_USING_CLOCK_TIME */
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
* Date Author Notes
* 2023-11-15 BetMul first version
*/
#ifndef __DRV_HWTIMER_H__
#define __DRV_HWTIMER_H__
#ifndef __DRV_CLOCK_TIMER_H__
#define __DRV_CLOCK_TIMER_H__

#include <rtconfig.h>

#ifdef RT_USING_HWTIMER
int rt_hw_hwtimer_init(void);
#ifdef RT_USING_CLOCK_TIME
int rt_hw_clock_timer_init(void);
#endif


#endif /* __DRV_HWTIMER_H__ */
#endif /* __DRV_CLOCK_TIMER_H__ */
2 changes: 1 addition & 1 deletion bsp/Infineon/libraries/HAL_Drivers/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ if GetDepend(['RT_USING_DAC']):
src += ['drv_dac.c']

if GetDepend(['BSP_USING_TIM']):
src += ['drv_hwtimer.c']
src += ['drv_timer.c']

if GetDepend(['BSP_USING_ETH']):
src += ['drv_eth.c']
Expand Down
Loading
Loading