http://kck.st/19E2bTw
The following code is what I used for generating the PWM.
while(count < length)
{
GPIO_OUTPUT_SET(gpio_no,1); //Set PWM Pin High
time_duty1 = time_count + duty_width1;
time_duty2 = time_count + time_width;
while(micros() < time_duty1){} //Wait on PWM High
GPIO_OUTPUT_SET(gpio_no,0); //Set PWM Pin Low
while(micros() < time_duty2){} //Wait on PWM Low
time_count += time_width;
count += time_width;
}