_BIS_SR_IRQ and _BIC_SR_IRQ is used to modify the user code status
register from ISR scope, for example when a ISR must wake up user code
from LPM.

this is _GET_SR_IRQ, the counterpart which reads the user code SR from
stack, for instance if the ISR needs to know if the user code is
currently in low power mode.

if this gets accepted for upstream inclusion, then perhaps someone
might also consider updating the documentation.

Note: if __GNUC_MINOR__ >= 4, then __bis_sr_irq et al. are declared
extern int, but implemented nowhere? are they supposed to reside in
some binary runtime object, or what's happening there?

Best regards,
Patrick

Index: iomacros.h
===================================================================
RCS file: /cvsroot/mspgcc/msp430-libc/include/iomacros.h,v
retrieving revision 1.28
diff -u -r1.28 iomacros.h
--- iomacros.h  22 Feb 2005 16:29:46 -0000      1.28
+++ iomacros.h  23 Feb 2005 14:11:33 -0000
@@ -137,7 +137,17 @@
 #define __EXIT_LPM(x) do {int *p = __get_frame_address(); *p = x;} while(0)
 
 #else
-/*only use the following two macros within interrupt functions*/
+/*only use the following three macros within interrupt functions*/
+#define _GET_SR_IRQ \
+({                \
+   uint16_t __x;        \
+   __asm__ __volatile__ (\
+       "mov .L__FrameOffset_" __FUNCTION__ "(r1), %0"\
+   : "=r" ((uint16_t)__x)    \
+   :);            \
+   __x;            \
+})
+
 #define _BIS_SR_IRQ(x)\
     __asm__ __volatile__ (\
         "bis %0, .L__FrameOffset_" __FUNCTION__ "(r1)"\

Reply via email to