From 242d9d81f037c7114282ae0da520200b288b8369 Mon Sep 17 00:00:00 2001 From: Jakob Gruber Date: Fri, 27 Jul 2012 13:46:28 +0200 Subject: [PATCH] misc: Add extern "C" blocks to headers Most headers already had these. This commit adds them where they weren't included yet. --- simavr/sim/avr_adc.h | 8 ++++++++ simavr/sim/avr_bitbang.c | 8 ++++++++ simavr/sim/avr_eeprom.h | 8 ++++++++ simavr/sim/avr_extint.h | 8 ++++++++ simavr/sim/avr_flash.h | 8 ++++++++ simavr/sim/avr_ioport.h | 8 ++++++++ simavr/sim/avr_lin.h | 8 ++++++++ simavr/sim/avr_spi.h | 8 ++++++++ simavr/sim/avr_timer.h | 8 ++++++++ simavr/sim/avr_twi.h | 8 ++++++++ simavr/sim/avr_uart.h | 8 ++++++++ simavr/sim/avr_usb.h | 8 ++++++++ simavr/sim/avr_watchdog.h | 7 +++++++ simavr/sim/fifo_declare.h | 8 ++++++++ simavr/sim/sim_avr_types.h | 8 ++++++++ simavr/sim/sim_time.h | 8 ++++++++ 16 files changed, 127 insertions(+) diff --git a/simavr/sim/avr_adc.h b/simavr/sim/avr_adc.h index eaf78ee..e1e75d1 100644 --- a/simavr/sim/avr_adc.h +++ b/simavr/sim/avr_adc.h @@ -22,6 +22,10 @@ #ifndef __AVR_ADC_H___ #define __AVR_ADC_H___ +#ifdef __cplusplus +extern "C" { +#endif + #include "sim_avr.h" /* @@ -142,4 +146,8 @@ void avr_adc_init(avr_t * avr, avr_adc_t * port); .kind = ADC_MUX_VCC4, \ } +#ifdef __cplusplus +}; +#endif + #endif /* __AVR_ADC_H___ */ diff --git a/simavr/sim/avr_bitbang.c b/simavr/sim/avr_bitbang.c index 1bee186..254c95a 100644 --- a/simavr/sim/avr_bitbang.c +++ b/simavr/sim/avr_bitbang.c @@ -20,6 +20,10 @@ along with simavr. If not, see . */ +#ifdef __cplusplus +extern "C" { +#endif + #include #include @@ -233,3 +237,7 @@ void avr_bitbang_stop(avr_bitbang_t * p) avr_cycle_timer_cancel(p->avr, avr_bitbang_clk_timer, p); avr_irq_unregister_notify( avr_io_getirq(p->avr, AVR_IOCTL_IOPORT_GETIRQ( p->p_clk.port ), p->p_clk.pin), avr_bitbang_clk_hook, p); } + +#ifdef __cplusplus +}; +#endif diff --git a/simavr/sim/avr_eeprom.h b/simavr/sim/avr_eeprom.h index 6176b0c..ae301af 100644 --- a/simavr/sim/avr_eeprom.h +++ b/simavr/sim/avr_eeprom.h @@ -22,6 +22,10 @@ #ifndef __AVR_EEPROM_H__ #define __AVR_EEPROM_H__ +#ifdef __cplusplus +extern "C" { +#endif + #include "sim_avr.h" typedef struct avr_eeprom_t { @@ -120,4 +124,8 @@ typedef struct avr_eeprom_desc_t { },\ } +#ifdef __cplusplus +}; +#endif + #endif /* __AVR_EEPROM_H__ */ diff --git a/simavr/sim/avr_extint.h b/simavr/sim/avr_extint.h index fce4fa4..57519d0 100644 --- a/simavr/sim/avr_extint.h +++ b/simavr/sim/avr_extint.h @@ -24,6 +24,10 @@ #ifndef AVR_EXTINT_H_ #define AVR_EXTINT_H_ +#ifdef __cplusplus +extern "C" { +#endif + #include "sim_avr.h" @@ -86,4 +90,8 @@ void avr_extint_init(avr_t * avr, avr_extint_t * p); }, \ } +#ifdef __cplusplus +}; +#endif + #endif /* AVR_EXTINT_H_ */ diff --git a/simavr/sim/avr_flash.h b/simavr/sim/avr_flash.h index dffaeaf..7714250 100644 --- a/simavr/sim/avr_flash.h +++ b/simavr/sim/avr_flash.h @@ -23,6 +23,10 @@ #ifndef __AVR_FLASH_H___ #define __AVR_FLASH_H___ +#ifdef __cplusplus +extern "C" { +#endif + #include "sim_avr.h" /* @@ -61,4 +65,8 @@ void avr_flash_init(avr_t * avr, avr_flash_t * p); },\ } +#ifdef __cplusplus +}; +#endif + #endif /* __AVR_FLASH_H___ */ diff --git a/simavr/sim/avr_ioport.h b/simavr/sim/avr_ioport.h index bc090b2..c6f5a4b 100644 --- a/simavr/sim/avr_ioport.h +++ b/simavr/sim/avr_ioport.h @@ -22,6 +22,10 @@ #ifndef __AVR_IOPORT_H__ #define __AVR_IOPORT_H__ +#ifdef __cplusplus +extern "C" { +#endif + #include "sim_avr.h" enum { @@ -92,4 +96,8 @@ typedef struct avr_ioport_t { void avr_ioport_init(avr_t * avr, avr_ioport_t * port); +#ifdef __cplusplus +}; +#endif + #endif /* __AVR_IOPORT_H__ */ diff --git a/simavr/sim/avr_lin.h b/simavr/sim/avr_lin.h index b27c88d..b1ecadf 100644 --- a/simavr/sim/avr_lin.h +++ b/simavr/sim/avr_lin.h @@ -23,6 +23,10 @@ #ifndef __AVR_LIN_H__ #define __AVR_LIN_H__ +#ifdef __cplusplus +extern "C" { +#endif + #include "sim_avr.h" #include "avr_uart.h" @@ -44,4 +48,8 @@ avr_lin_init( avr_t *avr, avr_lin_t *port); +#ifdef __cplusplus +}; +#endif + #endif /* __AVR_LIN_H__ */ diff --git a/simavr/sim/avr_spi.h b/simavr/sim/avr_spi.h index 3e3a26a..4a8eaf0 100644 --- a/simavr/sim/avr_spi.h +++ b/simavr/sim/avr_spi.h @@ -22,6 +22,10 @@ #ifndef AVR_SPI_H_ #define AVR_SPI_H_ +#ifdef __cplusplus +extern "C" { +#endif + #include "sim_avr.h" enum { @@ -53,4 +57,8 @@ typedef struct avr_spi_t { void avr_spi_init(avr_t * avr, avr_spi_t * port); +#ifdef __cplusplus +}; +#endif + #endif /* AVR_SPI_H_ */ diff --git a/simavr/sim/avr_timer.h b/simavr/sim/avr_timer.h index 39362d4..4e92318 100644 --- a/simavr/sim/avr_timer.h +++ b/simavr/sim/avr_timer.h @@ -22,6 +22,10 @@ #ifndef AVR_TIMER_H_ #define AVR_TIMER_H_ +#ifdef __cplusplus +extern "C" { +#endif + #include "sim_avr.h" enum { @@ -124,4 +128,8 @@ typedef struct avr_timer_t { void avr_timer_init(avr_t * avr, avr_timer_t * port); +#ifdef __cplusplus +}; +#endif + #endif /* AVR_TIMER_H_ */ diff --git a/simavr/sim/avr_twi.h b/simavr/sim/avr_twi.h index 6b30c34..e21e3b6 100644 --- a/simavr/sim/avr_twi.h +++ b/simavr/sim/avr_twi.h @@ -22,6 +22,10 @@ #ifndef AVR_TWI_H_ #define AVR_TWI_H_ +#ifdef __cplusplus +extern "C" { +#endif + #include "sim_avr.h" //#include "sim_twi.h" @@ -103,4 +107,8 @@ avr_twi_irq_msg( uint8_t addr, uint8_t data); +#ifdef __cplusplus +}; +#endif + #endif /* AVR_TWI_H_ */ diff --git a/simavr/sim/avr_uart.h b/simavr/sim/avr_uart.h index f0ff4af..d21c36f 100644 --- a/simavr/sim/avr_uart.h +++ b/simavr/sim/avr_uart.h @@ -22,6 +22,10 @@ #ifndef AVR_UART_H_ #define AVR_UART_H_ +#ifdef __cplusplus +extern "C" { +#endif + #include "sim_avr.h" #include "fifo_declare.h" @@ -117,4 +121,8 @@ typedef struct avr_uart_t { void avr_uart_init(avr_t * avr, avr_uart_t * port); +#ifdef __cplusplus +}; +#endif + #endif /* AVR_UART_H_ */ diff --git a/simavr/sim/avr_usb.h b/simavr/sim/avr_usb.h index 609ffb6..842e423 100644 --- a/simavr/sim/avr_usb.h +++ b/simavr/sim/avr_usb.h @@ -22,6 +22,10 @@ #ifndef AVR_USB_H_ #define AVR_USB_H_ +#ifdef __cplusplus +extern "C" { +#endif + #include "sim_avr.h" enum { @@ -63,4 +67,8 @@ typedef struct avr_usb_t { void avr_usb_init(avr_t * avr, avr_usb_t * port); +#ifdef __cplusplus +}; +#endif + #endif /* AVR_USB_H_ */ diff --git a/simavr/sim/avr_watchdog.h b/simavr/sim/avr_watchdog.h index e31d3bb..0620b7f 100644 --- a/simavr/sim/avr_watchdog.h +++ b/simavr/sim/avr_watchdog.h @@ -23,6 +23,9 @@ #ifndef __AVR_WATCHDOG_H___ #define __AVR_WATCHDOG_H___ +#ifdef __cplusplus +extern "C" { +#endif #include "sim_avr.h" @@ -80,4 +83,8 @@ void avr_watchdog_init(avr_t * avr, avr_watchdog_t * p); },\ } +#ifdef __cplusplus +}; +#endif + #endif /* __AVR_WATCHDOG_H___ */ diff --git a/simavr/sim/fifo_declare.h b/simavr/sim/fifo_declare.h index 44deb39..bbacb3a 100644 --- a/simavr/sim/fifo_declare.h +++ b/simavr/sim/fifo_declare.h @@ -31,6 +31,10 @@ #ifndef __FIFO_DECLARE__ #define __FIFO_DECLARE__ +#ifdef __cplusplus +extern "C" { +#endif + /* doing a : DECLARE_FIFO(uint8_t, myfifo, 128); @@ -154,4 +158,8 @@ static FIFO_INLINE void __name##_reset(__name##_t *c)\ }\ struct __name##_t +#ifdef __cplusplus +}; +#endif + #endif diff --git a/simavr/sim/sim_avr_types.h b/simavr/sim/sim_avr_types.h index 638d68f..b15bafc 100644 --- a/simavr/sim/sim_avr_types.h +++ b/simavr/sim/sim_avr_types.h @@ -23,6 +23,10 @@ #ifndef __SIM_AVR_TYPES_H___ #define __SIM_AVR_TYPES_H___ +#ifdef __cplusplus +extern "C" { +#endif + #include #include @@ -46,4 +50,8 @@ typedef struct avr_regbit_t { struct avr_t; +#ifdef __cplusplus +}; +#endif + #endif /* __SIM_AVR_TYPES_H___ */ diff --git a/simavr/sim/sim_time.h b/simavr/sim/sim_time.h index fa1106f..fd17174 100644 --- a/simavr/sim/sim_time.h +++ b/simavr/sim/sim_time.h @@ -23,6 +23,10 @@ #ifndef __SIM_TIME_H___ #define __SIM_TIME_H___ +#ifdef __cplusplus +extern "C" { +#endif + #include "sim_avr.h" // converts a number of usec to a number of machine cycles, at current speed @@ -49,4 +53,8 @@ static inline avr_cycle_count_t avr_hz_to_cycles(avr_t * avr, uint32_t hz) return avr->frequency / hz; } +#ifdef __cplusplus +}; +#endif + #endif /* __SIM_TIME_H___ */ -- 2.39.5