From: Gerhard Sittig Date: Sat, 2 May 2020 16:37:03 +0000 (+0200) Subject: asix-sigma: nits in the list of firmware files X-Git-Url: http://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=742368a2bc2e4a01b0fbcdc6d5aa2bb4c0bcda4c asix-sigma: nits in the list of firmware files Eliminate an unnecessary magic number for the maximum filename length of SIGMA netlists. Use a more compact source code phrase to "unclutter" the list of filenames and their features/purpose. Move the filesize limit to the list of files to simplify future maintenance. --- diff --git a/src/hardware/asix-sigma/protocol.c b/src/hardware/asix-sigma/protocol.c index d040b37c..3d346894 100644 --- a/src/hardware/asix-sigma/protocol.c +++ b/src/hardware/asix-sigma/protocol.c @@ -47,19 +47,16 @@ SR_PRIV const uint64_t samplerates[] = { SR_PRIV const size_t samplerates_count = ARRAY_SIZE(samplerates); -static const char firmware_files[][24] = { - /* 50 MHz, supports 8 bit fractions */ - "asix-sigma-50.fw", - /* 100 MHz */ - "asix-sigma-100.fw", - /* 200 MHz */ - "asix-sigma-200.fw", - /* Synchronous clock from pin */ - "asix-sigma-50sync.fw", - /* Frequency counter */ - "asix-sigma-phasor.fw", +static const char *firmware_files[] = { + "asix-sigma-50.fw", /* Up to 50MHz sample rate, 8bit divider. */ + "asix-sigma-100.fw", /* 100MHz sample rate, fixed. */ + "asix-sigma-200.fw", /* 200MHz sample rate, fixed. */ + "asix-sigma-50sync.fw", /* Synchronous clock from external pin. */ + "asix-sigma-phasor.fw", /* Frequency counter. */ }; +#define SIGMA_FIRMWARE_SIZE_LIMIT (256 * 1024) + static int sigma_read(void *buf, size_t size, struct dev_context *devc) { int ret; @@ -370,8 +367,8 @@ static int sigma_fw_2_bitbang(struct sr_context *ctx, const char *name, int ret = SR_OK; /* Retrieve the on-disk firmware file content. */ - firmware = sr_resource_load(ctx, SR_RESOURCE_FIRMWARE, - name, &file_size, 256 * 1024); + firmware = sr_resource_load(ctx, SR_RESOURCE_FIRMWARE, name, + &file_size, SIGMA_FIRMWARE_SIZE_LIMIT); if (!firmware) return SR_ERR;