1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #1783 from dangnhat/extern_C_in_headers_core

c++: core: add extern C in header files
This commit is contained in:
René Kijewski 2014-10-09 20:42:12 +02:00
commit b7dcb44e10
30 changed files with 232 additions and 0 deletions

View File

@ -19,6 +19,10 @@
#ifndef __ATOMIC_ARCH_H #ifndef __ATOMIC_ARCH_H
#define __ATOMIC_ARCH_H #define __ATOMIC_ARCH_H
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* @brief Define mappings between arch and internal interfaces * @brief Define mappings between arch and internal interfaces
* *
@ -41,6 +45,9 @@
*/ */
unsigned int atomic_arch_set_return(unsigned int *to_set, unsigned int value); unsigned int atomic_arch_set_return(unsigned int *to_set, unsigned int value);
#ifdef __cplusplus
}
#endif
#endif /* __ATOMIC_ARCH_H */ #endif /* __ATOMIC_ARCH_H */
/** @} */ /** @} */

View File

@ -22,6 +22,10 @@
#ifndef HWTIMER_ARCH_H_ #ifndef HWTIMER_ARCH_H_
#define HWTIMER_ARCH_H_ #define HWTIMER_ARCH_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h> #include <stdint.h>
/** /**
@ -73,6 +77,9 @@ void hwtimer_arch_unset(short timer);
*/ */
unsigned long hwtimer_arch_now(void); unsigned long hwtimer_arch_now(void);
#ifdef __cplusplus
}
#endif
#endif /* HWTIMER_ARCH_H_ */ #endif /* HWTIMER_ARCH_H_ */
/** @} */ /** @} */

View File

@ -19,6 +19,10 @@
#ifndef __IO_ARCH_H #ifndef __IO_ARCH_H
#define __IO_ARCH_H #define __IO_ARCH_H
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* @brief Define mapping between kernel internal and arch interfaces * @brief Define mapping between kernel internal and arch interfaces
* *
@ -44,6 +48,9 @@
*/ */
int io_arch_puts(char *data, int count); int io_arch_puts(char *data, int count);
#ifdef __cplusplus
}
#endif
#endif /* __IO_ARCH_H */ #endif /* __IO_ARCH_H */
/** @} */ /** @} */

View File

@ -22,6 +22,10 @@
#ifndef __IRQ_ARCH_H #ifndef __IRQ_ARCH_H
#define __IRQ_ARCH_H #define __IRQ_ARCH_H
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* @name Define mapping between kernel internal and arch interfaces * @name Define mapping between kernel internal and arch interfaces
* *
@ -66,6 +70,9 @@ void irq_arch_restore(unsigned int state);
*/ */
int irq_arch_in(void); int irq_arch_in(void);
#ifdef __cplusplus
}
#endif
#endif /* __IRQ_ARCH_H */ #endif /* __IRQ_ARCH_H */
/** @} */ /** @} */

View File

@ -22,6 +22,10 @@
#ifndef __LPM_ARCH_H #ifndef __LPM_ARCH_H
#define __LPM_ARCH_H #define __LPM_ARCH_H
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* @brief Define the mapping between the architecture independent interfaces * @brief Define the mapping between the architecture independent interfaces
and the kernel internal interfaces and the kernel internal interfaces
@ -88,6 +92,9 @@ void lpm_arch_begin_awake(void);
*/ */
void lpm_arch_end_awake(void); void lpm_arch_end_awake(void);
#ifdef __cplusplus
}
#endif
#endif /* __LPM_ARCH_H */ #endif /* __LPM_ARCH_H */
/** @} */ /** @} */

View File

@ -20,6 +20,10 @@
#ifndef __REBOOT_ARCH_H #ifndef __REBOOT_ARCH_H
#define __REBOOT_ARCH_H #define __REBOOT_ARCH_H
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* @brief Reboot the system * @brief Reboot the system
* *
@ -30,6 +34,9 @@
*/ */
int reboot_arch(int mode); int reboot_arch(int mode);
#ifdef __cplusplus
}
#endif
#endif /* __REBOOT_ARCH_H */ #endif /* __REBOOT_ARCH_H */
/** @} */ /** @} */

View File

@ -19,6 +19,10 @@
#ifndef __THREAD_ARCH_H #ifndef __THREAD_ARCH_H
#define __THREAD_ARCH_H #define __THREAD_ARCH_H
#ifdef __cplusplus
extern "C" {
#endif
#include "attributes.h" #include "attributes.h"
/** /**
@ -65,6 +69,9 @@ void thread_arch_start_threading(void) NORETURN;
*/ */
void thread_arch_yield(void); void thread_arch_yield(void);
#ifdef __cplusplus
}
#endif
#endif /* __THREAD_ARCH_H */ #endif /* __THREAD_ARCH_H */
/** @} */ /** @} */

View File

@ -19,6 +19,10 @@
#ifndef _ATOMIC_H #ifndef _ATOMIC_H
#define _ATOMIC_H #define _ATOMIC_H
#ifdef __cplusplus
extern "C" {
#endif
#include "arch/atomic_arch.h" #include "arch/atomic_arch.h"
/** /**
@ -31,5 +35,9 @@
*/ */
unsigned int atomic_set_return(unsigned int *val, unsigned int set); unsigned int atomic_set_return(unsigned int *val, unsigned int set);
#ifdef __cplusplus
}
#endif
#endif /* _ATOMIC_H */ #endif /* _ATOMIC_H */
/** @} */ /** @} */

View File

@ -19,6 +19,10 @@
#ifndef ATTRIBUTES_H_ #ifndef ATTRIBUTES_H_
#define ATTRIBUTES_H_ #define ATTRIBUTES_H_
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* @def NORETURN * @def NORETURN
* @brief The *NORETURN* keyword tells the compiler to assume that the function * @brief The *NORETURN* keyword tells the compiler to assume that the function
@ -68,5 +72,9 @@
#define UNREACHABLE() do { /* nothing */ } while (1) #define UNREACHABLE() do { /* nothing */ } while (1)
#endif #endif
#ifdef __cplusplus
}
#endif
#endif /* ATTRIBUTES_H_ */ #endif /* ATTRIBUTES_H_ */
/** @} */ /** @} */

View File

@ -20,6 +20,10 @@
#ifndef BITARITHM_H_ #ifndef BITARITHM_H_
#define BITARITHM_H_ #define BITARITHM_H_
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* @def SETBIT * @def SETBIT
* @brief Sets a bitmask for a bitfield * @brief Sets a bitmask for a bitfield
@ -114,5 +118,9 @@ unsigned bitarithm_lsb(register unsigned v);
*/ */
unsigned bitarithm_bits_set(unsigned v); unsigned bitarithm_bits_set(unsigned v);
#ifdef __cplusplus
}
#endif
#endif /* BITARITHM_H_ */ #endif /* BITARITHM_H_ */
/** @} */ /** @} */

View File

@ -21,6 +21,10 @@
#ifndef __CIB_H #ifndef __CIB_H
#define __CIB_H #define __CIB_H
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* @brief circular integer buffer structure * @brief circular integer buffer structure
*/ */
@ -68,5 +72,9 @@ int cib_put(cib_t *cib);
*/ */
int cib_avail(cib_t *cib); int cib_avail(cib_t *cib);
#ifdef __cplusplus
}
#endif
#endif /* __CIB_H */ #endif /* __CIB_H */
/** @} */ /** @} */

View File

@ -19,6 +19,10 @@
#ifndef __CLIST_H #ifndef __CLIST_H
#define __CLIST_H #define __CLIST_H
#ifdef __cplusplus
extern "C" {
#endif
#include "kernel_macros.h" #include "kernel_macros.h"
/** /**
@ -85,5 +89,9 @@ static inline void clist_advance(clist_node_t **list)
void clist_print(clist_node_t *clist); void clist_print(clist_node_t *clist);
#endif #endif
#ifdef __cplusplus
}
#endif
#endif /* __CLIST_H */ #endif /* __CLIST_H */
/** @} */ /** @} */

View File

@ -19,6 +19,10 @@
#ifndef CONFIG_H #ifndef CONFIG_H
#define CONFIG_H #define CONFIG_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h> #include <stdint.h>
#define CONFIG_KEY (0x1701) /**< key to identify configuration */ #define CONFIG_KEY (0x1701) /**< key to identify configuration */
@ -66,5 +70,9 @@ uint8_t config_save(void);
*/ */
void config_load(void); void config_load(void);
#ifdef __cplusplus
}
#endif
#endif /* CONFIG_H */ #endif /* CONFIG_H */
/** @} */ /** @} */

View File

@ -22,6 +22,10 @@
#ifndef __CRASH_H #ifndef __CRASH_H
#define __CRASH_H #define __CRASH_H
#ifdef __cplusplus
extern "C" {
#endif
#include "kernel.h" #include "kernel.h"
/** /**
@ -46,5 +50,9 @@
* */ * */
NORETURN void core_panic(int crash_code, const char *message); NORETURN void core_panic(int crash_code, const char *message);
#ifdef __cplusplus
}
#endif
#endif /* __CRASH_H */ #endif /* __CRASH_H */
/** @} */ /** @} */

View File

@ -21,6 +21,10 @@
#ifndef __DEBUG_H #ifndef __DEBUG_H
#define __DEBUG_H #define __DEBUG_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h> #include <stdio.h>
#include "sched.h" #include "sched.h"
@ -80,5 +84,9 @@
#endif #endif
/** @} */ /** @} */
#ifdef __cplusplus
}
#endif
#endif /* __DEBUG_H */ #endif /* __DEBUG_H */
/** @} */ /** @} */

View File

@ -19,6 +19,10 @@
#ifndef _FLAGS_H #ifndef _FLAGS_H
#define _FLAGS_H #define _FLAGS_H
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* @name Optional flags for controlling a threads initial state. * @name Optional flags for controlling a threads initial state.
* @{ * @{
@ -30,5 +34,9 @@
usage (for debugging) */ usage (for debugging) */
/** @} */ /** @} */
#ifdef __cplusplus
}
#endif
#endif /* _FLAGS_H */ #endif /* _FLAGS_H */
/** @} */ /** @} */

View File

@ -33,6 +33,10 @@
#ifndef __HWTIMER_H #ifndef __HWTIMER_H
#define __HWTIMER_H #define __HWTIMER_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h> #include <stdint.h>
#include "hwtimer_cpu.h" #include "hwtimer_cpu.h"
#include "board.h" #include "board.h"
@ -172,5 +176,9 @@ void hwtimer_init_comp(uint32_t fcpu);
*/ */
void hwtimer_spin(unsigned long ticks); void hwtimer_spin(unsigned long ticks);
#ifdef __cplusplus
}
#endif
/** @} */ /** @} */
#endif /* __HWTIMER_H */ #endif /* __HWTIMER_H */

View File

@ -21,6 +21,10 @@
#ifndef IO_H #ifndef IO_H
#define IO_H #define IO_H
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* @brief Firmware putstring implementation * @brief Firmware putstring implementation
* *
@ -29,5 +33,9 @@
*/ */
int fw_puts(char *data, int count); int fw_puts(char *data, int count);
#ifdef __cplusplus
}
#endif
/** @} */ /** @} */
#endif /* IO_H */ #endif /* IO_H */

View File

@ -21,6 +21,10 @@
#ifndef IRQ_H_ #ifndef IRQ_H_
#define IRQ_H_ #define IRQ_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h> #include <stdbool.h>
#include "arch/irq_arch.h" #include "arch/irq_arch.h"
@ -69,5 +73,9 @@ void restoreIRQ(unsigned state);
*/ */
int inISR(void); int inISR(void);
#ifdef __cplusplus
}
#endif
#endif /* IRQ_H_ */ #endif /* IRQ_H_ */
/** @} */ /** @} */

View File

@ -22,6 +22,10 @@
#ifndef KERNEL_H_ #ifndef KERNEL_H_
#define KERNEL_H_ #define KERNEL_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
@ -136,5 +140,9 @@ int reboot(int mode);
*/ */
#define RB_AUTOBOOT 0 #define RB_AUTOBOOT 0
#ifdef __cplusplus
}
#endif
#endif /* KERNEL_H_ */ #endif /* KERNEL_H_ */
/** @} */ /** @} */

View File

@ -19,6 +19,10 @@
#ifndef KERNEL_INTERNAL_H_ #ifndef KERNEL_INTERNAL_H_
#define KERNEL_INTERNAL_H_ #define KERNEL_INTERNAL_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "attributes.h" #include "attributes.h"
/** /**
@ -55,5 +59,9 @@ NORETURN void sched_task_exit(void);
*/ */
void thread_print_stack(void); void thread_print_stack(void);
#ifdef __cplusplus
}
#endif
#endif /* KERNEL_INTERNAL_H_ */ #endif /* KERNEL_INTERNAL_H_ */
/** @} */ /** @} */

View File

@ -9,6 +9,10 @@
#ifndef KERNEL_TYPES_H #ifndef KERNEL_TYPES_H
#define KERNEL_TYPES_H #define KERNEL_TYPES_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h> #include <stdint.h>
#include <inttypes.h> #include <inttypes.h>
#include <limits.h> #include <limits.h>
@ -63,4 +67,8 @@
*/ */
typedef int16_t kernel_pid_t; typedef int16_t kernel_pid_t;
#ifdef __cplusplus
}
#endif
#endif /* KERNEL_TYPES_H */ #endif /* KERNEL_TYPES_H */

View File

@ -23,6 +23,10 @@
#ifndef __LIFO_H_ #ifndef __LIFO_H_
#define __LIFO_H_ #define __LIFO_H_
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* @brief Check if the given lifo is empty. * @brief Check if the given lifo is empty.
* *
@ -62,5 +66,9 @@ void lifo_insert(int *array, int i);
*/ */
int lifo_get(int *array); int lifo_get(int *array);
#ifdef __cplusplus
}
#endif
#endif /* __LIFO_H_ */ #endif /* __LIFO_H_ */
/** @} */ /** @} */

View File

@ -23,6 +23,10 @@
#ifndef LPM_H_ #ifndef LPM_H_
#define LPM_H_ #define LPM_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "arch/lpm_arch.h" #include "arch/lpm_arch.h"
/** /**
@ -60,5 +64,9 @@ void lpm_end_awake(void);
*/ */
enum lpm_mode lpm_get(void); enum lpm_mode lpm_get(void);
#ifdef __cplusplus
}
#endif
#endif /* __LPM_H_ */ #endif /* __LPM_H_ */
/** @} */ /** @} */

View File

@ -32,6 +32,10 @@
#ifndef __MSG_H_ #ifndef __MSG_H_
#define __MSG_H_ #define __MSG_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "kernel_types.h" #include "kernel_types.h"
@ -180,5 +184,9 @@ int msg_reply(msg_t *m, msg_t *reply);
*/ */
int msg_init_queue(msg_t *array, int num); int msg_init_queue(msg_t *array, int num);
#ifdef __cplusplus
}
#endif
#endif /* __MSG_H_ */ #endif /* __MSG_H_ */
/** @} */ /** @} */

View File

@ -21,6 +21,10 @@
#ifndef __MUTEX_H_ #ifndef __MUTEX_H_
#define __MUTEX_H_ #define __MUTEX_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "priority_queue.h" #include "priority_queue.h"
/** /**
@ -92,5 +96,9 @@ void mutex_unlock(mutex_t *mutex);
*/ */
void mutex_unlock_and_sleep(mutex_t *mutex); void mutex_unlock_and_sleep(mutex_t *mutex);
#ifdef __cplusplus
}
#endif
#endif /* __MUTEX_H_ */ #endif /* __MUTEX_H_ */
/** @} */ /** @} */

View File

@ -19,6 +19,10 @@
#ifndef __QUEUE_H #ifndef __QUEUE_H
#define __QUEUE_H #define __QUEUE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
@ -110,5 +114,9 @@ void priority_queue_print(priority_queue_t *root);
void priority_queue_print_node(priority_queue_t *root); void priority_queue_print_node(priority_queue_t *root);
#endif #endif
#ifdef __cplusplus
}
#endif
/** @} */ /** @} */
#endif /* __QUEUE_H */ #endif /* __QUEUE_H */

View File

@ -80,6 +80,10 @@
#ifndef _SCHEDULER_H #ifndef _SCHEDULER_H
#define _SCHEDULER_H #define _SCHEDULER_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h> #include <stddef.h>
#include "bitarithm.h" #include "bitarithm.h"
#include "tcb.h" #include "tcb.h"
@ -178,5 +182,9 @@ void sched_register_cb(void (*callback)(uint32_t, uint32_t));
#endif #endif
#ifdef __cplusplus
}
#endif
#endif // _SCHEDULER_H #endif // _SCHEDULER_H
/** @} */ /** @} */

View File

@ -20,6 +20,10 @@
#ifndef TCB_H_ #ifndef TCB_H_
#define TCB_H_ #define TCB_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h> #include <stdint.h>
#include "priority_queue.h" #include "priority_queue.h"
#include "clist.h" #include "clist.h"
@ -78,5 +82,9 @@ typedef struct tcb_t {
#endif #endif
} tcb_t; } tcb_t;
#ifdef __cplusplus
}
#endif
#endif /* TCB_H_ */ #endif /* TCB_H_ */
/** @} */ /** @} */

View File

@ -21,6 +21,9 @@
#ifndef __THREAD_H #ifndef __THREAD_H
#define __THREAD_H #define __THREAD_H
#ifdef __cplusplus
extern "C" {
#endif
#include "kernel.h" #include "kernel.h"
#include "tcb.h" #include "tcb.h"
@ -156,5 +159,9 @@ static inline kernel_pid_t thread_getpid(void)
int thread_measure_stack_free(char *stack); int thread_measure_stack_free(char *stack);
#endif #endif
#ifdef __cplusplus
}
#endif
/* @} */ /* @} */
#endif /* __THREAD_H */ #endif /* __THREAD_H */