]> sigrok.org Git - libsigrok.git/blobdiff - libsigrok-internal.h
scpi: factorize dev_inst_new calls out of individual drivers
[libsigrok.git] / libsigrok-internal.h
index b3eeb8dbbb5931378e2e186176c0c9b7458206e7..d72c4dc5d2b90e2c57f77243cf5492c57bc53bbe 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__
@@ -387,6 +387,8 @@ struct sr_scpi_dev_inst {
        void *priv;
 };
 
+SR_PRIV struct sr_scpi_dev_inst *scpi_dev_inst_new(const char *resource,
+               const char *serialcomm);
 SR_PRIV int sr_scpi_open(struct sr_scpi_dev_inst *scpi);
 SR_PRIV int sr_scpi_source_add(struct sr_scpi_dev_inst *scpi, int events,
                int timeout, sr_receive_data_callback_t cb, void *cb_data);
@@ -420,6 +422,11 @@ SR_PRIV int sr_scpi_get_hw_id(struct sr_scpi_dev_inst *scpi,
                        struct sr_scpi_hw_info **scpi_response);
 SR_PRIV void sr_scpi_hw_info_free(struct sr_scpi_hw_info *hw_info);
 
+/*--- hardware/common/scpi_vxi.c --------------------------------------------*/
+
+SR_PRIV struct sr_scpi_dev_inst *scpi_vxi_dev_inst_new(const char *address,
+                       const char *instrument);
+
 /*--- hardware/common/scpi_serial.c -----------------------------------------*/
 
 #ifdef HAVE_LIBSERIALPORT
@@ -514,6 +521,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 -----------------------------------------*/