| 49 | #define FLAG_DIE_MASK 0xC0 // top 2 bits count during multi-die erase |
| 50 | |
| 51 | void SerialFlashChip::wait(void) |
| 52 | { |
| 53 | uint32_t status; |
| 54 | //Serial.print("wait-"); |
| 55 | while (1) { |
| 56 | SPIPORT.beginTransaction(SPICONFIG); |
| 57 | CSASSERT(); |
| 58 | if (flags & FLAG_STATUS_CMD70) { |
| 59 | // some Micron chips require this different |
| 60 | // command to detect program and erase completion |
| 61 | SPIPORT.transfer(0x70); |
| 62 | status = SPIPORT.transfer(0); |
| 63 | CSRELEASE(); |
| 64 | SPIPORT.endTransaction(); |
| 65 | //Serial.printf("b=%02x.", status & 0xFF); |
| 66 | if ((status & 0x80)) break; |
| 67 | } else { |
| 68 | // all others work by simply reading the status reg |
| 69 | SPIPORT.transfer(0x05); |
| 70 | status = SPIPORT.transfer(0); |
| 71 | CSRELEASE(); |
| 72 | SPIPORT.endTransaction(); |
| 73 | //Serial.printf("b=%02x.", status & 0xFF); |
| 74 | if (!(status & 1)) break; |
| 75 | } |
| 76 | } |
| 77 | busy = 0; |
| 78 | //Serial.println(); |
| 79 | } |
| 80 | |
| 81 | void SerialFlashChip::read(uint32_t addr, void *buf, uint32_t len) |
| 82 | { |
nothing calls this directly
no outgoing calls
no test coverage detected