Просмотр исходного кода

added _cplusplus extern wrapper

hathach 13 лет назад
Родитель
Сommit
829c8672bb

+ 8 - 0
tinyusb/common/arch/arch.h

@@ -38,6 +38,10 @@
 #ifndef _TUSB_ARCH_H_
 #define _TUSB_ARCH_H_
 
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
 #define ARCH_LPC134X 1
 #define ARCH_LPC43XX 2
 #define ARCH ARCH_LPC134X
@@ -51,4 +55,8 @@
 
 #endif
 
+#ifdef __cplusplus
+ }
+#endif
+
 #endif /* _TUSB_ARCH_H_ */

+ 8 - 0
tinyusb/common/arch/arch_lpc134x.h

@@ -38,10 +38,18 @@
 #ifndef _TUSB_ARCH_LPC134_X_H_
 #define _TUSB_ARCH_LPC134_X_H_
 
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
 #include "arm_mx.h"
 
 #define ARM ARM_M3
 
 #define DEVICE_ROMDRIVER
 
+#ifdef __cplusplus
+ }
+#endif
+
 #endif /* _TUSB_ARCH_LPC134_X_H_ */

+ 8 - 0
tinyusb/common/arch/arch_lpc43xx.h

@@ -38,9 +38,17 @@
 #ifndef _TUSB_ARCH_LPC43XX_H_
 #define _TUSB_ARCH_LPC43XX_H_
 
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
 #define ARM ARM_M4
 //#define ARM ARM_M0
 
 #include "arm_mx.h"
 
+#ifdef __cplusplus
+ }
+#endif
+
 #endif /* _TUSB_ARCH_LPC43XX_H_ */

+ 8 - 0
tinyusb/common/arch/arm_mx.h

@@ -38,7 +38,15 @@
 #ifndef _TUSB_ARM_MX_H_
 #define _TUSB_ARM_MX_H_
 
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
 #define ENDIAN_LITTLE
 #define ALIGNMENT (4)
 
+#ifdef __cplusplus
+ }
+#endif
+
 #endif /* _TUSB_ARM_MX_H_ */

+ 8 - 0
tinyusb/common/common.h

@@ -38,8 +38,16 @@
 #ifndef _TUSB_COMMON_H_
 #define _TUSB_COMMON_H_
 
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
 #include "arch/arch.h"
 #include "compiler/compiler.h"
 #include "errors.h"
 
+#ifdef __cplusplus
+ }
+#endif
+
 #endif /* _TUSB_COMMON_H_ */

+ 8 - 0
tinyusb/common/compiler/compiler.h

@@ -38,8 +38,16 @@
 #ifndef _TUSB_COMPILER_H_
 #define _TUSB_COMPILER_H_
 
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
 #if defined(__GNUC__)
   #include "compiler_gcc.h"
 #endif
 
+#ifdef __cplusplus
+ }
+#endif
+
 #endif /* _TUSB_COMPILER_H_ */

+ 8 - 0
tinyusb/common/compiler/compiler_gcc.h

@@ -35,6 +35,10 @@
  * This file is part of the tiny usb stack.
  */
 
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
 #ifndef _TUSB_COMPILER_GCC_H_
 #define _TUSB_COMPILER_GCC_H_
 
@@ -52,4 +56,8 @@
 #define ATTR_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
 #define ATTR_ALWAYS_INLINE			__attribute__ ((always_inline))
 
+#ifdef __cplusplus
+ }
+#endif
+
 #endif /* _TUSB_COMPILER_GCC_H_ */

+ 8 - 0
tinyusb/common/errors.h

@@ -38,5 +38,13 @@
 #ifndef _TUSB_ERRORS_H_
 #define _TUSB_ERRORS_H_
 
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+
+#ifdef __cplusplus
+ }
+#endif
 
 #endif /* _TUSB_ERRORS_H_ */

+ 8 - 0
tinyusb/device/dcd.h

@@ -38,10 +38,18 @@
 #ifndef _TUSB_DCD_H_
 #define _TUSB_DCD_H_
 
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
 #include "tusb_cfg.h"
 
 #ifdef DEVICE_ROMDRIVER
 #include "romdriver/mw_usbd_rom_api.h"
 #endif
 
+#ifdef __cplusplus
+ }
+#endif
+
 #endif /* _TUSB_DCD_H_ */

+ 12 - 0
tinyusb/host/hcd.h

@@ -35,3 +35,15 @@
  * This file is part of the tiny usb stack.
  */
 
+#ifndef _TUSB_HCD_H_
+#define _TUSB_HCD_H_
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#ifdef __cplusplus
+ }
+#endif
+
+ #endif /* _TUSB_HCD_H_ */

+ 11 - 3
tinyusb/tusb.h

@@ -35,8 +35,12 @@
  * This file is part of the tiny usb stack.
  */
 
-#ifndef TUSB_H_
-#define TUSB_H_
+#ifndef _TUSB_H_
+#define _TUSB_H_
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
 
 #include "common/common.h"
 #include "tusb_cfg.h"
@@ -45,4 +49,8 @@
 #include "device/dcd.h"
 #endif
 
-#endif /* TUSB_H_ */
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* _TUSB_H_ */

+ 8 - 0
tinyusb/tusb_cfg.h

@@ -38,6 +38,10 @@
 #ifndef _TUSB_CFG_H_
 #define _TUSB_CFG_H_
 
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
 #include "common/common.h"
 
 #define CFG_TUSB_HOST
@@ -66,4 +70,8 @@
 #define  CDC_NOTIFICATION_EP_MAXPACKETSIZE  8
 #define  CDC_DATA_EP_MAXPACKET_SIZE         16
 
+#ifdef __cplusplus
+ }
+#endif
+
 #endif /* _TUSB_CFG_H_ */