spiFlash: introduce jedec_id

This commit is contained in:
Gwenhael Goavec-Merou 2021-05-05 06:25:00 +02:00
parent 23067a9dbb
commit c82257c9ba
2 changed files with 7 additions and 6 deletions

View File

@ -185,21 +185,21 @@ void SPIFlash::read_id()
bool has_edid = false; bool has_edid = false;
_spi->spi_put(0x9F, NULL, rx, 4); _spi->spi_put(0x9F, NULL, rx, 4);
int d = 0; _jedec_id = 0;
for (int i=0; i < 4; i++) { for (int i=0; i < 4; i++) {
d = d << 8; _jedec_id = _jedec_id << 8;
d |= (0x00ff & (int)rx[i]); _jedec_id |= (0x00ff & (int)rx[i]);
if (_verbose > 0) if (_verbose > 0)
printf("%x ", rx[i]); printf("%x ", rx[i]);
} }
if (_verbose > 0) if (_verbose > 0)
printf("read %x\n", d); printf("read %x\n", _jedec_id);
/* read extented */ /* read extented */
if ((d & 0xff) != 0) { if ((_jedec_id & 0xff) != 0) {
has_edid = true; has_edid = true;
len += (d & 0x0ff); len += (_jedec_id & 0x0ff);
_spi->spi_put(0x9F, NULL, rx, len); _spi->spi_put(0x9F, NULL, rx, len);
} }

View File

@ -49,6 +49,7 @@ class SPIFlash {
private: private:
SPIInterface *_spi; SPIInterface *_spi;
int8_t _verbose; int8_t _verbose;
uint32_t _jedec_id; /**< CHIP ID */
}; };
#endif #endif