Merge remote-tracking branch 'rtt_gitee/gitee_master'
This commit is contained in:
commit
1e7dfa694f
|
@ -113,16 +113,32 @@ void _Error_Handler(char *s, int num)
|
||||||
*/
|
*/
|
||||||
void rt_hw_us_delay(rt_uint32_t us)
|
void rt_hw_us_delay(rt_uint32_t us)
|
||||||
{
|
{
|
||||||
rt_uint32_t start, now, delta, reload, us_tick;
|
rt_uint32_t ticks;
|
||||||
start = SysTick->VAL;
|
rt_uint32_t told, tnow, tcnt = 0;
|
||||||
reload = SysTick->LOAD;
|
rt_uint32_t reload = SysTick->LOAD;
|
||||||
us_tick = SystemCoreClock / 1000000UL;
|
|
||||||
do
|
ticks = us * reload / (1000000 / RT_TICK_PER_SECOND);
|
||||||
|
told = SysTick->VAL;
|
||||||
|
while (1)
|
||||||
{
|
{
|
||||||
now = SysTick->VAL;
|
tnow = SysTick->VAL;
|
||||||
delta = start >= now ? start - now : reload + start - now;
|
if (tnow != told)
|
||||||
|
{
|
||||||
|
if (tnow < told)
|
||||||
|
{
|
||||||
|
tcnt += told - tnow;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tcnt += reload - tnow + told;
|
||||||
|
}
|
||||||
|
told = tnow;
|
||||||
|
if (tcnt >= ticks)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while (delta < us_tick * us);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -64,6 +64,7 @@ rt_err_t rt_workqueue_submit_work(struct rt_workqueue *queue, struct rt_work *wo
|
||||||
rt_err_t rt_workqueue_cancel_work(struct rt_workqueue *queue, struct rt_work *work);
|
rt_err_t rt_workqueue_cancel_work(struct rt_workqueue *queue, struct rt_work *work);
|
||||||
rt_err_t rt_workqueue_cancel_work_sync(struct rt_workqueue *queue, struct rt_work *work);
|
rt_err_t rt_workqueue_cancel_work_sync(struct rt_workqueue *queue, struct rt_work *work);
|
||||||
rt_err_t rt_workqueue_cancel_all_work(struct rt_workqueue *queue);
|
rt_err_t rt_workqueue_cancel_all_work(struct rt_workqueue *queue);
|
||||||
|
rt_err_t rt_workqueue_critical_work(struct rt_workqueue *queue, struct rt_work *work);
|
||||||
|
|
||||||
#ifdef RT_USING_SYSTEM_WORKQUEUE
|
#ifdef RT_USING_SYSTEM_WORKQUEUE
|
||||||
rt_err_t rt_work_submit(struct rt_work *work, rt_tick_t time);
|
rt_err_t rt_work_submit(struct rt_work *work, rt_tick_t time);
|
||||||
|
|
Loading…
Reference in New Issue