]> sigrok.org Git - libsigrok.git/blobdiff - hardware/chronovu-la8/chronovu-la8.c
sr: s/config_set/dev_config_set/.
[libsigrok.git] / hardware / chronovu-la8 / chronovu-la8.c
index 22164cfe8693a5b676fad91ea5a9f3ada3cfb088..6de27a49f6b207a8cb9bc49673a6873d451a997e 100644 (file)
@@ -111,7 +111,7 @@ struct la8 {
        uint8_t divcount;
 };
 
-/* This will be initialized via hw_get_device_info()/SR_DI_SAMPLERATES. */
+/* This will be initialized via hw_dev_info_get()/SR_DI_SAMPLERATES. */
 static uint64_t supported_samplerates[255 + 1] = { 0 };
 
 /*
@@ -126,7 +126,7 @@ static struct sr_samplerates samplerates = {
 };
 
 /* Note: Continuous sampling is not supported by the hardware. */
-static int capabilities[] = {
+static int hwcaps[] = {
        SR_HWCAP_LOGIC_ANALYZER,
        SR_HWCAP_SAMPLERATE,
        SR_HWCAP_LIMIT_MSEC, /* TODO: Not yet implemented. */
@@ -136,7 +136,7 @@ static int capabilities[] = {
 
 /* Function prototypes. */
 static int la8_close_usb_reset_sequencer(struct la8 *la8);
-static int hw_stop_acquisition(int device_index, gpointer session_data);
+static int hw_dev_acquisition_stop(int dev_index, gpointer session_data);
 static int la8_reset(struct la8 *la8);
 
 static void fill_supported_samplerates_if_needed(void)
@@ -467,14 +467,14 @@ static int configure_probes(struct la8 *la8, GSList *probes)
        return SR_OK;
 }
 
-static int hw_init(const char *deviceinfo)
+static int hw_init(const char *devinfo)
 {
        int ret;
        struct sr_dev_inst *sdi;
        struct la8 *la8;
 
        /* Avoid compiler errors. */
-       (void)deviceinfo;
+       (void)devinfo;
 
        /* Allocate memory for our private driver context. */
        if (!(la8 = g_try_malloc(sizeof(struct la8)))) {
@@ -550,13 +550,13 @@ err_free_nothing:
        return 0;
 }
 
-static int hw_opendev(int device_index)
+static int hw_dev_open(int dev_index)
 {
        int ret;
        struct sr_dev_inst *sdi;
        struct la8 *la8;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index))) {
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("la8: %s: sdi was NULL", __func__);
                return SR_ERR; /* TODO: SR_ERR_ARG? */
        }
@@ -583,7 +583,7 @@ static int hw_opendev(int device_index)
                sr_err("la8: %s: ftdi_usb_purge_buffers: (%d) %s",
                       __func__, ret, ftdi_get_error_string(la8->ftdic));
                (void) la8_close_usb_reset_sequencer(la8); /* Ignore errors. */
-               goto err_opendev_close_ftdic;
+               goto err_dev_open_close_ftdic;
        }
        sr_dbg("la8: FTDI buffers purged successfully");
 
@@ -592,7 +592,7 @@ static int hw_opendev(int device_index)
                sr_err("la8: %s: ftdi_setflowcontrol: (%d) %s",
                       __func__, ret, ftdi_get_error_string(la8->ftdic));
                (void) la8_close_usb_reset_sequencer(la8); /* Ignore errors. */
-               goto err_opendev_close_ftdic;
+               goto err_dev_open_close_ftdic;
        }
        sr_dbg("la8: FTDI flow control enabled successfully");
 
@@ -603,7 +603,7 @@ static int hw_opendev(int device_index)
 
        return SR_OK;
 
-err_opendev_close_ftdic:
+err_dev_open_close_ftdic:
        (void) la8_close(la8); /* Log, but ignore errors. */
        return SR_ERR;
 }
@@ -638,12 +638,12 @@ static int set_samplerate(struct sr_dev_inst *sdi, uint64_t samplerate)
        return SR_OK;
 }
 
-static int hw_closedev(int device_index)
+static int hw_dev_close(int dev_index)
 {
        struct sr_dev_inst *sdi;
        struct la8 *la8;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index))) {
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("la8: %s: sdi was NULL", __func__);
                return SR_ERR; /* TODO: SR_ERR_ARG? */
        }
@@ -693,7 +693,7 @@ static int hw_cleanup(void)
        return ret;
 }
 
-static void *hw_get_device_info(int device_index, int device_info_id)
+static void *hw_dev_info_get(int dev_index, int dev_info_id)
 {
        struct sr_dev_inst *sdi;
        struct la8 *la8;
@@ -701,7 +701,7 @@ static void *hw_get_device_info(int device_index, int device_info_id)
 
        sr_spew("la8: entering %s", __func__);
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index))) {
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("la8: %s: sdi was NULL", __func__);
                return NULL;
        }
@@ -711,8 +711,8 @@ static void *hw_get_device_info(int device_index, int device_info_id)
                return NULL;
        }
 
-       switch (device_info_id) {
-       case SR_DI_INSTANCE:
+       switch (dev_info_id) {
+       case SR_DI_INST:
                info = sdi;
                break;
        case SR_DI_NUM_PROBES:
@@ -741,11 +741,11 @@ static void *hw_get_device_info(int device_index, int device_info_id)
        return info;
 }
 
-static int hw_get_status(int device_index)
+static int hw_dev_status_get(int dev_index)
 {
        struct sr_dev_inst *sdi;
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index))) {
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("la8: %s: sdi was NULL, device not found", __func__);
                return SR_ST_NOT_FOUND;
        }
@@ -755,21 +755,21 @@ static int hw_get_status(int device_index)
        return sdi->status;
 }
 
-static int *hw_get_capabilities(void)
+static int *hw_hwcap_get_all(void)
 {
        sr_spew("la8: entering %s", __func__);
 
-       return capabilities;
+       return hwcaps;
 }
 
-static int hw_set_configuration(int device_index, int capability, void *value)
+static int hw_dev_config_set(int dev_index, int hwcap, void *value)
 {
        struct sr_dev_inst *sdi;
        struct la8 *la8;
 
        sr_spew("la8: entering %s", __func__);
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index))) {
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("la8: %s: sdi was NULL", __func__);
                return SR_ERR; /* TODO: SR_ERR_ARG? */
        }
@@ -779,7 +779,7 @@ static int hw_set_configuration(int device_index, int capability, void *value)
                return SR_ERR; /* TODO: SR_ERR_ARG? */
        }
 
-       switch (capability) {
+       switch (hwcap) {
        case SR_HWCAP_SAMPLERATE:
                if (set_samplerate(sdi, *(uint64_t *)value) == SR_ERR)
                        return SR_ERR;
@@ -990,7 +990,7 @@ static int receive_data(int fd, int revents, void *session_data)
        /* Get one block of data. */
        if ((ret = la8_read_block(la8)) < 0) {
                sr_err("la8: %s: la8_read_block error: %d", __func__, ret);
-               hw_stop_acquisition(sdi->index, session_data);
+               hw_dev_acquisition_stop(sdi->index, session_data);
                return FALSE;
        }
 
@@ -1006,13 +1006,13 @@ static int receive_data(int fd, int revents, void *session_data)
        for (i = 0; i < NUM_BLOCKS; i++)
                send_block_to_session_bus(la8, i);
 
-       hw_stop_acquisition(sdi->index, session_data);
+       hw_dev_acquisition_stop(sdi->index, session_data);
 
        // return FALSE; /* FIXME? */
        return TRUE;
 }
 
-static int hw_start_acquisition(int device_index, gpointer session_data)
+static int hw_dev_acquisition_start(int dev_index, gpointer session_data)
 {
        struct sr_dev_inst *sdi;
        struct la8 *la8;
@@ -1023,7 +1023,7 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
 
        sr_spew("la8: entering %s", __func__);
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index))) {
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("la8: %s: sdi was NULL", __func__);
                return SR_ERR; /* TODO: SR_ERR_ARG? */
        }
@@ -1087,7 +1087,7 @@ static int hw_start_acquisition(int device_index, gpointer session_data)
        return SR_OK;
 }
 
-static int hw_stop_acquisition(int device_index, gpointer session_data)
+static int hw_dev_acquisition_stop(int dev_index, gpointer session_data)
 {
        struct sr_dev_inst *sdi;
        struct la8 *la8;
@@ -1095,7 +1095,7 @@ static int hw_stop_acquisition(int device_index, gpointer session_data)
 
        sr_dbg("la8: stopping acquisition");
 
-       if (!(sdi = sr_dev_inst_get(dev_insts, device_index))) {
+       if (!(sdi = sr_dev_inst_get(dev_insts, dev_index))) {
                sr_err("la8: %s: sdi was NULL", __func__);
                return SR_ERR_BUG;
        }
@@ -1113,18 +1113,18 @@ static int hw_stop_acquisition(int device_index, gpointer session_data)
        return SR_OK;
 }
 
-SR_PRIV struct sr_device_plugin chronovu_la8_plugin_info = {
+SR_PRIV struct sr_dev_plugin chronovu_la8_plugin_info = {
        .name = "chronovu-la8",
        .longname = "ChronoVu LA8",
        .api_version = 1,
        .init = hw_init,
        .cleanup = hw_cleanup,
-       .opendev = hw_opendev,
-       .closedev = hw_closedev,
-       .get_device_info = hw_get_device_info,
-       .get_status = hw_get_status,
-       .get_capabilities = hw_get_capabilities,
-       .set_configuration = hw_set_configuration,
-       .start_acquisition = hw_start_acquisition,
-       .stop_acquisition = hw_stop_acquisition,
+       .dev_open = hw_dev_open,
+       .dev_close = hw_dev_close,
+       .dev_info_get = hw_dev_info_get,
+       .dev_status_get = hw_dev_status_get,
+       .hwcap_get_all = hw_hwcap_get_all,
+       .dev_config_set = hw_dev_config_set,
+       .dev_acquisition_start = hw_dev_acquisition_start,
+       .dev_acquisition_stop = hw_dev_acquisition_stop,
 };