libc-compat: avoid using poisoned macro
authorGregor Riepl <onitake@gmail.com>
Mon, 15 Dec 2014 02:27:27 +0000 (03:27 +0100)
committerOlivier Matz <zer0@droids-corp.org>
Sun, 25 Jan 2015 21:15:30 +0000 (22:15 +0100)
Old-style avr-libc macros are poisoned and should not be used with
recent device headers. In uart and adc modules, use the most recent
macros names if they are available. This fixes the compilation with
recent devices.

Signed-off-by: Gregor Riepl <onitake@gmail.com>
modules/comm/uart/uart.c
modules/hardware/adc/adc.c

index 102db28..9266d1e 100644 (file)
@@ -145,55 +145,73 @@ static void uart_recv_next_char(uint8_t num);
  * a new unread data in the reception buffer.
  */
 #ifdef UART0_COMPILE
-#ifndef USART0_RX_vect
-#if defined(USART_RX_vect)
-#define USART0_RX_vect USART_RX_vect
-#elif defined(SIG_USART0_RECV)
-#define USART0_RX_vect SIG_USART0_RECV
+#ifndef USART0_RXC_vect
+#if defined(USART_RXC_vect)
+#define USART0_RXC_vect USART_RXC_vect
+#elif defined(USART_RX_vect)
+#define USART0_RXC_vect USART_RX_vect
+#elif defined(USART0_RX_vect)
+#define USART0_RXC_vect USART0_RX_vect
+#else
+#if defined(SIG_USART0_RECV)
+#define USART0_RXC_vect SIG_USART0_RECV
 #elif defined(SIG_UART0_RECV)
-#define USART0_RX_vect SIG_UART0_RECV
+#define USART0_RXC_vect SIG_UART0_RECV
 #endif
 #endif
-SIGNAL(USART0_RX_vect)
+#endif
+SIGNAL(USART0_RXC_vect)
 {
        uart_recv_next_char(0);
 }
 #endif
 #ifdef UART1_COMPILE
-#ifndef USART1_RX_vect
+#ifndef USART1_RXC_vect
+#if defined(USART1_RX_vect)
+#define USART1_RXC_vect USART1_RX_vect
+#else
 #if defined(SIG_USART1_RECV)
-#define USART1_RX_vect SIG_USART1_RECV
+#define USART1_RXC_vect SIG_USART1_RECV
 #elif defined(SIG_UART1_RECV)
-#define USART1_RX_vect SIG_UART1_RECV
+#define USART1_RXC_vect SIG_UART1_RECV
+#endif
 #endif
 #endif
-SIGNAL(USART1_RX_vect)
+SIGNAL(USART1_RXC_vect)
 {
        uart_recv_next_char(1);
 }
 #endif
 #ifdef UART2_COMPILE
-#ifndef USART2_RX_vect
+#ifndef USART2_RXC_vect
+#if defined(USART2_RX_vect)
+#define USART2_RXC_vect USART2_RX_vect
+#else
 #if defined(SIG_USART2_RECV)
-#define USART2_RX_vect SIG_USART2_RECV
+#define USART2_RXC_vect SIG_USART2_RECV
 #elif defined(SIG_UART2_RECV)
-#define USART2_RX_vect SIG_UART2_RECV
+#define USART2_RXC_vect SIG_UART2_RECV
 #endif
 #endif
-SIGNAL(USART2_RX_vect)
+#endif
+SIGNAL(USART2_RXC_vect)
 {
        uart_recv_next_char(2);
 }
 #endif
 #ifdef UART3_COMPILE
-#ifndef USART3_RX_vect
+#ifndef USART3_RXC_vect
+#if defined(USART3_RX_vect)
+#define USART3_RXC_vect USART3_RX_vect
+#else
 #if defined(SIG_USART3_RECV)
 #define USART3_RX_vect SIG_USART3_RECV
 #elif defined(SIG_UART3_RECV)
 #define USART3_RX_vect SIG_UART3_RECV
 #endif
 #endif
-SIGNAL(USART3_RX_vect)
+#endif
+SIGNAL(USART3_RXC_vect)
 {
        uart_recv_next_char(3);
 }
index ba0971c..bc4c122 100644 (file)
@@ -82,7 +82,12 @@ void adc_register_event(void (*f)(int16_t))
  * Interrupt function, other interrupts are disabled during its
  * execution.
  */
-SIGNAL(SIG_ADC)
+#ifndef ADC_vect
+#if defined(SIG_ADC)
+#define ADC_vect SIG_ADC
+#endif
+#endif
+SIGNAL(ADC_vect)
 {
        int16_t result;