A more advanced set of atomic operators called the RMWÂ APIs is available as well. Among its many uses (we show a list in the coming section) is that of performing atomic RMW operations on bits, in other words, performing bitwise operations atomically (safely, indivisibly). As a device driver author operating upon device or peripheral registers, this is indeed something you will find yourself using.
The material in this section assumes you have at least a basic understanding of accessing peripheral device (chip) memory and registers; we have covered this in detail in Chapter 3, Working with Hardware I/O Memory. Please ensure you understand it before moving further.Â
Very often, you'll need to perform bit operations (with the bitwise AND & and bitwise OR | being the most commonplace operators) on registers; this is done to modify its value, setting and/or clearing some bits within it. The thing is, merely...