Added RCC helper support to RTC driver.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3342 35acf78f-673a-0410-8e92-d51de3d6d3f4
master
barthess 2011-09-18 21:08:42 +00:00
parent 07f868d379
commit e1afd2700b
2 changed files with 33 additions and 1 deletions

View File

@ -112,7 +112,7 @@ CH_IRQ_HANDLER(RTC_IRQHandler) {
* @notapi * @notapi
*/ */
void rtc_lld_init(void){ void rtc_lld_init(void){
RCC->APB1ENR |= (RCC_APB1ENR_PWREN | RCC_APB1ENR_BKPEN); /* enable clocking */ rccEnableBKP(FALSE); /* enable interface clocking */
PWR->CR |= PWR_CR_DBP; /* enable access */ PWR->CR |= PWR_CR_DBP; /* enable access */
if (!(RCC->BDCR & (RCC_BDCR_RTCEN | RCC_BDCR_LSEON))){ /* BKP domain was reseted */ if (!(RCC->BDCR & (RCC_BDCR_RTCEN | RCC_BDCR_LSEON))){ /* BKP domain was reseted */

View File

@ -202,6 +202,38 @@
#define rccResetADC1() rccResetAPB2(RCC_APB2RSTR_ADC1RST) #define rccResetADC1() rccResetAPB2(RCC_APB2RSTR_ADC1RST)
/** @} */ /** @} */
/**
* @brief Bakup domain interface specific RCC operations
* @{
*/
/**
* @brief Enables the BKP interface clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
#define rccEnableBKP(lp) rccEnableAPB1(RCC_APB1ENR_BKPEN, lp);
/**
* @brief Disables BKP interface clock.
* @note The @p lp parameter is ignored in this family.
*
* @param[in] lp low power enable flag
*
* @api
*/
#define rccDisableBKP(lp) rccDisableAPB1(RCC_APB1ENR_BKPEN, lp);
/**
* @brief Resets the Backup Domain.
*
* @api
*/
#define rccResetBKP(lp) rccResetAPB1(RCC_APB1ENR_BKPRST);
/** @} */
/** /**
* @brief CAN peripherals specific RCC operations * @brief CAN peripherals specific RCC operations
* @{ * @{