DDA Queue - manage the move queue. More...
#include "dda_queue.h"
#include <string.h>
#include <avr/interrupt.h>
#include "config.h"
#include "timer.h"
#include "serial.h"
#include "sermsg.h"
#include "delay.h"
#include <stdint.h>
#include <util/delay_basic.h>
#include "watchdog.h"
#include "sersendf.h"
#include "clock.h"
#include "memory_barrier.h"
Functions | |
DDA movebuffer[MOVEBUFFER_SIZE] | __attribute__ ((__section__(".bss"))) |
move buffer. | |
uint8_t | queue_full () |
check if the queue is completely full | |
uint8_t | queue_empty () |
check if the queue is completely empty | |
void | queue_step () |
Take a step or go to the next move. | |
void | enqueue (TARGET *t) |
add a move to the movebuffer | |
void | enqueue_home (TARGET *t, uint8_t endstop_check, uint8_t endstop_stop_cond) |
void | next_move () |
go to the next move. | |
void | print_queue () |
DEBUG - print queue. | |
void | queue_flush () |
dump queue for emergency stop. | |
void | queue_wait () |
wait for queue to empty | |
Variables | |
uint8_t | mb_head = 0 |
movebuffer head pointer. | |
uint8_t | mb_tail = 0 |
movebuffer tail pointer. |
DDA Queue - manage the move queue.
DDA movebuffer [MOVEBUFFER_SIZE] __attribute__ | ( | (__section__(".bss")) | ) |
move buffer.
holds move queue contents are read/written both in and out of interrupts, but once writing starts in interrupts on a specific slot, the slot will only be modified in interrupts until the slot is is no longer live. The size does not need to be a power of 2 anymore!
void enqueue | ( | TARGET * | t | ) |
add a move to the movebuffer
Referenced by process_gcode_command().
void next_move | ( | void | ) |
go to the next move.
be aware that this is sometimes called from interrupt context, sometimes not. Note that if it is called from outside an interrupt it must not/can not by be interrupted such that it can be re-entered from within an interrupt. The timer interrupt MUST be disabled on entry. This is ensured because the timer was disabled at the start of the ISR or else because the current move buffer was dead in the non-interrupt case (which indicates that the timer interrupt is disabled).
Referenced by queue_step().
void print_queue | ( | void | ) |
DEBUG - print queue.
Qt/hs format, t is tail, h is head, s is F/full, E/empty or neither
Referenced by clock_250ms(), and process_gcode_command().
void queue_flush | ( | void | ) |
uint8_t mb_head = 0 |
movebuffer head pointer.
Points to the last move in the queue. this variable is used both in and out of interrupts, but is only written outside of interrupts.
Referenced by print_queue(), queue_empty(), queue_flush(), and queue_full().
uint8_t mb_tail = 0 |
movebuffer tail pointer.
Points to the currently executing move this variable is read/written both in and out of interrupts.
Referenced by clock_250ms(), next_move(), print_queue(), process_gcode_command(), queue_empty(), queue_flush(), queue_full(), queue_step(), and update_current_position().