static inline void USB_Device_GetSerialString(uint16_t* UnicodeString)
{
- ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
+ uint_reg_t CurrentGlobalInt = USB_INT_GetGlobalEnableState();
+ USB_INT_GlobalDisable();
+
+ uint8_t SigReadAddress = 0x0E;
+
+ for (uint8_t SerialCharNum = 0; SerialCharNum < (INTERNAL_SERIAL_LENGTH_BITS / 4); SerialCharNum++)
{
- uint8_t SigReadAddress = 0x0E;
+ uint8_t SerialByte = boot_signature_byte_get(SigReadAddress);
- for (uint8_t SerialCharNum = 0; SerialCharNum < (INTERNAL_SERIAL_LENGTH_BITS / 4); SerialCharNum++)
+ if (SerialCharNum & 0x01)
{
- uint8_t SerialByte = boot_signature_byte_get(SigReadAddress);
-
- if (SerialCharNum & 0x01)
- {
- SerialByte >>= 4;
- SigReadAddress++;
- }
+ SerialByte >>= 4;
+ SigReadAddress++;
+ }
- SerialByte &= 0x0F;
+ SerialByte &= 0x0F;
- UnicodeString[SerialCharNum] = cpu_to_le16((SerialByte >= 10) ?
- (('A' - 10) + SerialByte) : ('0' + SerialByte));
- }
+ UnicodeString[SerialCharNum] = cpu_to_le16((SerialByte >= 10) ?
+ (('A' - 10) + SerialByte) : ('0' + SerialByte));
}
+
+ USB_INT_SetGlobalEnableState(CurrentGlobalInt);
}
#endif