aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/Misc
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2011-04-08 04:49:20 +0000
committerDean Camera <dean@fourwalledcubicle.com>2011-04-08 04:49:20 +0000
commit70284d390f524e84e0539ad1e869366aaf94cf24 (patch)
treeb250bd819829b6e2807f4c85bd1342aa979eeb28 /LUFA/Drivers/Misc
parent0c5afda7e8d7c3bbaa15297c05d39dc4c90e4d5b (diff)
downloadlufa-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/Misc')
-rw-r--r--LUFA/Drivers/Misc/RingBuffer.h49
1 files changed, 28 insertions, 21 deletions
diff --git a/LUFA/Drivers/Misc/RingBuffer.h b/LUFA/Drivers/Misc/RingBuffer.h
index 1a825ac23..5c8c8403b 100644
--- a/LUFA/Drivers/Misc/RingBuffer.h
+++ b/LUFA/Drivers/Misc/RingBuffer.h
@@ -125,15 +125,17 @@
{
GCC_FORCE_POINTER_ACCESS(Buffer);
- ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
- {
- Buffer->In = DataPtr;
- Buffer->Out = DataPtr;
- Buffer->Start = &DataPtr[0];
- Buffer->End = &DataPtr[Size];
- Buffer->Size = Size;
- Buffer->Count = 0;
- }
+ uint_reg_t CurrentGlobalInt = USB_INT_GetGlobalEnableState();
+ USB_INT_GlobalDisable();
+
+ Buffer->In = DataPtr;
+ Buffer->Out = DataPtr;
+ Buffer->Start = &DataPtr[0];
+ Buffer->End = &DataPtr[Size];
+ Buffer->Size = Size;
+ Buffer->Count = 0;
+
+ USB_INT_SetGlobalEnableState(CurrentGlobalInt);
}
/** Retrieves the minimum number of bytes stored in a particular buffer. This value is computed
@@ -153,11 +155,12 @@
{
uint16_t Count;
- ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
- {
- Count = Buffer->Count;
- }
+ uint_reg_t CurrentGlobalInt = USB_INT_GetGlobalEnableState();
+ USB_INT_GlobalDisable();
+
+ Count = Buffer->Count;
+ USB_INT_SetGlobalEnableState(CurrentGlobalInt);
return Count;
}
@@ -210,10 +213,12 @@
if (++Buffer->In == Buffer->End)
Buffer->In = Buffer->Start;
- ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
- {
- Buffer->Count++;
- }
+ uint_reg_t CurrentGlobalInt = USB_INT_GetGlobalEnableState();
+ USB_INT_GlobalDisable();
+
+ Buffer->Count++;
+
+ USB_INT_SetGlobalEnableState(CurrentGlobalInt);
}
/** Removes an element from the ring buffer.
@@ -235,10 +240,12 @@
if (++Buffer->Out == Buffer->End)
Buffer->Out = Buffer->Start;
- ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
- {
- Buffer->Count--;
- }
+ uint_reg_t CurrentGlobalInt = USB_INT_GetGlobalEnableState();
+ USB_INT_GlobalDisable();
+
+ Buffer->Count--;
+
+ USB_INT_SetGlobalEnableState(CurrentGlobalInt);
return Data;
}