chronovu-la: Fix byte order for LA16 samples sent to the bus.

This commit is contained in:
Uwe Hermann 2014-04-01 23:23:23 +02:00
parent b0efc84e12
commit 05266f36a5
1 changed files with 12 additions and 2 deletions

View File

@ -417,8 +417,8 @@ SR_PRIV int cv_read_block(struct dev_context *devc)
SR_PRIV void cv_send_block_to_session_bus(struct dev_context *devc, int block)
{
int i;
uint8_t sample, expected_sample;
int i, idx;
uint8_t sample, expected_sample, tmp8;
struct sr_datafeed_packet packet;
struct sr_datafeed_logic logic;
int trigger_point; /* Relative trigger point (in this block). */
@ -452,6 +452,16 @@ SR_PRIV void cv_send_block_to_session_bus(struct dev_context *devc, int block)
}
}
/* Swap low and high bytes of the 16-bit LA16 samples. */
if (devc->prof->model == CHRONOVU_LA16) {
for (i = 0; i < BS; i += 2) {
idx = (block * BS) + i;
tmp8 = devc->final_buf[idx];
devc->final_buf[idx] = devc->final_buf[idx + 1];
devc->final_buf[idx + 1] = tmp8;
}
}
/* If no trigger was found, send one SR_DF_LOGIC packet. */
if (trigger_point == -1) {
/* Send an SR_DF_LOGIC packet to the session bus. */