Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 28 additions & 9 deletions src/colognechip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,30 @@ bool CologneChip::dumpFlash(uint32_t base_addr, uint32_t len)
return post_flash_access();
}

/**
* Set QE bit, if available. Works in both SPI and JTAG-SPI-bypass mode.
*/
bool CologneChip::set_quad_bit(bool set_quad)
{
if (!SPIInterface::set_quad_bit(set_quad)) {
return false;
}

return true;
}

/**
* Peform bulk erase. Works in both SPI and JTAG-SPI-bypass mode.
*/
bool CologneChip::bulk_erase_flash()
{
if (!SPIInterface::bulk_erase_flash()) {
return false;
}

return true;
}

/**
* Parse bitstream from *.bit or *.cfg and program FPGA in SPI or JTAG mode
* or write configuration to external flash via SPI or JTAG-SPI-bypass.
Expand Down Expand Up @@ -450,15 +474,10 @@ int CologneChip::spi_wait(uint8_t cmd, uint8_t mask, uint8_t cond,
_jtag->read_write(&tx, NULL, 8, 0);

do {
if (count == 0) {
_jtag->read_write(dummy, rx, 16, 0);
uint8_t b0 = ConfigBitstreamParser::reverseByte(rx[0]);
uint8_t b1 = ConfigBitstreamParser::reverseByte(rx[1]);
tmp = (b0 << 1) | ((b1 >> 7) & 0x01);
} else {
_jtag->read_write(dummy, rx, 8, 0);
tmp = ConfigBitstreamParser::reverseByte(rx[0]);
}
_jtag->read_write(dummy, rx, 16, 0);
uint8_t b0 = ConfigBitstreamParser::reverseByte(rx[0]);
uint8_t b1 = ConfigBitstreamParser::reverseByte(rx[1]);
tmp = (b0 << 1) | ((b1 >> 7) & 0x01);

count++;
if (count == timeout) {
Expand Down
4 changes: 2 additions & 2 deletions src/colognechip.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ class CologneChip: public Device, SPIInterface {
printError("protect flash not supported"); return false;}
virtual bool unprotect_flash() override {
printError("unprotect flash not supported"); return false;}
virtual bool bulk_erase_flash() override {
printError("bulk erase flash not supported"); return false;}
bool set_quad_bit(bool set_quad) override;
bool bulk_erase_flash() override;
void program(unsigned int offset, bool unprotect_flash) override;

uint32_t idCode() override {return 0;}
Expand Down
Loading