Write on the whiteboard C/C++ code to read a memory mapped register, clear a bit, then write it back.
Things I don't care about:
- If there are any simple syntax errors or missing semicolons.
- The variables types used, as long as the candidate knows how many bits they are (int, versus uint32, versus DWORD).
- Was the "volatile" keyword used when declaring the variable that would point to the register? (I would hope that the value we get from the register is a fresh, uncached value).
- Did the candidate ask how big the data bus of the system is? (How else would I know how the pointer type?)
- Was it second nature to use the "wordwithbittoflip &= ~MASK" convention.
- Did the candidate ask whether a MMU is being used? (need to make sure you are accessing physical memory, not virtual)
- Did the candidate ask what OS is being used, if any? (tracing back to the MMU question, if there is one being used, getting access to physical memory will vary from OS)
- The candidate uses bit banding for increased speed.
- The candidate wonders if the system is big or little endian when setting up the mask.