Пример #1
0
/**
 * \brief Set Clock Divider & Power save divider for MCI.
 *
 * \param pRMci    Pointer to an MCI instance.
 * \param bClkDiv  Clock Divider value (0 ~ 255).
 * \param bPwsDiv  Power Saving Divider (1 ~ 7).
 */
extern void HSMCI_DivCtrl(Hsmci *pRMci, uint8_t bClkDiv, uint8_t bPwsDiv)
{
    uint32_t mr = pRMci->HSMCI_MR;
    pRMci->HSMCI_MR = (mr & ~(HSMCI_MR_CLKDIV_Msk | HSMCI_MR_PWSDIV_Msk))
                    | HSMCI_MR_CLKDIV(bClkDiv)
                    | HSMCI_MR_PWSDIV(bPwsDiv)
                    ;
}
Пример #2
0
/**
 * \brief Set Clock Divider & Power save divider for MCI.
 *
 * \param pRMci    Pointer to an MCI instance.
 * \param bClkDiv  Clock Divider value (0 ~ 255).
 * \param bPwsDiv  Power Saving Divider (1 ~ 7).
 */
extern void HSMCI_DivCtrl(Hsmci *pRMci, uint32_t bClkDiv, uint8_t bPwsDiv)
{
	uint32_t mr = pRMci->HSMCI_MR;
	uint32_t clkdiv , clkodd;
	clkdiv = bClkDiv - 2;
	clkodd = (bClkDiv & 1) ? HSMCI_MR_CLKODD : 0;
	clkdiv = clkdiv >> 1;

	pRMci->HSMCI_MR = (mr & ~(HSMCI_MR_CLKDIV_Msk | HSMCI_MR_PWSDIV_Msk))
					  | HSMCI_MR_CLKDIV(clkdiv)
					  | HSMCI_MR_PWSDIV(bPwsDiv)
					  | clkodd
					 ;
}