aboutsummaryrefslogtreecommitdiffstats
path: root/src/avr/misc.h
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2016-05-25 11:37:40 -0400
committerKevin O'Connor <kevin@koconnor.net>2016-05-25 11:37:40 -0400
commitf582a36e4df16d5709943f7df17a900c8bcc12ab (patch)
tree628d927c4f3e19e54618f7f47c7a44af66bf0c2f /src/avr/misc.h
parent37a91e9c10648208de002c75df304e23ca89e256 (diff)
downloadkutter-f582a36e4df16d5709943f7df17a900c8bcc12ab.tar.gz
kutter-f582a36e4df16d5709943f7df17a900c8bcc12ab.tar.xz
kutter-f582a36e4df16d5709943f7df17a900c8bcc12ab.zip
Initial commit of source code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/avr/misc.h')
-rw-r--r--src/avr/misc.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/avr/misc.h b/src/avr/misc.h
new file mode 100644
index 00000000..244cd5bc
--- /dev/null
+++ b/src/avr/misc.h
@@ -0,0 +1,25 @@
+#ifndef __AVR_MISC_H
+#define __AVR_MISC_H
+
+#include <stdint.h>
+#include <util/crc16.h>
+
+// alloc.c
+size_t alloc_maxsize(size_t reqsize);
+
+// console.c
+char *console_get_input(uint8_t *plen);
+void console_pop_input(uint8_t len);
+char *console_get_output(uint8_t len);
+void console_push_output(uint8_t len);
+
+// Optimized crc16_ccitt for the avr processor
+#define HAVE_OPTIMIZED_CRC 1
+static inline uint16_t _crc16_ccitt(char *buf, uint8_t len) {
+ uint16_t crc = 0xFFFF;
+ while (len--)
+ crc = _crc_ccitt_update(crc, *buf++);
+ return crc;
+}
+
+#endif // misc.h