2024-08-29 10:12:47 +08:00
|
|
|
#ifndef __SMP_IPI_H__
|
|
|
|
#define __SMP_IPI_H__
|
|
|
|
#include <rtthread.h>
|
2024-09-12 11:54:50 +08:00
|
|
|
typedef void (*smp_call_func_back)(void *data);
|
|
|
|
typedef rt_bool_t (*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)
|
|
|
|
#define SMP_CALL_NO_WAIT (1 << 1)
|
|
|
|
|
|
|
|
#define RT_ALL_CPU ((1 << RT_CPUS_NR) - 1)
|
2024-08-29 10:12:47 +08:00
|
|
|
struct smp_event
|
|
|
|
{
|
|
|
|
int cpu_mask;
|
|
|
|
int event_id;
|
|
|
|
void *data;
|
2024-09-12 11:54:50 +08:00
|
|
|
smp_call_func_back func;
|
2024-08-29 10:12:47 +08:00
|
|
|
};
|
2024-08-29 16:21:19 +08:00
|
|
|
struct smp_call
|
|
|
|
{
|
|
|
|
struct rt_spinlock lock;
|
|
|
|
struct smp_event event;
|
|
|
|
};
|
|
|
|
|
2024-08-29 10:12:47 +08:00
|
|
|
|
|
|
|
void rt_smp_call_ipi_handler(int vector, void *param);
|
2024-09-12 11:54:50 +08:00
|
|
|
void rt_call_each_cpu(smp_call_func_back func, void *data,rt_uint8_t flag);
|
|
|
|
void rt_call_each_cpu_cond(smp_call_func_back func, void *data,rt_uint8_t flag,smp_cond cond_func);
|
|
|
|
void rt_call_any_cpu(int cpu_mask,smp_call_func_back func, void *data,rt_uint8_t flag);
|
|
|
|
void rt_call_any_cpu_cond(int cpu_mask,smp_call_func_back func, void *data,rt_uint8_t flag,smp_cond cond_func);
|
2024-08-29 10:12:47 +08:00
|
|
|
void smp_init(void);
|
|
|
|
|
2024-08-29 10:16:33 +08:00
|
|
|
#endif
|