stepper: Use a reusable interface to the "move queue"

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2020-11-20 18:57:47 -05:00
parent 3b9412513e
commit 697412d25c
3 changed files with 82 additions and 32 deletions

View file

@ -4,10 +4,22 @@
#include <stddef.h> // size_t
#include <stdint.h> // uint8_t
struct move_node {
struct move_node *next;
};
struct move_queue_head {
struct move_node *first, *last;
};
void *alloc_chunk(size_t size);
void move_free(void *m);
void *move_alloc(void);
void move_request_size(int size);
int move_queue_empty(struct move_queue_head *mh);
struct move_node *move_queue_first(struct move_queue_head *mh);
int move_queue_push(struct move_node *m, struct move_queue_head *mh);
struct move_node *move_queue_pop(struct move_queue_head *mh);
void move_queue_clear(struct move_queue_head *mh);
void move_queue_setup(struct move_queue_head *mh, int size);
void *oid_lookup(uint8_t oid, void *type);
void *oid_alloc(uint8_t oid, void *type, uint16_t size);
void *oid_next(uint8_t *i, void *type);