/* Set the PWM frequency of the PWM module. This function is to set the PWM frequency of the PWM module.  */
unsigned long xPWMFrequencySet(unsigned long ulBase, unsigned long ulChannel, unsigned long ulFrequency)
/* Set the PWM frequency of the PWM module. This function is to set the PWM frequency of the PWM module.  */
unsigned long xPWMFrequencySet(unsigned long ulBase, unsigned long ulChannel, unsigned long ulFrequency)
{
    unsigned long ulPwmFre = 0;
    (void) ulChannel;
    xASSERT(ulBase == xPWM1_BASE);
    xASSERT( (ulChannel == xPWM_CHANNEL0) ||
             (ulChannel == xPWM_CHANNEL1) ||
             (ulChannel == xPWM_CHANNEL2) ||
             (ulChannel == xPWM_CHANNEL3) ||
             (ulChannel == xPWM_CHANNEL4) ||
             (ulChannel == xPWM_CHANNEL5) ||
             (ulChannel == xPWM_CHANNEL6) );
    ulPwmFre = SysCtlPeripheralClockGet(PCLKSEL_PWM1);
    if(ulPwmFre < ulFrequency)
    {
        while(1);
    }
    _PWMFrequency = ulFrequency;
    xHWREG(ulBase + PWM_PR) = ((ulPwmFre/ulFrequency) - 1);
    return (ulFrequency);
}