/* MSS_SPI_configure_slave_mode() See "mss_spi.h" for details of how to use this function.  */
void MSS_SPI_configure_slave_mode(mss_spi_instance_t *this_spi, mss_spi_protocol_mode_t protocol_mode, mss_spi_pclk_div_t clk_rate, uint8_t frame_bit_length)
/* MSS_SPI_configure_slave_mode() See "mss_spi.h" for details of how to use this function.  */
void MSS_SPI_configure_slave_mode(mss_spi_instance_t *this_spi, mss_spi_protocol_mode_t protocol_mode, mss_spi_pclk_div_t clk_rate, uint8_t frame_bit_length)
{
    ASSERT( (this_spi == &g_mss_spi0) || (this_spi == &g_mss_spi1) );
    ASSERT( frame_bit_length <= 32 );
    this_spi->hw_reg_bit->CTRL_MASTER = MSS_SPI_MODE_SLAVE;
    this_spi->hw_reg_bit->CTRL_ENABLE = 0U;
    this_spi->hw_reg->CONTROL = (this_spi->hw_reg->CONTROL & ~PROTOCOL_MODE_MASK) | (uint32_t)protocol_mode;
    this_spi->hw_reg->CLK_GEN = (uint32_t)clk_rate;
    this_spi->hw_reg->CONTROL = (this_spi->hw_reg->CONTROL & ~TXRXDFCOUNT_MASK) | ((uint32_t)1 << TXRXDFCOUNT_SHIFT);
    this_spi->hw_reg->TXRXDF_SIZE = frame_bit_length;
    this_spi->hw_reg_bit->CTRL_ENABLE = 1U;
}