23 #include "libsigrok-internal.h" 26 const uint8_t *data,
size_t length)
30 if (!out || !spec || !data)
33 #define VALUE_TYPE(T, R, L) \ 35 if (spec->offset + (L) > length) \ 37 value = R(data + spec->offset); \ 41 VALUE_TYPE(BVT_UINT8, read_u8,
sizeof(uint8_t));
43 VALUE_TYPE(BVT_BE_UINT16, read_u16be,
sizeof(uint16_t));
44 VALUE_TYPE(BVT_BE_UINT24, read_u24be, 3 *
sizeof(uint8_t));
45 VALUE_TYPE(BVT_BE_UINT32, read_u32be,
sizeof(uint32_t));
47 VALUE_TYPE(BVT_LE_UINT16, read_u16le,
sizeof(uint16_t));
48 VALUE_TYPE(BVT_LE_UINT24, read_u24le, 3 *
sizeof(uint8_t));
49 VALUE_TYPE(BVT_LE_UINT32, read_u32le,
sizeof(uint32_t));
68 ptr = &data[spec->offset];
75 value = read_u16be(ptr);
78 value = read_u24be(ptr);
81 value = read_u32be(ptr);
84 value = read_u16le(ptr);
87 value = read_u24le(ptr);
90 value = read_u32le(ptr);
SR_PRIV int bv_get_value_len(float *out, const struct binary_value_spec *spec, const uint8_t *data, size_t length)
The public libsigrok header file to be used by frontends.
#define VALUE_TYPE(T, R, L)
SR_PRIV int bv_get_value(float *out, const struct binary_value_spec *spec, const uint8_t *data)