diff options
| author | zms123456 <[email protected]> | 2024-06-23 22:08:54 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-06-23 22:08:54 +0800 |
| commit | 22b5e5fd7b80403d2c58c8361d3678eb7f21df68 (patch) | |
| tree | 48f41d2a8929539526233ca784380f440ce670ec /components/drivers/pic | |
| parent | 5c1e5d2fcadda2ff797db3f7e23b5a38ad466cbc (diff) | |
[components][ktime]support period ktime timeout and multiple ktimer_hrtimer (#8972)
* support period time
* enable multiple ktimer
* mv set delay_cnt to hrtimer_start
* add ktime debug info
* change current_irq_begin to local var
* fix bug: setting current timer and setting timeout in driver aren't atomicly
* create->init
* refactoring ktime
Diffstat (limited to 'components/drivers/pic')
| -rw-r--r-- | components/drivers/pic/pic.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/components/drivers/pic/pic.c b/components/drivers/pic/pic.c index 4b7467a10b..4525c7d49e 100644 --- a/components/drivers/pic/pic.c +++ b/components/drivers/pic/pic.c @@ -515,6 +515,7 @@ rt_err_t rt_pic_handle_isr(struct rt_pic_irq *pirq) #ifdef RT_USING_PIC_STATISTICS struct timespec ts; rt_ubase_t irq_time_ns; + rt_ubase_t current_irq_begin; #endif RT_ASSERT(pirq != RT_NULL); @@ -522,7 +523,7 @@ rt_err_t rt_pic_handle_isr(struct rt_pic_irq *pirq) #ifdef RT_USING_PIC_STATISTICS rt_ktime_boottime_get_ns(&ts); - pirq->stat.current_irq_begin[rt_hw_cpu_id()] = ts.tv_sec * (1000UL * 1000 * 1000) + ts.tv_nsec; + current_irq_begin = ts.tv_sec * (1000UL * 1000 * 1000) + ts.tv_nsec; #endif handler_nodes = &pirq->isr.list; @@ -577,7 +578,7 @@ rt_err_t rt_pic_handle_isr(struct rt_pic_irq *pirq) #ifdef RT_USING_PIC_STATISTICS rt_ktime_boottime_get_ns(&ts); - irq_time_ns = ts.tv_sec * (1000UL * 1000 * 1000) + ts.tv_nsec - pirq->stat.current_irq_begin[rt_hw_cpu_id()]; + irq_time_ns = ts.tv_sec * (1000UL * 1000 * 1000) + ts.tv_nsec - current_irq_begin; pirq->stat.sum_irq_time_ns += irq_time_ns; if (irq_time_ns < pirq->stat.min_irq_time_ns || pirq->stat.min_irq_time_ns == 0) { |
