Add SR_ prefix to the KHZ/MHZ/GHZ macros.
This commit is contained in:
parent
9688b443f6
commit
59df0c77e2
|
@ -43,22 +43,22 @@
|
||||||
static GSList *device_instances = NULL;
|
static GSList *device_instances = NULL;
|
||||||
|
|
||||||
static uint64_t supported_samplerates[] = {
|
static uint64_t supported_samplerates[] = {
|
||||||
KHZ(200),
|
SR_KHZ(200),
|
||||||
KHZ(250),
|
SR_KHZ(250),
|
||||||
KHZ(500),
|
SR_KHZ(500),
|
||||||
MHZ(1),
|
SR_MHZ(1),
|
||||||
MHZ(5),
|
SR_MHZ(5),
|
||||||
MHZ(10),
|
SR_MHZ(10),
|
||||||
MHZ(25),
|
SR_MHZ(25),
|
||||||
MHZ(50),
|
SR_MHZ(50),
|
||||||
MHZ(100),
|
SR_MHZ(100),
|
||||||
MHZ(200),
|
SR_MHZ(200),
|
||||||
0,
|
0,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct sr_samplerates samplerates = {
|
static struct sr_samplerates samplerates = {
|
||||||
KHZ(200),
|
SR_KHZ(200),
|
||||||
MHZ(200),
|
SR_MHZ(200),
|
||||||
0,
|
0,
|
||||||
supported_samplerates,
|
supported_samplerates,
|
||||||
};
|
};
|
||||||
|
@ -561,15 +561,15 @@ static int set_samplerate(struct sr_device_instance *sdi,
|
||||||
if (supported_samplerates[i] == 0)
|
if (supported_samplerates[i] == 0)
|
||||||
return SR_ERR_SAMPLERATE;
|
return SR_ERR_SAMPLERATE;
|
||||||
|
|
||||||
if (samplerate <= MHZ(50)) {
|
if (samplerate <= SR_MHZ(50)) {
|
||||||
ret = upload_firmware(0, sigma);
|
ret = upload_firmware(0, sigma);
|
||||||
sigma->num_probes = 16;
|
sigma->num_probes = 16;
|
||||||
}
|
}
|
||||||
if (samplerate == MHZ(100)) {
|
if (samplerate == SR_MHZ(100)) {
|
||||||
ret = upload_firmware(1, sigma);
|
ret = upload_firmware(1, sigma);
|
||||||
sigma->num_probes = 8;
|
sigma->num_probes = 8;
|
||||||
}
|
}
|
||||||
else if (samplerate == MHZ(200)) {
|
else if (samplerate == SR_MHZ(200)) {
|
||||||
ret = upload_firmware(2, sigma);
|
ret = upload_firmware(2, sigma);
|
||||||
sigma->num_probes = 4;
|
sigma->num_probes = 4;
|
||||||
}
|
}
|
||||||
|
@ -608,7 +608,7 @@ static int configure_probes(struct sr_device_instance *sdi, GSList *probes)
|
||||||
if (!probe->enabled || !probe->trigger)
|
if (!probe->enabled || !probe->trigger)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (sigma->cur_samplerate >= MHZ(100)) {
|
if (sigma->cur_samplerate >= SR_MHZ(100)) {
|
||||||
/* Fast trigger support. */
|
/* Fast trigger support. */
|
||||||
if (trigger_set) {
|
if (trigger_set) {
|
||||||
g_warning("Asix Sigma only supports a single "
|
g_warning("Asix Sigma only supports a single "
|
||||||
|
@ -839,7 +839,7 @@ static int decode_chunk_ts(uint8_t *buf, uint16_t *lastts,
|
||||||
|
|
||||||
/* Check if trigger is in this chunk. */
|
/* Check if trigger is in this chunk. */
|
||||||
if (triggerpos != -1) {
|
if (triggerpos != -1) {
|
||||||
if (sigma->cur_samplerate <= MHZ(50))
|
if (sigma->cur_samplerate <= SR_MHZ(50))
|
||||||
triggerpos -= EVENTS_PER_CLUSTER - 1;
|
triggerpos -= EVENTS_PER_CLUSTER - 1;
|
||||||
|
|
||||||
if (triggerpos < 0)
|
if (triggerpos < 0)
|
||||||
|
@ -1220,13 +1220,13 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
|
||||||
|
|
||||||
/* If the samplerate has not been set, default to 200 KHz. */
|
/* If the samplerate has not been set, default to 200 KHz. */
|
||||||
if (sigma->cur_firmware == -1)
|
if (sigma->cur_firmware == -1)
|
||||||
set_samplerate(sdi, KHZ(200));
|
set_samplerate(sdi, SR_KHZ(200));
|
||||||
|
|
||||||
/* Enter trigger programming mode. */
|
/* Enter trigger programming mode. */
|
||||||
sigma_set_register(WRITE_TRIGGER_SELECT1, 0x20, sigma);
|
sigma_set_register(WRITE_TRIGGER_SELECT1, 0x20, sigma);
|
||||||
|
|
||||||
/* 100 and 200 MHz mode. */
|
/* 100 and 200 MHz mode. */
|
||||||
if (sigma->cur_samplerate >= MHZ(100)) {
|
if (sigma->cur_samplerate >= SR_MHZ(100)) {
|
||||||
sigma_set_register(WRITE_TRIGGER_SELECT1, 0x81, sigma);
|
sigma_set_register(WRITE_TRIGGER_SELECT1, 0x81, sigma);
|
||||||
|
|
||||||
/* Find which pin to trigger on from mask. */
|
/* Find which pin to trigger on from mask. */
|
||||||
|
@ -1243,7 +1243,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
|
||||||
triggerselect |= 1 << 3;
|
triggerselect |= 1 << 3;
|
||||||
|
|
||||||
/* All other modes. */
|
/* All other modes. */
|
||||||
} else if (sigma->cur_samplerate <= MHZ(50)) {
|
} else if (sigma->cur_samplerate <= SR_MHZ(50)) {
|
||||||
build_basic_trigger(&lut, sigma);
|
build_basic_trigger(&lut, sigma);
|
||||||
|
|
||||||
sigma_write_trigger_lut(&lut, sigma);
|
sigma_write_trigger_lut(&lut, sigma);
|
||||||
|
@ -1264,10 +1264,10 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
|
||||||
sigma_set_register(WRITE_TRIGGER_SELECT1, triggerselect, sigma);
|
sigma_set_register(WRITE_TRIGGER_SELECT1, triggerselect, sigma);
|
||||||
|
|
||||||
/* Set clock select register. */
|
/* Set clock select register. */
|
||||||
if (sigma->cur_samplerate == MHZ(200))
|
if (sigma->cur_samplerate == SR_MHZ(200))
|
||||||
/* Enable 4 probes. */
|
/* Enable 4 probes. */
|
||||||
sigma_set_register(WRITE_CLOCK_SELECT, 0xf0, sigma);
|
sigma_set_register(WRITE_CLOCK_SELECT, 0xf0, sigma);
|
||||||
else if (sigma->cur_samplerate == MHZ(100))
|
else if (sigma->cur_samplerate == SR_MHZ(100))
|
||||||
/* Enable 8 probes. */
|
/* Enable 8 probes. */
|
||||||
sigma_set_register(WRITE_CLOCK_SELECT, 0x00, sigma);
|
sigma_set_register(WRITE_CLOCK_SELECT, 0x00, sigma);
|
||||||
else {
|
else {
|
||||||
|
@ -1275,7 +1275,7 @@ static int hw_start_acquisition(int device_index, gpointer session_device_id)
|
||||||
* 50 MHz mode (or fraction thereof). Any fraction down to
|
* 50 MHz mode (or fraction thereof). Any fraction down to
|
||||||
* 50 MHz / 256 can be used, but is not supported by sigrok API.
|
* 50 MHz / 256 can be used, but is not supported by sigrok API.
|
||||||
*/
|
*/
|
||||||
frac = MHZ(50) / sigma->cur_samplerate - 1;
|
frac = SR_MHZ(50) / sigma->cur_samplerate - 1;
|
||||||
|
|
||||||
clockselect.async = 0;
|
clockselect.async = 0;
|
||||||
clockselect.fraction = frac;
|
clockselect.fraction = frac;
|
||||||
|
|
|
@ -65,7 +65,7 @@ static int capabilities[] = {
|
||||||
|
|
||||||
static struct sr_samplerates samplerates = {
|
static struct sr_samplerates samplerates = {
|
||||||
1,
|
1,
|
||||||
GHZ(1),
|
SR_GHZ(1),
|
||||||
1,
|
1,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
@ -89,7 +89,7 @@ static uint8_t genmode_default[] = {
|
||||||
|
|
||||||
/* List of struct sr_device_instance, maintained by opendev()/closedev(). */
|
/* List of struct sr_device_instance, maintained by opendev()/closedev(). */
|
||||||
static GSList *device_instances = NULL;
|
static GSList *device_instances = NULL;
|
||||||
static uint64_t cur_samplerate = KHZ(200);
|
static uint64_t cur_samplerate = SR_KHZ(200);
|
||||||
static uint64_t limit_samples = 0;
|
static uint64_t limit_samples = 0;
|
||||||
static uint64_t limit_msec = 0;
|
static uint64_t limit_msec = 0;
|
||||||
static int default_genmode = GENMODE_DEFAULT;
|
static int default_genmode = GENMODE_DEFAULT;
|
||||||
|
|
|
@ -47,13 +47,34 @@ static int capabilities[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint64_t supported_samplerates[] = {
|
static uint64_t supported_samplerates[] = {
|
||||||
100, 200, 500, KHZ(1), KHZ(2), KHZ(5), KHZ(10), KHZ(20),
|
100,
|
||||||
KHZ(50), KHZ(100), KHZ(200), KHZ(500), MHZ(1), MHZ(2), MHZ(5),
|
200,
|
||||||
MHZ(10), MHZ(20), MHZ(50), MHZ(100), MHZ(200), 0
|
500,
|
||||||
|
SR_KHZ(1),
|
||||||
|
SR_KHZ(2),
|
||||||
|
SR_KHZ(5),
|
||||||
|
SR_KHZ(10),
|
||||||
|
SR_KHZ(20),
|
||||||
|
SR_KHZ(50),
|
||||||
|
SR_KHZ(100),
|
||||||
|
SR_KHZ(200),
|
||||||
|
SR_KHZ(500),
|
||||||
|
SR_MHZ(1),
|
||||||
|
SR_MHZ(2),
|
||||||
|
SR_MHZ(5),
|
||||||
|
SR_MHZ(10),
|
||||||
|
SR_MHZ(20),
|
||||||
|
SR_MHZ(50),
|
||||||
|
SR_MHZ(100),
|
||||||
|
SR_MHZ(200),
|
||||||
|
0,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct sr_samplerates samplerates = {
|
static struct sr_samplerates samplerates = {
|
||||||
100, MHZ(200), 0, supported_samplerates,
|
100,
|
||||||
|
SR_MHZ(200),
|
||||||
|
0,
|
||||||
|
supported_samplerates,
|
||||||
};
|
};
|
||||||
|
|
||||||
static GSList *device_instances = NULL;
|
static GSList *device_instances = NULL;
|
||||||
|
@ -283,7 +304,7 @@ static int mso_configure_trigger(struct sr_device_instance *sdi)
|
||||||
ops[2] = mso_trans(3, dso_trigger & 0xff);
|
ops[2] = mso_trans(3, dso_trigger & 0xff);
|
||||||
ops[3] = mso_trans(4, (dso_trigger >> 8) & 0xff);
|
ops[3] = mso_trans(4, (dso_trigger >> 8) & 0xff);
|
||||||
ops[4] = mso_trans(11,
|
ops[4] = mso_trans(11,
|
||||||
mso->dso_trigger_width / HZ_TO_NS(mso->cur_rate));
|
mso->dso_trigger_width / SR_HZ_TO_NS(mso->cur_rate));
|
||||||
ops[5] = mso_trans(15, (2 | mso->slowmode));
|
ops[5] = mso_trans(15, (2 | mso->slowmode));
|
||||||
|
|
||||||
/* FIXME SPI/I2C Triggers */
|
/* FIXME SPI/I2C Triggers */
|
||||||
|
|
|
@ -83,23 +83,23 @@ struct rate_map {
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct rate_map rate_map[] = {
|
static struct rate_map rate_map[] = {
|
||||||
{ MHZ(200), 0x0205, 0 },
|
{ SR_MHZ(200), 0x0205, 0 },
|
||||||
{ MHZ(100), 0x0105, 0 },
|
{ SR_MHZ(100), 0x0105, 0 },
|
||||||
{ MHZ(50), 0x0005, 0 },
|
{ SR_MHZ(50), 0x0005, 0 },
|
||||||
{ MHZ(20), 0x0303, 0 },
|
{ SR_MHZ(20), 0x0303, 0 },
|
||||||
{ MHZ(10), 0x0308, 0 },
|
{ SR_MHZ(10), 0x0308, 0 },
|
||||||
{ MHZ(5), 0x030c, 0 },
|
{ SR_MHZ(5), 0x030c, 0 },
|
||||||
{ MHZ(2), 0x0330, 0 },
|
{ SR_MHZ(2), 0x0330, 0 },
|
||||||
{ MHZ(1), 0x0362, 0 },
|
{ SR_MHZ(1), 0x0362, 0 },
|
||||||
{ KHZ(500), 0x03c6, 0 },
|
{ SR_KHZ(500), 0x03c6, 0 },
|
||||||
{ KHZ(200), 0x07f2, 0 },
|
{ SR_KHZ(200), 0x07f2, 0 },
|
||||||
{ KHZ(100), 0x0fe6, 0 },
|
{ SR_KHZ(100), 0x0fe6, 0 },
|
||||||
{ KHZ(50), 0x1fce, 0 },
|
{ SR_KHZ(50), 0x1fce, 0 },
|
||||||
{ KHZ(20), 0x4f86, 0 },
|
{ SR_KHZ(20), 0x4f86, 0 },
|
||||||
{ KHZ(10), 0x9f0e, 0 },
|
{ SR_KHZ(10), 0x9f0e, 0 },
|
||||||
{ KHZ(5), 0x03c7, 0x20 },
|
{ SR_KHZ(5), 0x03c7, 0x20 },
|
||||||
{ KHZ(2), 0x07f3, 0x20 },
|
{ SR_KHZ(2), 0x07f3, 0x20 },
|
||||||
{ KHZ(1), 0x0fe7, 0x20 },
|
{ SR_KHZ(1), 0x0fe7, 0x20 },
|
||||||
{ 500, 0x1fcf, 0x20 },
|
{ 500, 0x1fcf, 0x20 },
|
||||||
{ 200, 0x4f87, 0x20 },
|
{ 200, 0x4f87, 0x20 },
|
||||||
{ 100, 0x9f0f, 0x20 },
|
{ 100, 0x9f0f, 0x20 },
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
#define NUM_TRIGGER_STAGES 4
|
#define NUM_TRIGGER_STAGES 4
|
||||||
#define TRIGGER_TYPES "01"
|
#define TRIGGER_TYPES "01"
|
||||||
#define SERIAL_SPEED B115200
|
#define SERIAL_SPEED B115200
|
||||||
#define CLOCK_RATE MHZ(100)
|
#define CLOCK_RATE SR_MHZ(100)
|
||||||
#define MIN_NUM_SAMPLES 4
|
#define MIN_NUM_SAMPLES 4
|
||||||
|
|
||||||
/* Command opcodes */
|
/* Command opcodes */
|
||||||
|
@ -93,7 +93,7 @@ static int capabilities[] = {
|
||||||
|
|
||||||
static struct sr_samplerates samplerates = {
|
static struct sr_samplerates samplerates = {
|
||||||
10,
|
10,
|
||||||
MHZ(200),
|
SR_MHZ(200),
|
||||||
1,
|
1,
|
||||||
0,
|
0,
|
||||||
};
|
};
|
||||||
|
@ -321,7 +321,7 @@ static int hw_init(const char *deviceinfo)
|
||||||
free(serial_params);
|
free(serial_params);
|
||||||
g_slist_free(ports);
|
g_slist_free(ports);
|
||||||
|
|
||||||
cur_samplerate = KHZ(200);
|
cur_samplerate = SR_KHZ(200);
|
||||||
|
|
||||||
return final_devcnt;
|
return final_devcnt;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,22 +73,22 @@ static GTimeVal firmware_updated = { 0, 0 };
|
||||||
static libusb_context *usb_context = NULL;
|
static libusb_context *usb_context = NULL;
|
||||||
|
|
||||||
static uint64_t supported_samplerates[] = {
|
static uint64_t supported_samplerates[] = {
|
||||||
KHZ(200),
|
SR_KHZ(200),
|
||||||
KHZ(250),
|
SR_KHZ(250),
|
||||||
KHZ(500),
|
SR_KHZ(500),
|
||||||
MHZ(1),
|
SR_MHZ(1),
|
||||||
MHZ(2),
|
SR_MHZ(2),
|
||||||
MHZ(4),
|
SR_MHZ(4),
|
||||||
MHZ(8),
|
SR_MHZ(8),
|
||||||
MHZ(12),
|
SR_MHZ(12),
|
||||||
MHZ(16),
|
SR_MHZ(16),
|
||||||
MHZ(24),
|
SR_MHZ(24),
|
||||||
0,
|
0,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct sr_samplerates samplerates = {
|
static struct sr_samplerates samplerates = {
|
||||||
KHZ(200),
|
SR_KHZ(200),
|
||||||
MHZ(24),
|
SR_MHZ(24),
|
||||||
0,
|
0,
|
||||||
supported_samplerates,
|
supported_samplerates,
|
||||||
};
|
};
|
||||||
|
|
|
@ -90,22 +90,22 @@ static libusb_context *usb_context = NULL;
|
||||||
static uint64_t supported_samplerates[] = {
|
static uint64_t supported_samplerates[] = {
|
||||||
100,
|
100,
|
||||||
500,
|
500,
|
||||||
KHZ(1),
|
SR_KHZ(1),
|
||||||
KHZ(5),
|
SR_KHZ(5),
|
||||||
KHZ(25),
|
SR_KHZ(25),
|
||||||
KHZ(50),
|
SR_KHZ(50),
|
||||||
KHZ(100),
|
SR_KHZ(100),
|
||||||
KHZ(200),
|
SR_KHZ(200),
|
||||||
KHZ(400),
|
SR_KHZ(400),
|
||||||
KHZ(800),
|
SR_KHZ(800),
|
||||||
MHZ(1),
|
SR_MHZ(1),
|
||||||
MHZ(10),
|
SR_MHZ(10),
|
||||||
MHZ(25),
|
SR_MHZ(25),
|
||||||
MHZ(50),
|
SR_MHZ(50),
|
||||||
MHZ(80),
|
SR_MHZ(80),
|
||||||
MHZ(100),
|
SR_MHZ(100),
|
||||||
MHZ(150),
|
SR_MHZ(150),
|
||||||
MHZ(200),
|
SR_MHZ(200),
|
||||||
0,
|
0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -445,10 +445,10 @@ static int *hw_get_capabilities(void)
|
||||||
static int set_configuration_samplerate(uint64_t samplerate)
|
static int set_configuration_samplerate(uint64_t samplerate)
|
||||||
{
|
{
|
||||||
g_message("%s(%" PRIu64 ")", __FUNCTION__, samplerate);
|
g_message("%s(%" PRIu64 ")", __FUNCTION__, samplerate);
|
||||||
if (samplerate > MHZ(1))
|
if (samplerate > SR_MHZ(1))
|
||||||
analyzer_set_freq(samplerate / MHZ(1), FREQ_SCALE_MHZ);
|
analyzer_set_freq(samplerate / SR_MHZ(1), FREQ_SCALE_MHZ);
|
||||||
else if (samplerate > KHZ(1))
|
else if (samplerate > SR_KHZ(1))
|
||||||
analyzer_set_freq(samplerate / KHZ(1), FREQ_SCALE_KHZ);
|
analyzer_set_freq(samplerate / SR_KHZ(1), FREQ_SCALE_KHZ);
|
||||||
else
|
else
|
||||||
analyzer_set_freq(samplerate, FREQ_SCALE_HZ);
|
analyzer_set_freq(samplerate, FREQ_SCALE_HZ);
|
||||||
|
|
||||||
|
|
|
@ -106,12 +106,12 @@ static int init(struct sr_output *o)
|
||||||
|
|
||||||
/* timescale */
|
/* timescale */
|
||||||
/* VCD can only handle 1/10/100 (s - fs), so scale up first */
|
/* VCD can only handle 1/10/100 (s - fs), so scale up first */
|
||||||
if (ctx->samplerate > MHZ(1))
|
if (ctx->samplerate > SR_MHZ(1))
|
||||||
ctx->period = GHZ(1);
|
ctx->period = SR_GHZ(1);
|
||||||
else if (ctx->samplerate > KHZ(1))
|
else if (ctx->samplerate > SR_KHZ(1))
|
||||||
ctx->period = MHZ(1);
|
ctx->period = SR_MHZ(1);
|
||||||
else
|
else
|
||||||
ctx->period = KHZ(1);
|
ctx->period = SR_KHZ(1);
|
||||||
if (!(frequency_s = sr_period_string(ctx->period))) {
|
if (!(frequency_s = sr_period_string(ctx->period))) {
|
||||||
g_string_free(ctx->header, TRUE);
|
g_string_free(ctx->header, TRUE);
|
||||||
free(ctx);
|
free(ctx);
|
||||||
|
|
8
sigrok.h
8
sigrok.h
|
@ -59,11 +59,11 @@ extern "C" {
|
||||||
#define SR_MAX_PROBENAME_LEN 32
|
#define SR_MAX_PROBENAME_LEN 32
|
||||||
|
|
||||||
/* Handy little macros */
|
/* Handy little macros */
|
||||||
#define KHZ(n) ((n) * 1000)
|
#define SR_KHZ(n) ((n) * 1000)
|
||||||
#define MHZ(n) ((n) * 1000000)
|
#define SR_MHZ(n) ((n) * 1000000)
|
||||||
#define GHZ(n) ((n) * 1000000000)
|
#define SR_GHZ(n) ((n) * 1000000000)
|
||||||
|
|
||||||
#define HZ_TO_NS(n) (1000000000 / (n))
|
#define SR_HZ_TO_NS(n) (1000000000 / (n))
|
||||||
|
|
||||||
typedef int (*sr_receive_data_callback) (int fd, int revents, void *user_data);
|
typedef int (*sr_receive_data_callback) (int fd, int revents, void *user_data);
|
||||||
|
|
||||||
|
|
18
strutil.c
18
strutil.c
|
@ -41,11 +41,11 @@ char *sr_samplerate_string(uint64_t samplerate)
|
||||||
if (!o)
|
if (!o)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (samplerate >= GHZ(1))
|
if (samplerate >= SR_GHZ(1))
|
||||||
r = snprintf(o, 30, "%" PRIu64 " GHz", samplerate / 1000000000);
|
r = snprintf(o, 30, "%" PRIu64 " GHz", samplerate / 1000000000);
|
||||||
else if (samplerate >= MHZ(1))
|
else if (samplerate >= SR_MHZ(1))
|
||||||
r = snprintf(o, 30, "%" PRIu64 " MHz", samplerate / 1000000);
|
r = snprintf(o, 30, "%" PRIu64 " MHz", samplerate / 1000000);
|
||||||
else if (samplerate >= KHZ(1))
|
else if (samplerate >= SR_KHZ(1))
|
||||||
r = snprintf(o, 30, "%" PRIu64 " kHz", samplerate / 1000);
|
r = snprintf(o, 30, "%" PRIu64 " kHz", samplerate / 1000);
|
||||||
else
|
else
|
||||||
r = snprintf(o, 30, "%" PRIu64 " Hz", samplerate);
|
r = snprintf(o, 30, "%" PRIu64 " Hz", samplerate);
|
||||||
|
@ -78,11 +78,11 @@ char *sr_period_string(uint64_t frequency)
|
||||||
if (!o)
|
if (!o)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (frequency >= GHZ(1))
|
if (frequency >= SR_GHZ(1))
|
||||||
r = snprintf(o, 30, "%" PRIu64 " ns", frequency / 1000000000);
|
r = snprintf(o, 30, "%" PRIu64 " ns", frequency / 1000000000);
|
||||||
else if (frequency >= MHZ(1))
|
else if (frequency >= SR_MHZ(1))
|
||||||
r = snprintf(o, 30, "%" PRIu64 " us", frequency / 1000000);
|
r = snprintf(o, 30, "%" PRIu64 " us", frequency / 1000000);
|
||||||
else if (frequency >= KHZ(1))
|
else if (frequency >= SR_KHZ(1))
|
||||||
r = snprintf(o, 30, "%" PRIu64 " ms", frequency / 1000);
|
r = snprintf(o, 30, "%" PRIu64 " ms", frequency / 1000);
|
||||||
else
|
else
|
||||||
r = snprintf(o, 30, "%" PRIu64 " s", frequency);
|
r = snprintf(o, 30, "%" PRIu64 " s", frequency);
|
||||||
|
@ -198,15 +198,15 @@ uint64_t sr_parse_sizestring(const char *sizestring)
|
||||||
break;
|
break;
|
||||||
case 'k':
|
case 'k':
|
||||||
case 'K':
|
case 'K':
|
||||||
multiplier = KHZ(1);
|
multiplier = SR_KHZ(1);
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
case 'M':
|
case 'M':
|
||||||
multiplier = MHZ(1);
|
multiplier = SR_MHZ(1);
|
||||||
break;
|
break;
|
||||||
case 'g':
|
case 'g':
|
||||||
case 'G':
|
case 'G':
|
||||||
multiplier = GHZ(1);
|
multiplier = SR_GHZ(1);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
val = 0;
|
val = 0;
|
||||||
|
|
Loading…
Reference in New Issue