diff options
author | Tomasz Kramkowski <tk@the-tk.com> | 2017-03-28 16:31:20 +0100 |
---|---|---|
committer | Tomasz Kramkowski <tk@the-tk.com> | 2017-03-28 16:31:20 +0100 |
commit | 4eab550b3b19345d271b4a93d34374a0dae867da (patch) | |
tree | 8c060b2ff85163b483467121f1a192d0cdf2cd6e | |
parent | fa2eda4bbf5f25b46dde84acdd1ed977bd2ee25b (diff) | |
download | mk20dx256-4eab550b3b19345d271b4a93d34374a0dae867da.tar.gz mk20dx256-4eab550b3b19345d271b4a93d34374a0dae867da.tar.xz mk20dx256-4eab550b3b19345d271b4a93d34374a0dae867da.zip |
reg: cleanup regdefs
-rw-r--r-- | reg/regdefs.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/reg/regdefs.h b/reg/regdefs.h index 802d7c0..10eeff9 100644 --- a/reg/regdefs.h +++ b/reg/regdefs.h @@ -12,18 +12,18 @@ #define REG_32_M(start, len) ((uint32_t)(BITS(len) << (start))) #define BV(b) (1 << (b)) -#define IS_BIT_SET(reg, bit) (!!((reg) & BV(bit))) -#define WAIT_BIT_UNSET(reg, bit) do { } while (IS_BIT_SET(reg, bit)) -#define WAIT_BIT_SET(reg, bit) do { } while (!IS_BIT_SET(reg, bit)) +#define BITS(n) (0xffffffff >> (32 - (n))) + +#define GET_BIT(reg, bit) (!!((reg) & BV(bit))) +#define GET_BITS(reg, offset) (((reg) & (offset ## _M)) >> (offset)) #define SET_BIT(reg, bit) ((reg) |= BV(bit)) #define UNSET_BIT(reg, bit) ((reg) &= ~BV(bit)) - -#define GET_BIT(reg, bit) !!((reg) & BV(bit)) -#define GET_BITS(reg, offset) (((reg) & (offset ## _M)) >> (offset)) +#define TOGGLE_BIT(reg, bit) ((reg) ^= BV(bit)) #define SET_MASKED(reg, mask, bits) ((reg) = ((reg) & ~(mask)) | ((bits) & (mask))) -#define BITS(n) (0xffffffff >> (32 - (n))) +#define WAIT_BIT_UNSET(reg, bit) do { } while (GET_BIT(reg, bit)) +#define WAIT_BIT_SET(reg, bit) do { } while (!GET_BIT(reg, bit)) #endif /* MK20DX256_REG_REGDEFS_H */ |