In read_header we do:
1. read data
2. unserialize header
3. validity check
4. dump header
In send_header:
1. dump header
2. validity check (we skip it, actually)
3. serialize header
4. send data
unserialize_header(dev->buffer, h);
unserialize_header(dev->buffer, h);
- debug_dump_header(dev->ctx, h);
-
if (h->direction == AM7XXX_DIRECTION_IN) {
ret = 0;
} else {
if (h->direction == AM7XXX_DIRECTION_IN) {
ret = 0;
} else {
+ debug_dump_header(dev->ctx, h);
+
debug_dump_header(dev->ctx, h);
debug_dump_header(dev->ctx, h);
+ /* For symmetry with read_header() we should check here for
+ * h->direction == AM7XXX_DIRECTION_OUT but we just ensure that in all
+ * the callers and save some cycles here.
+ */
+
serialize_header(h, dev->buffer);
serialize_header(h, dev->buffer);
ret = send_data(dev, dev->buffer, AM7XXX_HEADER_WIRE_SIZE);
if (ret < 0)
error(dev->ctx, "failed to send data\n");
ret = send_data(dev, dev->buffer, AM7XXX_HEADER_WIRE_SIZE);
if (ret < 0)
error(dev->ctx, "failed to send data\n");