rp-pac

Crates

git

Versions

rp235x

Flavors

Struct rp_pac::sha256::regs::Csr

source ·
#[repr(transparent)]
pub struct Csr(pub u32);
Expand description

Control and status register

Tuple Fields§

§0: u32

Implementations§

source§

impl Csr

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

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§

source§

impl Clone for Csr

source§

fn clone(&self) -> Csr

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Default for Csr

source§

fn default() -> Csr

Returns the “default value” for a type. Read more
source§

impl PartialEq for Csr

source§

fn eq(&self, other: &Csr) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for Csr

source§

impl Eq for Csr

source§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.