Why pass pointer to register as volatile?
It's passed as volatile so the compiler doesn't optimize away any accesses to said parameter. This is required because a compiler may see something like this:

port = 1;
port = 2;
port = 3;


Or perhaps

while (port &amp; 0x01) ...


Assuming that the ending state is all that matters, that can be optimized to

port = 3;


And

some_cpu_register = port;
while (some_cpu_register &amp; 0x01) ...


Saving on instructions, memory accesses, and code space. However, since port actually accesses physical resources, these reads and writes actually are significant and the compiler should be instructed that the programmer knows best here and the compiler should not remove any reads or writes so that the program will perform the intended operations.