#define NUM_TRIGGER_STAGES 4
#define TRIGGER_TYPES "01"
#define SERIAL_SPEED B115200
-#define CLOCK_RATE MHZ(100)
+#define CLOCK_RATE SR_MHZ(100)
#define MIN_NUM_SAMPLES 4
/* Command opcodes */
0,
};
-static struct samplerates samplerates = {
+static struct sr_samplerates samplerates = {
10,
- MHZ(200),
+ SR_MHZ(200),
1,
0,
};
static int configure_probes(GSList *probes)
{
- struct probe *probe;
+ struct sr_probe *probe;
GSList *l;
int probe_bit, stage, i;
char *tc;
num_stages = 0;
for (l = probes; l; l = l->next) {
- probe = (struct probe *)l->data;
+ probe = (struct sr_probe *)l->data;
if (!probe->enabled)
continue;
return out;
}
-static int hw_init(char *deviceinfo)
+static int hw_init(const char *deviceinfo)
{
struct sr_device_instance *sdi;
GSList *ports, *l;
free(serial_params);
g_slist_free(ports);
- cur_samplerate = samplerates.low;
+ cur_samplerate = SR_KHZ(200);
return final_devcnt;
}
* longer than it takes to send a byte, that means it's
* finished. We'll double that to 30ms to be sure...
*/
- source_remove(fd);
- source_add(fd, G_IO_IN, 30, receive_data, user_data);
+ sr_source_remove(fd);
+ sr_source_add(fd, G_IO_IN, 30, receive_data, user_data);
raw_sample_buf = malloc(limit_samples * 4);
/* fill with 1010... for debugging */
memset(raw_sample_buf, 0x82, limit_samples * 4);
packet.length = trigger_at * 4;
packet.unitsize = 4;
packet.payload = raw_sample_buf;
- session_bus(user_data, &packet);
+ sr_session_bus(user_data, &packet);
}
packet.type = SR_DF_TRIGGER;
packet.length = 0;
- session_bus(user_data, &packet);
+ sr_session_bus(user_data, &packet);
packet.type = SR_DF_LOGIC;
packet.length = (limit_samples * 4) - (trigger_at * 4);
packet.unitsize = 4;
packet.payload = raw_sample_buf + trigger_at * 4;
- session_bus(user_data, &packet);
+ sr_session_bus(user_data, &packet);
} else {
packet.type = SR_DF_LOGIC;
packet.length = limit_samples * 4;
packet.unitsize = 4;
packet.payload = raw_sample_buf;
- session_bus(user_data, &packet);
+ sr_session_bus(user_data, &packet);
}
free(raw_sample_buf);
serial_close(fd);
packet.type = SR_DF_END;
packet.length = 0;
- session_bus(user_data, &packet);
+ sr_session_bus(user_data, &packet);
}
return TRUE;
if (send_shortcommand(sdi->serial->fd, CMD_RUN) != SR_OK)
return SR_ERR;
- source_add(sdi->serial->fd, G_IO_IN, -1, receive_data,
- session_device_id);
+ sr_source_add(sdi->serial->fd, G_IO_IN, -1, receive_data,
+ session_device_id);
/* Send header packet to the session bus. */
packet = g_malloc(sizeof(struct sr_datafeed_packet));
header->protocol_id = SR_PROTO_RAW;
header->num_logic_probes = NUM_PROBES;
header->num_analog_probes = 0;
- session_bus(session_device_id, packet);
+ sr_session_bus(session_device_id, packet);
g_free(header);
g_free(packet);
packet.type = SR_DF_END;
packet.length = 0;
- session_bus(session_device_id, &packet);
+ sr_session_bus(session_device_id, &packet);
}
struct sr_device_plugin ols_plugin_info = {