If UOG_ENDPTSETUPSTAT bit 31 is not 0
0x40013010 = 1
UOG_ENDPTSETUPSTAT = UOG_ENDPTCOMPLETE
end
if UOG_ENDPTCOMPLETE bit 30 is not 0
0x40013014 = 1
end
If UOG_ENDPTCOMPLETE bit 13 is not 0
if 0x40014008 !=0
0x40014008 = 0
UOG_ENDPTCOMPLETE = 0x40000
else
0x40013018 = 1;
end
end
If UOG_USBSTS bit 30 is not 0
0x4001300c = 1
end
if UOG_USBSTS bit 25 is not 0
0x40013008 = 1
0x40014004 = 0
0x40014008 = 0
end
if UOG_USBSTS bit 29 is not 0
0x40013020 = 1
end
if UOG_USBSTS bit 23 is not 0
0x40013000 = 2
else
0x40013000 = 1
end
x = UOG_USBSTS
UOG_USBSTS = x
if UOG_OTGSC is not 0
0x4001301c = 1
x = UOG_OTGSC
UOG_OTGSC = x
end