39#ifndef PROTOCORE_PREEMPT_QUEUE_H
40#define PROTOCORE_PREEMPT_QUEUE_H
44#if PC_ENABLE_PREEMPT_QUEUE
54enum class pc_pq_lane : uint8_t
68typedef void (*pc_pq_handler)(
const void *item,
void *ctx);
73 pc_pq_handler handler;
90bool pc_pq_start_lane(pc_pq_lane lane,
const pc_pq_config *cfg);
94bool pc_pq_post_lane(pc_pq_lane lane,
const void *item, uint32_t timeout_ticks);
97bool pc_pq_post_lane_urgent(pc_pq_lane lane,
const void *item, uint32_t timeout_ticks);
100bool pc_pq_post_lane_from_isr(pc_pq_lane lane,
const void *item);
104void pc_pq_drain_lane(pc_pq_lane lane);
107void pc_pq_stop_lane(pc_pq_lane lane);
110bool pc_pq_running_lane(pc_pq_lane lane);
113size_t pc_pq_high_water_lane(pc_pq_lane lane);
117uint8_t pc_pq_lane_priority(pc_pq_lane lane);
122inline bool pc_pq_start(
const pc_pq_config *cfg)
124 return pc_pq_start_lane(pc_pq_lane::PC_PQ_LANE_USER, cfg);
127inline bool pc_pq_post(
const void *item, uint32_t timeout_ticks)
129 return pc_pq_post_lane(pc_pq_lane::PC_PQ_LANE_USER, item, timeout_ticks);
132inline bool pc_pq_post_urgent(
const void *item, uint32_t timeout_ticks)
134 return pc_pq_post_lane_urgent(pc_pq_lane::PC_PQ_LANE_USER, item, timeout_ticks);
137inline bool pc_pq_post_from_isr(
const void *item)
139 return pc_pq_post_lane_from_isr(pc_pq_lane::PC_PQ_LANE_USER, item);
142inline void pc_pq_drain(
void)
144 pc_pq_drain_lane(pc_pq_lane::PC_PQ_LANE_USER);
147inline void pc_pq_stop(
void)
149 pc_pq_stop_lane(pc_pq_lane::PC_PQ_LANE_USER);
152inline bool pc_pq_running(
void)
154 return pc_pq_running_lane(pc_pq_lane::PC_PQ_LANE_USER);
157inline size_t pc_pq_high_water(
void)
159 return pc_pq_high_water_lane(pc_pq_lane::PC_PQ_LANE_USER);
User-facing configuration for ProtoCore.