Hi
I have a question about the register of am335x.
In the starterware_02_00_01_01, there are the sample code about the Initialization of MPUPLL、GPIO、I2C、UART...etc.
For example:
StarterWare\bootloader\src\armv7a\am335x\bl_platform.c :
void MPUPLLInit(unsigned int freqMult)
{
volatile unsigned int regVal = 0;
/* Put the PLL in bypass mode */
regVal =
HWREG(SOC_CM_WKUP_REGS +CM_WKUP_CM_CLKMODE_DPLL_MPU) & ~CM_WKUP_CM_CLKMODE_DPLL_MPU_DPLL_EN;
regVal |= CM_WKUP_CM_CLKMODE_DPLL_MPU_DPLL_EN_DPLL_MN_BYP_MODE;
HWREG(SOC_CM_WKUP_REGS + CM_WKUP_CM_CLKMODE_DPLL_MPU) = regVal;
/* Wait for DPLL to go in to bypass mode */
while(!(HWREG(SOC_CM_WKUP_REGS + CM_WKUP_CM_IDLEST_DPLL_MPU) &
CM_WKUP_CM_IDLEST_DPLL_MPU_ST_MN_BYPASS));
StarterWare\platform\beaglebone\gpio.c :
void GPIO1ModuleClkConfig(void)
{
HWREG(SOC_CM_PER_REGS + CM_PER_GPIO1_CLKCTRL) |=
CM_PER_GPIO1_CLKCTRL_MODULEMODE_ENABLE;
/* Waiting for MODULEMODE field to reflect the written value. */
while(CM_PER_GPIO1_CLKCTRL_MODULEMODE_ENABLE !=
(HWREG(SOC_CM_PER_REGS + CM_PER_GPIO1_CLKCTRL) &
CM_PER_GPIO1_CLKCTRL_MODULEMODE));
In the code , the "while " is be used for waiting for the field to reflect the written value.
My question is that why the "while" wait is necessary?
If it is necessary, could you tech me that after how much time the value will be reflected? Because I want to add a timeout count in this code.
Thanks!
Yin