Add esp/iomux_regs.h

This commit is contained in:
Alex Stewart 2015-08-18 17:38:31 -07:00
parent 3eee1a9845
commit 2ffd3da71e
7 changed files with 197 additions and 180 deletions
core/include

View file

@ -16,6 +16,15 @@
#define BIT(X) (1<<(X))
#endif
/* These macros convert values to/from bitfields specified by *_M and *_S (mask
* and shift) constants. Used primarily with ESP8266 register access.
*/
#define VAL2FIELD(fieldname, value) (((value) & fieldname##_M) << fieldname##_S)
#define FIELD2VAL(fieldname, regbits) (((regbits) >> fieldname##_S) & fieldname##_M)
#define SETFIELD(regbits, fieldname, value) (((regbits) & ~(fieldname##_M << fieldname##_S)) | VAL2FIELD(fieldname, value))
/* Use this macro to store constant values in IROM flash instead
of having them loaded into rodata (which resides in DRAM)