diff --git a/os/common/ports/ARM/compilers/GCC/chtypes.h b/os/common/ports/ARM/compilers/GCC/chtypes.h index a34c5bd04..bc0c8dc20 100644 --- a/os/common/ports/ARM/compilers/GCC/chtypes.h +++ b/os/common/ports/ARM/compilers/GCC/chtypes.h @@ -74,14 +74,14 @@ typedef uint32_t ucnt_t; /**< Generic unsigned counter. */ * @brief ROM constant modifier. * @note It is set to use the "const" keyword in this port. */ -#define ROMCONST const +#define ROMCONST const /** * @brief Makes functions not inlineable. - * @note If the compiler does not support such attribute then the - * realtime counter precision could be degraded. + * @note If the compiler does not support such attribute then some + * time-dependent services could be degraded. */ -#define NOINLINE __attribute__((noinline)) +#define NOINLINE __attribute__((noinline)) /** * @brief Optimized thread function declaration macro. @@ -91,12 +91,24 @@ typedef uint32_t ucnt_t; /**< Generic unsigned counter. */ /** * @brief Packed variable specifier. */ -#define PACKED_VAR __attribute__((packed)) +#define PACKED_VAR __attribute__((packed)) /** * @brief Memory alignment enforcement for variables. */ -#define ALIGNED_VAR(n) __attribute__((aligned(n))) +#define ALIGNED_VAR(n) __attribute__((aligned(n))) + +/** + * @brief Size of a pointer. + * @note To be used where the sizeof operator cannot be used, preprocessor + * expressions for example. + */ +#define SIZEOF_PTR 4 + +/** + * @brief True if alignment is low-high in current architecture. + */ +#define REVERSE_ORDER 1 #endif /* CHTYPES_H */ diff --git a/os/common/ports/ARMCMx/compilers/GCC/chtypes.h b/os/common/ports/ARMCMx/compilers/GCC/chtypes.h index 8c03899d7..e91763c10 100644 --- a/os/common/ports/ARMCMx/compilers/GCC/chtypes.h +++ b/os/common/ports/ARMCMx/compilers/GCC/chtypes.h @@ -74,14 +74,14 @@ typedef uint32_t ucnt_t; /**< Generic unsigned counter. */ * @brief ROM constant modifier. * @note It is set to use the "const" keyword in this port. */ -#define ROMCONST const +#define ROMCONST const /** * @brief Makes functions not inlineable. - * @note If the compiler does not support such attribute then the - * realtime counter precision could be degraded. + * @note If the compiler does not support such attribute then some + * time-dependent services could be degraded. */ -#define NOINLINE __attribute__((noinline)) +#define NOINLINE __attribute__((noinline)) /** * @brief Optimized thread function declaration macro. @@ -91,12 +91,24 @@ typedef uint32_t ucnt_t; /**< Generic unsigned counter. */ /** * @brief Packed variable specifier. */ -#define PACKED_VAR __attribute__((packed)) +#define PACKED_VAR __attribute__((packed)) /** * @brief Memory alignment enforcement for variables. */ -#define ALIGNED_VAR(n) __attribute__((aligned(n))) +#define ALIGNED_VAR(n) __attribute__((aligned(n))) + +/** + * @brief Size of a pointer. + * @note To be used where the sizeof operator cannot be used, preprocessor + * expressions for example. + */ +#define SIZEOF_PTR 4 + +/** + * @brief True if alignment is low-high in current architecture. + */ +#define REVERSE_ORDER 1 #endif /* CHTYPES_H */ diff --git a/os/common/ports/ARMCMx/compilers/IAR/chtypes.h b/os/common/ports/ARMCMx/compilers/IAR/chtypes.h index 1cec367f0..07287e5cc 100644 --- a/os/common/ports/ARMCMx/compilers/IAR/chtypes.h +++ b/os/common/ports/ARMCMx/compilers/IAR/chtypes.h @@ -74,14 +74,14 @@ typedef uint32_t ucnt_t; /**< Generic unsigned counter. */ * @brief ROM constant modifier. * @note It is set to use the "const" keyword in this port. */ -#define ROMCONST const +#define ROMCONST const /** * @brief Makes functions not inlineable. - * @note If the compiler does not support such attribute then the - * realtime counter precision could be degraded. + * @note If the compiler does not support such attribute then some + * time-dependent services could be degraded. */ -#define NOINLINE +#define NOINLINE _Pragma("inline=never") /** * @brief Optimized thread function declaration macro. @@ -91,12 +91,24 @@ typedef uint32_t ucnt_t; /**< Generic unsigned counter. */ /** * @brief Packed variable specifier. */ -#define PACKED_VAR __packed +#define PACKED_VAR __packed /** * @brief Memory alignment enforcement for variables. */ -#define ALIGNED_VAR(n) __attribute__((aligned(n))) +#define ALIGNED_VAR(n) _Pragma(__CH_STRINGIFY(data_alignment=##n)) + +/** + * @brief Size of a pointer. + * @note To be used where the sizeof operator cannot be used, preprocessor + * expressions for example. + */ +#define SIZEOF_PTR 4 + +/** + * @brief True if alignment is low-high in current architecture. + */ +#define REVERSE_ORDER 1 #endif /* CHTYPES_H */ diff --git a/os/common/ports/ARMCMx/compilers/RVCT/chtypes.h b/os/common/ports/ARMCMx/compilers/RVCT/chtypes.h index 73a960376..0b24b648b 100644 --- a/os/common/ports/ARMCMx/compilers/RVCT/chtypes.h +++ b/os/common/ports/ARMCMx/compilers/RVCT/chtypes.h @@ -74,14 +74,14 @@ typedef uint32_t ucnt_t; /**< Generic unsigned counter. */ * @brief ROM constant modifier. * @note It is set to use the "const" keyword in this port. */ -#define ROMCONST const +#define ROMCONST const /** * @brief Makes functions not inlineable. - * @note If the compiler does not support such attribute then the - * realtime counter precision could be degraded. + * @note If the compiler does not support such attribute then some + * time-dependent services could be degraded. */ -#define NOINLINE +#define NOINLINE __attribute__((noinline)) /** * @brief Optimized thread function declaration macro. @@ -91,12 +91,24 @@ typedef uint32_t ucnt_t; /**< Generic unsigned counter. */ /** * @brief Packed variable specifier. */ -#define PACKED_VAR __packed +#define PACKED_VAR __packed /** * @brief Memory alignment enforcement for variables. */ -#define ALIGNED_VAR(n) __attribute__((aligned(n))) +#define ALIGNED_VAR(n) __attribute__((aligned(n))) + +/** + * @brief Size of a pointer. + * @note To be used where the sizeof operator cannot be used, preprocessor + * expressions for example. + */ +#define SIZEOF_PTR 4 + +/** + * @brief True if alignment is low-high in current architecture. + */ +#define REVERSE_ORDER 1 #endif /* CHTYPES_H */ diff --git a/os/common/ports/AVR/compilers/GCC/chtypes.h b/os/common/ports/AVR/compilers/GCC/chtypes.h index 8222a3f8e..91215dde7 100644 --- a/os/common/ports/AVR/compilers/GCC/chtypes.h +++ b/os/common/ports/AVR/compilers/GCC/chtypes.h @@ -74,14 +74,14 @@ typedef uint8_t ucnt_t; /**< Generic unsigned counter. */ * @brief ROM constant modifier. * @note It is set to use the "const" keyword in this port. */ -#define ROMCONST const +#define ROMCONST const /** * @brief Makes functions not inlineable. * @note If the compiler does not support such attribute then the * realtime counter precision could be degraded. */ -#define NOINLINE __attribute__((noinline)) +#define NOINLINE __attribute__((noinline)) /** * @brief Optimized thread function declaration macro. @@ -91,12 +91,24 @@ typedef uint8_t ucnt_t; /**< Generic unsigned counter. */ /** * @brief Packed variable specifier. */ -#define PACKED_VAR __attribute__((packed)) +#define PACKED_VAR __attribute__((packed)) /** * @brief Memory alignment enforcement for variables. */ -#define ALIGNED_VAR(n) __attribute__((aligned(n))) +#define ALIGNED_VAR(n) __attribute__((aligned(n))) + +/** + * @brief Size of a pointer. + * @note To be used where the sizeof operator cannot be used, preprocessor + * expressions for example. + */ +#define SIZEOF_PTR 2 + +/** + * @brief True if alignment is low-high in current architecture. + */ +#define REVERSE_ORDER 1 #endif /* CHTYPES_H */ diff --git a/os/common/ports/SIMIA32/compilers/GCC/chtypes.h b/os/common/ports/SIMIA32/compilers/GCC/chtypes.h index db35061be..330c798ab 100644 --- a/os/common/ports/SIMIA32/compilers/GCC/chtypes.h +++ b/os/common/ports/SIMIA32/compilers/GCC/chtypes.h @@ -86,14 +86,14 @@ typedef uint32_t ucnt_t; /**< Generic unsigned counter. */ * @brief ROM constant modifier. * @note It is set to use the "const" keyword in this port. */ -#define ROMCONST const +#define ROMCONST const /** * @brief Makes functions not inlineable. - * @note If the compiler does not support such attribute then the - * realtime counter precision could be degraded. + * @note If the compiler does not support such attribute then some + * time-dependent services could be degraded. */ -#define NOINLINE __attribute__((noinline)) +#define NOINLINE __attribute__((noinline)) /** * @brief Optimized thread function declaration macro. @@ -103,12 +103,24 @@ typedef uint32_t ucnt_t; /**< Generic unsigned counter. */ /** * @brief Packed variable specifier. */ -#define PACKED_VAR __attribute__((packed)) +#define PACKED_VAR __attribute__((packed)) /** * @brief Memory alignment enforcement for variables. */ -#define ALIGNED_VAR(n) __attribute__((aligned(n))) +#define ALIGNED_VAR(n) __attribute__((aligned(n))) + +/** + * @brief Size of a pointer. + * @note To be used where the sizeof operator cannot be used, preprocessor + * expressions for example. + */ +#define SIZEOF_PTR 4 + +/** + * @brief True if alignment is low-high in current architecture. + */ +#define REVERSE_ORDER 1 #endif /* CHTYPES_H */ diff --git a/os/common/ports/e200/compilers/CW/chtypes.h b/os/common/ports/e200/compilers/CW/chtypes.h index f8e6f2691..b2c55a5eb 100644 --- a/os/common/ports/e200/compilers/CW/chtypes.h +++ b/os/common/ports/e200/compilers/CW/chtypes.h @@ -74,14 +74,14 @@ typedef uint32_t ucnt_t; /**< Generic unsigned counter. */ * @brief ROM constant modifier. * @note It is set to use the "const" keyword in this port. */ -#define ROMCONST const +#define ROMCONST const /** * @brief Makes functions not inlineable. - * @note If the compiler does not support such attribute then the - * realtime counter precision could be degraded. + * @note If the compiler does not support such attribute then some + * time-dependent services could be degraded. */ -#define NOINLINE __attribute__((noinline)) +#define NOINLINE __attribute__((noinline)) /** * @brief Optimized thread function declaration macro. @@ -91,12 +91,24 @@ typedef uint32_t ucnt_t; /**< Generic unsigned counter. */ /** * @brief Packed variable specifier. */ -#define PACKED_VAR __attribute__((packed)) +#define PACKED_VAR __attribute__((packed)) /** * @brief Memory alignment enforcement for variables. */ -#define ALIGNED_VAR(n) __attribute__((aligned(n))) +#define ALIGNED_VAR(n) __attribute__((aligned(n))) + +/** + * @brief Size of a pointer. + * @note To be used where the sizeof operator cannot be used, preprocessor + * expressions for example. + */ +#define SIZEOF_PTR 4 + +/** + * @brief True if alignment is low-high in current architecture. + */ +#define REVERSE_ORDER 0 #endif /* CHTYPES_H */ diff --git a/os/common/ports/e200/compilers/GCC/chtypes.h b/os/common/ports/e200/compilers/GCC/chtypes.h index 124874850..20a601e93 100644 --- a/os/common/ports/e200/compilers/GCC/chtypes.h +++ b/os/common/ports/e200/compilers/GCC/chtypes.h @@ -74,14 +74,14 @@ typedef uint32_t ucnt_t; /**< Generic unsigned counter. */ * @brief ROM constant modifier. * @note It is set to use the "const" keyword in this port. */ -#define ROMCONST const +#define ROMCONST const /** * @brief Makes functions not inlineable. - * @note If the compiler does not support such attribute then the - * realtime counter precision could be degraded. + * @note If the compiler does not support such attribute then some + * time-dependent services could be degraded. */ -#define NOINLINE __attribute__((noinline)) +#define NOINLINE __attribute__((noinline)) /** * @brief Optimized thread function declaration macro. @@ -91,12 +91,24 @@ typedef uint32_t ucnt_t; /**< Generic unsigned counter. */ /** * @brief Packed variable specifier. */ -#define PACKED_VAR __attribute__((packed)) +#define PACKED_VAR __attribute__((packed)) /** * @brief Memory alignment enforcement for variables. */ -#define ALIGNED_VAR(n) __attribute__((aligned(n))) +#define ALIGNED_VAR(n) __attribute__((aligned(n))) + +/** + * @brief Size of a pointer. + * @note To be used where the sizeof operator cannot be used, preprocessor + * expressions for example. + */ +#define SIZEOF_PTR 4 + +/** + * @brief True if alignment is low-high in current architecture. + */ +#define REVERSE_ORDER 0 #endif /* CHTYPES_H */ diff --git a/os/common/ports/templates/chtypes.h b/os/common/ports/templates/chtypes.h index fa63f8898..eb75204c4 100644 --- a/os/common/ports/templates/chtypes.h +++ b/os/common/ports/templates/chtypes.h @@ -78,14 +78,14 @@ typedef uint32_t ucnt_t; /**< Generic unsigned counter. */ * @brief ROM constant modifier. * @note It is set to use the "const" keyword in this port. */ -#define ROMCONST const +#define ROMCONST const /** * @brief Makes functions not inlineable. * @note If the compiler does not support such attribute then the * realtime counter precision could be degraded. */ -#define NOINLINE __attribute__((noinline)) +#define NOINLINE __attribute__((noinline)) /** * @brief Optimized thread function declaration macro. @@ -95,12 +95,24 @@ typedef uint32_t ucnt_t; /**< Generic unsigned counter. */ /** * @brief Packed variable specifier. */ -#define PACKED_VAR __attribute__((packed)) +#define PACKED_VAR __attribute__((packed)) /** * @brief Memory alignment enforcement for variables. */ -#define ALIGNED_VAR(n) __attribute__((aligned(n))) +#define ALIGNED_VAR(n) __attribute__((aligned(n))) + +/** + * @brief Size of a pointer. + * @note To be used where the sizeof operator cannot be used, preprocessor + * expressions for example. + */ +#define SIZEOF_PTR 4 + +/** + * @brief True if alignment is low-high in current architecture. + */ +#define REVERSE_ORDER 1 #endif /* CHTYPES_H */