The PowerNet QUEUE
data structure is the head of a
linked list of queue buffer data structures, usually
a PBUF
or an I/O buffer. The first cell of anything
that is added to a QUEUE
must have a link field
at offset 0, the first cell.
: QLock \ -- ; lock out interrupts
If QUEUEs are used in interrupts, or if the scheduler
is interrupt driven, place your locking code here.
Do not forget to change the COMPILER ... TARGET
macros too.
: QUnLock \ -- ; reenable interrupts
If QUEUEs are used in interrupts, or if the scheduler
is interrupt driven, place your locking code here.
Do not forget to change the COMPILER ... TARGET
macros too.
: PeekQ \ *queue -- *head
Return the first item in the queue without removing it.
Useful for testing and handling partially full/empty buffers.
: Dequeue \ *queue -- *head|0 ; 0 indicates nothing to remove
Remove the next item from the queue.
: Enqueue \ *buffer *queue --
Add buffer to queue.
: InitQ \ *queue --
Initialise/reset the queue.