aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Scheduler
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/Scheduler
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/Scheduler')
-rw-r--r--LUFA/Scheduler/Scheduler.c10
-rw-r--r--LUFA/Scheduler/Scheduler.h10
2 files changed, 12 insertions, 8 deletions
diff --git a/LUFA/Scheduler/Scheduler.c b/LUFA/Scheduler/Scheduler.c
index 4e71d4d87..87a21491d 100644
--- a/LUFA/Scheduler/Scheduler.c
+++ b/LUFA/Scheduler/Scheduler.c
@@ -39,10 +39,12 @@ bool Scheduler_HasDelayElapsed(const uint_least16_t Delay,
SchedulerDelayCounter_t CurrentTickValue_LCL;
SchedulerDelayCounter_t DelayCounter_LCL;
- ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
- {
- CurrentTickValue_LCL = Scheduler_TickCounter;
- }
+ uint_reg_t CurrentGlobalInt = USB_INT_GetGlobalEnableState();
+ USB_INT_GlobalDisable();
+
+ CurrentTickValue_LCL = Scheduler_TickCounter;
+
+ USB_INT_SetGlobalEnableState(CurrentGlobalInt);
DelayCounter_LCL = *DelayCounter;
diff --git a/LUFA/Scheduler/Scheduler.h b/LUFA/Scheduler/Scheduler.h
index 7aa513322..499a63a1b 100644
--- a/LUFA/Scheduler/Scheduler.h
+++ b/LUFA/Scheduler/Scheduler.h
@@ -219,10 +219,12 @@
ATTR_NON_NULL_PTR_ARG(1) ATTR_ALWAYS_INLINE;
static inline void Scheduler_ResetDelay(SchedulerDelayCounter_t* const DelayCounter)
{
- ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
- {
- *DelayCounter = Scheduler_TickCounter;
- }
+ uint_reg_t CurrentGlobalInt = USB_INT_GetGlobalEnableState();
+ USB_INT_GlobalDisable();
+
+ *DelayCounter = Scheduler_TickCounter;
+
+ USB_INT_SetGlobalEnableState(CurrentGlobalInt);
}
/* Function Prototypes: */