mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-02-28 04:27:07 +08:00
[ch32][risc-v][bsp] update drv_common for wch risc-v bsp
This commit is contained in:
parent
7d8f485321
commit
1104b80a4d
@ -11,15 +11,22 @@
|
|||||||
#include <rtthread.h>
|
#include <rtthread.h>
|
||||||
#include "drv_common.h"
|
#include "drv_common.h"
|
||||||
|
|
||||||
|
#define DBG_TAG "drv.common"
|
||||||
|
#define DBG_LVL DBG_INFO
|
||||||
|
#include <rtdbg.h>
|
||||||
|
|
||||||
void rt_hw_us_delay(rt_uint32_t us)
|
void rt_hw_us_delay(rt_uint32_t us)
|
||||||
{
|
{
|
||||||
uint64_t total_delay_ticks, us_ticks, start, now, delta, reload;
|
rt_uint64_t total_delay_ticks, us_ticks, start, now, delta, reload;
|
||||||
|
|
||||||
start = SysTick->CNT;
|
start = SysTick->CNT;
|
||||||
reload = SysTick->CMP;
|
reload = SysTick->CMP;
|
||||||
us_ticks = SystemCoreClock / 8000000UL;
|
us_ticks = SystemCoreClock / 8000000UL;
|
||||||
total_delay_ticks = (uint32_t)us * us_ticks;
|
total_delay_ticks = us * us_ticks;
|
||||||
RT_ASSERT(total_delay_ticks < reload);
|
if (total_delay_ticks >= reload)
|
||||||
|
{
|
||||||
|
LOW_E("rt_hw_us_delay: the us parameter exceeds the maximum limit!");
|
||||||
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
now = SysTick->CNT;
|
now = SysTick->CNT;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user