/* If the update of the counter for the specified PWM generator has yet to be completed, the value returned may not be the active period. The value returned is the programmed period, measured in PWM clock ticks. */
unsigned long PWMGenPeriodGet(unsigned long ulBase, unsigned long ulGen)
/* If the update of the counter for the specified PWM generator has yet to be completed, the value returned may not be the active period. The value returned is the programmed period, measured in PWM clock ticks. */
unsigned long PWMGenPeriodGet(unsigned long ulBase, unsigned long ulGen)
{
    ASSERT(ulBase == PWM_BASE);
    ASSERT(PWMGenValid(ulGen));
    ulGen = PWM_GEN_BADDR(ulBase, ulGen);
    if(HWREG(ulGen + PWM_O_X_CTL) & PWM_X_CTL_MODE)
    {
        return(HWREG(ulGen + PWM_O_X_LOAD) * 2);
    }
    else
    {
        return(HWREG(ulGen + PWM_O_X_LOAD) + 1);
    }
}