hameg-hmo: Move the declaration of the driver info out of protocol.h
This fixes duplicate symbol error on Mac OS X. BugLink: http://sigrok.org/bugzilla/show_bug.cgi?id=216
This commit is contained in:
parent
cb7b165b3d
commit
e9a6213976
|
@ -23,6 +23,13 @@
|
||||||
|
|
||||||
#define SERIALCOMM "115200/8n1/flow=1"
|
#define SERIALCOMM "115200/8n1/flow=1"
|
||||||
|
|
||||||
|
SR_PRIV struct sr_dev_driver hameg_hmo_driver_info;
|
||||||
|
static struct sr_dev_driver *di = &hameg_hmo_driver_info;
|
||||||
|
|
||||||
|
static const char *manufacturers[] = {
|
||||||
|
"HAMEG",
|
||||||
|
};
|
||||||
|
|
||||||
static const int32_t hwopts[] = {
|
static const int32_t hwopts[] = {
|
||||||
SR_CONF_CONN,
|
SR_CONF_CONN,
|
||||||
SR_CONF_SERIALCOMM,
|
SR_CONF_SERIALCOMM,
|
||||||
|
@ -186,6 +193,79 @@ skip_device:
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int check_manufacturer(const char *manufacturer)
|
||||||
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
for (i = 0; i < ARRAY_SIZE(manufacturers); ++i)
|
||||||
|
if (!strcmp(manufacturer, manufacturers[i]))
|
||||||
|
return SR_OK;
|
||||||
|
|
||||||
|
return SR_ERR;
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct sr_dev_inst *hmo_probe_serial_device(const char *serial_device,
|
||||||
|
const char *serial_options)
|
||||||
|
{
|
||||||
|
struct sr_dev_inst *sdi;
|
||||||
|
struct dev_context *devc;
|
||||||
|
struct sr_scpi_hw_info *hw_info;
|
||||||
|
struct sr_scpi_dev_inst *scpi;
|
||||||
|
|
||||||
|
sdi = NULL;
|
||||||
|
devc = NULL;
|
||||||
|
scpi = NULL;
|
||||||
|
hw_info = NULL;
|
||||||
|
|
||||||
|
if (!(scpi = scpi_serial_dev_inst_new(serial_device, serial_options)))
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
sr_info("Probing %s.", serial_device);
|
||||||
|
if (sr_scpi_open(scpi) != SR_OK)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
if (sr_scpi_get_hw_id(scpi, &hw_info) != SR_OK) {
|
||||||
|
sr_info("Couldn't get IDN response.");
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (check_manufacturer(hw_info->manufacturer) != SR_OK)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
if (!(sdi = sr_dev_inst_new(0, SR_ST_ACTIVE,
|
||||||
|
hw_info->manufacturer, hw_info->model,
|
||||||
|
hw_info->firmware_version))) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
sr_scpi_hw_info_free(hw_info);
|
||||||
|
hw_info = NULL;
|
||||||
|
|
||||||
|
if (!(devc = g_try_malloc0(sizeof(struct dev_context))))
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
sdi->driver = di;
|
||||||
|
sdi->priv = devc;
|
||||||
|
sdi->inst_type = SR_INST_SCPI;
|
||||||
|
sdi->conn = scpi;
|
||||||
|
|
||||||
|
if (hmo_init_device(sdi) != SR_OK)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
return sdi;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
if (hw_info)
|
||||||
|
sr_scpi_hw_info_free(hw_info);
|
||||||
|
if (scpi)
|
||||||
|
sr_scpi_free(scpi);
|
||||||
|
if (sdi)
|
||||||
|
sr_dev_inst_free(sdi);
|
||||||
|
if (devc)
|
||||||
|
g_free(devc);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static GSList *scan(GSList *options)
|
static GSList *scan(GSList *options)
|
||||||
{
|
{
|
||||||
GSList *devices;
|
GSList *devices;
|
||||||
|
|
|
@ -19,10 +19,6 @@
|
||||||
|
|
||||||
#include "protocol.h"
|
#include "protocol.h"
|
||||||
|
|
||||||
static const char *manufacturers[] = {
|
|
||||||
"HAMEG",
|
|
||||||
};
|
|
||||||
|
|
||||||
static const char *hameg_scpi_dialect[] = {
|
static const char *hameg_scpi_dialect[] = {
|
||||||
[SCPI_CMD_GET_DIG_DATA] = ":POD%d:DATA?",
|
[SCPI_CMD_GET_DIG_DATA] = ":POD%d:DATA?",
|
||||||
[SCPI_CMD_GET_TIMEBASE] = ":TIM:SCAL?",
|
[SCPI_CMD_GET_TIMEBASE] = ":TIM:SCAL?",
|
||||||
|
@ -256,17 +252,6 @@ static struct scope_config scope_models[] = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static int check_manufacturer(const char *manufacturer)
|
|
||||||
{
|
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(manufacturers); ++i)
|
|
||||||
if (!strcmp(manufacturer, manufacturers[i]))
|
|
||||||
return SR_OK;
|
|
||||||
|
|
||||||
return SR_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void scope_state_dump(struct scope_config *config,
|
static void scope_state_dump(struct scope_config *config,
|
||||||
struct scope_state *state)
|
struct scope_state *state)
|
||||||
{
|
{
|
||||||
|
@ -560,68 +545,6 @@ SR_PRIV int hmo_init_device(struct sr_dev_inst *sdi)
|
||||||
return SR_OK;
|
return SR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
SR_PRIV struct sr_dev_inst *hmo_probe_serial_device(const char *serial_device,
|
|
||||||
const char *serial_options)
|
|
||||||
{
|
|
||||||
struct sr_dev_inst *sdi;
|
|
||||||
struct dev_context *devc;
|
|
||||||
struct sr_scpi_hw_info *hw_info;
|
|
||||||
struct sr_scpi_dev_inst *scpi;
|
|
||||||
|
|
||||||
sdi = NULL;
|
|
||||||
devc = NULL;
|
|
||||||
scpi = NULL;
|
|
||||||
hw_info = NULL;
|
|
||||||
|
|
||||||
if (!(scpi = scpi_serial_dev_inst_new(serial_device, serial_options)))
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
sr_info("Probing %s.", serial_device);
|
|
||||||
if (sr_scpi_open(scpi) != SR_OK)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
if (sr_scpi_get_hw_id(scpi, &hw_info) != SR_OK) {
|
|
||||||
sr_info("Couldn't get IDN response.");
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (check_manufacturer(hw_info->manufacturer) != SR_OK)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
if (!(sdi = sr_dev_inst_new(0, SR_ST_ACTIVE,
|
|
||||||
hw_info->manufacturer, hw_info->model,
|
|
||||||
hw_info->firmware_version))) {
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
sr_scpi_hw_info_free(hw_info);
|
|
||||||
hw_info = NULL;
|
|
||||||
|
|
||||||
if (!(devc = g_try_malloc0(sizeof(struct dev_context))))
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
sdi->driver = di;
|
|
||||||
sdi->priv = devc;
|
|
||||||
sdi->inst_type = SR_INST_SCPI;
|
|
||||||
sdi->conn = scpi;
|
|
||||||
|
|
||||||
if (hmo_init_device(sdi) != SR_OK)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
return sdi;
|
|
||||||
|
|
||||||
fail:
|
|
||||||
if (hw_info)
|
|
||||||
sr_scpi_hw_info_free(hw_info);
|
|
||||||
if (scpi)
|
|
||||||
sr_scpi_free(scpi);
|
|
||||||
if (sdi)
|
|
||||||
sr_dev_inst_free(sdi);
|
|
||||||
if (devc)
|
|
||||||
g_free(devc);
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data)
|
SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data)
|
||||||
{
|
{
|
||||||
struct sr_probe *probe;
|
struct sr_probe *probe;
|
||||||
|
|
|
@ -38,9 +38,6 @@
|
||||||
#define MAX_INSTRUMENT_VERSIONS 10
|
#define MAX_INSTRUMENT_VERSIONS 10
|
||||||
#define MAX_COMMAND_SIZE 31
|
#define MAX_COMMAND_SIZE 31
|
||||||
|
|
||||||
SR_PRIV struct sr_dev_driver hameg_hmo_driver_info;
|
|
||||||
static struct sr_dev_driver *di = &hameg_hmo_driver_info;
|
|
||||||
|
|
||||||
struct scope_config {
|
struct scope_config {
|
||||||
const char *name[MAX_INSTRUMENT_VERSIONS];
|
const char *name[MAX_INSTRUMENT_VERSIONS];
|
||||||
const uint8_t analog_channels;
|
const uint8_t analog_channels;
|
||||||
|
@ -115,8 +112,6 @@ struct dev_context {
|
||||||
SR_PRIV int hmo_init_device(struct sr_dev_inst *sdi);
|
SR_PRIV int hmo_init_device(struct sr_dev_inst *sdi);
|
||||||
SR_PRIV int hmo_request_data(const struct sr_dev_inst *sdi);
|
SR_PRIV int hmo_request_data(const struct sr_dev_inst *sdi);
|
||||||
SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data);
|
SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data);
|
||||||
SR_PRIV struct sr_dev_inst *hmo_probe_serial_device(const char *serial_device,
|
|
||||||
const char *serial_options);
|
|
||||||
|
|
||||||
SR_PRIV struct scope_state *hmo_scope_state_new(struct scope_config *config);
|
SR_PRIV struct scope_state *hmo_scope_state_new(struct scope_config *config);
|
||||||
SR_PRIV void hmo_scope_state_free(struct scope_state *state);
|
SR_PRIV void hmo_scope_state_free(struct scope_state *state);
|
||||||
|
|
Loading…
Reference in New Issue