rt-thread-official/components/drivers/smp/smp.h

35 lines
1.0 KiB
C
Raw Normal View History

2024-08-29 10:12:47 +08:00
#ifndef __SMP_IPI_H__
#define __SMP_IPI_H__
#include <rtthread.h>
2024-09-12 18:30:34 +08:00
typedef void (*rt_smp_call_func_back)(void *data);
typedef rt_bool_t (*rt_smp_cond)(int cpu, void *info);
2024-08-29 10:12:47 +08:00
#define SMP_CALL_EVENT_FUNC 0x1
2024-09-12 11:54:50 +08:00
#define SMP_CALL_WAIT_ALL (1 << 0)
2024-09-13 09:35:06 +08:00
#define SMP_CALL_NO_WAIT (1 << 1)
2024-09-12 11:54:50 +08:00
#define RT_ALL_CPU ((1 << RT_CPUS_NR) - 1)
2024-09-12 18:25:10 +08:00
struct rt_smp_event
2024-08-29 10:12:47 +08:00
{
2024-09-13 09:35:06 +08:00
int cpu_mask;
int event_id;
void *data;
2024-09-12 18:30:34 +08:00
rt_smp_call_func_back func;
2024-08-29 10:12:47 +08:00
};
2024-09-12 18:25:10 +08:00
struct rt_smp_call
2024-08-29 16:21:19 +08:00
{
2024-09-13 09:35:06 +08:00
struct rt_spinlock lock;
2024-09-12 18:25:10 +08:00
struct rt_smp_event event;
2024-08-29 16:21:19 +08:00
};
2024-08-29 10:12:47 +08:00
void rt_smp_call_ipi_handler(int vector, void *param);
2024-09-13 09:35:06 +08:00
void rt_smp_call_each_cpu(rt_smp_call_func_back func, void *data, rt_uint8_t flag);
void rt_smp_call_each_cpu_cond(rt_smp_call_func_back func, void *data, rt_uint8_t flag, rt_smp_cond cond_func);
void rt_smp_call_any_cpu(int cpu_mask, rt_smp_call_func_back func, void *data, rt_uint8_t flag);
void rt_smp_call_any_cpu_cond(int cpu_mask, rt_smp_call_func_back func, void *data, rt_uint8_t flag, rt_smp_cond cond_func);
2024-09-12 18:25:10 +08:00
void rt_smp_init(void);
2024-08-29 10:12:47 +08:00
2024-08-29 10:16:33 +08:00
#endif