25 #include "sigrok-internal.h"
34 uint64_t length_in, uint8_t **data_out,
38 unsigned int outsize, offset, p;
53 if (!(outbuf = g_try_malloc0(outsize + 1))) {
54 sr_err(
"bits out: %s: outbuf malloc failed", __func__);
61 strncpy((
char *)outbuf, ctx->
header, outsize);
71 for (offset = 0; offset <= length_in - ctx->
unitsize;
73 memcpy(&sample, data_in + offset, ctx->
unitsize);
75 c = (sample & ((uint64_t) 1 << p)) ?
'1' :
'0';
98 sr_info(
"bits out: short buffer (length_in=%" PRIu64
")",
103 *length_out = strlen((
const char *)outbuf);
110 .description =
"Bits",