X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fzeroplus-logic-cube%2Fzeroplus.c;h=e9b599b839fc0c316e4061232cdafc216a97a203;hb=59df0c77e2906323290544ea62801831818ec096;hp=7752d42e86e3aa4eae8fd7bf253c61675f4a3d31;hpb=60679b18e6940d20ee36fa77ea7411b67cbb9c2a;p=libsigrok.git diff --git a/hardware/zeroplus-logic-cube/zeroplus.c b/hardware/zeroplus-logic-cube/zeroplus.c index 7752d42e..e9b599b8 100644 --- a/hardware/zeroplus-logic-cube/zeroplus.c +++ b/hardware/zeroplus-logic-cube/zeroplus.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "analyzer.h" #define USB_VENDOR 0x0c12 @@ -51,7 +52,7 @@ typedef struct { * 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}, @@ -89,22 +90,22 @@ static libusb_context *usb_context = NULL; 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, }; @@ -116,8 +117,8 @@ static struct sr_samplerates 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 }; @@ -189,7 +190,7 @@ static int opendev4(struct sr_device_instance **sdi, libusb_device *dev, 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; @@ -273,7 +274,7 @@ static int configure_probes(GSList *probes) * 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; @@ -444,10 +445,10 @@ static int *hw_get_capabilities(void) 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);