ni845x_spi: Remove ineffective `csnumber' parameter parsing
Rather odd, but this code was apparently never used. The only side
effects are in altering the `CS_str` and `CS_number` variables, but
they are never read.
There were also two issues with this code stub that GCC complained
about: checking `CS_number < 0` is ineffective, as it is declared
unsigned, and strlen() of `CS_str` was taken after it was freed.
If we can figure out how to actually set the CS pin used, the fea-
ture should be fixed and return, of course.
Change-Id: I076564e0efb07c6120f0a84e6c8de766624c420c
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/409
diff --git a/flashprog.8.tmpl b/flashprog.8.tmpl
index baa49b9..35738dc 100644
--- a/flashprog.8.tmpl
+++ b/flashprog.8.tmpl
@@ -1404,18 +1404,6 @@
.B frequency
is 12 MHz (12000 kHz) for the USB-8451 and 50 MHz (50000 kHz) for the USB-8452.
The default is a frequency of 1 MHz (1000 kHz).
-.sp
-An optional
-.B cs
-parameter specifies which target chip select line should be used. Syntax is
-.sp
-.B " flashprog \-p ni845x_spi:csnumber=value"
-.sp
-where
-.B value
-should be between
-.BR 0 " and " 7
-By default the CS0 is used.
.SS
.BR "digilent_spi " programmer
.IP
diff --git a/ni845x_spi.c b/ni845x_spi.c
index a475598..98ac153 100644
--- a/ni845x_spi.c
+++ b/ni845x_spi.c
@@ -42,7 +42,6 @@
static const struct spi_master spi_programmer_ni845x;
-static unsigned char CS_number; // use chip select 0 as default
static enum USB845x_type device_pid = Unknown_NI845X_Device;
static uInt32 device_handle;
@@ -393,7 +392,6 @@
static int ni845x_spi_init(struct flashprog_programmer *const prog)
{
char *speed_str = NULL;
- char *CS_str = NULL;
char *voltage = NULL;
char *endptr = NULL;
int requested_io_voltage_mV = 1200; // default the IO voltage to 1.2V
@@ -402,17 +400,6 @@
char *ignore_io_voltage_limits_str = NULL;
int32 tmp = 0;
- // read the cs parameter (which Chip select should we use)
- CS_str = extract_programmer_param("cs");
- if (CS_str) {
- CS_number = CS_str[0] - '0';
- free(CS_str);
- if (strlen(CS_str) > 1 || CS_number < 0 || 7 < CS_number) {
- msg_perr("Only CS 0-7 supported\n");
- return 1;
- }
- }
-
voltage = extract_programmer_param("voltage");
if (voltage != NULL) {
requested_io_voltage_mV = parse_voltage(voltage);