4 typedef unsigned int uint;
11 #define MIN(x,y) ((x) < (y) ? (x) : (y))
12 #define MAX(x,y) ((x) > (y) ? (x) : (y))
14 static inline uint get_u16_le(byte *p)
16 return (p[1] << 8) | p[0];
19 static inline uint get_u16_be(byte *p)
21 return (p[0] << 8) | p[1];
24 static inline uint get_u32_le(byte *p)
26 return (p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0];
29 static inline uint get_u32_be(byte *p)
31 return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
34 static inline void put_u16_le(byte *p, u16 x)
40 static inline void put_u16_be(byte *p, u16 x)
46 static inline void put_u32_be(byte *p, u32 x)
49 p[1] = (x >> 16) & 0xff;
50 p[2] = (x >> 8) & 0xff;
54 static inline void put_u32_le(byte *p, u32 x)
57 p[2] = (x >> 16) & 0xff;
58 p[1] = (x >> 8) & 0xff;
64 // #define DEBUG_SEMIHOSTING
65 #define DEBUG_USART USART1
67 void debug_printf(const char *fmt, ...);
68 void debug_puts(const char *s);
69 void debug_putc(int c);