]> sigrok.org Git - libsigrok.git/blobdiff - hwdriver.c
sr: Made hwcap const
[libsigrok.git] / hwdriver.c
index 9b0df152b9d3e38bb3a002e8b497a855a6011d24..bbaccc8ca1719863e90d61a970f8c074d7efb6f1 100644 (file)
 SR_API struct sr_hwcap_option sr_hwcap_options[] = {
        {SR_HWCAP_SAMPLERATE, SR_T_UINT64, "Sample rate", "samplerate"},
        {SR_HWCAP_CAPTURE_RATIO, SR_T_UINT64, "Pre-trigger capture ratio", "captureratio"},
-       {SR_HWCAP_PATTERN_MODE, SR_T_CHAR, "Pattern generator mode", "patternmode"},
+       {SR_HWCAP_PATTERN_MODE, SR_T_CHAR, "Pattern generator mode", "pattern"},
        {SR_HWCAP_RLE, SR_T_BOOL, "Run Length Encoding", "rle"},
+       {SR_HWCAP_TRIGGER_SLOPE, SR_T_UINT64, "Trigger slope", "triggerslope"},
+       {SR_HWCAP_TRIGGER_SOURCE, SR_T_CHAR, "Trigger source", "triggersource"},
+       {SR_HWCAP_HORIZ_TRIGGERPOS, SR_T_FLOAT, "Horizontal trigger position",
+                       "horiz_triggerpos"},
+       {SR_HWCAP_BUFFERSIZE, SR_T_UINT64, "Buffer size", "buffersize"},
+       {SR_HWCAP_TIMEBASE, SR_T_RATIONAL_PERIOD, "Time base", "timebase"},
+       {SR_HWCAP_FILTER, SR_T_CHAR, "Filter targets", "filter"},
+       {SR_HWCAP_VDIV, SR_T_RATIONAL_VOLT, "Volts/div", "vdiv"},
+       {SR_HWCAP_COUPLING, SR_T_CHAR, "Coupling", "coupling"},
        {0, 0, NULL, NULL},
 };
 
 #ifdef HAVE_LA_DEMO
 extern SR_PRIV struct sr_dev_driver demo_driver_info;
 #endif
-#ifdef HAVE_LA_SALEAE_LOGIC
-extern SR_PRIV struct sr_dev_driver saleae_logic_driver_info;
-#endif
 #ifdef HAVE_LA_OLS
 extern SR_PRIV struct sr_dev_driver ols_driver_info;
 #endif
@@ -66,14 +72,14 @@ extern SR_PRIV struct sr_dev_driver alsa_driver_info;
 #ifdef HAVE_LA_FX2LAFW
 extern SR_PRIV struct sr_dev_driver fx2lafw_driver_info;
 #endif
+#ifdef HAVE_HW_HANTEK_DSO
+extern SR_PRIV struct sr_dev_driver hantek_dso_plugin_info;
+#endif
 
 static struct sr_dev_driver *drivers_list[] = {
 #ifdef HAVE_LA_DEMO
        &demo_driver_info,
 #endif
-#ifdef HAVE_LA_SALEAE_LOGIC
-       &saleae_logic_driver_info,
-#endif
 #ifdef HAVE_LA_OLS
        &ols_driver_info,
 #endif
@@ -94,6 +100,9 @@ static struct sr_dev_driver *drivers_list[] = {
 #endif
 #ifdef HAVE_LA_FX2LAFW
        &fx2lafw_driver_info,
+#endif
+#ifdef HAVE_HW_HANTEK_DSO
+       &hantek_dso_plugin_info,
 #endif
        NULL,
 };
@@ -267,7 +276,8 @@ SR_PRIV void sr_serial_dev_inst_free(struct sr_serial_dev_inst *serial)
  */
 SR_API gboolean sr_driver_hwcap_exists(struct sr_dev_driver *driver, int hwcap)
 {
-       int *hwcaps, i;
+       const int *hwcaps;
+       int i;
 
        if (!driver) {
                sr_err("hwdriver: %s: driver was NULL", __func__);
@@ -295,7 +305,7 @@ SR_API gboolean sr_driver_hwcap_exists(struct sr_dev_driver *driver, int hwcap)
  * @return A pointer to a struct with information about the parameter, or NULL
  *         if the capability was not found.
  */
-SR_API struct sr_hwcap_option *sr_hw_hwcap_get(int hwcap)
+SR_API const struct sr_hwcap_option *sr_hw_hwcap_get(int hwcap)
 {
        int i;
 
@@ -307,15 +317,15 @@ SR_API struct sr_hwcap_option *sr_hw_hwcap_get(int hwcap)
        return NULL;
 }
 
-/* unnecessary level of indirection follows. */
+/* Unnecessary level of indirection follows. */
 
-SR_PRIV void sr_source_remove(int fd)
+SR_PRIV int sr_source_remove(int fd)
 {
-       sr_session_source_remove(fd);
+       return sr_session_source_remove(fd);
 }
 
-SR_PRIV void sr_source_add(int fd, int events, int timeout,
-                  sr_receive_data_callback rcv_cb, void *user_data)
+SR_PRIV int sr_source_add(int fd, int events, int timeout,
+                         sr_receive_data_callback_t cb, void *cb_data)
 {
-       sr_session_source_add(fd, events, timeout, rcv_cb, user_data);
+       return sr_session_source_add(fd, events, timeout, cb, cb_data);
 }