]> sigrok.org Git - libsigrok.git/blobdiff - libsigrok-internal.h
Add initial support for the V&A VA40B multimeter.
[libsigrok.git] / libsigrok-internal.h
index 0805a1a611bc5428bbbf48ee3a0ea9f1b176e460..2577fd0dcd981202b927e9d95dbb5ee633c61d47 100644 (file)
  * @param x a pointer to the input memory
  * @return the corresponding integer
  */
-#define RB16(x)  ((((const uint8_t*)(x))[0] <<  8) |  \
-                   ((const uint8_t*)(x))[1])
+#define RB16(x)  (((unsigned)((const uint8_t*)(x))[0] <<  8) |  \
+                   (unsigned)((const uint8_t*)(x))[1])
 
 /**
  * Read a 16 bits little endian integer out of memory.
  * @param x a pointer to the input memory
  * @return the corresponding integer
  */
-#define RL16(x)  ((((const uint8_t*)(x))[1] <<  8) |  \
-                   ((const uint8_t*)(x))[0])
+#define RL16(x)  (((unsigned)((const uint8_t*)(x))[1] <<  8) | \
+                   (unsigned)((const uint8_t*)(x))[0])
 
 /**
  * Read a 32 bits big endian integer out of memory.
  * @param x a pointer to the input memory
  * @return the corresponding integer
  */
-#define RB32(x)  ((((const uint8_t*)(x))[0] << 24) |  \
-                  (((const uint8_t*)(x))[1] << 16) |  \
-                  (((const uint8_t*)(x))[2] <<  8) |  \
-                   ((const uint8_t*)(x))[3])
+#define RB32(x)  (((unsigned)((const uint8_t*)(x))[0] << 24) | \
+                  ((unsigned)((const uint8_t*)(x))[1] << 16) |  \
+                  ((unsigned)((const uint8_t*)(x))[2] <<  8) |  \
+                   (unsigned)((const uint8_t*)(x))[3])
 
 /**
  * Read a 32 bits little endian integer out of memory.
  * @param x a pointer to the input memory
  * @return the corresponding integer
  */
-#define RL32(x)  ((((const uint8_t*)(x))[3] << 24) |  \
-                  (((const uint8_t*)(x))[2] << 16) |  \
-                  (((const uint8_t*)(x))[1] <<  8) |  \
-                   ((const uint8_t*)(x))[0])
+#define RL32(x)  (((unsigned)((const uint8_t*)(x))[3] << 24) | \
+                  ((unsigned)((const uint8_t*)(x))[2] << 16) |  \
+                  ((unsigned)((const uint8_t*)(x))[1] <<  8) |  \
+                   (unsigned)((const uint8_t*)(x))[0])
 
 /* Portability fixes for FreeBSD. */
 #ifdef __FreeBSD__
@@ -290,8 +290,16 @@ SR_PRIV int serial_close(struct sr_serial_dev_inst *serial);
 SR_PRIV int serial_flush(struct sr_serial_dev_inst *serial);
 SR_PRIV int serial_write(struct sr_serial_dev_inst *serial,
                const void *buf, size_t count);
+SR_PRIV int serial_write_blocking(struct sr_serial_dev_inst *serial,
+               const void *buf, size_t count);
+SR_PRIV int serial_write_nonblocking(struct sr_serial_dev_inst *serial,
+               const void *buf, size_t count);
 SR_PRIV int serial_read(struct sr_serial_dev_inst *serial, void *buf,
                size_t count);
+SR_PRIV int serial_read_blocking(struct sr_serial_dev_inst *serial, void *buf,
+               size_t count);
+SR_PRIV int serial_read_nonblocking(struct sr_serial_dev_inst *serial, void *buf,
+               size_t count);
 SR_PRIV int serial_set_params(struct sr_serial_dev_inst *serial, int baudrate,
                int bits, int parity, int stopbits, int flowcontrol, int rts, int dtr);
 SR_PRIV int serial_set_paramstr(struct sr_serial_dev_inst *serial,
@@ -506,6 +514,7 @@ SR_PRIV void sr_fs9721_00_temp_c(struct sr_datafeed_analog *analog, void *info);
 SR_PRIV void sr_fs9721_01_temp_c(struct sr_datafeed_analog *analog, void *info);
 SR_PRIV void sr_fs9721_10_temp_c(struct sr_datafeed_analog *analog, void *info);
 SR_PRIV void sr_fs9721_01_10_temp_f_c(struct sr_datafeed_analog *analog, void *info);
+SR_PRIV void sr_fs9721_max_c_min(struct sr_datafeed_analog *analog, void *info);
 
 /*--- hardware/common/dmm/m2110.c -----------------------------------------*/