uint32_t spi_min, spi_max, spi_new;
spi_min = lib->settings->get_int(lib->settings, "%s.spi_min",
- 0x00000000, lib->ns);
+ 0x00000100, lib->ns);
spi_max = lib->settings->get_int(lib->settings, "%s.spi_max",
0xffffffff, lib->ns);
if (spi_min > spi_max)
spi_min = spi_max;
spi_max = spi_new;
}
+ /* make sure the SPI is valid (not in range 0-255) */
+ spi_min = max(spi_min, 0x00000100);
+ spi_max = max(spi_max, 0x00000100);
this->mutex->lock(this->mutex);
if (!this->rng)
return FAILED;
}
spi_new = spi_min + spi_new % (spi_max - spi_min + 1);
- /* make sure the SPI is valid (not in range 0-255) */
- spi_new |= 0x00000100;
spi_new = htonl(spi_new);
}
while (!allocate_spi(this, spi_new));