#[repr(transparent)]pub struct Csr(pub u32);
Expand description
Control and status register
Tuple Fields§
§0: u32
Implementations§
source§impl Csr
impl Csr
sourcepub const fn start(&self) -> bool
pub const fn start(&self) -> bool
Write 1 to prepare the SHA-256 core for a new checksum. The SUMx registers are initialised to the proper values (fractional bits of square roots of first 8 primes) and internal counters are cleared. This immediately forces WDATA_RDY and SUM_VLD high. START must be written before initiating a DMA transfer to the SHA-256 core, because the core will always request 16 transfers at a time (1 512-bit block). Additionally, the DMA channel should be configured for a multiple of 16 32-bit transfers.
sourcepub fn set_start(&mut self, val: bool)
pub fn set_start(&mut self, val: bool)
Write 1 to prepare the SHA-256 core for a new checksum. The SUMx registers are initialised to the proper values (fractional bits of square roots of first 8 primes) and internal counters are cleared. This immediately forces WDATA_RDY and SUM_VLD high. START must be written before initiating a DMA transfer to the SHA-256 core, because the core will always request 16 transfers at a time (1 512-bit block). Additionally, the DMA channel should be configured for a multiple of 16 32-bit transfers.
sourcepub const fn wdata_rdy(&self) -> bool
pub const fn wdata_rdy(&self) -> bool
If 1, the SHA-256 core is ready to accept more data through the WDATA register. After writing 16 words, this flag will go low for 57 cycles whilst the core completes its digest.
sourcepub fn set_wdata_rdy(&mut self, val: bool)
pub fn set_wdata_rdy(&mut self, val: bool)
If 1, the SHA-256 core is ready to accept more data through the WDATA register. After writing 16 words, this flag will go low for 57 cycles whilst the core completes its digest.
sourcepub const fn sum_vld(&self) -> bool
pub const fn sum_vld(&self) -> bool
If 1, the SHA-256 checksum presented in registers SUM0 through SUM7 is currently valid. Goes low when WDATA is first written, then returns high once 16 words have been written and the digest of the current 512-bit block has subsequently completed.
sourcepub fn set_sum_vld(&mut self, val: bool)
pub fn set_sum_vld(&mut self, val: bool)
If 1, the SHA-256 checksum presented in registers SUM0 through SUM7 is currently valid. Goes low when WDATA is first written, then returns high once 16 words have been written and the digest of the current 512-bit block has subsequently completed.
sourcepub const fn err_wdata_not_rdy(&self) -> bool
pub const fn err_wdata_not_rdy(&self) -> bool
Set when a write occurs whilst the SHA-256 core is not ready for data (WDATA_RDY is low). Write one to clear.
sourcepub fn set_err_wdata_not_rdy(&mut self, val: bool)
pub fn set_err_wdata_not_rdy(&mut self, val: bool)
Set when a write occurs whilst the SHA-256 core is not ready for data (WDATA_RDY is low). Write one to clear.
sourcepub const fn dma_size(&self) -> DmaSize
pub const fn dma_size(&self) -> DmaSize
Configure DREQ logic for the correct DMA data size. Must be configured before the DMA channel is triggered. The SHA-256 core’s DREQ logic requests one entire block of data at once, since there is no FIFO, and data goes straight into the core’s message schedule and digest hardware. Therefore, when transferring data with DMA, CSR_DMA_SIZE must be configured in advance so that the correct number of transfers can be requested per block.
sourcepub fn set_dma_size(&mut self, val: DmaSize)
pub fn set_dma_size(&mut self, val: DmaSize)
Configure DREQ logic for the correct DMA data size. Must be configured before the DMA channel is triggered. The SHA-256 core’s DREQ logic requests one entire block of data at once, since there is no FIFO, and data goes straight into the core’s message schedule and digest hardware. Therefore, when transferring data with DMA, CSR_DMA_SIZE must be configured in advance so that the correct number of transfers can be requested per block.
sourcepub const fn bswap(&self) -> bool
pub const fn bswap(&self) -> bool
Enable byte swapping of 32-bit values at the point they are committed to the SHA message scheduler. This block’s bus interface assembles byte/halfword data into message words in little-endian order, so that DMAing the same buffer with different transfer sizes always gives the same result on a little-endian system like RP2350. However, when marshalling bytes into blocks, SHA expects that the first byte is the most significant in each message word. To resolve this, once the bus interface has accumulated 32 bits of data (either a word write, two halfword writes in little-endian order, or four byte writes in little-endian order) the final value can be byte-swapped before passing to the actual SHA core. This feature is enabled by default because using the SHA core to checksum byte buffers is expected to be more common than having preformatted SHA message words lying around.
sourcepub fn set_bswap(&mut self, val: bool)
pub fn set_bswap(&mut self, val: bool)
Enable byte swapping of 32-bit values at the point they are committed to the SHA message scheduler. This block’s bus interface assembles byte/halfword data into message words in little-endian order, so that DMAing the same buffer with different transfer sizes always gives the same result on a little-endian system like RP2350. However, when marshalling bytes into blocks, SHA expects that the first byte is the most significant in each message word. To resolve this, once the bus interface has accumulated 32 bits of data (either a word write, two halfword writes in little-endian order, or four byte writes in little-endian order) the final value can be byte-swapped before passing to the actual SHA core. This feature is enabled by default because using the SHA core to checksum byte buffers is expected to be more common than having preformatted SHA message words lying around.
Trait Implementations§
impl Copy for Csr
impl Eq for Csr
impl StructuralPartialEq for Csr
Auto Trait Implementations§
impl Freeze for Csr
impl RefUnwindSafe for Csr
impl Send for Csr
impl Sync for Csr
impl Unpin for Csr
impl UnwindSafe for Csr
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)