/* Reset and initialize USB OTG peripheral to specified speed mode.  */
static void main_otg_init(void)
/* Reset and initialize USB OTG peripheral to specified speed mode.  */
static void main_otg_init(void)
{
	otg_disable();
	delay_ms(10);
	otg_enable();
	otg_disable_id_pin();
	otg_force_device_mode();
	otg_enable_pad();
	otg_enable();
	switch (speed) {
	case 0:
		udd_low_speed_enable();
		udd_high_speed_disable();
		break;
	case 1:
		udd_low_speed_disable();
		udd_high_speed_disable();
		break;
	case 2:
		udd_low_speed_disable();
		udd_high_speed_enable();
		break;
	default:
		Assert(false);
		break;
	}
	otg_unfreeze_clock();
	(void)Is_otg_clock_frozen();
}