Looking at a particular code for ATmega328P, I see the following assignment
EIMSK |= (1<<INT0);
The Atmega328p specification clearly says - "Bit 7..2 "“ Res: Reserved Bits"
Is the above not a violation of reserved bits which are supposed to be set to 0?
Below is what I have understood from some preliminary investigation...
I had a look at the header file of ATmega328p and some search revealed the following info
#define EIMSK =_SFR_IO8(0x1D)
#define INT0 0
#define _SFR_IO8(io_addr) ((io_addr) + __SFR_OFFSET)
# if __AVR_ARCH__ >= 100
# define __SFR_OFFSET 0x00
# define __SFR_OFFSET 0x20
so let's assume that EIMSK is essentially 0x2D. So in the original assignment i.e. EIMSK |= (1<<INT0), doesn't 0x2D get written to EIMSK(which itself is also 0x2E - location in address space)? And if this is the case, then it's a clear violation of the reserved bits as mentioned in the specification document. I see that such assignments are very common so most likely I am missing something obvious.
Please help me understand this.