Exemple #1
0
//------------------------------------------------------------------------------
/// Selection of Master Clock.
/// \param clockSource  Master Clock source.
/// \param mckr  MCKR configuration instance.
///
/// \note
/// The PMC_MCKR register must not be programmed in a single write
/// operation (see. Product Data Sheet).
//------------------------------------------------------------------------------
void PMC_SetMckSelection(unsigned int clockSource, mckrConfiguration *mckr)
{
    switch ( clockSource )
    {
        case AT91C_PMC_CSS_SLOW_CLK :
            PMC_SwitchMck2SlowClock();
            _PMC_SetMckPrescaler(mckr->prescaler);
            break;

        case AT91C_PMC_CSS_MAIN_CLK :
            _PMC_SwitchMck2MainClock();
            _PMC_SetMckPrescaler(mckr->prescaler);
            break;
#if defined ( AT91C_PMC_CSS_PLLA_CLK)
        case AT91C_PMC_CSS_PLLA_CLK :
            _PMC_SetMckPrescaler(mckr->prescaler);
            _PMC_SwitchMck2PllaClock(mckr);
            break ;
#endif
#if defined ( AT91C_PMC_CSS_PLL_CLK)
        case AT91C_PMC_CSS_PLL_CLK :
            _PMC_SetMckPrescaler(mckr->prescaler);
            _PMC_SwitchMck2PllaClock(mckr);
            break ;
#endif
    }
}
Exemple #2
0
/**
 * \brief Selection of Master Clock.
 *
 * \param clockSource  Master Clock source.
 * \param prescaler    Master Clock prescaler.
 *
 * \note
 * The PMC_MCKR register must not be programmed in a single write
 * operation (see. Product Data Sheet).
 */
void PMC_SetMckSelection(uint32_t clockSource, uint32_t prescaler)
{
	switch ( clockSource ) {
	case PMC_MCKR_CSS_SLOW_CLK :
		_PMC_SwitchMck2SlowClock();
		_PMC_SetMckPrescaler(prescaler);
		break;

	case PMC_MCKR_CSS_MAIN_CLK :
		_PMC_SwitchMck2MainClock();
		_PMC_SetMckPrescaler(prescaler);
		break;

	case PMC_MCKR_CSS_PLLA_CLK :
		_PMC_SetMckPrescaler(prescaler);
		_PMC_SwitchMck2PllaClock();
		break ;
	}
}