rewrite schedule pool.
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* Description: Event scheduling implementation
|
||||
*
|
||||
* Date: 2023-12-21 13:32
|
||||
* LastEditors: Fan Hao
|
||||
* LastEditTime: 2023-12-21 13:32
|
||||
* Revisions: Rev 0.0
|
||||
* History:
|
||||
* [2023-12-21]: Initial version.
|
||||
*
|
||||
* Copyright(c) 2021 Beijing Institute of Technology.
|
||||
* Lab of Communication and Networking
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef SCHDEVENT_H_
|
||||
#define SCHDEVENT_H_
|
||||
|
||||
#define SCHDEVENT_ID_NONE UINT32_MAX
|
||||
/***************************** Include Files *********************************/
|
||||
#include <stdlib.h>
|
||||
#include "linklayer814_types.h"
|
||||
#include "../error.h"
|
||||
#include "../util/list.h"
|
||||
/***************** Macros (Inline Functions) Definitions *********************/
|
||||
/**************************** Type Definitions *******************************/
|
||||
/** @name L2 event
|
||||
* A definition of L2 event instance.
|
||||
*/
|
||||
typedef struct {
|
||||
bool isSchd;
|
||||
bool isVolatile;
|
||||
L2_EVENT l2Event;
|
||||
uint32_t eventId;
|
||||
uint32_t ocurrCnt;
|
||||
uint32_t schdFrame;
|
||||
uint32_t schdSlot;
|
||||
} L2_SCHD_EVENT;
|
||||
|
||||
/** @name L2 event
|
||||
* A definition of L2 event instance.
|
||||
*/
|
||||
typedef struct {
|
||||
list_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_
|
||||
Reference in New Issue
Block a user