From a630a8945d14b6421fb8a98f0120dcb13328f8a3 Mon Sep 17 00:00:00 2001 From: Kelvin Lawson Date: Fri, 27 May 2011 17:35:56 +0100 Subject: [PATCH] Add comments to critical region regarding nesting requirement. --- kernel/atomport-template.h | 7 ++++++- ports/avr/atomport.h | 7 ++++++- ports/stm8/atomport.h | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/kernel/atomport-template.h b/kernel/atomport-template.h index 68772e7..9f17635 100755 --- a/kernel/atomport-template.h +++ b/kernel/atomport-template.h @@ -60,7 +60,12 @@ #define POINTER void * -/* Critical region protection */ +/** + * Critical region protection: this should disable interrupts + * to protect OS data structures during modification. It must + * allow nested calls, which means that interrupts should only + * be re-enabled when the outer CRITICAL_END() is reached. + */ #define CRITICAL_STORE uint8_t sreg #define CRITICAL_START() sreg = SREG; cli(); #define CRITICAL_END() SREG = sreg diff --git a/ports/avr/atomport.h b/ports/avr/atomport.h index ba4dead..875bd15 100644 --- a/ports/avr/atomport.h +++ b/ports/avr/atomport.h @@ -54,7 +54,12 @@ #define POINTER void * -/* Critical region protection */ +/** + * Critical region protection: this should disable interrupts + * to protect OS data structures during modification. It must + * allow nested calls, which means that interrupts should only + * be re-enabled when the outer CRITICAL_END() is reached. + */ #define CRITICAL_STORE uint8_t sreg #define CRITICAL_START() sreg = SREG; cli(); #define CRITICAL_END() SREG = sreg diff --git a/ports/stm8/atomport.h b/ports/stm8/atomport.h index caf87de..2063bfb 100644 --- a/ports/stm8/atomport.h +++ b/ports/stm8/atomport.h @@ -60,7 +60,12 @@ #define POINTER void * -/* Critical region protection */ +/** + * Critical region protection: this should disable interrupts + * to protect OS data structures during modification. It must + * allow nested calls, which means that interrupts should only + * be re-enabled when the outer CRITICAL_END() is reached. + */ /* COSMIC: Use inline assembler */ #if defined(__CSMC__)