forked from 0xha0/df_datalink
76 lines
2.1 KiB
C
76 lines
2.1 KiB
C
/*****************************************************************************/
|
|
/**
|
|
* @file schdevent.c
|
|
* @author FanHao ([email protected])
|
|
* @brief DF Linklayer Event scheduling header file.
|
|
* @version 0.1
|
|
* @date 2023-05-06
|
|
*
|
|
* @copyright Copyright(c) 2024 Beijing Institute of Technology.\n
|
|
* Lab of Communication and Network
|
|
*
|
|
******************************************************************************/
|
|
/**
|
|
* @addtogroup LinkLayer
|
|
* @{
|
|
*/
|
|
|
|
/**
|
|
* @addtogroup LinkLayer_Scheduler
|
|
* @{
|
|
*/
|
|
#ifndef SCHDEVENT_H_
|
|
#define SCHDEVENT_H_
|
|
|
|
#define SCHDEVENT_ID_NONE UINT32_MAX
|
|
/***************************** Include Files *********************************/
|
|
#include <stdlib.h>
|
|
#include "link_layer_types.h"
|
|
#include "error.h"
|
|
#include "clist.h"
|
|
/***************** Macros (Inline Functions) Definitions *********************/
|
|
/**************************** Type Definitions *******************************/
|
|
/**
|
|
* @struct L2_SCHD_EVENT
|
|
* @brief Linklayer scheduled event descriptor
|
|
*/
|
|
typedef struct
|
|
{
|
|
bool isSchd;
|
|
bool isVolatile;
|
|
L2_EVENT l2Event;
|
|
uint32_t eventId;
|
|
uint32_t occurCnt;
|
|
uint32_t schdFrame;
|
|
uint32_t schdSlot;
|
|
} L2_SCHD_EVENT;
|
|
|
|
/**
|
|
* @struct L2_SCHD_POOL
|
|
* @brief Linklayer schedule event pool instance
|
|
*/
|
|
typedef struct
|
|
{
|
|
clist_t *schdList;
|
|
uint32_t envCnt;
|
|
} L2_SCHD_POOL;
|
|
|
|
/************************** Variable Definitions *****************************/
|
|
/************************** Function Prototypes ******************************/
|
|
// Scheduling Event
|
|
int32_t L2_CreateSchedEventPool(L2_SCHD_POOL **schdPool);
|
|
void L2_ClearSchedEventPool(L2_SCHD_POOL *schdPool);
|
|
void L2_DestroySchedEventPool(L2_SCHD_POOL *schdPool);
|
|
|
|
L2_SCHD_EVENT *L2_CreatNewSchdEvent(L2_SCHD_POOL *schdPool, L2_EVENT_TYPE event, bool isVolatile);
|
|
L2_SCHD_EVENT *L2_GetEventById(L2_SCHD_POOL *schdPool, uint32_t id);
|
|
int32_t L2_DeleteSchdEventById(L2_SCHD_POOL *schdPool, uint32_t id);
|
|
|
|
void L2_SchdEventAppendMsg(L2_SCHD_EVENT *schdEvent, void *msg);
|
|
bool L2_isEventScheduled(const L2_SCHD_EVENT *schdEvent);
|
|
int32_t L2_CancelEvent(L2_SCHD_EVENT *schdEvent);
|
|
|
|
#endif // SCHDEVENT_H_
|
|
|
|
/** @} LinkLayer_Scheduler*/
|
|
/** @} LinkLayer*/ |