/* Example 2: turn on one LED on the control panel */
char * LED_pointer = (char *) 0x2089;
char led = *LED_pointer;
led = led | 0x40; //set LED controlled by bit 6
*LED_pointer = led;
Yes really. It's example code written for the sole purpose of being read by people for educational purposes. As long as you understand the basics of pointers, it's really easy to read. Why are you mad at it?
I know some people who object to one-line read-modify-write of hardware registers, the idea being that glancing at the code the non-atomicity of the operation might be lost. I also generally don't use raw volatile pointers directly when dealing with hardware registers, too easy to forget a "volatile" somewhere and have the code behave erratically. I always use tiny read32/write32 wrappers instead.
Absolutely. Modern compilers are trivially able to inline such operations, so there's no reason not to make your intentions and separation of operations crystal clear. After all, you're going to read the code a lot more often than you'll write it.
You have to be careful though in some cases. For instance, if you read two MMIO registers in a one liner, there's no way to guarantee the ordering between them.
The title is misleading. This tool is to mute all the speakers, disable all the cameras and network adapter. I think it's required for a meeting etc. A better program maybe just pull the power off.