#undef signal
#endif
+
+// Re-definitions for safe tinyOS
+// These rely on io.h being included at the top of this file
+// thus pulling the affected header files before the re-definitions
+#ifdef SAFE_TINYOS
+#undef ADC12MEM
+#define ADC12MEM TCAST(int* ONE, ADC12MEM_) /* ADC12 Conversion Memory (for C) */
+#undef ADC12MCTL
+#define ADC12MCTL TCAST(char * ONE, ADC12MCTL_)
+#endif
+
// define platform constants that can be changed for different compilers
// these are all msp430-gcc specific (add as necessary)
#define __msp430_have_adc12
#endif
+// backwards compatibility to older versions of the header files
+#ifdef __MSP430_HAS_I2C__
+#define __msp430_have_usart0_with_i2c
+#endif
+
// I2CBusy flag is not defined by current MSP430-GCC
#ifdef __msp430_have_usart0_with_i2c
#ifndef I2CBUSY
// The signal attribute has opposite meaning in msp430-gcc than in avr-gcc
#define TOSH_SIGNAL(signame) \
-void sig_##signame() __attribute__((interrupt (signame), wakeup, C))
+ void sig_##signame() __attribute__((interrupt (signame), wakeup)) @C()
// TOSH_INTERRUPT allows nested interrupts
#define TOSH_INTERRUPT(signame) \
-void isr_##signame() __attribute__((interrupt (signame), signal, wakeup, C))
+ void isr_##signame() __attribute__((interrupt (signame), signal, wakeup)) @C()
#define SET_FLAG(port, flag) ((port) |= (flag))
{
__nesc_atomic_t result = ((READ_SR & SR_GIE) != 0);
__nesc_disable_interrupt();
+ asm volatile("" : : : "memory"); /* ensure atomic section effect visibility */
return result;
}
void __nesc_atomic_end(__nesc_atomic_t reenable_interrupts) @spontaneous()
{
+ asm volatile("" : : : "memory"); /* ensure atomic section effect visibility */
if( reenable_interrupts )
__nesc_enable_interrupt();
}