sw: experimental improved dfu performance

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2019-04-03 22:11:31 +08:00
parent 4c3f0f2402
commit d72925fdeb
2 changed files with 8 additions and 2 deletions

View File

@ -73,7 +73,7 @@ static struct toboot_state {
static dfu_state_t dfu_state = dfuIDLE;
static dfu_status_t dfu_status = OK;
static unsigned dfu_poll_timeout_ms = 100;
static unsigned dfu_poll_timeout_ms = 1;
static uint32_t dfu_buffer[DFU_TRANSFER_SIZE/4];
static uint32_t dfu_buffer_offset;

View File

@ -32,13 +32,17 @@ static void gpioWrite(int pin, int val) {
do_mirror |= 1 << pin;
else
do_mirror &= ~(1 << pin);
bbspi_do_write(do_mirror);
// bbspi_do_write(do_mirror);
}
static int gpioRead(int pin) {
return !!(bbspi_di_read() & (1 << pin));
}
static void gpioSync(void) {
bbspi_do_write(do_mirror);
}
#define SPI_ONLY_SINGLE
enum ff_spi_quirks {
@ -161,11 +165,13 @@ void spiBegin(struct ff_spi *spi) {
gpioWrite(spi->pins.hold, 1);
}
gpioWrite(spi->pins.cs, 0);
gpioSync();
}
void spiEnd(struct ff_spi *spi) {
(void)spi;
gpioWrite(spi->pins.cs, 1);
gpioSync();
}
static uint8_t spiXfer(struct ff_spi *spi, uint8_t out) {