atmel-samd: Clear the error bit after the known buffer overflow and be explicit about dst increase.

This commit is contained in:
Scott Shawcroft 2017-08-03 13:43:26 -07:00
parent c08cc4106b
commit 8f3c5ebdc8
1 changed files with 2 additions and 0 deletions

View File

@ -131,6 +131,7 @@ enum status_code shared_dma_write(Sercom* sercom, const uint8_t* buffer, uint32_
sercom->SPI.DATA.reg;
}
sercom->SPI.STATUS.bit.BUFOVF = 1;
sercom->SPI.INTFLAG.reg = SERCOM_SPI_INTFLAG_ERROR;
return general_dma_tx.job_status;
}
@ -148,6 +149,7 @@ enum status_code shared_dma_read(Sercom* sercom, uint8_t* buffer, uint32_t lengt
dma_descriptor_get_config_defaults(&descriptor_config);
descriptor_config.beat_size = DMA_BEAT_SIZE_BYTE;
descriptor_config.src_increment_enable = false;
descriptor_config.dst_increment_enable = true;
descriptor_config.block_transfer_count = length;
// DATA register is consistently addressed across all SERCOM modes.
descriptor_config.source_address = ((uint32_t)&sercom->SPI.DATA.reg);