Implement flashing from scratch rom
This commit is contained in:
@@ -17,16 +17,8 @@ uint8_t pmc_read(struct Pmc * pmc) {
|
||||
return *(pmc->data_in);
|
||||
}
|
||||
|
||||
static bool pmc_wait(struct Pmc * pmc, int timeout) {
|
||||
while (pmc_status(pmc) & PMC_STS_OBF) {
|
||||
if (timeout == 0) return false;
|
||||
timeout -= 1;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool pmc_write(struct Pmc * pmc, uint8_t data, int timeout) {
|
||||
if (!pmc_wait(pmc, timeout)) return false;
|
||||
bool pmc_write(struct Pmc * pmc, uint8_t data) {
|
||||
while (pmc_status(pmc) & PMC_STS_OBF) {}
|
||||
*(pmc->data_out) = data;
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user