예제 #1
0
파일: api.c 프로젝트: BayLibre/libsigrok
static int dev_acquisition_start(const struct sr_dev_inst *sdi)
{
	struct dev_context *devc;
	struct sr_serial_dev_inst *serial;

	if (sdi->status != SR_ST_ACTIVE)
		return SR_ERR_DEV_CLOSED;

	devc = sdi->priv;
	serial = sdi->conn;

	sr_spew("Set O1 mode (continuous values, stable and unstable ones).");
	if (serial_write_nonblocking(serial, "O1\r\n", 4) != 4)
		return SR_ERR;
	/* Device replies with "A00\r\n" (OK) or "E01\r\n" (Error). Ignore. */

	sr_sw_limits_acquisition_start(&devc->limits);
	std_session_send_df_header(sdi);

	/* Poll every 50ms, or whenever some data comes in. */
	serial_source_add(sdi->session, serial, G_IO_IN, 50,
		      kern_scale_receive_data, (void *)sdi);

	return SR_OK;
}
예제 #2
0
파일: api.c 프로젝트: BayLibre/libsigrok
static int dev_acquisition_start(const struct sr_dev_inst *sdi)
{
	int ret;
	struct dev_context *devc;
	struct sr_serial_dev_inst *serial;

	if (sdi->status != SR_ST_ACTIVE)
		return SR_ERR_DEV_CLOSED;

	devc = sdi->priv;
	serial = sdi->conn;

	/* Send the 'monitor <ms>' command (doesn't have a reply). */
	if ((ret = serial_write_blocking(serial, CMD_MONITOR,
			strlen(CMD_MONITOR), serial_timeout(serial,
			strlen(CMD_MONITOR)))) < (int)strlen(CMD_MONITOR)) {
		sr_err("Unable to send 'monitor' command: %d.", ret);
		return SR_ERR;
	}

	/* Poll every 100ms, or whenever some data comes in. */
	serial_source_add(sdi->session, serial, G_IO_IN, 100,
			  reloadpro_receive_data, (void *)sdi);

	sr_sw_limits_acquisition_start(&devc->limits);
	std_session_send_df_header(sdi);

	memset(devc->buf, 0, RELOADPRO_BUFSIZE);
	devc->buflen = 0;

	return SR_OK;
}
예제 #3
0
static int dev_acquisition_start(const struct sr_dev_inst *sdi,
				    void *cb_data, int dmm)
{
	struct dev_context *devc;
	struct sr_serial_dev_inst *serial;

	if (sdi->status != SR_ST_ACTIVE)
		return SR_ERR_DEV_CLOSED;

	if (!(devc = sdi->priv)) {
		sr_err("sdi->priv was NULL.");
		return SR_ERR_BUG;
	}

	devc->cb_data = cb_data;

	/*
	 * Reset the number of samples to take. If we've already collected our
	 * quota, but we start a new session, and don't reset this, we'll just
	 * quit without acquiring any new samples.
	 */
	devc->num_samples = 0;
	devc->starttime = g_get_monotonic_time();

	/* Send header packet to the session bus. */
	std_session_send_df_header(cb_data, LOG_PREFIX);

	/* Poll every 50ms, or whenever some data comes in. */
	serial = sdi->conn;
	serial_source_add(serial, G_IO_IN, 50,
		      dmms[dmm].receive_data, (void *)sdi);

	return SR_OK;
}
예제 #4
0
파일: api.c 프로젝트: asanza/libsigrok
static int dev_acquisition_start_2x_bd232(const struct sr_dev_inst *sdi)
{
	struct dev_context *devc;
	struct sr_serial_dev_inst *serial;

	if (sdi->status != SR_ST_ACTIVE)
		return SR_ERR_DEV_CLOSED;

	devc = sdi->priv;
	devc->settings_ok = FALSE;
	devc->buflen = 0;

	std_session_send_df_header(sdi, LOG_PREFIX);

	/* Start timer, if required. */
	if (devc->limit_msec)
		g_timer_start(devc->elapsed_msec);

	/* Poll every 40ms, or whenever some data comes in. */
	serial = sdi->conn;
	serial_source_add(sdi->session, serial, G_IO_IN, 40,
			gmc_mh_2x_receive_data, (void *)sdi);

	/* Send start message */
	return req_meas14(sdi);
}
예제 #5
0
파일: api.c 프로젝트: DeeJay/libsigrok
static int dev_acquisition_start(const struct sr_dev_inst *sdi,
		void *cb_data)
{
	struct dev_context *devc;
	struct sr_serial_dev_inst *serial;
	uint8_t packet[PACKET_SIZE];

	(void)cb_data;

	if (sdi->status != SR_ST_ACTIVE)
		return SR_ERR_DEV_CLOSED;

	devc = sdi->priv;
	memset(devc->packet, 0x44, PACKET_SIZE);
	devc->packet_size = 0;

	devc->acquisition_running = TRUE;

	serial = sdi->conn;
	serial_source_add(serial, G_IO_IN, 50, atten_pps3xxx_receive_data, (void *)sdi);
	std_session_send_df_header(cb_data, LOG_PREFIX);

	/* Send a "channel" configuration packet now. */
	memset(packet, 0, PACKET_SIZE);
	packet[0] = 0xaa;
	packet[1] = 0xaa;
	send_packet(sdi, packet);

	return SR_OK;
}
예제 #6
0
파일: api.c 프로젝트: DeeJay/libsigrok
static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
{
	struct dev_context *devc;
	struct sr_serial_dev_inst *serial;

	if (sdi->status != SR_ST_ACTIVE)
		return SR_ERR_DEV_CLOSED;

	if (!(devc = sdi->priv)) {
		sr_err("sdi->priv was NULL.");
		return SR_ERR_BUG;
	}

	devc->cb_data = cb_data;
	devc->state = ST_INIT;
	devc->num_samples = 0;
	devc->buf_len = 0;

	/* Send header packet to the session bus. */
	std_session_send_df_header(cb_data, LOG_PREFIX);

	/* Poll every 100ms, or whenever some data comes in. */
	serial = sdi->conn;
	serial_source_add(serial, G_IO_IN, 150, cem_dt_885x_receive_data,
			(void *)sdi);

	return SR_OK;
}
예제 #7
0
static int dev_acquisition_start_1x_2x_rs232(const struct sr_dev_inst *sdi,
					     void *cb_data)
{
	struct dev_context *devc;
	struct sr_serial_dev_inst *serial;

	if (!sdi || !cb_data || !(devc = sdi->priv))
		return SR_ERR_BUG;

	if (sdi->status != SR_ST_ACTIVE)
		return SR_ERR_DEV_CLOSED;

	devc->cb_data = cb_data;
	devc->settings_ok = FALSE;
	devc->buflen = 0;

	/* Send header packet to the session bus. */
	std_session_send_df_header(cb_data, LOG_PREFIX);

	/* Start timer, if required. */
	if (devc->limit_msec)
		g_timer_start(devc->elapsed_msec);

	/* Poll every 40ms, or whenever some data comes in. */
	serial = sdi->conn;
	serial_source_add(sdi->session, serial, G_IO_IN, 40,
			gmc_mh_1x_2x_receive_data, (void *)sdi);

	return SR_OK;
}
예제 #8
0
파일: api.c 프로젝트: ant9000/libsigrok
static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
{
	struct dev_context *devc;
	struct sr_serial_dev_inst *serial;

	if (sdi->status != SR_ST_ACTIVE)
		return SR_ERR_DEV_CLOSED;

	if (!(devc = sdi->priv)) {
		sr_err("sdi->priv was NULL.");
		return SR_ERR_BUG;
	}

	devc->cb_data = cb_data;

	/* Send header packet to the session bus. */
	std_session_send_df_header(cb_data, LOG_PREFIX);

	/* Poll every 100ms, or whenever some data comes in. */
	serial = sdi->conn;
	serial_source_add(sdi->session, serial, G_IO_IN, 50,
			fluke_receive_data, (void *)sdi);

	if (serial_write_blocking(serial, "QM\r", 3, SERIAL_WRITE_TIMEOUT_MS) < 0) {
		sr_err("Unable to send QM.");
		return SR_ERR;
	}
	devc->cmd_sent_at = g_get_monotonic_time() / 1000;
	devc->expect_response = TRUE;

	return SR_OK;
}
예제 #9
0
static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data)
{
	struct dev_context *devc;
	struct sr_serial_dev_inst *serial;

	if (sdi->status != SR_ST_ACTIVE)
		return SR_ERR_DEV_CLOSED;

	devc = sdi->priv;
	devc->cb_data = cb_data;

	/* Send header packet to the session bus. */
	std_session_send_df_header(cb_data, LOG_PREFIX);

	devc->starttime = g_get_monotonic_time();
	devc->num_samples = 0;
	devc->reply_pending = FALSE;
	devc->req_sent_at = 0;
	serial = sdi->conn;
	serial_source_add(sdi->session, serial, G_IO_IN,
			KDXXXXP_POLL_INTERVAL_MS,
			korad_kdxxxxp_receive_data, (void *)sdi);

	return SR_OK;
}
예제 #10
0
static int scpi_serial_source_add(void *priv, int events, int timeout,
			sr_receive_data_callback cb, void *cb_data)
{
	struct scpi_serial *sscpi = priv;
	struct sr_serial_dev_inst *serial = sscpi->serial;

	return serial_source_add(serial, events, timeout, cb, cb_data);
}
예제 #11
0
static int dev_acquisition_start(const struct sr_dev_inst *sdi)
{
	struct sr_serial_dev_inst *serial;

	if (sdi->status != SR_ST_ACTIVE)
		return SR_ERR_DEV_CLOSED;

	std_session_send_df_header(sdi, LOG_PREFIX);

	/* Poll every 100ms, or whenever some data comes in. */
	serial = sdi->conn;
	serial_source_add(sdi->session, serial, G_IO_IN, 100,
			agdmm_receive_data, (void *)sdi);

	return SR_OK;
}
예제 #12
0
파일: api.c 프로젝트: abraxa/libsigrok
static int dev_acquisition_start(const struct sr_dev_inst *sdi)
{
	struct dev_context *devc;
	struct sr_serial_dev_inst *serial;

	devc = sdi->priv;

	sr_sw_limits_acquisition_start(&devc->limits);
	std_session_send_df_header(sdi);

	serial = sdi->conn;
	serial_source_add(sdi->session, serial, G_IO_IN, 50,
		      receive_data, (void *)sdi);

	return SR_OK;
}
예제 #13
0
파일: api.c 프로젝트: abraxa/libsigrok
static int dev_acquisition_start(const struct sr_dev_inst *sdi)
{
	struct dev_context *devc;
	struct sr_serial_dev_inst *serial;

	devc = sdi->priv;
	devc->buffer_len = 0;
	devc->memory_state = MEM_STATE_REQUEST_MEMORY_USAGE;

	std_session_send_df_header(sdi);

	serial = sdi->conn;
	serial_source_add(sdi->session, serial, G_IO_IN, 150,
			pce_322a_receive_data, (void *)sdi);

	return SR_OK;
}
예제 #14
0
파일: api.c 프로젝트: abraxa/libsigrok
static int dev_acquisition_start(const struct sr_dev_inst *sdi)
{
	struct dev_context *devc;
	struct sr_serial_dev_inst *serial;

	devc = sdi->priv;
	devc->state = ST_INIT;
	devc->num_samples = 0;
	devc->buf_len = 0;

	std_session_send_df_header(sdi);

	serial = sdi->conn;
	serial_source_add(sdi->session, serial, G_IO_IN, 150,
			cem_dt_885x_receive_data, (void *)sdi);

	return SR_OK;
}
예제 #15
0
파일: api.c 프로젝트: BayLibre/libsigrok
static int dev_acquisition_start(const struct sr_dev_inst *sdi)
{
	struct dev_context *devc = sdi->priv;
	struct sr_serial_dev_inst *serial;

	if (sdi->status != SR_ST_ACTIVE)
		return SR_ERR_DEV_CLOSED;

	sr_sw_limits_acquisition_start(&devc->limits);
	std_session_send_df_header(sdi);

	/* Poll every 150ms, or whenever some data comes in. */
	serial = sdi->conn;
	serial_source_add(sdi->session, serial, G_IO_IN, 150,
			colead_slm_receive_data, (void *)sdi);

	return SR_OK;
}
예제 #16
0
파일: api.c 프로젝트: zschunky/libsigrok
static int dev_acquisition_start(const struct sr_dev_inst *sdi)
{
	struct dev_context *devc;
	struct sr_serial_dev_inst *serial;

	devc = sdi->priv;

	sr_sw_limits_acquisition_start(&devc->limits);
	std_session_send_df_header(sdi);

	devc->reply_pending = FALSE;
	devc->req_sent_at = 0;
	serial = sdi->conn;
	serial_source_add(sdi->session, serial, G_IO_IN,
			KAXXXXP_POLL_INTERVAL_MS,
			korad_kaxxxxp_receive_data, (void *)sdi);

	return SR_OK;
}
예제 #17
0
파일: api.c 프로젝트: martinling/libsigrok
static int dev_acquisition_start_1x_2x_rs232(const struct sr_dev_inst *sdi)
{
	struct dev_context *devc;
	struct sr_serial_dev_inst *serial;

	if (sdi->status != SR_ST_ACTIVE)
		return SR_ERR_DEV_CLOSED;

	devc = sdi->priv;
	devc->settings_ok = FALSE;
	devc->buflen = 0;

	sr_sw_limits_acquisition_start(&devc->limits);
	std_session_send_df_header(sdi);

	/* Poll every 40ms, or whenever some data comes in. */
	serial = sdi->conn;
	serial_source_add(sdi->session, serial, G_IO_IN, 40,
			gmc_mh_1x_2x_receive_data, (void *)sdi);

	return SR_OK;
}
예제 #18
0
파일: api.c 프로젝트: asanza/libsigrok
static int dev_acquisition_start(const struct sr_dev_inst *sdi)
{
	struct dev_context *devc;
	struct sr_serial_dev_inst *serial;

	if (sdi->status != SR_ST_ACTIVE)
		return SR_ERR_DEV_CLOSED;

	devc = sdi->priv;
	devc->state = ST_INIT;
	devc->num_samples = 0;
	devc->buf_len = 0;

	std_session_send_df_header(sdi, LOG_PREFIX);

	/* Poll every 100ms, or whenever some data comes in. */
	serial = sdi->conn;
	serial_source_add(sdi->session, serial, G_IO_IN, 150,
			cem_dt_885x_receive_data, (void *)sdi);

	return SR_OK;
}
예제 #19
0
파일: api.c 프로젝트: ant9000/libsigrok
static int dev_acquisition_start(const struct sr_dev_inst *sdi,
				    void *cb_data)
{
	struct dev_context *devc;
	struct sr_serial_dev_inst *serial;

	if (sdi->status != SR_ST_ACTIVE)
		return SR_ERR_DEV_CLOSED;

	devc = sdi->priv;
	devc->cb_data = cb_data;

	/* Send header packet to the session bus. */
	std_session_send_df_header(cb_data, LOG_PREFIX);

	/* Poll every 500ms, or whenever some data comes in. */
	serial = sdi->conn;
	serial_source_add(sdi->session, serial, G_IO_IN, 500,
		      tondaj_sl_814_receive_data, (void *)sdi);

	return SR_OK;
}
예제 #20
0
파일: api.c 프로젝트: asanza/libsigrok
static int dev_acquisition_start(const struct sr_dev_inst *sdi)
{
	struct dev_context *devc;
	struct sr_serial_dev_inst *serial;

	if (sdi->status != SR_ST_ACTIVE)
		return SR_ERR_DEV_CLOSED;

	devc = sdi->priv;

	sr_sw_limits_acquisition_start(&devc->limits);
	std_session_send_df_header(sdi, LOG_PREFIX);

	devc->reply_pending = FALSE;
	devc->req_sent_at = 0;

	/* Poll every 10ms, or whenever some data comes in. */
	serial = sdi->conn;
	serial_source_add(sdi->session, serial, G_IO_IN, 10,
			hcs_receive_data, (void *)sdi);

	return SR_OK;
}
예제 #21
0
파일: api.c 프로젝트: anatol/libsigrok
static int dev_acquisition_start(const struct sr_dev_inst *sdi,
				    void *cb_data, int idx)
{
	struct dev_context *devc;
	struct sr_serial_dev_inst *serial;

	if (sdi->status != SR_ST_ACTIVE)
		return SR_ERR_DEV_CLOSED;

	devc = sdi->priv;
	devc->cb_data = cb_data;
	devc->num_samples = 0;
	devc->starttime = g_get_monotonic_time();

	/* Send header packet to the session bus. */
	std_session_send_df_header(cb_data, LOG_PREFIX);

	/* Poll every 500ms, or whenever some data comes in. */
	serial = sdi->conn;
	serial_source_add(sdi->session, serial, G_IO_IN, 500,
		      center_devs[idx].receive_data, (void *)sdi);

	return SR_OK;
}