[libcpu/rv64] feat: unify tick.c

The changes unify the tick.c implementations for all risc-v64
architectures, leveraging the CPUTIME feature. This refactoring was
necessary to streamline the codebase, and ensure consistent timer
handling across different platforms.

Changes:
- Updated `Kconfig` in `bsp/cvitek/cv18xx_risc-v` to fix formatting issues.
- Updated .config for BSPs to update `CPUTIME_TIMER_FREQ`
- Updated header of for API `riscv_cputime_init`
- Initialized riscv timer on `rt_hw_tick_init`
- Refactored `tick.c` and `tick.h` in `libcpu/risc-v/t-head/c906` and `libcpu/risc-v/virt64`:
  - Replaced direct use of `rdtime` with `clock_cpu_gettime`.
  - Removed redundant timer frequency definitions.
  - Added static assertions to check the value of `CPUTIME_TIMER_FREQ`.
  - Initialized `tick_cycles` based on `CPUTIME_TIMER_FREQ`.
  - Integrated `ktime` support for tick initialization.

Signed-off-by: Shell <smokewood@qq.com>
Reviewed-on: https://github.com/RT-Thread/rt-thread/pull/9164
Reviewed-by: Chen Wang <unicorn_wang@outlook.com>
This commit is contained in:
Shell
2024-07-15 12:06:39 +08:00
parent ca4645000a
commit 65ffe4e13e
15 changed files with 850 additions and 184 deletions
+277 -53
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -12,6 +12,7 @@ osource "$PKGS_DIR/Kconfig"
config BOARD_allwinnerd1s
bool
select ARCH_RISCV64
select ARCH_USING_RISCV_COMMON64
select RT_USING_COMPONENTS_INIT
select RT_USING_USER_MAIN
select RT_USING_CACHE
+42 -6
View File
@@ -68,6 +68,7 @@
#define KERNEL_VADDR_START 0x40000000
#define ARCH_RISCV
#define ARCH_RISCV64
#define ARCH_USING_RISCV_COMMON64
/* RT-Thread Components */
@@ -143,6 +144,9 @@
#define RT_SYSTEM_WORKQUEUE_PRIORITY 23
#define RT_USING_SERIAL
#define RT_USING_SERIAL_V2
#define RT_USING_CPUTIME
#define RT_USING_CPUTIME_RISCV
#define CPUTIME_TIMER_FREQ 24000000
#define RT_USING_NULL
#define RT_USING_ZERO
#define RT_USING_RANDOM
@@ -243,6 +247,18 @@
/* Wiced WiFi */
/* end of Wiced WiFi */
/* CYW43012 WiFi */
/* end of CYW43012 WiFi */
/* BL808 WiFi */
/* end of BL808 WiFi */
/* CYW43439 WiFi */
/* end of CYW43439 WiFi */
/* end of Wi-Fi */
/* IoT Cloud */
@@ -274,10 +290,6 @@
/* u8g2: a monochrome graphic library */
/* end of u8g2: a monochrome graphic library */
/* PainterEngine: A cross-platform graphics application framework written in C language */
/* end of PainterEngine: A cross-platform graphics application framework written in C language */
/* end of multimedia packages */
/* tools packages */
@@ -305,16 +317,38 @@
/* peripheral libraries and drivers */
/* HAL & SDK Drivers */
/* STM32 HAL & SDK Drivers */
/* end of STM32 HAL & SDK Drivers */
/* Infineon HAL Packages */
/* end of Infineon HAL Packages */
/* Kendryte SDK */
/* end of Kendryte SDK */
/* end of HAL & SDK Drivers */
/* sensors drivers */
/* end of sensors drivers */
/* touch drivers */
/* end of touch drivers */
/* end of peripheral libraries and drivers */
/* AI packages */
/* end of AI packages */
/* Signal Processing and Control Algorithm Packages */
/* end of Signal Processing and Control Algorithm Packages */
/* miscellaneous packages */
/* project laboratory */
@@ -333,9 +367,9 @@
/* Arduino libraries */
/* Projects */
/* Projects and Demos */
/* end of Projects */
/* end of Projects and Demos */
/* Sensors */
@@ -365,6 +399,8 @@
/* Other */
/* end of Other */
/* Signal IO */
/* end of Signal IO */