From de352aee62e55ec2bc0b142355c14f7895e4bd78 Mon Sep 17 00:00:00 2001 From: GUI <39894654+GuEe-GUI@users.noreply.github.com> Date: Tue, 28 May 2024 09:55:24 +0800 Subject: [PIC] Make affinity helper interface (#8995) * [PIC] Make affinity helper interface Signed-off-by: GuEe-GUI <2991707448@qq.com> * [PIC/GIC] Fixup GIC affinity init GICv2 is not support if current CPU is not startup, but RT-Thread SMP is startup after the devices init in the `main` thread. This patch fixup the cpumask to init once and check the init status in affinity interface. Signed-off-by: GuEe-GUI <2991707448@qq.com> --------- Signed-off-by: GuEe-GUI <2991707448@qq.com> --- components/drivers/include/drivers/pic.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'components/drivers/include') diff --git a/components/drivers/include/drivers/pic.h b/components/drivers/include/drivers/pic.h index 5ab1434047..c2ca0e0079 100755 --- a/components/drivers/include/drivers/pic.h +++ b/components/drivers/include/drivers/pic.h @@ -40,7 +40,7 @@ struct rt_pic rt_list_t list; - struct rt_pic_ops *ops; + const struct rt_pic_ops *ops; void *priv_data; void *user_data; @@ -91,6 +91,10 @@ struct rt_pic_isr struct rt_irq_desc action; }; +#define RT_IRQ_AFFINITY_DECLARE(name) RT_BITMAP_DECLARE(name, RT_CPUS_NR) +#define RT_IRQ_AFFINITY_SET(affinity, cpuid) rt_bitmap_set_bit(affinity, cpuid) +#define RT_IRQ_AFFINITY_CLEAR(affinity, cpuid) rt_bitmap_clear_bit(affinity, cpuid) + #ifdef RT_USING_PIC_STATISTICS struct rt_pic_irq_statistics { @@ -117,7 +121,7 @@ struct rt_pic_irq rt_uint32_t mode; rt_uint32_t priority; - RT_BITMAP_DECLARE(affinity, RT_CPUS_NR); + RT_IRQ_AFFINITY_DECLARE(affinity); rt_list_t list; rt_list_t children_nodes; -- cgit v1.3.1