aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/serialqueue.h
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2018-04-30 11:22:16 -0400
committerKevin O'Connor <kevin@koconnor.net>2018-04-30 11:44:53 -0400
commit15248706ae3950ce89ea595c72349b3738983f41 (patch)
treea0bc14c73de7a0844c4a3a43381bc93334fa3dbb /klippy/serialqueue.h
parent8e1b516eb6e47eb3aa295f2b872fa60a530274e1 (diff)
downloadkutter-15248706ae3950ce89ea595c72349b3738983f41.tar.gz
kutter-15248706ae3950ce89ea595c72349b3738983f41.tar.xz
kutter-15248706ae3950ce89ea595c72349b3738983f41.zip
chelper: Move the host C code to a new klippy/chelper/ directory
Move the C code out of the main klippy/ directory and into its own directory. This reduces the clutter in the main klippy directory. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/serialqueue.h')
-rw-r--r--klippy/serialqueue.h69
1 files changed, 0 insertions, 69 deletions
diff --git a/klippy/serialqueue.h b/klippy/serialqueue.h
deleted file mode 100644
index 80ab686e..00000000
--- a/klippy/serialqueue.h
+++ /dev/null
@@ -1,69 +0,0 @@
-#ifndef SERIALQUEUE_H
-#define SERIALQUEUE_H
-
-#include "list.h" // struct list_head
-
-#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;
- };
- };
- 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;
- double sent_time, receive_time;
-};
-
-struct serialqueue;
-struct serialqueue *serialqueue_alloc(int serial_fd, int write_only);
-void serialqueue_exit(struct serialqueue *sq);
-void serialqueue_free(struct serialqueue *sq);
-struct command_queue *serialqueue_alloc_commandqueue(void);
-void serialqueue_free_commandqueue(struct command_queue *cq);
-void serialqueue_send_batch(struct serialqueue *sq, struct command_queue *cq
- , struct list_head *msgs);
-void serialqueue_send(struct serialqueue *sq, struct command_queue *cq
- , uint8_t *msg, int len
- , uint64_t min_clock, uint64_t req_clock);
-void serialqueue_encode_and_send(struct serialqueue *sq, struct command_queue *cq
- , uint32_t *data, int len
- , uint64_t min_clock, uint64_t req_clock);
-void serialqueue_pull(struct serialqueue *sq, struct pull_queue_message *pqm);
-void serialqueue_set_baud_adjust(struct serialqueue *sq, double baud_adjust);
-void serialqueue_set_clock_est(struct serialqueue *sq, double est_freq
- , double last_clock_time, uint64_t last_clock);
-void serialqueue_get_stats(struct serialqueue *sq, char *buf, int len);
-int serialqueue_extract_old(struct serialqueue *sq, int sentq
- , struct pull_queue_message *q, int max);
-
-#endif // serialqueue.h