Control the number of simultaneous times that the users attempt to open the device. This is useful if you want to grant access to device only to one program user at a time.
Initialise ports to a convenient status.
Install interrupt handlers.
Disable hardware interrupts.
Ask for a free irq number.
Unmask that interrupt (The Jourdain book listed in Resources is a good place to learn how to program the Intel 8119 chip).
Enable hardware interrupts again.
For mrv4_release():
Specific device operations (stop the robot).
Uninstall interrupts.
Disable hardware interrupts.
Mask the interrupt.
Enable hardware interrupts again.
Leave the ports in an adequate (relaxed) state.
For mrv4_write():
Catch input arguments.
Transform input into internal variables.
Process input information.
Write to ports.
Return the number of bytes which have been written.