第一次提交,修改保存刷写上位机IP
This commit is contained in:
47
app/app_frm_signal.h
Normal file
47
app/app_frm_signal.h
Normal file
@@ -0,0 +1,47 @@
|
||||
#ifndef APP_FRM_SIGNAL_H
|
||||
#define APP_FRM_SIGNAL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include "app_dependence.h"
|
||||
|
||||
#define MAX_SIGNALS 500u // 每个优先级的最大信号数量
|
||||
#define MAX_SUBSCRIBERS 50u // 不同信号的订阅者数量
|
||||
#define MAX_CALLBACKS 25u // 每个信号最多支持多少订阅者
|
||||
#define PRIORITY_LEVELS 2u // 优先级层次
|
||||
|
||||
|
||||
// 回调函数类型定义
|
||||
typedef void (*CallbackFunc)(void *signal_id);
|
||||
|
||||
// 函数声明
|
||||
void initFramework(void);
|
||||
int32_t subscribe(void *signal_id, CallbackFunc callback);
|
||||
int32_t publishMessage(void *signal_id, uint8_t priority);
|
||||
void processMessages(void);
|
||||
int32_t getSignalCount(uint32_t priority);
|
||||
uint32_t getSubscriberCount(void);
|
||||
|
||||
// 进入临界区,禁用中断,并返回之前的中断状态
|
||||
static inline irq_state_t enter_critical_section(void)
|
||||
{
|
||||
return arch_irq_save();
|
||||
}
|
||||
|
||||
// 退出临界区,恢复之前的中断状态
|
||||
static inline void exit_critical_section(irq_state_t saved_state)
|
||||
{
|
||||
arch_irq_restore(saved_state);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // APP_FRM_SIGNAL_H
|
||||
Reference in New Issue
Block a user