#include <glib.h>
#include <libusb.h>
#include <sigrok.h>
+#include <sigrok-internal.h>
#include "analyzer.h"
#define USB_VENDOR 0x0c12
* Note -- 16032, 16064 and 16128 *usually* -- but not always -- have the
* same 128K sample depth.
*/
-model_t zeroplus_models[] = {
+static model_t zeroplus_models[] = {
{0x7009, "LAP-C(16064)", 16, 64, 100},
{0x700A, "LAP-C(16128)", 16, 128, 200},
{0x700B, "LAP-C(32128)", 32, 128, 200},
static uint64_t supported_samplerates[] = {
100,
500,
- KHZ(1),
- KHZ(5),
- KHZ(25),
- KHZ(50),
- KHZ(100),
- KHZ(200),
- KHZ(400),
- KHZ(800),
- MHZ(1),
- MHZ(10),
- MHZ(25),
- MHZ(50),
- MHZ(80),
- MHZ(100),
- MHZ(150),
- MHZ(200),
+ SR_KHZ(1),
+ SR_KHZ(5),
+ SR_KHZ(25),
+ SR_KHZ(50),
+ SR_KHZ(100),
+ SR_KHZ(200),
+ SR_KHZ(400),
+ SR_KHZ(800),
+ SR_MHZ(1),
+ SR_MHZ(10),
+ SR_MHZ(25),
+ SR_MHZ(50),
+ SR_MHZ(80),
+ SR_MHZ(100),
+ SR_MHZ(150),
+ SR_MHZ(200),
0,
};
-static struct samplerates samplerates = {
+static struct sr_samplerates samplerates = {
0, 0, 0,
supported_samplerates,
};
/* TODO: All of these should go in a device-specific struct. */
static uint64_t cur_samplerate = 0;
static uint64_t limit_samples = 0;
-int num_channels = 32; /* TODO: This isn't initialized before it's needed :( */
-uint64_t memory_size = 0;
+static int num_channels = 32; /* TODO: This isn't initialized before it's needed :( */
+static uint64_t memory_size = 0;
static uint8_t probe_mask = 0;
static uint8_t trigger_mask[NUM_TRIGGER_STAGES] = { 0 };
static uint8_t trigger_value[NUM_TRIGGER_STAGES] = { 0 };
return 0;
}
-struct sr_device_instance *zp_open_device(int device_index)
+static struct sr_device_instance *zp_open_device(int device_index)
{
struct sr_device_instance *sdi;
libusb_device **devlist;
static int configure_probes(GSList *probes)
{
- struct probe *probe;
+ struct sr_probe *probe;
GSList *l;
int probe_bit, stage, i;
char *tc;
stage = -1;
for (l = probes; l; l = l->next) {
- probe = (struct probe *)l->data;
+ probe = (struct sr_probe *)l->data;
if (probe->enabled == FALSE)
continue;
probe_bit = 1 << (probe->index - 1);
* API callbacks
*/
-static int hw_init(char *deviceinfo)
+static int hw_init(const char *deviceinfo)
{
struct sr_device_instance *sdi;
struct libusb_device_descriptor des;
static int set_configuration_samplerate(uint64_t samplerate)
{
g_message("%s(%" PRIu64 ")", __FUNCTION__, samplerate);
- if (samplerate > MHZ(1))
- analyzer_set_freq(samplerate / MHZ(1), FREQ_SCALE_MHZ);
- else if (samplerate > KHZ(1))
- analyzer_set_freq(samplerate / KHZ(1), FREQ_SCALE_KHZ);
+ if (samplerate > SR_MHZ(1))
+ analyzer_set_freq(samplerate / SR_MHZ(1), FREQ_SCALE_MHZ);
+ else if (samplerate > SR_KHZ(1))
+ analyzer_set_freq(samplerate / SR_KHZ(1), FREQ_SCALE_KHZ);
else
analyzer_set_freq(samplerate, FREQ_SCALE_HZ);
header.protocol_id = SR_PROTO_RAW;
header.num_logic_probes = num_channels;
header.num_analog_probes = 0;
- session_bus(session_device_id, &packet);
+ sr_session_bus(session_device_id, &packet);
buf = g_malloc(PACKET_SIZE);
if (!buf)
packet.length = PACKET_SIZE;
packet.unitsize = 4;
packet.payload = buf;
- session_bus(session_device_id, &packet);
+ sr_session_bus(session_device_id, &packet);
}
analyzer_read_stop(sdi->usb->devhdl);
g_free(buf);
packet.type = SR_DF_END;
- session_bus(session_device_id, &packet);
+ sr_session_bus(session_device_id, &packet);
return SR_OK;
}
struct sr_device_instance *sdi;
packet.type = SR_DF_END;
- session_bus(session_device_id, &packet);
+ sr_session_bus(session_device_id, &packet);
if (!(sdi = sr_get_device_instance(device_instances, device_index)))
return; /* TODO: Cry? */