+/*
+ * Debugging Utilities for STM32
+ *
+ * (c) 2018--2019 Martin Mareš <mj@ucw.cz>
+ */
+
#include "util.h"
#include <libopencm3/stm32/usart.h>
+/*
+ * General Utility Library for STM32
+ *
+ * (c) 2018--2019 Martin Mareš <mj@ucw.cz>
+ */
+
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "config.h"
+// Types
+
typedef unsigned int uint;
typedef uint8_t byte;
typedef uint16_t u16;
typedef uint32_t u32;
typedef int32_t s32;
+// Macros
+
#define MIN(x,y) ((x) < (y) ? (x) : (y))
#define MAX(x,y) ((x) > (y) ? (x) : (y))
#define UNUSED __attribute__((unused))
+// Unaligned access to data
+
static inline uint get_u16_le(byte *p)
{
return (p[1] << 8) | p[0];