*/
#include "config.h"
+#include <glib.h>
+#include <glib/gstdio.h>
#include <ftdi.h>
#include <string.h>
#include <zlib.h>
0,
};
-static struct samplerates samplerates = {
+static struct sr_samplerates samplerates = {
KHZ(200),
MHZ(200),
0,
int c, ret, bit, v;
uint32_t imm = 0x3f6df2ab;
- f = fopen(filename, "r");
+ f = g_fopen(filename, "rb");
if (!f) {
- g_warning("fopen(\"%s\", \"r\")", filename);
+ g_warning("g_fopen(\"%s\", \"rb\")", filename);
return -1;
}
static int configure_probes(struct sr_device_instance *sdi, GSList *probes)
{
struct sigma *sigma = sdi->priv;
- struct probe *probe;
+ struct sr_probe *probe;
GSList *l;
int trigger_set = 0;
int probebit;
memset(&sigma->trigger, 0, sizeof(struct sigma_trigger));
for (l = probes; l; l = l->next) {
- probe = (struct probe *)l->data;
+ probe = (struct sr_probe *)l->data;
probebit = 1 << (probe->index - 1);
if (!probe->enabled || !probe->trigger)
packet.length = tosend * sizeof(uint16_t);
packet.unitsize = 2;
packet.payload = samples + sent;
- session_bus(sigma->session_id, &packet);
+ sr_session_bus(sigma->session_id, &packet);
sent += tosend;
}
packet.length = tosend * sizeof(uint16_t);
packet.unitsize = 2;
packet.payload = samples;
- session_bus(sigma->session_id, &packet);
+ sr_session_bus(sigma->session_id, &packet);
sent += tosend;
}
packet.type = SR_DF_TRIGGER;
packet.length = 0;
packet.payload = 0;
- session_bus(sigma->session_id, &packet);
+ sr_session_bus(sigma->session_id, &packet);
}
}
packet.length = tosend * sizeof(uint16_t);
packet.unitsize = 2;
packet.payload = samples + sent;
- session_bus(sigma->session_id, &packet);
+ sr_session_bus(sigma->session_id, &packet);
}
*lastsample = samples[n - 1];
/* End of samples. */
packet.type = SR_DF_END;
packet.length = 0;
- session_bus(sigma->session_id, &packet);
+ sr_session_bus(sigma->session_id, &packet);
sigma->state.state = SIGMA_IDLE;
header.protocol_id = SR_PROTO_RAW;
header.num_logic_probes = sigma->num_probes;
header.num_analog_probes = 0;
- session_bus(session_device_id, &packet);
+ sr_session_bus(session_device_id, &packet);
/* Add capture source. */
- source_add(0, G_IO_IN, 10, receive_data, sdi);
+ sr_source_add(0, G_IO_IN, 10, receive_data, sdi);
sigma->state.state = SIGMA_CAPTURE;