qspi: expand padding comments

This commit is contained in:
Robert Jördens 2021-08-04 10:50:39 +00:00
parent b7c4858a1d
commit 2a90697834
1 changed files with 4 additions and 0 deletions

View File

@ -602,10 +602,14 @@ impl ProfileSerializer {
#[inline]
fn pad(&mut self) {
// Pad the buffer to 32-bit (4 byte) alignment by adding dummy writes to CSR and LSRR.
// In the case of 1 byte padding, this instead pads with 5 bytes as there is no
// valid single-byte write that could be used.
if self.index & 1 != 0 {
// Pad with 3 bytes
self.add_write(Register::LSRR, &[0, 0]);
}
if self.index & 2 != 0 {
// Pad with 2 bytes
self.add_write(Register::CSR, &[(self.mode as u8) << 1]);
}
debug_assert_eq!(self.index & 3, 0);