mirror of
https://github.com/trabucayre/openFPGALoader.git
synced 2026-08-30 01:48:50 +02:00
lattice: spi_put: avoid loop when tx == NULL
This commit is contained in:
+7
-4
@@ -1361,10 +1361,13 @@ int Lattice::spi_put(const uint8_t *tx, uint8_t *rx, uint32_t len)
|
||||
uint8_t jtx[len];
|
||||
uint8_t jrx[len];
|
||||
|
||||
for (uint32_t i = 0; i < len; ++i) {
|
||||
jtx[i] = (tx) ? LatticeBitParser::reverseByte(tx[i]) : 0;
|
||||
jrx[i] = 0;
|
||||
}
|
||||
memset(jrx, 0, len);
|
||||
|
||||
if (tx)
|
||||
for (uint32_t i = 0; i < len; ++i)
|
||||
jtx[i] = LatticeBitParser::reverseByte(tx[i]);
|
||||
else
|
||||
memset(jtx, 0, len);
|
||||
|
||||
/* send first already stored cmd,
|
||||
* in the same time store each byte
|
||||
|
||||
Reference in New Issue
Block a user