ns800 增加硬件定时器#11395
Conversation
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
📌 Code Review Assignment🏷️ Tag: componentsReviewers: Maihuanyi Changed Files (Click to expand)
📊 Current Review Status (Last Updated: 2026-05-16 23:22 CST)
📝 Review Instructions
|
There was a problem hiding this comment.
Pull request overview
This PR adds TIM-based hardware clock timer support for the novosns ns800 BSP so RT_USING_CLOCK_TIME can work on bsp/novosns/ns800/ns800rt7p65-nssinepad, and adjusts the clock_time component SCons build flags accordingly.
本 PR 为 novosns ns800 BSP 增加基于 TIM 的硬件 clock timer 支持,以便在 bsp/novosns/ns800/ns800rt7p65-nssinepad 上启用/使用 RT_USING_CLOCK_TIME,并相应调整 clock_time 组件的 SCons 编译参数。
Changes:
- Add ns800 TIM clock timer driver and hook it into the BSP HAL drivers build.
增加 ns800 TIM clock timer 驱动,并接入 BSP HAL_Drivers 编译。 - Add Kconfig options to enable TIM and select specific TIM instances (TIM1/TIM2).
增加 Kconfig 选项以启用 TIM 并选择具体 TIM 实例(TIM1/TIM2)。 - Remove per-component
LOCAL_CCFLAGSfromcomponents/drivers/clock_time/SConscript.
移除components/drivers/clock_time/SConscript中的LOCAL_CCFLAGS设置。
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| components/drivers/clock_time/SConscript | Removes module-local C standard flags when defining the DeviceDrivers group. |
| bsp/novosns/ns800/ns800rt7p65-nssinepad/board/Kconfig | Adds BSP_USING_TIM and per-instance enable options for TIM1/TIM2. |
| bsp/novosns/ns800/libraries/HAL_Drivers/drivers/SConscript | Builds drv_timer.c when BSP_USING_TIM is enabled. |
| bsp/novosns/ns800/libraries/HAL_Drivers/drivers/drv_timer.c | Introduces ns800 TIM-based rt_clock_timer implementation and registration. |
| menuconfig BSP_USING_TIM | ||
| bool "Enable TIM (Hardware Timer)" | ||
| select RT_USING_CLOCK_TIME | ||
| default n |
| if BSP_USING_TIM | ||
| menu "TIM Timer Configuration" | ||
| config BSP_USING_TIM1 | ||
| bool "Enable TIM1" | ||
| default n | ||
| config BSP_USING_TIM2 | ||
| bool "Enable TIM2" | ||
| default n | ||
| endmenu |
| static struct ns800_clock_timer ns800_timers[] = | ||
| { | ||
| #ifdef BSP_USING_TIM1 | ||
| {.instance = TIM1, .irqno = TIM1_IRQn, .irq_handler = TIM1_IRQHandler, .name = "timer1"}, | ||
| #endif | ||
| #ifdef BSP_USING_TIM2 | ||
| {.instance = TIM2, .irqno = TIM2_IRQn, .irq_handler = TIM2_IRQHandler, .name = "timer2"}, | ||
| #endif | ||
| }; | ||
|
|
||
| #define NS800_TIMER_NUM (sizeof(ns800_timers) / sizeof(ns800_timers[0])) | ||
|
|
1. 增加关闭定时器实现 2. 去掉多余的break入口 3. KConfig缩进保持与当前已有的一致
1. 注册定时器时增加注册成功失败返回值判断,并依据是否注册成功决定是否注册中断向量表 2. 参考其他驱动,驱动部分增加打印消息宏开关,但不主动加打印 3. 上一版提交提交的验证不充分部分,关闭计数器函数错误传递2个参数
拉取/合并请求描述:(PR description)
[
bsp/novosns/ns800/ns800rt7p65-nssinepad
为什么提交这份PR (why to submit this PR)
你的解决方案是什么 (what is your solution)
请提供验证的bsp和config (provide the config and bsp)
bsp/novosns/ns800/ns800rt7p65-nssinepad
CONFIG_RT_USING_CLOCK_TIME=y
CONFIG_BSP_USING_TIM=y
CONFIG_BSP_USING_BTIM1=y
CONFIG_BSP_USING_BTIM2=y
https://github.com/oxlm/rt-thread/actions/workflows/manual_dist.yml
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up