diff options
| author | hathach <[email protected]> | 2012-12-02 11:07:59 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2012-12-02 11:07:59 +0700 |
| commit | b36a85ad3625596ce57f1a9fc2ddde2ea98b33d8 (patch) | |
| tree | d73d19e9d96075369ffdb3f20a6878fdde0d51d6 /tinyusb | |
| parent | a636d75fc6c8af025a5f5a6229bd02334f82e976 (diff) | |
add extern "C" for cpp
start to work on hal layer
Diffstat (limited to 'tinyusb')
| -rw-r--r-- | tinyusb/common/arch/arch_lpc134x.h | 2 | ||||
| -rw-r--r-- | tinyusb/common/common.h | 8 | ||||
| -rw-r--r-- | tinyusb/common/compiler/compiler_gcc.h | 8 | ||||
| -rw-r--r-- | tinyusb/common/errors.h | 8 | ||||
| -rw-r--r-- | tinyusb/common/fifo.h | 7 | ||||
| -rw-r--r-- | tinyusb/device/dcd.h | 6 | ||||
| -rw-r--r-- | tinyusb/host/hcd.h | 4 | ||||
| -rw-r--r-- | tinyusb/tusb.c | 16 | ||||
| -rw-r--r-- | tinyusb/tusb_cfg.h | 8 |
9 files changed, 38 insertions, 29 deletions
diff --git a/tinyusb/common/arch/arch_lpc134x.h b/tinyusb/common/arch/arch_lpc134x.h index a1c42ca7e..b43bcea7c 100644 --- a/tinyusb/common/arch/arch_lpc134x.h +++ b/tinyusb/common/arch/arch_lpc134x.h @@ -54,7 +54,7 @@ #include "arm_mx.h" #include "LPC13Uxx.h" - +#include "system_LPC13Uxx.h" #endif /* _TUSB_ARCH_LPC134_X_H_ */ diff --git a/tinyusb/common/common.h b/tinyusb/common/common.h index b35639574..a0a50896b 100644 --- a/tinyusb/common/common.h +++ b/tinyusb/common/common.h @@ -51,6 +51,10 @@ #ifndef _TUSB_COMMON_H_ #define _TUSB_COMMON_H_ +#ifdef __cplusplus + extern "C" { +#endif + #include <stddef.h> #include <stdbool.h> #include <string.h> @@ -89,6 +93,10 @@ #define ASSERT_ERROR(sts) ASSERT_ERROR_MESSAGE(sts, NULL) +#ifdef __cplusplus + } +#endif + #endif /* _TUSB_COMMON_H_ */ /** @} */ diff --git a/tinyusb/common/compiler/compiler_gcc.h b/tinyusb/common/compiler/compiler_gcc.h index 787f9f6ae..ee651140b 100644 --- a/tinyusb/common/compiler/compiler_gcc.h +++ b/tinyusb/common/compiler/compiler_gcc.h @@ -49,6 +49,10 @@ #ifndef _TUSB_COMPILER_GCC_H_ #define _TUSB_COMPILER_GCC_H_ +#ifdef __cplusplus + extern "C" { +#endif + /// Normally, the compiler places the objects it generates in sections like data or bss & function in text. Sometimes, however, you need additional sections, or you need certain particular variables to appear in special sections, for example to map to special hardware. The section attribute specifies that a variable (or function) lives in a particular section #define ATTR_SECTION(section) __attribute__ ((#section)) @@ -117,6 +121,10 @@ /** @} */ +#ifdef __cplusplus + } +#endif + #endif /* _TUSB_COMPILER_GCC_H_ */ /// @} diff --git a/tinyusb/common/errors.h b/tinyusb/common/errors.h index e9644bb3d..4a33aeb4f 100644 --- a/tinyusb/common/errors.h +++ b/tinyusb/common/errors.h @@ -49,6 +49,10 @@ #ifndef _TUSB_ERRORS_H_ #define _TUSB_ERRORS_H_ +#ifdef __cplusplus + extern "C" { +#endif + /** \enum TUSB_Error_t * \brief Error Code returned */ @@ -60,10 +64,6 @@ typedef enum { ERROR_COUNT }TUSB_Error_t; -#ifdef __cplusplus - extern "C" { -#endif - /// Enum to String for debugging purposes. Only available if \ref CFG_TUSB_DEBUG_LEVEL > 0 extern char const* const TUSB_ErrorStr[]; diff --git a/tinyusb/common/fifo.h b/tinyusb/common/fifo.h index b23c56f0d..6ce602456 100644 --- a/tinyusb/common/fifo.h +++ b/tinyusb/common/fifo.h @@ -51,6 +51,10 @@ #include "common/common.h" +#ifdef __cplusplus + extern "C" { +#endif + /** \struct fifo_t * \brief Simple Circular FIFO */ @@ -65,9 +69,6 @@ typedef struct _fifo_t IRQn_Type irq; ///< interrupt used to lock fifo } fifo_t; -#ifdef __cplusplus - extern "C" { -#endif void fifo_init(fifo_t* f, uint8_t* buffer, uint16_t size, bool overwritable, IRQn_Type irq); bool fifo_write(fifo_t* f, uint8_t data); diff --git a/tinyusb/device/dcd.h b/tinyusb/device/dcd.h index 2db802e70..79d646f9b 100644 --- a/tinyusb/device/dcd.h +++ b/tinyusb/device/dcd.h @@ -51,6 +51,9 @@ #ifndef _TUSB_DCD_H_ #define _TUSB_DCD_H_ +#ifdef __cplusplus + extern "C" { +#endif #include "common/common.h" @@ -60,9 +63,6 @@ #define USBD_API ((*(ROM **)(0x1FFF1FF8))->pUSBD) // TODO HAL #endif -#ifdef __cplusplus - extern "C" { -#endif /** \brief Initialize DCD * diff --git a/tinyusb/host/hcd.h b/tinyusb/host/hcd.h index 8ab648450..a5fe31624 100644 --- a/tinyusb/host/hcd.h +++ b/tinyusb/host/hcd.h @@ -51,12 +51,12 @@ #ifndef _TUSB_HCD_H_ #define _TUSB_HCD_H_ -#include "common/common.h" - #ifdef __cplusplus extern "C" { #endif +#include "common/common.h" + /** \brief Initialize HCD * * \param[in] para1 diff --git a/tinyusb/tusb.c b/tinyusb/tusb.c index 6a3ddf387..22add472e 100644 --- a/tinyusb/tusb.c +++ b/tinyusb/tusb.c @@ -37,22 +37,6 @@ #include "tusb.h" -TUSB_Error_t hal_init() -{ - // TODO usb abstract later - /* Enable AHB clock to the USB block and USB RAM. */ - LPC_SYSCON->SYSAHBCLKCTRL |= ((0x1<<14) | (0x1<<27)); - - /* Pull-down is needed, or internally, VBUS will be floating. This is to - address the wrong status in VBUSDebouncing bit in CmdStatus register. */ - LPC_IOCON->PIO0_3 &= ~0x1F; - LPC_IOCON->PIO0_3 |= (0x01<<0); /* Secondary function VBUS */ - LPC_IOCON->PIO0_6 &= ~0x07; - LPC_IOCON->PIO0_6 |= (0x01<<0); /* Secondary function SoftConn */ - - return tERROR_NONE; -} - TUSB_Error_t tusb_init(void) { ASSERT_ERROR( hal_init() ) ; /* HARDWARE INIT */ diff --git a/tinyusb/tusb_cfg.h b/tinyusb/tusb_cfg.h index 34c28da07..b172c4b31 100644 --- a/tinyusb/tusb_cfg.h +++ b/tinyusb/tusb_cfg.h @@ -46,6 +46,10 @@ * @{ */ +#ifdef __cplusplus + extern "C" { +#endif + #ifndef _TUSB_CFG_H_ #define _TUSB_CFG_H_ @@ -92,6 +96,10 @@ #define CDC_NOTIFICATION_EP_MAXPACKETSIZE 8 #define CDC_DATA_EP_MAXPACKET_SIZE 16 +#ifdef __cplusplus + } +#endif + #endif /* _TUSB_CFG_H_ */ /** @} */ |
