From: Bert Vermeulen Date: Sun, 9 Jan 2011 05:32:38 +0000 (+0100) Subject: change all DF_LOGIC* to a single DF_LOGIC type X-Git-Tag: libsigrok-0.1.0~466 X-Git-Url: http://sigrok.org/gitweb/?a=commitdiff_plain;h=4c046c6bcc392666405154853faf7dc2522aa1d9;hp=af812219f655b286f5a2a0146846d9b97e25435c;p=libsigrok.git change all DF_LOGIC* to a single DF_LOGIC type The datafeed packet has a new field 'unitsize' to denote the number of bytes per sample in the payload. --- diff --git a/hardware/asix-sigma/asix-sigma.c b/hardware/asix-sigma/asix-sigma.c index 05467824..09c87993 100644 --- a/hardware/asix-sigma/asix-sigma.c +++ b/hardware/asix-sigma/asix-sigma.c @@ -812,8 +812,9 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts, while (sent < n) { tosend = MIN(2048, n - sent); - packet.type = DF_LOGIC16; + packet.type = DF_LOGIC; packet.length = tosend * sizeof(uint16_t); + packet.unitsize = 2; packet.payload = samples + sent; session_bus(user_data, &packet); @@ -854,8 +855,9 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts, &trigger); if (tosend > 0) { - packet.type = DF_LOGIC16; + packet.type = DF_LOGIC; packet.length = tosend * sizeof(uint16_t); + packet.unitsize = 2; packet.payload = samples; session_bus(user_data, &packet); @@ -871,8 +873,9 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts, /* Send rest of the chunk to sigrok. */ tosend = n - sent; - packet.type = DF_LOGIC16; + packet.type = DF_LOGIC; packet.length = tosend * sizeof(uint16_t); + packet.unitsize = 2; packet.payload = samples + sent; session_bus(user_data, &packet); diff --git a/hardware/demo/demo.c b/hardware/demo/demo.c index b5598a52..cb627ef5 100644 --- a/hardware/demo/demo.c +++ b/hardware/demo/demo.c @@ -258,8 +258,9 @@ static int receive_data(int fd, int revents, void *user_data) z = read(fd, &c, BUFSIZE); if (z > 0) { - packet.type = DF_LOGIC8; + packet.type = DF_LOGIC; packet.length = z; + packet.unitsize = 1; packet.payload = c; session_bus(user_data, &packet); } diff --git a/hardware/openbench-logic-sniffer/ols.c b/hardware/openbench-logic-sniffer/ols.c index cbe145d8..0e791457 100644 --- a/hardware/openbench-logic-sniffer/ols.c +++ b/hardware/openbench-logic-sniffer/ols.c @@ -604,8 +604,9 @@ static int receive_data(int fd, int revents, void *user_data) */ if (trigger_at > 0) { /* there are pre-trigger samples, send those first */ - packet.type = DF_LOGIC32; + packet.type = DF_LOGIC; packet.length = trigger_at * 4; + packet.unitsize = 4; packet.payload = raw_sample_buf; session_bus(user_data, &packet); } @@ -614,13 +615,15 @@ static int receive_data(int fd, int revents, void *user_data) packet.length = 0; session_bus(user_data, &packet); - packet.type = DF_LOGIC32; + packet.type = DF_LOGIC; packet.length = (limit_samples * 4) - (trigger_at * 4); + packet.unitsize = 4; packet.payload = raw_sample_buf + trigger_at * 4; session_bus(user_data, &packet); } else { - packet.type = DF_LOGIC32; + packet.type = DF_LOGIC; packet.length = limit_samples * 4; + packet.unitsize = 4; packet.payload = raw_sample_buf; session_bus(user_data, &packet); } diff --git a/hardware/saleae-logic/saleae-logic.c b/hardware/saleae-logic/saleae-logic.c index 58f31acf..b80808db 100644 --- a/hardware/saleae-logic/saleae-logic.c +++ b/hardware/saleae-logic/saleae-logic.c @@ -613,8 +613,9 @@ void receive_transfer(struct libusb_transfer *transfer) * Send the samples that triggered it, since we're * skipping past them. */ - packet.type = DF_LOGIC8; + packet.type = DF_LOGIC; packet.length = trigger_stage; + packet.unitsize = 1; packet.payload = trigger_buffer; session_bus(user_data, &packet); @@ -645,8 +646,9 @@ void receive_transfer(struct libusb_transfer *transfer) if (trigger_stage == TRIGGER_FIRED) { /* Send the incoming transfer to the session bus. */ - packet.type = DF_LOGIC8; + packet.type = DF_LOGIC; packet.length = cur_buflen - trigger_offset; + packet.unitsize = 1; packet.payload = cur_buf + trigger_offset; session_bus(user_data, &packet); g_free(cur_buf); diff --git a/hardware/zeroplus-logic-cube/zeroplus.c b/hardware/zeroplus-logic-cube/zeroplus.c index 316acfeb..eef93cbf 100644 --- a/hardware/zeroplus-logic-cube/zeroplus.c +++ b/hardware/zeroplus-logic-cube/zeroplus.c @@ -528,8 +528,9 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id) PACKET_SIZE, res); #endif - packet.type = DF_LOGIC32; + packet.type = DF_LOGIC; packet.length = PACKET_SIZE; + packet.unitsize = 4; packet.payload = buf; session_bus(session_device_id, &packet); } diff --git a/input/input_binary.c b/input/input_binary.c index 113b34f6..7c9f96ba 100644 --- a/input/input_binary.c +++ b/input/input_binary.c @@ -57,7 +57,8 @@ static int in_loadfile(const char *filename) packet.payload = &header; session_bus(device, &packet); - packet.type = DF_LOGIC8; + packet.type = DF_LOGIC; + packet.unitsize = 1; packet.payload = buffer; while ((size = read(fd, buffer, CHUNKSIZE)) > 0) { packet.length = size; diff --git a/sigrok.h b/sigrok.h index 9551b887..a9183a39 100644 --- a/sigrok.h +++ b/sigrok.h @@ -89,17 +89,15 @@ enum { DF_HEADER, DF_END, DF_TRIGGER, - DF_LOGIC8, - DF_LOGIC16, - DF_LOGIC24, - DF_LOGIC32, - DF_LOGIC48, - DF_LOGIC64, + DF_LOGIC, + DF_PD, + DF_PA, }; struct datafeed_packet { uint16_t type; uint64_t length; + uint16_t unitsize; void *payload; };