summaryrefslogtreecommitdiff
path: root/tinyusb/common
diff options
context:
space:
mode:
authorhathach <[email protected]>2014-04-17 22:57:11 +0700
committerhathach <[email protected]>2014-04-17 22:57:11 +0700
commit06bb9ad7a797d5da58358a59fb874782e1c67b59 (patch)
tree399b4e7108dc4ef2094468450865fcbbc2ae3dfa /tinyusb/common
parent69c46b2f9a1b272392fe5fb26d6cbea1da530c13 (diff)
move STRING & XSTRING & STATIC_ASSERT to compiler.h
disable test for a class of cdc host temporarily disable test for test_osal_none.c change include in some core files remove osal.h from common.h
Diffstat (limited to 'tinyusb/common')
-rw-r--r--tinyusb/common/assertion.h18
-rw-r--r--tinyusb/common/common.h15
-rw-r--r--tinyusb/common/compiler/compiler.h20
-rw-r--r--tinyusb/common/compiler/compiler_gcc.h25
-rw-r--r--tinyusb/common/std_descriptors.h4
-rw-r--r--tinyusb/common/std_request.h4
6 files changed, 38 insertions, 48 deletions
diff --git a/tinyusb/common/assertion.h b/tinyusb/common/assertion.h
index 4cbbd8aa8..3832c00c4 100644
--- a/tinyusb/common/assertion.h
+++ b/tinyusb/common/assertion.h
@@ -50,25 +50,13 @@ extern "C"
#endif
#include "tusb_option.h"
+#include "primitive_types.h"
+#include "compiler/compiler.h"
+
#include "hal/hal.h" // TODO find a way to break hal dependency
#define VOID_RETURN
-//--------------------------------------------------------------------+
-// Compile-time Assert
-//--------------------------------------------------------------------+
-#ifdef __ICCARM__
- #define STATIC_ASSERT static_assert
-#else
- #if defined __COUNTER__ && __COUNTER__ != __COUNTER__
- #define _ASSERT_COUNTER __COUNTER__
- #else
- #define _ASSERT_COUNTER __LINE__
- #endif
-
- #define STATIC_ASSERT(const_expr, message) enum { XSTRING_CONCAT_(static_assert_, _ASSERT_COUNTER) = 1/(!!(const_expr)) }
-#endif
-
//#if ( defined CFG_PRINTF_UART || defined CFG_PRINTF_USBCDC || defined CFG_PRINTF_DEBUG )
#if TUSB_CFG_DEBUG
#define _PRINTF(...) printf(__VA_ARGS__)
diff --git a/tinyusb/common/common.h b/tinyusb/common/common.h
index e1ff26e89..6bd12c391 100644
--- a/tinyusb/common/common.h
+++ b/tinyusb/common/common.h
@@ -48,14 +48,6 @@
#endif
//--------------------------------------------------------------------+
-// MACROS
-//--------------------------------------------------------------------+
-#define STRING_(x) #x // stringify without expand
-#define XSTRING_(x) STRING_(x) // expand then stringify
-#define STRING_CONCAT_(a, b) a##b // concat without expand
-#define XSTRING_CONCAT_(a, b) STRING_CONCAT_(a, b) // expand then concat
-
-//--------------------------------------------------------------------+
// INCLUDES
//--------------------------------------------------------------------+
@@ -79,16 +71,9 @@
#include "std_descriptors.h"
#include "std_request.h"
-#include "osal/osal.h"
-
//--------------------------------------------------------------------+
// MACROS
//--------------------------------------------------------------------+
-#define STRING_(x) #x ///< stringify without expand
-#define XSTRING_(x) STRING_(x) ///< expand then stringify
-#define STRING_CONCAT_(a, b) a##b ///< concat without expand
-#define XSTRING_CONCAT_(a, b) STRING_CONCAT_(a, b) ///< expand then concat
-
#define MAX_OF(a, b) ( (a) > (b) ? (a) : (b) )
#define MIN_OF(a, b) ( (a) < (b) ? (a) : (b) )
diff --git a/tinyusb/common/compiler/compiler.h b/tinyusb/common/compiler/compiler.h
index e628ce7c1..0103bc945 100644
--- a/tinyusb/common/compiler/compiler.h
+++ b/tinyusb/common/compiler/compiler.h
@@ -44,6 +44,26 @@
#ifndef _TUSB_COMPILER_H_
#define _TUSB_COMPILER_H_
+#define STRING_(x) #x ///< stringify without expand
+#define XSTRING_(x) STRING_(x) ///< expand then stringify
+#define STRING_CONCAT_(a, b) a##b ///< concat without expand
+#define XSTRING_CONCAT_(a, b) STRING_CONCAT_(a, b) ///< expand then concat
+
+//--------------------------------------------------------------------+
+// Compile-time Assert
+//--------------------------------------------------------------------+
+#ifdef __ICCARM__
+ #define STATIC_ASSERT static_assert
+#else
+ #if defined __COUNTER__ && __COUNTER__ != __COUNTER__
+ #define _ASSERT_COUNTER __COUNTER__
+ #else
+ #define _ASSERT_COUNTER __LINE__
+ #endif
+
+ #define STATIC_ASSERT(const_expr, message) enum { XSTRING_CONCAT_(static_assert_, _ASSERT_COUNTER) = 1/(!!(const_expr)) }
+#endif
+
#ifndef _TEST_
// TODO move some to tusb_option.h
#define STATIC_ static
diff --git a/tinyusb/common/compiler/compiler_gcc.h b/tinyusb/common/compiler/compiler_gcc.h
index ab3ced5d3..9b249e4bf 100644
--- a/tinyusb/common/compiler/compiler_gcc.h
+++ b/tinyusb/common/compiler/compiler_gcc.h
@@ -36,14 +36,9 @@
*/
/**************************************************************************/
-/** \file
- * \brief GCC Header
- */
-
/** \ingroup Group_Compiler
* \defgroup Group_GCC GNU GCC
- * @{
- */
+ * @{ */
#ifndef _TUSB_COMPILER_GCC_H_
#define _TUSB_COMPILER_GCC_H_
@@ -63,10 +58,8 @@
/// If this attribute is used on a function declaration and a call to such a function is not eliminated through dead code elimination or other optimizations, a warning that includes message is diagnosed. This is useful for compile-time checking
#define ATTR_WARNING(Message) __attribute__ ((warning(Message)))
-/**
- * \defgroup Group_VariableAttr Variable Attributes
- * @{
- */
+/** \defgroup Group_VariableAttr Variable Attributes
+ * @{ */
/// This attribute specifies a minimum alignment for the variable or structure field, measured in bytes
#define ATTR_ALIGNED(Bytes) __attribute__ ((aligned(Bytes)))
@@ -79,10 +72,8 @@
#define ATTR_PACKED_STRUCT(x) x __attribute__ ((packed))
/** @} */
-/**
- * \defgroup Group_FuncAttr Function Attributes
- * @{
- */
+/** \defgroup Group_FuncAttr Function Attributes
+ * @{ */
#ifndef ATTR_ALWAYS_INLINE
/// Generally, functions are not inlined unless optimization is specified. For functions declared inline, this attribute inlines the function even if no optimization level is specified
@@ -125,10 +116,8 @@
/** @} */
-/**
-* \defgroup Group_BuiltinFunc Built-in Functions
-* @{
-*/
+/** \defgroup Group_BuiltinFunc Built-in Functions
+* @{ */
// TODO mcu specific
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
diff --git a/tinyusb/common/std_descriptors.h b/tinyusb/common/std_descriptors.h
index 2deb43c7d..8b8da9c04 100644
--- a/tinyusb/common/std_descriptors.h
+++ b/tinyusb/common/std_descriptors.h
@@ -49,6 +49,10 @@
extern "C" {
#endif
+#include "tusb_option.h"
+#include "primitive_types.h"
+#include "compiler/compiler.h"
+
//--------------------------------------------------------------------+
// STANDARD DESCRIPTORS
//--------------------------------------------------------------------+
diff --git a/tinyusb/common/std_request.h b/tinyusb/common/std_request.h
index 0ace160c4..46ce76c4f 100644
--- a/tinyusb/common/std_request.h
+++ b/tinyusb/common/std_request.h
@@ -46,6 +46,10 @@
extern "C" {
#endif
+#include "tusb_option.h"
+#include "primitive_types.h"
+#include "compiler/compiler.h"
+
typedef ATTR_PACKED_STRUCT(struct){
union {
ATTR_PACKED_STRUCT(struct) {