From af05fd8c1ef182d517c340b1247cb03005ca7f1c Mon Sep 17 00:00:00 2001
From: Lars Immisch <lars@ibp.de>
Date: Tue, 10 Apr 2012 22:53:49 +0200
Subject: [PATCH 1/2] Modifications for avr-libc >= 1.7.2


Signed-off-by: Lars Immisch <lars@ibp.de>
---
 examples/atmega128_timer/main.c    |    2 +-
 examples/atmel_key/StdDefs.c       |    5 +++--
 examples/atmel_key/StdDefs.h       |    6 +++---
 examples/atmel_key/kb.c            |    2 +-
 examples/atmel_key/main.c          |    5 +++--
 examples/atmel_key/scancodes.h     |    4 ++--
 examples/feedback/uart.h           |    2 +-
 examples/python/ex_pinout.c        |    2 +-
 examples/python/example.c          |    2 +-
 examples/python/example_io.c       |    2 +-
 examples/python/multicore.c        |    2 +-
 regress/extinttest/ext_int0.c      |    6 +++---
 regress/timertest/timer_16bit.c    |    2 +-
 regress/timertest/timer_8bit_ctc.c |    4 ++--
 14 files changed, 24 insertions(+), 22 deletions(-)

diff --git a/examples/atmega128_timer/main.c b/examples/atmega128_timer/main.c
index 15661d7..d666ac0 100644
--- a/examples/atmega128_timer/main.c
+++ b/examples/atmega128_timer/main.c
@@ -5,7 +5,7 @@
 volatile int timer2_ticks;
 
 /* Every ~ms */
-ISR(SIG_OUTPUT_COMPARE2)
+ISR(TIMER2_COMP_vect)
 {                               /* Every ~1ms */
    timer2_ticks++;
 }
diff --git a/examples/atmel_key/StdDefs.c b/examples/atmel_key/StdDefs.c
index 738f84c..c52b369 100644
--- a/examples/atmel_key/StdDefs.c
+++ b/examples/atmel_key/StdDefs.c
@@ -5,6 +5,7 @@
 // Common routines used in most programs
 
 #include <avr/io.h>
+#include <avr/sleep.h>
 #include <util/delay.h>
 #include <stdlib.h>
 #include <string.h>
@@ -13,7 +14,7 @@
 #include "StdDefs.h"
 #include "serial.h"
 
-// 02-Sep-2008 K. Schwichtenberg _delay_ms included for a useful timing
+// 02-Sep-2008 K. Schwichtenberg // // // _delay_ms included for a useful timing
 
 void setbaud(BaudRate br)
    {
@@ -112,7 +113,7 @@ void putchar(CHARU c)
    }
 */
 
-void putstr(CHARU *s)
+void putstr(const char *s)
    {
    int j;
    for (j = 0; j <= strlen(s); j++)
diff --git a/examples/atmel_key/StdDefs.h b/examples/atmel_key/StdDefs.h
index 9ae8b91..31b900c 100644
--- a/examples/atmel_key/StdDefs.h
+++ b/examples/atmel_key/StdDefs.h
@@ -44,7 +44,7 @@ void test_pin(void);
 void msleep(INT16U ms);
 void putBCD(INT16S X, CHARU length, CHARU TrailingSpace);
 //void putchar(CHARU c);
-void putstr(CHARU *s);
+void putstr(const char *s);
 //CHARU bit_num(CHARU x);
 //CHARU subt_rollover(CHARU x, CHARU y);
 void print_hexbyte(unsigned char i);
@@ -63,8 +63,8 @@ void print_hexbyte(unsigned char i);
    #define UART_BAUD_REG_H      UBRR0H
    #define UART_CONTROL_REG     UCSR0B
    #define UART_STATUS_REG      UCSR0A
-   #define UART_RCV_INT_VECTOR  SIG_UART0_RECV
-   #define UART_REG_EMPTY_INT_VECTOR  SIG_UART0_DATA
+   #define UART_RCV_INT_VECTOR  USART0_RX_vect
+   #define UART_REG_EMPTY_INT_VECTOR  USART0_UDRE_vect
    #define UART_DATA_REG        UDR0
 #elif DEVICE_NAME == ATMEGA163
    #define UART_BAUD_REG        UBRR
diff --git a/examples/atmel_key/kb.c b/examples/atmel_key/kb.c
index 322b443..77edaa2 100644
--- a/examples/atmel_key/kb.c
+++ b/examples/atmel_key/kb.c
@@ -36,7 +36,7 @@ void init_kb(void)
     bitcount = 11;
 }
 
-SIGNAL(SIG_INTERRUPT0)
+SIGNAL(INT0_vect)
 {
     static unsigned char data;                // Holds the received scan code
 
diff --git a/examples/atmel_key/main.c b/examples/atmel_key/main.c
index 5fb551a..c63ed6e 100644
--- a/examples/atmel_key/main.c
+++ b/examples/atmel_key/main.c
@@ -6,9 +6,10 @@
 
 #include <avr/io.h>
 #include <stdlib.h>
-//include <sig-avr.h>
+//#include <sig-avr.h>
 #include <avr/interrupt.h>
 #include <compat/deprecated.h>
+#include <util/delay.h>
 
 #include "serial.h"
 #include "kb.h"
@@ -31,7 +32,7 @@ int main(void)
     {
         key=getchar();
         putchar(key);
-        msleep(10);
+        _delay_ms(10);
     }
     return 1;
 }
diff --git a/examples/atmel_key/scancodes.h b/examples/atmel_key/scancodes.h
index a9375f3..f39474b 100644
--- a/examples/atmel_key/scancodes.h
+++ b/examples/atmel_key/scancodes.h
@@ -15,7 +15,7 @@
 
 // Unshifted characters
 
-static char unshifted[][2]  __attribute__ ((progmem)) = {
+static const char unshifted[][2] PROGMEM = {
 0x0d,9,
 0x0e,'`',
 0x15,'q',
@@ -87,7 +87,7 @@ static char unshifted[][2]  __attribute__ ((progmem)) = {
 };
 
 // Shifted characters
-prog_char shifted[][2] = {
+static const char shifted[][2] PROGMEM = {
 0x0d,9,
 0x0e,'~',
 0x15,'Q',
diff --git a/examples/feedback/uart.h b/examples/feedback/uart.h
index 18a0c3c..e5caf5e 100644
--- a/examples/feedback/uart.h
+++ b/examples/feedback/uart.h
@@ -53,7 +53,7 @@ extern volatile unsigned char uart_output_timeout_1;
 
 
 #ifndef P
-#define P(s) ({static const char c[] __attribute__ ((progmem)) = s;c;})
+#define P(s) ({static const char c[] PROGMEM = s;c;})
 #endif
 
 
diff --git a/examples/python/ex_pinout.c b/examples/python/ex_pinout.c
index 0bea2e0..7e55392 100644
--- a/examples/python/ex_pinout.c
+++ b/examples/python/ex_pinout.c
@@ -3,7 +3,7 @@
 
 volatile int timer2_ticks;
 
-ISR(SIG_OUTPUT_COMPARE2) {
+ISR(TIMER2_COMP_vect) {
    timer2_ticks++;
 }
 
diff --git a/examples/python/example.c b/examples/python/example.c
index bfd7509..35931b5 100644
--- a/examples/python/example.c
+++ b/examples/python/example.c
@@ -4,7 +4,7 @@
 volatile int timer2_ticks;
 
 /* Every ~ms */
-ISR(SIG_OUTPUT_COMPARE2) {
+ISR(TIMER2_COMP_vect) {
    timer2_ticks++;
 }
 
diff --git a/examples/python/example_io.c b/examples/python/example_io.c
index 3822b41..71c932e 100644
--- a/examples/python/example_io.c
+++ b/examples/python/example_io.c
@@ -5,7 +5,7 @@ volatile int timer2_ticks;
 volatile int port_val;
 volatile int port_cnt;
 
-ISR(SIG_OUTPUT_COMPARE2) {
+ISR(TIMER2_COMP_vect) {
    timer2_ticks++;
 }
 
diff --git a/examples/python/multicore.c b/examples/python/multicore.c
index 2df7443..869563e 100644
--- a/examples/python/multicore.c
+++ b/examples/python/multicore.c
@@ -11,7 +11,7 @@
 volatile char cnt_irq = 0;         // IRQ counter
 volatile char cnt_res = 0;         // measurement value for time distance between events
 
-ISR(SIG_INTERRUPT0) {
+ISR(INT0_vect) {
   cnt_irq++;                       // increment event counter
   cnt_res = TCNT0;                 // save timer value = time distance to last event
   TCNT0 = 0;                       // reset timer value
diff --git a/regress/extinttest/ext_int0.c b/regress/extinttest/ext_int0.c
index 9a619c2..a12304a 100644
--- a/regress/extinttest/ext_int0.c
+++ b/regress/extinttest/ext_int0.c
@@ -89,12 +89,12 @@ volatile unsigned char hs_data = 0;
 volatile unsigned char dis_mask = 0;
 
 #if defined(TEST_INT1)
-  ISR(SIG_INTERRUPT1) {
+  ISR(INT1_vect) {
 #else
 # if defined(TEST_INT2_16)
-  ISR(SIG_INTERRUPT2) {
+  ISR(INT2_vect) {
 # else
-  ISR(SIG_INTERRUPT0) {
+  ISR(INT0_vect) {
 # endif
 #endif
   cnt_irq++;
diff --git a/regress/timertest/timer_16bit.c b/regress/timertest/timer_16bit.c
index c3accf2..bcdd27b 100644
--- a/regress/timertest/timer_16bit.c
+++ b/regress/timertest/timer_16bit.c
@@ -7,7 +7,7 @@ volatile int timer_ticks;
 ISR(SIG_OVERFLOW3) {
    timer_ticks++;
 }
-ISR(SIG_OUTPUT_COMPARE3B) {
+ISR(TIMER3_COMPB_vect) {
    timer_ticks++;
 }
 #else
diff --git a/regress/timertest/timer_8bit_ctc.c b/regress/timertest/timer_8bit_ctc.c
index 1b9c969..52b9992 100644
--- a/regress/timertest/timer_8bit_ctc.c
+++ b/regress/timertest/timer_8bit_ctc.c
@@ -4,11 +4,11 @@
 volatile int timer_ticks;
 
 #ifdef PROC_atmega48
-ISR(SIG_OUTPUT_COMPARE2A) {
+ISR(TIMER2_COMP_vectA) {
    timer_ticks++;
 }
 #else
-ISR(SIG_OUTPUT_COMPARE2) {
+ISR(TIMER2_COMP_vect) {
    timer_ticks++;
 }
 #endif
-- 
1.7.9.4

