示例#1
0
/**
 * \brief Reset the SERCOM SPI module
 *
 * This function will disable and reset the SPI module to its power on default
 * values.
 *
 * \param[in,out] module Pointer to a driver instance.
 */
void spi_master_vec_reset(struct spi_master_vec_module *const module)
{
	/* Sanity check arguments */
	Assert(module);
	Assert(module->sercom);

	SercomSpi *const spi_hw = &(module->sercom->SPI);

	/* Disable the module */
	spi_master_vec_disable(module);

#  ifdef FEATURE_SPI_SYNC_SCHEME_VERSION_2
	while (spi_hw->STATUS.reg) {
		/* Intentionally left empty */
	}
#  else
	while (spi_hw->STATUS.reg & SERCOM_SPI_STATUS_SYNCBUSY) {
		/* Intentionally left empty */
	}
#  endif
	/* Software reset the module */
	spi_hw->CTRLA.reg |= SERCOM_SPI_CTRLA_SWRST;

#ifdef CONF_SPI_MASTER_VEC_OS_SUPPORT
	CONF_SPI_MASTER_VEC_DELETE_SEMAPHORE(module->busy_semaphore);
#endif
}
示例#2
0
OSStatus host_platform_bus_deinit( void )
{

    MCU_CLOCKS_NEEDED();
#ifdef USE_OWN_SPI_DRV
    pdc_disable_transfer(spi_m_pdc, PERIPH_PTCR_RXTDIS | PERIPH_PTCR_TXTDIS);
	spi_disable(SPI_MASTER_BASE);
#else
    spi_master_vec_disable(&spi_master);
#endif
    MCU_CLOCKS_NOT_NEEDED();

    return kNoErr;
}
示例#3
0
OSStatus host_platform_bus_deinit( void )
{

    platform_mcu_powersave_disable();
#ifdef USE_OWN_SPI_DRV
    pdc_disable_transfer(spi_m_pdc, PERIPH_PTCR_RXTDIS | PERIPH_PTCR_TXTDIS);
	spi_disable(SPI_MASTER_BASE);
#else
    spi_master_vec_disable(&spi_master);
#endif
    platform_mcu_powersave_enable();

    return kNoErr;
}
示例#4
0
/**
 * \brief Reset the SERCOM SPI module
 *
 * This function will disable and reset the SPI module to its power on default
 * values.
 *
 * \param[in,out] module Pointer to a driver instance.
 */
void spi_master_vec_reset(struct spi_master_vec_module *const module)
{
	/* Sanity check arguments */
	Assert(module);
	Assert(module->sercom);

	SercomSpi *const spi_hw = &(module->sercom->SPI);

	/* Disable the module */
	spi_master_vec_disable(module);

	_spi_master_vec_wait_for_sync(spi_hw);

	/* Software reset the module */
	spi_hw->CTRLA.reg |= SERCOM_SPI_CTRLA_SWRST;

#ifdef CONF_SPI_MASTER_VEC_OS_SUPPORT
	CONF_SPI_MASTER_VEC_DELETE_SEMAPHORE(module->busy_semaphore);
#endif
}