/* This function is used to set the number of period to be generated.  */
int tls_pwm_stoptime_by_period_config(u8 channel, u8 pnum)
/* This function is used to set the number of period to be generated.  */
int tls_pwm_stoptime_by_period_config(u8 channel, u8 pnum)
{
    u32 temp = 0;
    if(channel > (PWM_CHANNEL_MAX_NUM - 1))
		return WM_FAILED;
    if (4 == channel)
    {
        temp = tls_reg_read32(HR_PWM_CH4_REG1) & ~0x000000FF;
        temp |= pnum;
        tls_reg_write32(HR_PWM_CH4_REG1, temp);
    }
    else
    {
        temp = tls_reg_read32(HR_PWM_PNUM) & ~(0xFF << channel * 8);
        temp |= (pnum << (channel * 8));
        tls_reg_write32(HR_PWM_PNUM, temp);
    }
    return WM_SUCCESS;
}