From 677271b6c34a6f554ad2b401d495a8145828bda0 Mon Sep 17 00:00:00 2001 From: arighi Date: Tue, 4 May 2010 08:54:52 +0000 Subject: [PATCH] CM3: move the Cortex-M3 generic hardware macros to a distinct file. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3600 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/cpu/cortex-m3/io/cm3_types.h | 58 ++++++++++++++++++++++++++++ bertos/cpu/cortex-m3/io/lm3s_types.h | 22 +---------- 2 files changed, 60 insertions(+), 20 deletions(-) create mode 100644 bertos/cpu/cortex-m3/io/cm3_types.h diff --git a/bertos/cpu/cortex-m3/io/cm3_types.h b/bertos/cpu/cortex-m3/io/cm3_types.h new file mode 100644 index 00000000..8cb94855 --- /dev/null +++ b/bertos/cpu/cortex-m3/io/cm3_types.h @@ -0,0 +1,58 @@ +/** + * \file + * + * + * \brief Cortex-M3 generic hardware macros. + */ + +#ifndef CM3_TYPES_H +#define CM3_TYPES_H + +/** + * Macros for hardware access, both direct and via the bit-band region. + */ +/*\{*/ +#define HWREG(x) (*((reg32_t *)(x))) +#define HWREGH(x) (*((reg16_t *)(x))) +#define HWREGB(x) (*((reg8_t *)(x))) + +#define HWREGBITW(x, b) \ + HWREG(((reg32_t)(x) & 0xF0000000) | 0x02000000 | \ + (((reg32_t)(x) & 0x000FFFFF) << 5) | ((b) << 2)) +#define HWREGBITH(x, b) \ + HWREGH(((reg32_t)(x) & 0xF0000000) | 0x02000000 | \ + (((reg32_t)(x) & 0x000FFFFF) << 5) | ((b) << 2)) +#define HWREGBITB(x, b) \ + HWREGB(((reg32_t)(x) & 0xF0000000) | 0x02000000 | \ + (((reg32_t)(x) & 0x000FFFFF) << 5) | ((b) << 2)) +/*\}*/ + +#endif /* CM3_TYPES_H */ diff --git a/bertos/cpu/cortex-m3/io/lm3s_types.h b/bertos/cpu/cortex-m3/io/lm3s_types.h index ab1a822b..b88347b4 100644 --- a/bertos/cpu/cortex-m3/io/lm3s_types.h +++ b/bertos/cpu/cortex-m3/io/lm3s_types.h @@ -30,32 +30,14 @@ * * --> * - * \brief LM3S1968 generic hardware macros. + * \brief LM3S generic hardware macros. */ #ifndef LM3S_TYPES_H #define LM3S_TYPES_H #include - -/** - * Macros for hardware access, both direct and via the bit-band region. - */ -/*\{*/ -#define HWREG(x) (*((reg32_t *)(x))) -#define HWREGH(x) (*((reg16_t *)(x))) -#define HWREGB(x) (*((reg8_t *)(x))) - -#define HWREGBITW(x, b) \ - HWREG(((reg32_t)(x) & 0xF0000000) | 0x02000000 | \ - (((reg32_t)(x) & 0x000FFFFF) << 5) | ((b) << 2)) -#define HWREGBITH(x, b) \ - HWREGH(((reg32_t)(x) & 0xF0000000) | 0x02000000 | \ - (((reg32_t)(x) & 0x000FFFFF) << 5) | ((b) << 2)) -#define HWREGBITB(x, b) \ - HWREGB(((reg32_t)(x) & 0xF0000000) | 0x02000000 | \ - (((reg32_t)(x) & 0x000FFFFF) << 5) | ((b) << 2)) -/*\}*/ +#include /** * Helper Macros for determining the particular hardware revision. -- 2.25.1