[f1c100s]change spi xfer buffer, speed up!

This commit is contained in:
JianjunJiang 2021-06-10 09:54:45 +08:00
parent e056815773
commit af00cdd8dd

View File

@ -546,25 +546,25 @@ static int chip_spi_xfer(struct xfel_ctx_t * ctx, void * txbuf, uint32_t txlen,
fel_write(ctx, 0x00008800, (void *)&payload[0], sizeof(payload));
while(txlen > 0)
{
n = txlen > 256 ? 256 : txlen;
param[0] = cpu_to_le32(ctx->version.scratchpad);
n = txlen > 4096 ? 4096 : txlen;
param[0] = cpu_to_le32(0x00009800);
param[1] = 0;
param[2] = n;
fel_write(ctx, 0x00008800 + 0x4, (void *)&param, sizeof(param));
fel_write(ctx, ctx->version.scratchpad, txbuf, n);
fel_write(ctx, 0x00009800, txbuf, n);
fel_exec(ctx, 0x00008800);
txbuf += n;
txlen -= n;
}
while(rxlen > 0)
{
n = rxlen > 256 ? 256 : rxlen;
n = rxlen > 4096 ? 4096 : rxlen;
param[0] = 0;
param[1] = cpu_to_le32(ctx->version.scratchpad);
param[1] = cpu_to_le32(0x00009800);
param[2] = n;
fel_write(ctx, 0x00008800 + 0x4, (void *)&param, sizeof(param));
fel_exec(ctx, 0x00008800);
fel_read(ctx, ctx->version.scratchpad, rxbuf, n);
fel_read(ctx, 0x00009800, rxbuf, n);
rxbuf += n;
rxlen -= n;
}