39#ifndef PROTOCORE_PREEMPT_QUEUE_H
40#define PROTOCORE_PREEMPT_QUEUE_H
44#if PROTOCORE_ENABLE_PREEMPT_QUEUE
55 PROTOCORE_PQ_LANE_USER = 0,
56 PROTOCORE_PQ_LANE_DMA,
57 PROTOCORE_PQ_LANE_FORWARD,
58 PROTOCORE_PQ_LANE_DEVICE,
59 PROTOCORE_PQ_LANE_COUNT
67typedef void (*protocore_pq_handler)(
const void *item,
void *ctx);
77 protocore_pq_handler handler;
88 uint32_t timeout_ticks;
115 protocore_pq_lane lane;
116 const protocore_pq_config *cfg;
117 PqPostArgs post_args;
124extern PreemptQueueVars PreemptQueueV;
129 void (*
const post_from_isr)(uint8_t *work);
130 void (*
const post_urgent)(uint8_t *work);
131 void (*
const high_water)(uint8_t *work);
132 void (*
const priority)(uint8_t *work);
133 void (*
const running)(uint8_t *work);
134 void (*
const start)(uint8_t *work);
135 void (*
const post)(uint8_t *work);
136 void (*
const drain)(uint8_t *work);
137 void (*
const stop)(uint8_t *work);
142void protocore_preempt_queue_post_from_isr(uint8_t *work);
143void protocore_preempt_queue_post_urgent(uint8_t *work);
144void protocore_preempt_queue_high_water(uint8_t *work);
145void protocore_preempt_queue_priority(uint8_t *work);
146void protocore_preempt_queue_running(uint8_t *work);
147void protocore_preempt_queue_start(uint8_t *work);
148void protocore_preempt_queue_post(uint8_t *work);
149void protocore_preempt_queue_drain(uint8_t *work);
150void protocore_preempt_queue_stop(uint8_t *work);
156static const PreemptQueueNs PreemptQueue __attribute__((unused)) = {
157 .post_from_isr = protocore_preempt_queue_post_from_isr,
158 .post_urgent = protocore_preempt_queue_post_urgent,
159 .high_water = protocore_preempt_queue_high_water,
160 .priority = protocore_preempt_queue_priority,
161 .running = protocore_preempt_queue_running,
162 .start = protocore_preempt_queue_start,
163 .post = protocore_preempt_queue_post,
164 .drain = protocore_preempt_queue_drain,
165 .stop = protocore_preempt_queue_stop,
177uint8_t *protocore_preempt_queue_span(
void);
184 PreemptQueueV.lane = PROTOCORE_PQ_LANE_USER;
185 PreemptQueueV.cfg = cfg;
186 PreemptQueue.start(protocore_preempt_queue_span());
187 return PreemptQueueV.ok;
192 PreemptQueueV.lane = PROTOCORE_PQ_LANE_USER;
193 PreemptQueueV.post_args.item = item;
194 PreemptQueueV.post_args.timeout_ticks = timeout_ticks;
195 PreemptQueue.post(protocore_preempt_queue_span());
196 return PreemptQueueV.ok;
201 PreemptQueueV.lane = PROTOCORE_PQ_LANE_USER;
202 PreemptQueueV.post_args.item = item;
203 PreemptQueueV.post_args.timeout_ticks = timeout_ticks;
204 PreemptQueue.post_urgent(protocore_preempt_queue_span());
205 return PreemptQueueV.ok;
210 PreemptQueueV.lane = PROTOCORE_PQ_LANE_USER;
211 PreemptQueueV.post_args.item = item;
212 PreemptQueue.post_from_isr(protocore_preempt_queue_span());
213 return PreemptQueueV.ok;
218 PreemptQueueV.lane = PROTOCORE_PQ_LANE_USER;
219 PreemptQueue.drain(protocore_preempt_queue_span());
224 PreemptQueueV.lane = PROTOCORE_PQ_LANE_USER;
225 PreemptQueue.stop(protocore_preempt_queue_span());
230 PreemptQueueV.lane = PROTOCORE_PQ_LANE_USER;
231 PreemptQueue.running(protocore_preempt_queue_span());
232 return PreemptQueueV.ok;
237 PreemptQueueV.lane = PROTOCORE_PQ_LANE_USER;
238 PreemptQueue.high_water(protocore_preempt_queue_span());
239 return PreemptQueueV.n;
PROTO_ENUM_PACKED
Application protocol spoken on a listener port or connection slot.
#define PROTOCORE_INLINE
Linkage for a leaf primitive whose body is cheaper than the call that reaches it.
#define PROTOCORE_BEGIN_DECLS
Give a header's declarations C linkage, so their symbol names carry no parameter types.
_Bool proto_bool
The truth value.
#define PROTOCORE_END_DECLS