diff options
author | root <root@lab.panaceas.james.local> | 2019-02-19 13:46:18 +0000 |
---|---|---|
committer | root <root@lab.panaceas.james.local> | 2019-02-19 13:46:18 +0000 |
commit | b3c6320899d6b27899ab3c67c745e8d3b29af3a2 (patch) | |
tree | 41dc7fc5d71a841a416d0d53923de5d1d44277e3 /app/ubx.h | |
parent | c84e85e0e9641b006a376fab456ac2efcfdb14e2 (diff) | |
download | clock-b3c6320899d6b27899ab3c67c745e8d3b29af3a2.tar.gz clock-b3c6320899d6b27899ab3c67c745e8d3b29af3a2.tar.bz2 clock-b3c6320899d6b27899ab3c67c745e8d3b29af3a2.zip |
working ethernet
Diffstat (limited to 'app/ubx.h')
-rw-r--r-- | app/ubx.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/app/ubx.h b/app/ubx.h new file mode 100644 index 0000000..44c4782 --- /dev/null +++ b/app/ubx.h @@ -0,0 +1,56 @@ +static inline int +ubx_get_u8 (uint8_t *ptr, uint8_t *v) +{ + *v = *ptr; + return 1; +} + +static inline int +ubx_get_u16 (uint8_t *ptr, uint16_t *v) +{ + memcpy (v, ptr, sizeof (*v)); + return sizeof (*v); +} + +static inline int +ubx_get_u32 (uint8_t *ptr, uint32_t *v) +{ + memcpy (v, ptr, sizeof (*v)); + return sizeof (*v); +} + +static inline int +ubx_get_i32 (uint8_t *ptr, int32_t *v) +{ + memcpy (v, ptr, sizeof (*v)); + return sizeof (*v); +} + + +static inline int +ubx_put_u8 (uint8_t *ptr, uint8_t v) +{ + *ptr = v; + return sizeof (v); +} + +static inline int +ubx_put_u16 (uint8_t *ptr, uint16_t v) +{ + memcpy (ptr, &v, sizeof (v)); + return sizeof (v); +} + +static inline int +ubx_put_u32 (uint8_t *ptr, uint32_t v) +{ + memcpy (ptr, &v, sizeof (v)); + return sizeof (v); +} + +static inline int +ubx_put_i32 (uint8_t *ptr, int32_t v) +{ + memcpy (ptr, &v, sizeof (v)); + return sizeof (v); +} |