[Sound-open-firmware] [PATCH 08/15] [RFC][v2]DMIC: Add DMIC registers bit fields handling macros
Seppo Ingalsuo
seppo.ingalsuo at linux.intel.com
Fri May 4 17:01:10 CEST 2018
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo at linux.intel.com>
---
src/include/sof/io.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/include/sof/io.h b/src/include/sof/io.h
index 3181d41..05a34d2 100644
--- a/src/include/sof/io.h
+++ b/src/include/sof/io.h
@@ -33,6 +33,13 @@
#include <stdint.h>
+/* Macros for register bits access */
+#define BIT(b) (1 << (b))
+#define MASK(b_hi, b_lo) ((1 << ((b_hi) - (b_lo) + 1)) - 1)
+#define SET_BIT(b, x) (((x) & 1) << (b))
+#define SET_BITS(b_hi, b_lo, x) \
+ (((x) & ((1 << ((b_hi) - (b_lo) + 1)) - 1)) << (b_lo))
+
static inline uint32_t io_reg_read(uint32_t reg)
{
return *((volatile uint32_t*)reg);
--
2.14.1
More information about the Sound-open-firmware
mailing list