misc: Made (most) of the headers c++ friendly
authorMichel Pollet <buserror@gmail.com>
Thu, 2 Sep 2010 10:59:07 +0000 (11:59 +0100)
committerMichel Pollet <buserror@gmail.com>
Thu, 2 Sep 2010 10:59:07 +0000 (11:59 +0100)
No functional changes

Signed-off-by: Michel Pollet <buserror@gmail.com>
13 files changed:
include/avr_mcu_section.h
simavr/sim/sim_avr.h
simavr/sim/sim_core.h
simavr/sim/sim_cycle_timers.h
simavr/sim/sim_elf.h
simavr/sim/sim_gdb.h
simavr/sim/sim_hex.h
simavr/sim/sim_interrupts.h
simavr/sim/sim_io.h
simavr/sim/sim_irq.h
simavr/sim/sim_regbit.h
simavr/sim/sim_twi.h
simavr/sim/sim_vcd_file.h

index bce65e8..8991ac5 100644 (file)
 
 #include <stdint.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 enum {
        AVR_MMCU_TAG = 0,
        AVR_MMCU_TAG_NAME,
@@ -150,5 +154,8 @@ const uint8_t _##_tag _MMCU_ = { _tag, 1, _val }
 
 #endif /* __AVR__ */
 
+#ifdef __cplusplus
+};
+#endif
 
 #endif
index 8904dfd..5b20178 100644 (file)
 
 #include <stdint.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef uint64_t avr_cycle_count_t;
 typedef uint16_t       avr_io_addr_t;
 
@@ -253,6 +257,10 @@ uint8_t avr_core_watch_read(avr_t *avr, uint16_t addr);
 // this might activate gdb server
 void avr_sadly_crashed(avr_t *avr, uint8_t signal);
 
+#ifdef __cplusplus
+};
+#endif
+
 #include "sim_io.h"
 #include "sim_regbit.h"
 #include "sim_interrupts.h"
index fb818a0..dc9e12f 100644 (file)
 #ifndef SIM_CORE_H_
 #define SIM_CORE_H_
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /*
  * Instruction decoder, run ONE instruction
  */
@@ -91,4 +95,8 @@ void avr_dump_state(avr_t * avr);
 
 #endif 
 
+#ifdef __cplusplus
+};
+#endif
+
 #endif /* SIM_CORE_H_ */
index 8496b6c..49a9851 100644 (file)
 
 #include "sim_avr.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 // converts a number of usec to a number of machine cycles, at current speed
 static inline avr_cycle_count_t avr_usec_to_cycles(avr_t * avr, uint32_t usec)
 {
@@ -56,4 +60,8 @@ void avr_cycle_timer_cancel(avr_t * avr, avr_cycle_timer_t timer, void * param);
 //
 avr_cycle_count_t avr_cycle_timer_process(avr_t * avr);
 
+#ifdef __cplusplus
+};
+#endif
+
 #endif /* __SIM_CYCLE_TIMERS_H___ */
index 53edaeb..cd70f4d 100644 (file)
 
 #include "avr_mcu_section.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #ifndef ELF_SYMBOLS
 #define ELF_SYMBOLS 1
 #endif
@@ -72,4 +76,8 @@ int elf_read_firmware(const char * file, elf_firmware_t * firmware);
 
 void avr_load_firmware(avr_t * avr, elf_firmware_t * firmware);
 
+#ifdef __cplusplus
+};
+#endif
+
 #endif /* ELF_H_ */
index 49a5645..497dabf 100644 (file)
 #ifndef __SIM_GDB_H__
 #define __SIM_GDB_H__
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 int avr_gdb_init(avr_t * avr);
 
 // call from the main AVR decoder thread
 int avr_gdb_processor(avr_t * avr, uint32_t sleep);
 
+#ifdef __cplusplus
+};
+#endif
+
 #endif
index 83f50db..f187c38 100644 (file)
 
 #include <stdint.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 // parses a hex text string 'src' of at max 'maxlen' characters, decodes it into 'buffer'
 int read_hex_string(const char * src, uint8_t * buffer, int maxlen);
 
@@ -49,4 +53,8 @@ uint8_t * read_ihex_file(const char * fname, uint32_t * dsize, uint32_t * start)
 // hex dump from pointer 'b' for 'l' bytes with string prefix 'w'
 void hdump(const char *w, uint8_t *b, size_t l);
 
+#ifdef __cplusplus
+};
+#endif
+
 #endif /* __SIM_HEX_H___ */
index b03cfbb..659a497 100644 (file)
 #include "sim_avr.h"
 #include "sim_irq.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 // interrupt vector for the IO modules
 typedef struct avr_int_vector_t {
        uint8_t vector;                 // vector number, zero (reset) is reserved
@@ -60,4 +64,8 @@ int avr_clear_interupt_if(avr_t * avr, avr_int_vector_t * vector, uint8_t old);
 // this allows tracing of pending interupts
 avr_irq_t * avr_get_interupt_irq(avr_t * avr, uint8_t v);
 
+#ifdef __cplusplus
+};
+#endif
+
 #endif /* __SIM_INTERUPTS_H__ */
index eeb2f48..8fa338d 100644 (file)
 
 #include "sim_avr.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /*
  * used by the ioports to implement their own features
  * see avr_eeprom.* for an example, and avr_ioctl().
@@ -78,4 +82,8 @@ struct avr_irq_t * avr_io_getirq(avr_t * avr, uint32_t ctl, int index);
 #define AVR_IOMEM_IRQ_ALL 8
 struct avr_irq_t * avr_iomem_getirq(avr_t * avr, avr_io_addr_t addr, int index);
 
+#ifdef __cplusplus
+};
+#endif
+
 #endif /* __SIM_IO_H__ */
index b09137b..d7a9db0 100644 (file)
 
 #include <stdint.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /*
  * Internal IRQ system
  * 
@@ -73,4 +77,8 @@ void avr_connect_irq(avr_irq_t * src, avr_irq_t * dst);
 // register a notification 'hook' for 'irq' -- 'param' is anything that your want passed back as argument
 void avr_irq_register_notify(avr_irq_t * irq, avr_irq_notify_t notify, void * param);
 
+#ifdef __cplusplus
+};
+#endif
+
 #endif /* __SIM_IRQ_H__ */
index 1f74197..8325d63 100644 (file)
 
 #include "sim_avr.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define ARRAY_SIZE(_aa) (sizeof(_aa) / sizeof((_aa)[0]))
 
 /*
@@ -104,5 +108,8 @@ static inline uint8_t avr_regbit_get_array(avr_t * avr, avr_regbit_t *rb, int co
 #define AVR_IO_REGBIT(_io, _bit) { . reg = (_io), .bit = (_bit), .mask = 1 }
 #define AVR_IO_REGBITS(_io, _bit, _mask) { . reg = (_io), .bit = (_bit), .mask = (_mask) }
 
+#ifdef __cplusplus
+};
+#endif
 
 #endif /* __SIM_REGBIT_H__ */
index 195098a..dbb6b96 100644 (file)
 #include <stdint.h>
 #include "sim_irq.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /*
  * The TWI system is designed to be representing the same state as 
  * a TWI/i2c bus itself. So each "state" of the bus is an IRQ sent
@@ -93,4 +97,8 @@ void twi_bus_stop(twi_bus_t * bus);
 void twi_slave_init(twi_slave_t * slave, uint8_t address, void * param);
 void twi_slave_detach(twi_slave_t * slave);
 
+#ifdef __cplusplus
+};
+#endif
+
 #endif /*  SIM_TWI_H_ */
index a94c256..7f55be8 100644 (file)
 #include <stdio.h>
 #include "sim_irq.h"
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /*
  * Value Change dump module for simavr.
  * 
@@ -85,4 +89,8 @@ int avr_vcd_start(avr_vcd_t * vcd);
 // stops recording signal values into the file
 int avr_vcd_stop(avr_vcd_t * vcd);
 
+#ifdef __cplusplus
+};
+#endif
+
 #endif /* __SIM_VCD_FILE_H__ */