GEX core repository.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gex-core/tasks/sched_queue.h

59 lines
1.1 KiB

7 years ago
//
// Created by MightyPork on 2017/11/21.
//
// Job and message scheduling queue structs and typedefs
//
7 years ago
#ifndef GEX_SCHED_QUEUE_H
#define GEX_SCHED_QUEUE_H
#include "platform.h"
#include <TinyFrame.h>
#include "framework/unit.h"
7 years ago
/**
* Queued job typedef
*/
7 years ago
typedef struct sched_que_item Job;
/**
* Queued job callback
*/
7 years ago
typedef void (*ScheduledJobCb) (Job *job);
/**
* Queued job data struct
*/
7 years ago
struct sched_que_item {
/** The callback */
7 years ago
ScheduledJobCb cb;
// Fields for data
Unit *unit;
uint64_t timestamp;
uint32_t data1;
uint32_t data2;
uint32_t data3;
7 years ago
};
/**
* Queued data chunk structure - used for buffering received messages for TinyFrame
*/
struct rx_que_item {
uint32_t len;
uint8_t data[MSG_QUE_SLOT_SIZE];
};
/**
* Combined struct - added when we merged the two separate queues
*/
struct rx_sched_combined_que_item {
bool is_job; // tag indicating whether the job or msg field is used
union {
struct rx_que_item msg;
struct sched_que_item job;
};
};
7 years ago
#endif //GEX_SCHED_QUEUE_H