diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2021-02-17 22:20:47 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2021-06-09 18:58:35 -0400 |
commit | 1865080a0759b318a6bd9141aa7695de943736d5 (patch) | |
tree | b4ab3e747aec28fc6629e19f7700955fdfc5211c /klippy/chelper/serialqueue.h | |
parent | 2559a2dd5ad4c5e8341aeddb6e5a59967867cbd7 (diff) | |
download | kutter-1865080a0759b318a6bd9141aa7695de943736d5.tar.gz kutter-1865080a0759b318a6bd9141aa7695de943736d5.tar.xz kutter-1865080a0759b318a6bd9141aa7695de943736d5.zip |
msgblock: Move message manipulation code from serialqueue.c to new msgblock.c
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/chelper/serialqueue.h')
-rw-r--r-- | klippy/chelper/serialqueue.h | 34 |
1 files changed, 1 insertions, 33 deletions
diff --git a/klippy/chelper/serialqueue.h b/klippy/chelper/serialqueue.h index 62af9aaf..17e14316 100644 --- a/klippy/chelper/serialqueue.h +++ b/klippy/chelper/serialqueue.h @@ -2,43 +2,11 @@ #define SERIALQUEUE_H #include "list.h" // struct list_head +#include "msgblock.h" // MESSAGE_MAX #define MAX_CLOCK 0x7fffffffffffffffLL #define BACKGROUND_PRIORITY_CLOCK 0x7fffffff00000000LL -#define MESSAGE_MIN 5 -#define MESSAGE_MAX 64 -#define MESSAGE_HEADER_SIZE 2 -#define MESSAGE_TRAILER_SIZE 3 -#define MESSAGE_POS_LEN 0 -#define MESSAGE_POS_SEQ 1 -#define MESSAGE_TRAILER_CRC 3 -#define MESSAGE_TRAILER_SYNC 1 -#define MESSAGE_PAYLOAD_MAX (MESSAGE_MAX - MESSAGE_MIN) -#define MESSAGE_SEQ_MASK 0x0f -#define MESSAGE_DEST 0x10 -#define MESSAGE_SYNC 0x7E - -struct queue_message { - int len; - uint8_t msg[MESSAGE_MAX]; - union { - // Filled when on a command queue - struct { - uint64_t min_clock, req_clock; - }; - // Filled when in sent/receive queues - struct { - double sent_time, receive_time; - }; - }; - uint64_t notify_id; - struct list_node node; -}; - -struct queue_message *message_alloc_and_encode(uint32_t *data, int len); -void message_queue_free(struct list_head *root); - struct pull_queue_message { uint8_t msg[MESSAGE_MAX]; int len; |