diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2011-04-08 04:49:20 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2011-04-08 04:49:20 +0000 |
commit | 70284d390f524e84e0539ad1e869366aaf94cf24 (patch) | |
tree | b250bd819829b6e2807f4c85bd1342aa979eeb28 /LUFA/Drivers/USB/Core/UC3/Device_UC3.h | |
parent | 0c5afda7e8d7c3bbaa15297c05d39dc4c90e4d5b (diff) | |
download | lufa-70284d390f524e84e0539ad1e869366aaf94cf24.tar.gz lufa-70284d390f524e84e0539ad1e869366aaf94cf24.tar.bz2 lufa-70284d390f524e84e0539ad1e869366aaf94cf24.zip |
Add in a new common Delay_MS() function, which provides a blocking delay for all architectures.
Remove use of avr-libc specific ATOMIC_BLOCK, replace with a new per-architecture set of inline functions to retrieve and manipulate the global interrupt enable bit for each architecture.
Add in documentation for the USB controller common interrupt routine which must be linked to the interrupt controller in the user application on the AVR32 UC3 architecture.
Diffstat (limited to 'LUFA/Drivers/USB/Core/UC3/Device_UC3.h')
-rw-r--r-- | LUFA/Drivers/USB/Core/UC3/Device_UC3.h | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/LUFA/Drivers/USB/Core/UC3/Device_UC3.h b/LUFA/Drivers/USB/Core/UC3/Device_UC3.h index 8389d62dc..150b18860 100644 --- a/LUFA/Drivers/USB/Core/UC3/Device_UC3.h +++ b/LUFA/Drivers/USB/Core/UC3/Device_UC3.h @@ -187,26 +187,28 @@ 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 = (uint8_t*)0x80800204;
+
+ for (uint8_t SerialCharNum = 0; SerialCharNum < (INTERNAL_SERIAL_LENGTH_BITS / 4); SerialCharNum++)
{
- uint8_t* SigReadAddress = (uint8_t*)0x80800204;
+ uint8_t SerialByte = *SigReadAddress;
- for (uint8_t SerialCharNum = 0; SerialCharNum < (INTERNAL_SERIAL_LENGTH_BITS / 4); SerialCharNum++)
+ if (SerialCharNum & 0x01)
{
- uint8_t SerialByte = *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
|